{"source_code": "import java.lang.Math.abs\nimport java.lang.Math.pow\nimport java.math.BigInteger\nimport kotlin.math.sqrt\n\nfun solve(input:Int):Double {\n val aresult = sqrt((if (input < 0) -input else input).toDouble())\n val bresult = 5 * (input * input * input)\n val result = aresult + bresult\n return result\n}\n\nfun main() {\n val ans = List(11) {\n val key = readLine()!!.toInt()\n key to solve(key)\n }.asReversed()\n ans.forEach { (key, value) ->\n if (value > 400)\n System.out.printf(\"f(%d) = MAGNA NIMIS!\\n\", key)\n else\n System.out.printf(\"f(%d) = %.2f\\n\", key, value)\n }\n}\n", "positive_code": [{"source_code": "import kotlin.math.absoluteValue\nimport kotlin.math.sqrt\n\nfun main() {\n val br = System.`in`.bufferedReader()\n val sb = StringBuilder()\n val nums = IntArray(11){\n br.readLine().toInt()\n }.reversed().forEach{\n val num = sqrt(it.absoluteValue.toDouble()) + 5 * it * it * it\n sb.append(String.format(\"f(%d) = \", it))\n if(num > 400){\n sb.append(\"MAGNA NIMIS!\\n\")\n } else {\n sb.append(String.format(\"%.2f\\n\", num))\n }\n }\n print(sb)\n}"}, {"source_code": "fun main() {\n val l = mutableListOf()\n while (true) {\n val x = readLine()?.toInt() ?: break\n l.add(x)\n }\n for (x in l.reversed()) {\n print(\"f(\" + x + \") = \")\n val a = Math.sqrt(Math.abs(x.toDouble()))\n val b = 5*x*x*x\n val r = a + b\n if (r > 400) {\n println(\"MAGNA NIMIS!\")\n } else {\n println(\"%.2f\".format(r))\n }\n }\n}\n"}, {"source_code": "import java.lang.Math.abs\nimport java.lang.Math.pow\nimport java.math.BigInteger\nimport kotlin.math.sqrt\n\nfun solve(input:Int):Double {\n val aresult = sqrt((if (input < 0) -input else input).toDouble())\n val bresult = 5 * (input * input * input)\n val result = aresult + bresult\n return result\n}\n\nfun main() {\n val ans = List(11) {\n val key = readLine()!!.toInt()\n key to solve(key)\n }.asReversed()\n ans.forEach { (key, value) ->\n if (value > 400)\n System.out.printf(\"f(%d) = MAGNA NIMIS!\\n\", key)\n else\n System.out.printf(\"f(%d) = %.2f\\n\", key, value)\n }\n}"}, {"source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.File\nimport java.io.PrintWriter\nimport java.util.Arrays\nimport javax.imageio.ImageIO\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 S = readIntArray(11)\n S.reverse()\n for(s in S) {\n val t = s.toDouble()\n val f = sqrt(abs(t)) + 5 * t.pow(3)\n val res = if(f > 400) \"MAGNA NIMIS!\" else \"%.2f\".format(f)\n println(\"f($s) = $res\")\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 _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}"}, {"source_code": "import java.lang.Math.abs\nimport java.lang.Math.pow\nimport java.math.BigInteger\nimport kotlin.math.sqrt\n\nfun solve(input:Int):Double {\n val aresult = sqrt((if (input < 0) -input else input).toDouble())\n val bresult = 5 * (input * input * input)\n val result = aresult + bresult\n return result\n}\n\nfun main() {\n val ans = List(11) {\n val key = readLine()!!.toInt()\n key to solve(key)\n }.asReversed()\n ans.forEach { (key, value) ->\n if (value > 400)\n System.out.printf(\"f(%d) = MAGNA NIMIS!\\n\", key)\n else\n System.out.printf(\"f(%d) = %.2f\\n\", key, value)\n }\n}"}, {"source_code": "import java.lang.Math.abs\nimport java.lang.Math.pow\nimport java.math.BigInteger\nimport kotlin.math.sqrt\n\nfun solve(input:Int):Double {\n val aresult = sqrt((if (input < 0) -input else input).toDouble())\n val bresult = 5 * (input * input * input)\n val result = aresult + bresult\n return result\n}\n\nfun main() {\n val ans = List(11) {\n val key = readLine()!!.toInt()\n key to solve(key)\n }.asReversed()\n ans.forEach { (key, value) ->\n if (value > 400)\n System.out.printf(\"f(%d) = MAGNA NIMIS!\\n\", key)\n else\n System.out.printf(\"f(%d) = %.2f\\n\", key, value)\n }\n}"}, {"source_code": "import java.text.DecimalFormat\nimport kotlin.math.abs\nimport kotlin.math.sqrt\n\nfun main() {\n fun format(x: Double) = DecimalFormat(\"0.00\").format(x)\n var answer = mutableListOf()\n for (c in 1..11) {\n val k = readLine()!!.toInt()\n val x = k.toDouble()\n val res = (5.0 * x * x * x) + sqrt(abs(x))\n if (res < 400.0) {\n answer.add(\"f($k) = ${format(res)}\")\n } else {\n answer.add(\"f($k) = MAGNA NIMIS!\")\n }\n }\n println(answer.reversed().joinToString(\"\\n\"))\n}"}], "negative_code": [{"source_code": "import java.lang.Math.abs\nimport java.lang.Math.pow\nimport java.math.BigInteger\nimport kotlin.math.sqrt\n\nfun solve(input:Int):Double {\n val aresult = sqrt((if (input < 0) -input else input).toDouble())\n val bresult = 5 * (input * input * input)\n val result = aresult + bresult\n return result\n}\n\nfun main() {\n val ans = List(11) {\n val key = readLine()!!.toInt()\n key to solve(key)\n }.asReversed()\n ans.forEach { (key, value) ->\n if (value > 5000)\n System.out.printf(\"f(%d) = MAGNA NIMIS!\\n\", key)\n else\n System.out.printf(\"f(%d) = %.2f\\n\", key, value)\n }\n}"}], "src_uid": "30b3411c3c23d029ea1e9cf73e7d2f01"} {"source_code": "fun main() {\n val (da, db) = readInts()\n if (da == db) {\n val a = da*10\n val b = db*10 + 1\n println(\"$a $b\")\n } else if (da < 9 && db == da + 1) {\n val a = da*10 + 9\n val b = db*10\n println(\"$a $b\")\n } else if (da == 9 && db == 1) {\n val a = da*10 + 9\n val b = 100\n println(\"$a $b\")\n } else println(-1)\n}\n\n// Input Reader\nprivate fun readLn() = readLine()!!\n\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n", "positive_code": [{"source_code": "\nclass ForgettingThings {\n fun resolve(input: String) {\n val splitInput = input.split(\" \")\n val b1 = splitInput[0].toInt()\n val b2 = splitInput[1].toInt()\n\n if(b1 == b2 ) {\n println(\"${b1}1 ${b1}2\")\n return;\n }\n\n if(b1 == b2 - 1) {\n println(\"${b1}9 ${b2}0\")\n return\n }\n\n if(b1 == 9 && b2 == 1) {\n println(\"99 100\")\n return\n }\n\n println(\"-1\")\n\n }\n\n fun test() {\n listOf(\n \"1 2\",\n \"4 4\",\n \"5 7\",\n \"6 2\",\n \"9 1\"\n ).map {\n resolve(it)\n }\n }\n}\n\n//val test = ForgettingThings().test()\n\nfun main() {\n val input = readLine()!!\n ForgettingThings().resolve(input)\n}"}, {"source_code": "import java.io.*\n\nprivate fun solve() {\n var (d1,d2) = readStrings();\n\n for (a in 1..1000) {\n if (a.toString()[0] == d1[0] && (a + 1).toString()[0] == d2[0]) {\n out.println(\"$a ${a+1}\").also { return }\n }\n }\n\n out.println(-1);\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\nprivate var out: PrintWriter = PrintWriter(System.out);\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}"}, {"source_code": "\nfun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n val (n, k) = r.readLine()!!.split(\" \").map { it.toInt() }\n when{\n k-n==1-> println(\"${n}9 ${k}0\")\n n==9&&k==1-> println(\"${n}9 ${k}00\")\n k==n -> println(\"${n}0 ${k}1\")\n else -> println(-1)\n }\n}"}, {"source_code": "import com.sun.xml.internal.fastinfoset.util.StringArray\nimport 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 da: Int = ir.nextInt()\n val db: Int = ir.nextInt()\n\n when {\n da - db == -1 -> pw.print(\"${da}99 ${db}00\")\n da == db -> pw.print(\"${da}00 ${da}01\")\n da - db == 8 -> pw.print(\"9 10\")\n else -> pw.print(-1)\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}"}, {"source_code": "import com.sun.xml.internal.fastinfoset.util.StringArray\nimport 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 da: Int = ir.nextInt()\n val db: Int = ir.nextInt()\n\n when (da - db) {\n -1 -> pw.print(\"${da}99 ${db}00\")\n 0 -> pw.print(\"${da}00 ${da}01\")\n 8 -> pw.print(\"9 10\")\n else -> pw.print(-1)\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}"}, {"source_code": "import java.io.*\nimport java.util.*\n\nfun main(args: Array) {\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 val f1 = inp.nextInt()\n val f2 = inp.nextInt()\n if (f1 == f2)\n out.println(\"${f1}0 ${f2}1\")\n else if (f1 < f2) {\n if (f2 - f1 == 1)\n out.println(\"${f1}9 ${f2}0\")\n else\n out.println(-1)\n } else {\n if (f1 == 9 && f2 == 1)\n out.println(\"9 10\")\n else\n out.println(-1)\n }\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 fun nextLong(): Long {\n return next().toLong()\n }\n }\n}\n"}, {"source_code": "fun main() {\n val (da, db) = readLine()!!\n .split(' ')\n .map { it.toInt() }\n\n when {\n db - da == 0 -> print(\"${da}0 ${db}1\")\n db - da == 1 -> print(\"$da $db\")\n db == 1 && da == 9 -> print(\"9 10\")\n else -> print(\"-1\")\n }\n}"}, {"source_code": "\nfun readIntList() = readLine()!!.split(' ').map(String::toInt).toMutableList()\nfun readLongList() = readLine()!!.split(' ').map(String::toLong).toMutableList()\nfun readStringList() = readLine()!!.split(' ').toMutableList()\nfun readInt() = readLine()!!.toInt()\nfun readLong() = readLine()!!.toLong()\n\nfun main(args: Array) {\n\n val (a , b) = readIntList()\n\n\n if(a == b){\n println(\"${a}0 ${b}1\")\n }else if (a + 1 == b){\n println(\"${a}9 ${b}0\")\n }else if (a == 9 && b == 1){\n println(\"${a}9 ${b}00\")\n }else{\n println(-1)\n }\n\n\n}"}, {"source_code": "fun main() {\n val (a, b) = readLine()!!.split(' ').map(String::toInt)\n when {\n a == b - 1 -> println(\"${a * 10 + 9} ${b * 10}\")\n a == b -> println(\"${a * 10} ${b * 10 + 1}\")\n a == 9 && b == 1 -> println(\"99 100\")\n else -> println(\"-1\")\n }\n}"}, {"source_code": "fun main() {\n var list = readLine()!!.split(' ')\n var ans = \"\"\n var ans1 = \"\"\n if (list[0]==\"9\" && list[1]==\"1\") {\n println(\"9 10\")\n } else if ((list[1].toInt() - list[0].toInt()) == 0) {\n ans += list[0] + \"1\"\n ans1 += list[1] + \"2\"\n println(\"$ans $ans1\")\n } else if ((list[1].toInt() - list[0].toInt()) == 1) {\n ans += list[0] + \"9\"\n ans1 += list[1] + \"0\"\n println(\"$ans $ans1\")\n } else {\n println(-1)\n }\n}"}, {"source_code": "fun main(args : Array) {\n val (a, b) = readLine()!!.split(\" \") .map{it.toInt()}\n\n if (b - a == 0) {\n println(\"${a}1 ${b}2\")\n } else if (b - a == 1) {\n println(\"${a}9 ${b}0\")\n } else if (a == 9 && b == 1) {\n println(\"99 100\")\n } else {\n println(-1)\n }\n}"}, {"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 da = ni()\n val db = ni()\n if (da == db) {\n out.println(\"${da}0 ${db}1\")\n } else if (db == da + 1) {\n out.println(\"$da $db\")\n } else if (da == 9 && db == 1){\n out.println(\"9 10\")\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}\n"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (a, b) = readInts()\n print(\n when {\n b - a == 0 -> \"${a}0 ${a}1\"\n b - a == 1 -> \"${a}9 ${b}0\"\n a == 9 && b == 1 -> \"9 10\"\n else -> \"-1\"\n }\n )\n}"}, {"source_code": "fun main() {\n var (m, k) = readLine()!!.split(\" \").map { it.toInt() }\n if(m != k && m + 1 != k) {\n if(m == 9 && k == 1) {\n println(\"${m} ${k * 10}\")\n } else {\n println(-1)\n }\n } else {\n if(m != k) {\n println(\"${m * 10 + 9} ${k * 10}\")\n } else {\n println(\"${m * 10 + 1} ${k * 10 + 2}\")\n }\n }\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n\n val a = scanner.nextInt()\n val b = scanner.nextInt()\n\n if (a == b - 1) {\n print(\"$a $b\")\n } else if (a == b) {\n print(\"${a}00 ${b}01\")\n } else if (a == 9 && b == 1) {\n print(\"999 1000\")\n } else {\n print(-1)\n }\n}"}, {"source_code": "import kotlin.math.abs\nimport kotlin.math.min\n \nfun main() {\n task1()\n}\n \n \n \n \nfun task1() {\n \n var (a, b) = readLine()!!.split(\" \").map(String::toInt)\n \n if (a == 9 && b == 1) {\n print(\"9 10\")\n return\n }\n \n if (abs(a - b) > 1 || a > b) {\n println(\"-1\")\n } else if (a == b) {\n print(a * 10 + 1)\n print(\" \")\n print(b * 10 + 2)\n } else {\n print(a * 10 + 9)\n print(\" \")\n print(b * 10)\n }\n}"}, {"source_code": "fun main() {\n val (a, b) = readLine()!!.split(\" \").map { it.toInt() }\n\n if (b - a == 1) {\n println(\"$a $b\")\n } else if (a == b) {\n print(\"$a\")\n print(\"1 $b\")\n println(\"2\")\n } else if (b == 1 && a == 9) {\n println(\"99 100\")\n } else {\n print(\"-1\")\n }\n}"}, {"source_code": "import java.util.Scanner\n\nfun main(args : Array){\n val reader = Scanner(System.`in`);\n \n var a:Int = reader.nextInt();\n var b:Int = reader.nextInt();\n\n if(a == 9 && b == 1){\n print(\"$a 10\");\n return;\n }\n\n if(a > b || Math.abs(a - b) > 1){\n println(-1);\n return;\n }\n\n if(a == b){\n print(a);\n print(\"1 \");\n print(b);\n println(\"2\");\n }\n else{\n print(a);\n print(\"9 \");\n print(b);\n println(\"0\");\n }\n}"}, {"source_code": "fun main() {\n val (x, y) = readInts()\n when {\n x + 1 == y -> println(\"${x}9 ${y}0\")\n x == y -> println(\"${x}1 ${y}2\")\n x == 9 && y == 1 -> println(\"99 100\")\n else -> println(\"-1\")\n }\n}\n\nprivate fun readInts() = readLine()!!.split(\" \").map { it.toInt() }"}, {"source_code": "fun main(args: Array ) {\n val (a, b) = readLine()!!.split(\" \").map { it.toInt() }\n if ( a == b ) println( \"${10 * a + 1} ${10 * b + 2}\" )\n else if ( a + 1 == b ) println( \"${10 * a + 9} ${10 * b + 0}\" )\n else if ( a == 9 && b == 1 ) println( \"9 10\" )\n else println( -1 )\n}"}, {"source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\")\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 // immediate println for interactive\n\nfun main() {\n output {\n val da = readInt()\n val db = readInt()\n\n val a = when {\n db - da == 1 -> da\n db - da == 0 -> da * 10\n da == 9 && db == 1 -> 9\n else -> -1\n }\n\n if(a >= 0) {\n val b = a+1\n println(\"$a $b\")\n } else println(a)\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 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(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()"}, {"source_code": "fun main() {\n val input = readLine()!!.split(\" \").map(String::toInt)\n\n if (input[1] == 1 && input[0] == 9) {\n println(\"9 10\")\n } else if (input[1] == input[0] + 1) {\n val a = input[0] * 10 + 9\n val b = input[1] * 10\n println(\"$a $b\")\n } else if (input[1] == input[0]) {\n val a = input[0] * 10 + 1\n val b = input[1] * 10 + 2\n println(\"$a $b\")\n } else {\n println(-1)\n }\n}\n"}, {"source_code": "fun main() {\n val (da,db) = readLine()!!.split(\" \").map { it.toInt() }\n when {\n da == db -> println(\"${da*10} ${db*10 + 1}\")\n da + 1 == db -> //{da}9 {db}0\n println(\"${da}9 ${db}0\")\n da == 9 && db == 1 ->\n println(\"99 100\")\n else -> println(\"-1\")\n }\n}"}, {"source_code": "import java.util.*\n\n//30/11/2019\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val a = nextInt()\n val b = nextInt()\n when (b - a) {\n 0 -> {\n print(a * 100 + 1)\n print(\" \")\n print(a * 100 + 2)\n }\n 1 -> {\n print(b * 10 - 1)\n print(\" \")\n print(b * 10)\n }\n else -> {\n if (a == 9 && b == 1) {\n print(\"9 10\")\n } else {\n print(-1)\n }\n }\n }\n\n}"}, {"source_code": "fun main(args: Array) {\n val (a, b) = readLine()!!.split(\" \").map { it.toInt() }\n\n if (a == b) {\n println(\"${a}0 ${b}1\")\n } else if (a == 9 && b == 1) {\n println(\"9 10\")\n } else if (a + 1 == b) {\n println(\"${a}9 ${b}0\")\n } else {\n println(-1)\n }\n}"}], "negative_code": [{"source_code": "\nfun readIntList() = readLine()!!.split(' ').map(String::toInt).toMutableList()\nfun readLongList() = readLine()!!.split(' ').map(String::toLong).toMutableList()\nfun readStringList() = readLine()!!.split(' ').toMutableList()\nfun readInt() = readLine()!!.toInt()\nfun readLong() = readLine()!!.toLong()\n\nfun main(args: Array) {\n\n val (a , b) = readIntList()\n\n\n if(a == b){\n println(\"${a}0 ${b}1\")\n }else if (a + 1 == b){\n println(\"${a}9 ${b}0\")\n }else{\n println(-1)\n }\n\n\n}"}, {"source_code": "fun main(args : Array) {\n val (a, b) = readLine()!!.split(\" \") .map{it.toInt()}\n\n if (b - a == 0) {\n println(\"${a}1 ${b}2\")\n } else if (b - a == 1) {\n println(\"${a}9 ${b}0\")\n } else {\n println(-1)\n }\n}"}, {"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 da = ni()\n val db = ni()\n if (da == db) {\n out.println(\"$da $db\")\n } else if (db == da + 1) {\n out.println(\"$da $db\")\n } else if (da == 9 && db == 1){\n out.println(\"9 10\")\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}\n"}, {"source_code": "fun main() {\n var (m, k) = readLine()!!.split(\" \").map { it.toInt() }\n if(m != k && m + 1 != k) {\n println(-1)\n } else {\n if(m != k) {\n println(\"${m * 10 + 9} ${k * 10}\")\n } else {\n println(\"${m * 10 + 1} ${k * 10 + 2}\")\n }\n }\n}"}, {"source_code": "\nimport kotlin.math.abs\nimport kotlin.math.min\n\nfun main() {\n task1()\n}\n\n\n\n\nfun task1() {\n\n var (a, b) = readLine()!!.split(\" \").map(String::toInt)\n\n if (a == 9 || b == 1) {\n print(\"9 10\")\n return\n }\n \n if (abs(a - b) > 1 || a > b) {\n println(\"-1\")\n } else if (a == b) {\n print(a * 10 + 1)\n print(\" \")\n print(b * 10 + 2)\n } else {\n print(a * 10 + 9)\n print(\" \")\n print(b * 10)\n }\n}"}, {"source_code": "import kotlin.math.abs\n\nfun main() {\n task1()\n}\n\nfun task1() {\n\n var (a, b) = readLine()!!.split(\" \").map(String::toInt)\n\n if (abs(a - b) > 1 || a > b) {\n println(\"-1\")\n } else if (a == b)\n {\n print(a * 10 + 1)\n print( \" \")\n print(b * 10 + 2)\n } else {\n print(a * 10 + 9)\n print( \" \")\n print(b * 10)\n }\n}\n"}, {"source_code": "fun main() {\n val (x, y) = readInts()\n when {\n x + 1 == y -> println(\"${x}9 ${y}0\")\n x == y -> println(\"${x}1 ${y}2\")\n else -> println(\"-1\")\n }\n}\n\nprivate fun readInt() = readLine()!!.toInt()\n\nprivate fun readInts() = readLine()!!.split(\" \").map { it.toInt() }"}, {"source_code": "fun main() {\n val (x, y) = readInts()\n when {\n x + 1 == y -> println(\"${x}9 ${y}0\")\n x == y -> println(\"${x}1 ${y}2\")\n else -> println(\"-1\")\n }\n}\n\nprivate fun readInts() = readLine()!!.split(\" \").map { it.toInt() }"}, {"source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\")\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 // immediate println for interactive\n\nfun main() {\n output {\n val da = readInt()\n val db = readInt()\n\n val a = when(db - da) {\n 1 -> da\n 0 -> da * 10\n else -> -1\n }\n\n if(a >= 0) {\n val b = a+1\n println(\"$a $b\")\n } else println(a)\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 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(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()"}, {"source_code": "fun main() {\n val input = readLine()!!.split(\" \").map(String::toInt)\n\n val diff = input[1] - input[0]\n if (diff < 0 || 1 < diff) {\n println(-1)\n return\n }\n\n if (input[1] > input[0]) {\n val a = input[0] * 10 + 9\n val b = input[1] * 10\n println(\"$a $b\")\n } else {\n val a = input[0] * 10 + 1\n val b = input[1] * 10 + 2\n println(\"$a $b\")\n }\n}\n"}, {"source_code": "fun main() {\n val input = readLine()!!.split(\" \").map(String::toInt)\n\n if (input[1] == input[0] + 1) {\n val a = input[0] * 10 + 9\n val b = input[1] * 10\n println(\"$a $b\")\n } else if (input[1] == input[0]) {\n val a = input[0] * 10 + 1\n val b = input[1] * 10 + 2\n println(\"$a $b\")\n } else {\n println(-1)\n }\n}\n"}, {"source_code": "fun main() {\n val (da,db) = readLine()!!.split(\" \").map { it.toInt() }\n when {\n da == db -> println(\"${da*10} ${db*10 + 1}\")\n da + 1 == db -> //{da}9 {db}0\n println(\"${da}9 ${db}0\")\n else -> println(\"-1\")\n }\n}"}, {"source_code": "import java.util.*\n\n//30/11/2019\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val a = nextInt()\n val b = nextInt()\n when (b - a) {\n 0 -> {\n print(a * 100 + 1)\n print(\" \")\n print(a * 100 + 2)\n }\n 1 -> {\n print(b * 10 - 1)\n print(\" \")\n print(b * 10)\n }\n else -> {\n print(-1)\n }\n }\n\n}"}, {"source_code": "import java.util.*\n\n//30/11/2019\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val a = nextInt()\n val b = nextInt()\n when (b - a) {\n 0 -> {\n print(a * 100 + 1)\n print(\" \")\n print(a * 100 + 2)\n }\n 1 -> {\n print(b * 10 - 1)\n print(\" \")\n print(b * 10)\n }\n else -> {\n if (a == 9 && b == 1) {\n print(a)\n print(\" \")\n print(b)\n } else {\n print(-1)\n }\n }\n }\n\n}"}, {"source_code": "import com.sun.xml.internal.fastinfoset.util.StringArray\nimport 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 da: Int = ir.nextInt()\n val db: Int = ir.nextInt()\n\n if (da - db == -1)\n pw.print(\"${da}99 ${db}00\")\n else if (da == db)\n pw.print(\"${da}00 ${da}01\")\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 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}"}, {"source_code": "import java.io.*\nimport java.util.*\n\nfun main(args: Array) {\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 val f1 = inp.nextInt()\n val f2 = inp.nextInt()\n if (f1 == f2)\n out.println(\"${f1}0 ${f2}1\")\n else if (f1 < f2) {\n if (f2 - f1 == 1)\n out.println(\"${f1}9 ${f2}0\")\n else\n out.println(-1)\n } else\n out.println(-1)\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 fun nextLong(): Long {\n return next().toLong()\n }\n }\n}\n"}, {"source_code": "fun main() {\n val (a, b) = readLine()!!.split(' ').map(String::toInt)\n when {\n a == b + 1 -> println(\"${a * 10 + 9} ${b * 10}\")\n a == b -> println(\"${a * 10} ${b * 10 + 1}\")\n a == 9 && b == 1 -> println(\"99 100\")\n else -> println(\"-1\")\n }\n}"}, {"source_code": "fun main() {\n val (a, b) = readLine()!!.split(' ').map(String::toInt)\n when (b - a) {\n 1 -> println(\"${a * 10 + 9} ${b * 10}\")\n 0 -> println(\"${a * 10 + 1} ${b * 10 + 2}\")\n else -> println(\"-1\")\n }\n}"}, {"source_code": "fun main() {\n var list = readLine()!!.split(' ')\n var ans = \"\"\n var ans1 = \"\"\n if ((list[1].toInt() - list[0].toInt()) == 0) {\n ans += list[0] + \"1\"\n ans1 += list[1] + \"2\"\n println(\"$ans $ans1\")\n } else if ((list[1].toInt() - list[0].toInt()) == 1) {\n ans += list[0] + \"9\"\n ans1 += list[1] + \"0\"\n println(\"$ans $ans1\")\n } else {\n println(-1)\n }\n}"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (a, b) = readInts()\n print(\n when {\n b - a == 0 -> \"${a}0 ${a}1\"\n b - a == 1 -> \"${a}9 ${b}0\"\n else -> \"-1\"\n }\n )\n}"}, {"source_code": "import java.util.Scanner\n\nfun main(args : Array){\n val reader = Scanner(System.`in`);\n \n var a:Int = reader.nextInt();\n var b:Int = reader.nextInt();\n\n if(a > b || Math.abs(a - b) > 1){\n println(-1);\n return;\n }\n\n if(a == b){\n print(a);\n print(\"1 \");\n print(b);\n println(\"2\");\n }\n else{\n print(a);\n print(\"9 \");\n print(b);\n println(\"0\");\n }\n}"}], "src_uid": "3eff6f044c028146bea5f0dfd2870d23"} {"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)%MOD, (a*d+b*c)%MOD)\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", "positive_code": [{"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 tot = sz.toModInt().pow(nm)\n val ans = when {\n nm and 1 == 1L -> tot\n sz and 1 == 0 -> tot/2\n else -> (tot+1)/2\n }\n println(ans)\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}"}, {"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 sz.toModInt().pow(nm)\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}"}, {"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 sz.toModInt().pow(nm)\n\n var u = ModInt(sz / 2)\n var v = ModInt((sz + 1) / 2)\n\n v = u - v.also { u += v }\n\n u = u.pow(nm)\n v = v.pow(nm)\n\n v = u - v.also { u += v }\n\n u/2\n }\n println(ans)\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}"}, {"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\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\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\nfun calc_a(a:MutableMap, b:MutableMap, n:Long):ModInt {\n if (a.containsKey(n)) {\n return a[n]!!\n }\n val v = calc_a(a,b, n/2) * calc_a(a,b, n-n/2)+calc_b(a,b,n/2)*calc_b(a,b,n-n/2)\n a[n]=v\n return v\n}\n\nfun calc_b(a:MutableMap, b:MutableMap, n:Long):ModInt {\n if (b.containsKey(n)) {\n return b[n]!!\n }\n val v = calc_a(a,b, n/2) * calc_b(a,b, n-n/2)+calc_b(a,b,n/2)*calc_a(a,b,n-n/2)\n b[n]=v\n return v\n}\n\nfun PrintWriter.solve(sc: FastScanner) {\n val n = sc.nextLong()\n val m = sc.nextLong()\n val l = sc.nextLong()\n val r = sc.nextLong()\n if (n * m % 2 == 0L) {\n val even = r / 2 - (l - 1) / 2\n val a = mutableMapOf(0L to ModInt(1), 1L to ModInt(even))\n val b = mutableMapOf(0L to ModInt(0), 1L to ModInt(r - l + 1 - even))\n println(calc_a(a, b, n * m))\n } else {\n println(ModInt(r - l + 1).pow(m * 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}\n"}, {"source_code": "import java.io.PrintWriter\nimport java.math.BigInteger\nimport java.util.*\n\nprivate val M = 998244353L\nprivate val MB = M.toBigInteger()\nprivate val sc = Scanner( System.`in` )\nprivate val pw = PrintWriter( System.out )\n\nprivate fun solve(): Long {\n val n = sc.nextLong()\n val m = sc.nextLong()\n val l = sc.nextLong()\n val r = sc.nextLong()\n val totalCount = ( r - l + 1 ).toBigInteger().modPow( ( n * m ).toBigInteger(), MB ).toLong()\n if ( m * n % 2 == 1L ) return totalCount\n val inv2 = 2.toBigInteger().modInverse( MB ).toLong()\n return if ( l % 2 != r % 2 ) totalCount * inv2 % M else ( totalCount + 1 ) * inv2 % M\n}\n\nfun main() {\n pw.println( solve() )\n pw.close()\n}"}, {"source_code": "private const val MOD = 998_244_353\nfun main() {\n val (rows, cols, lower, upper) = System.`in`.bufferedReader().readLine().split(' ').map(String::toLong)\n val dif = upper - lower + 1\n val pow = (rows * cols)\n var ans = modPow(dif, pow)\n if (rows * cols and 1L == 0L) {\n if (dif and 1L == 1L) {\n ans++\n }\n if(ans and 1L == 1L){\n ans += MOD\n }\n ans = ans shr 1\n }\n print(ans%MOD)\n}\n\nprivate fun modPow(base: Long, pow: Long): Long {\n if (pow == 0L) {\n return 1L\n }\n var half = modPow(base, pow shr 1)\n half *= half\n half %= MOD\n if (pow and 1L == 1L) {\n half *= base\n half %= MOD\n }\n return half\n}"}, {"source_code": "//package c1332.e\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 times(x: MyLong): MyLong =\n MyLong(num * x.num % 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 fun pow(n: Long): MyLong {\n var res = 1.X\n var p = n\n var a = this\n while (p != 0L) {\n if (p.and(1) == 1L)\n res *= a\n a *= a\n p = p.shr(1)\n }\n return res\n }\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 val result = MyLong(r - l + 1).pow(n * m)\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}"}], "negative_code": [{"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}"}, {"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 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 val ans = A[0]\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}"}, {"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}"}, {"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"}], "src_uid": "ded299fa1cd010822c60f2389a3ba1a3"} {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val votes = Array(sc.nextInt()) { sc.nextInt() }\n print(A(votes).k)\n\n}\n\nclass A(val votes: Array) {\n val k: Int\n get() {\n val op = votes.sum()\n var res = votes.max()!!\n while (res * votes.size <= 2 * op) res += 1\n return res\n }\n}\n", "positive_code": [{"source_code": "\nfun main(args: Array) {\n val n = readLine()!!.toInt()\n val votes = readLine()!!.split(\" \").map { it.toInt() }\n val k = votes.max() ?: votes[0]\n val sumPierdole = votes.sum()\n val sumKurwa = votes.map { k - it }.sum()\n for (i in k..1000)\n if (sumPierdole < sumKurwa + (i-k)*n) {\n println(i)\n break\n }\n}"}, {"source_code": "\nfun main(args: Array) {\n\n val n = readLine()!!.toInt()\n\n val arr = readLine()!!.split(' ').map(String::toInt)\n\n var m = arr.max()!!\n\n var s1 = 0;\n var s2 = 0;\n\n arr.forEach { s1 += it }\n arr.forEach { s2 += (m!! - it) }\n\n\n while(s2 <= s1){\n s2 += arr.size\n m += 1;\n }\n\n print(m)\n}\n\nvar arr = arrayOfNulls(size = 1000)\n\nfun check(str: String , right: Int , left: Int): Boolean {\n val n = (left - right)\n\n for (i in 0..arr.size - 1) {\n arr[i] = 0;\n }\n\n\n for (i in left..right - 1) {\n val ch = str[i];\n arr[ch.toInt()] = arr[ch.toInt()]!! + 1;\n if (arr[ch.toInt()]!! > n / 2) {\n return false;\n }\n }\n\n return true;\n}"}, {"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\n val mx = d.max()!!\n val sum = d.sum()\n val k0 = sum / n\n var ans =\n if ((sum % n) * 2 < n)\n k0 * 2 + 1\n else\n k0 * 2 + 2\n\n cout .. max(ans, mx) .. nl\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"}, {"source_code": "import kotlin.math.max\n\nfun main() {\n fun readInt() = readLine()!!.toInt()\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val numStudents = readInt()\n val votesAgaints = readInts()\n val totalVotesAgaints = votesAgaints.sum()\n var necessary = totalVotesAgaints + totalVotesAgaints + 1\n print(\n max(\n votesAgaints.max()!!,\n if (necessary % numStudents == 0) necessary / numStudents else necessary / numStudents + 1\n )\n )\n}"}, {"source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var max = 0\n var e = 0\n var a= readLine()!!.split(\" \")\n for (i in a) {\n var v = i.toInt()\n e += v\n max = maxOf(v, max)\n }\n var al = max * n\n var my = al - e\n while (my <= e) {\n my += n\n max++\n }\n println(max)\n}"}, {"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}"}], "negative_code": [{"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=0\nvar f=e-d\nwhile(e<=c){\ne=0\nfor(i in 0..n-1){\ne+=(d-a[i])\n}\nif(e>c) break\nelse c++\n}\nprintln(c)\n}"}, {"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}"}, {"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}"}], "src_uid": "d215b3541d6d728ad01b166aae64faa2"} {"source_code": "import kotlin.math.*\n\nfun main(arg: Array){\n\tvar N = readLine()!!.toInt()\n\tval NN = N\n\tval M = 2.0.pow(N.toDouble()).toInt()\n\tval L = mutableListOf()\n\tvar S = 0\n\twhile(N > 0){\n\t\tL.add(readLine()!!.toInt())\n\t\tN--\n\t}\n\tL.forEach(){\n\t\tS += it\n\t}\n\tfor(i in 0..M-1){\n\t\tval opts = i.toString(2).padStart(NN,'0')\n\t\t//println(opts)\n\t\tvar Sum = 0\n\t\tfor (i in 1..opts.length){\n\t\t\tif(opts[i-1] == '0'){\n\t\t\t\tSum -= L[i-1]\n\t\t\t}else{\n\t\t\t\tSum += L[i-1]\n\t\t\t}\n\t\t}\n\t\tif(Sum.rem(360) == 0){\n\t\t\t//println(\"OGON: $opts $Sum\")\n\t\t\tprintln(\"YES\")\n\t\t\treturn\n\t\t}\n\n\t}\n\tprintln(\"NO\")\n}", "positive_code": [{"source_code": "fun main() {\n //println((4 or 6)xor(4 or 5))\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n var v = mutableListOf(0)\n repeat(r.readLine()!!.toInt()) {\n val n = r.readLine()!!.toInt()\n val newList = mutableListOf()\n v.forEach {\n newList += it+n\n newList += it-n\n }\n v = newList\n }\n val ans = v.any { it%360==0 }\n println(if (ans) \"YES\" else \"NO\")\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\n\nfun BufferedReader.readIntList() = readLine().split(' ').map(String::toInt)\nfun BufferedReader.readLongList() = readLine().split(' ').map(String::toLong)\n\nclass Solution(private val inf: BufferedReader, private val ouf: PrintWriter) : Runnable {\n constructor() : this(BufferedReader(InputStreamReader(System.`in`)), PrintWriter(System.out))\n\n fun solve() {\n val n = inf.readLine().toInt()\n val a = IntArray(n) {\n inf.readLine().toInt()\n }\n var ans = false\n for (i in 0 until (1 shl n)) {\n var sum = 0\n for (j in a.indices) {\n if ((i and (1 shl j)) == 0) sum += a[j] else sum -= a[j]\n }\n if ((sum % 360 + 360) % 360 == 0) ans = true\n }\n ouf.println(if (ans) \"YES\" else \"NO\")\n }\n\n override fun run() {\n// for (testNum in 1..inf.readLine().toInt()) {\n solve()\n// }\n\n ouf.close()\n }\n}\n\nfun main(args: Array) {\n Thread(null, Solution(), \"name\", 1 shl 27).start()\n}\n"}, {"source_code": "fun main() {\n val n = readInt()\n\n var possibilities = setOf(0)\n\n repeat(n) {\n val a = readInt()\n\n possibilities = sequence {\n for(p in possibilities) {\n yield((p + a) umod 360)\n yield((p - a) umod 360)\n }\n }.toSet()\n }\n\n if(0 in possibilities) println(\"YES\") else println(\"NO\")\n}\n\ninfix fun Int.umod(divisor: Int) =\n (this % divisor).let { if(it >= 0) it else it + divisor }\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readStrings() = readLn().split(' ')\nfun readInts() = readStrings().map { it.toInt() }\nfun readDoubles() = readStrings().map { it.toDouble() }\nfun readLongs() = readStrings().map { it.toLong() }"}, {"source_code": "//package com.happypeople.codeforces.c1097\n\nimport java.io.ByteArrayInputStream\nimport java.io.InputStream\nimport java.util.*\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 a=(1..n).map { sc.nextInt() }\n\n val res=binsearch(a, 0, 0)\n if(res)\n println(\"YES\")\n else\n println(\"NO\")\n }\n\n fun binsearch(a:List, next:Int, sum:Int):Boolean {\n if(next==a.size)\n return sum%360==0\n else\n return binsearch(a, next+1, sum+a[next]) ||\n binsearch(a, next+1, sum-a[next])\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}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val nums = IntArray(n)\n for (i in 0 until n) {\n nums[i] = readLine()!!.toInt()\n }\n var res = mutableListOf()\n res.add(circle(nums[0]))\n res.add(circle(-nums[0]))\n for (i in 1 until n) {\n val lr = res.count()\n val nres = mutableListOf()\n for (j in 0 until lr) {\n nres.add(circle(res[j] + nums[i]))\n nres.add(circle(res[j] - nums[i]))\n }\n res = nres\n }\n if (res.contains(0)) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}\n\nfun circle(x: Int): Int {\n if (x < 0) {\n return 360 + x\n } else\n return x % 360\n}"}, {"source_code": "import java.io.*\nimport java.lang.Math.abs\nimport java.util.*\nimport javax.swing.plaf.nimbus.NimbusLookAndFeel\nimport kotlin.collections.HashSet\n\nfun solve(cin: FastReader, out: PrintWriter) {\n val n = cin.int()\n val a = IntArray(n) {cin.int()}\n\n for (i in 0 until (1 shl n)) {\n var sum = 0\n for (j in 0 until n)\n if (((1 shl j) and i) != 0)\n sum += a[j]\n else\n sum -= a[j]\n if (sum % 360 == 0) {\n out.print(\"YES\")\n return\n }\n }\n out.print(\"NO\")\n}\n\n\n\nclass FastReader(input: InputStream) {\n private val br = BufferedReader(InputStreamReader(input))\n private var st = StringTokenizer(\"\")\n\n fun next(): String {\n while (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun int(): Int {\n return next().toInt()\n }\n\n fun double(): Double {\n return next().toDouble()\n }\n\n fun long(): Long {\n return next().toLong()\n }\n\n /**\n * Warning! Use carefully!\n */\n fun nextLine(): String {\n return br.readLine()\n }\n}\n\nfun main(args: Array) {\n val cin = FastReader(System.`in`)\n val out = PrintWriter(BufferedOutputStream(System.out))\n\n solve(cin, out)\n\n out.flush()\n}"}], "negative_code": [], "src_uid": "01b50fcba4185ceb1eb8e4ba04a0cc10"} {"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 a = readLn()\n val b = readLn()\n val c = readLn()\n\n val aUb = (a+b).groupingBy { it }.eachCount()\n val cU = c.groupingBy { it }.eachCount()\n\n if (aUb == cU) println(\"YES\") else println(\"NO\")\n}\n", "positive_code": [{"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.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 arr = IntArray(26)\n for (i in scanner.next())\n arr[i - 'A']++\n for (i in scanner.next())\n arr[i - 'A']++\n for (i in scanner.next())\n arr[i- 'A']--\n for (i in arr) {\n if (i != 0) {\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//}"}, {"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 = io.readToken()\n val b = io.readToken()\n val c = io.readToken()\n val s1 = (a + b).toCharArray().sortedArray()\n val s2 = c.toCharArray().sortedArray()\n val res = Arrays.equals(s1, s2)\n io.println(if (res) \"YES\" else \"NO\")\n io.close()\n}\n\nfun main(args: Array) {\n Thread({ solve() }).start()\n}\n"}, {"source_code": "fun main()\n{\n val one = (readLine()!! + readLine()!!).asSequence().sorted().joinToString(\"\")\n\n val both = readLine()!!.asSequence().sorted().joinToString(\"\")\n println(if (one == both ) \"YES\" else \"NO\")\n}\n\n"}, {"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 s3 = r.readLine()!!\n val c1 = mutableListOf()\n s1.forEach { c1 += it }\n s2.forEach { c1 += it }\n val c2 = mutableListOf()\n s3.forEach { c2 += it }\n if (c1.size!=c2.size){\n println(\"NO\")\n }else{\n var can = true\n c1.sort()\n c2.sort()\n (0..c1.size-1).forEach { if (c1[it]!=c2[it]) can = false }\n println(if (can) \"YES\" else \"NO\")\n }\n}"}, {"source_code": "import java.util.*\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n\n val s1 = (input.next() + input.next()).toCharArray()\n val s2 = input.next().toCharArray()\n\n Arrays.sort(s1)\n Arrays.sort(s2)\n\n if (Arrays.equals(s1, s2))\n println(\"YES\") \n else \n print(\"NO\")\n\n }"}, {"source_code": "import java.io.*\nimport java.math.BigDecimal\nimport java.math.BigInteger\nimport java.util.*\nimport kotlin.collections.HashSet\n\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 //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(System.`in`)\n .useOutputSource(System.out)\n .useScanner(FastScanner())\n .solveTask(TaskB())\n .run()\n\n class TaskA: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val countOfRooms = scanner.nextInt()\n val rooms = Array(countOfRooms) { scanner.nextInt() to scanner.nextInt() }\n printer.println(rooms\n .map { it.second - it.first }\n .filter { it >= 2 }\n .count())\n }\n\n }\n\n class TaskB: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val firstName = scanner.nextLine()\n val secondName = scanner.nextLine()\n val mixedUpName = scanner.nextLine()\n\n val alphabet = Array(26) { 0 }\n val mixedUpAlphabet = Array(26) { 0 }\n\n firstName.forEach { alphabet[it - 'A']++ }\n secondName.forEach { alphabet[it - 'A']++ }\n mixedUpName.forEach { mixedUpAlphabet[it - 'A']++ }\n\n for (it in 0..25) {\n if (alphabet[it] != mixedUpAlphabet[it]) {\n printer.println(\"NO\")\n return\n }\n\n }\n printer.println(\"YES\")\n }\n\n }\n}\n"}, {"source_code": "fun main() {\n val firstLine = readLine()!!.map { it.toString() }\n val secLine = readLine()!!.map { it.toString() }\n val thirdLine = readLine()!!.map { it.toString() }\n\n val result = firstLine + secLine\n\n if (thirdLine.sorted() == result.sorted()) {\n print(\"YES\")\n } else {\n print(\"NO\")\n }\n}"}, {"source_code": "import java.util.*\n\nfun String.freqs(): HashMap {\n val map = hashMapOf()\n forEach { c ->\n if (map.containsKey(c)) map[c] = map[c]!! + 1\n else map[c] = 1\n }\n return map\n}\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val name1 = sc.nextLine()\n val name2 = sc.nextLine()\n val letters = sc.nextLine()\n val map1 = name1.freqs()\n val map2 = name2.freqs()\n val map3 = letters.freqs()\n\n var ok = true\n map1.forEach { k, v ->\n if (map3.containsKey(k) && map3[k]!! - v >= 0) map3[k] = map3[k]!! - v\n else ok = false\n return@forEach\n }\n if (ok)\n map2.forEach { k, v ->\n if (map3.containsKey(k) && map3[k]!! - v >= 0) map3[k] = map3[k]!! - v\n else ok = false\n return@forEach\n }\n\n ok = ok && map3.values.sum() == 0\n\n if (ok)\n println(\"YES\")\n else\n println(\"NO\")\n}"}, {"source_code": "\nimport java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)){\n val guests = nextLine()!!\n val hosts = nextLine()!!\n\n val shuffled = nextLine()!!\n\n if (shuffled.length != hosts.length + guests.length){\n println(\"NO\")\n return\n }\n\n val guestsAr = guests.toCharArray()\n val hostsAr = hosts.toCharArray()\n val shuffledAr = shuffled.toCharArray()\n \n val gHelper = IntArray(guests.length){0}\n val hHelper = IntArray(hosts.length){0}\n\n for (target in shuffledAr){\n var found = false\n for (i in 0..guestsAr.size - 1){\n if (guestsAr[i] == target && gHelper[i] ==0) {\n found = true\n gHelper[i] = 1\n break\n }\n }\n\n if(found){\n continue\n }\n \n for (i in 0..hostsAr.size - 1){\n if (hostsAr[i] == target && hHelper[i] ==0) {\n found = true\n hHelper[i] = 1\n break\n }\n }\n if(!found){\n println(\"NO\")\n return\n }\n }\n println(\"YES\")\n}"}, {"source_code": "import java.io.*\nimport java.lang.StringBuilder\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.println(if (StringBuilder(input.next()).append(input.next()).toList().sorted() == input.next().toList().sorted()) \"YES\" else \"NO\")\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}"}, {"source_code": "\nfun main(){\n var arrChar = readLine()!!.toCharArray().toMutableList()\n arrChar.addAll(readLine()!!.toCharArray().toMutableList())\n arrChar.sort()\n var str = readLine()!!.toCharArray().toMutableList()\n str.sort()\n println(if (arrChar.equals(str)) \"YES\" else \"NO\")\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val guest = sc.next()\n val host = sc.next()\n val mixed = sc.next().toCharArray().sorted()\n val sm = (guest + host).toCharArray().sorted()\n\n if (mixed == sm) {\n print(\"YES\")\n } else print(\"NO\")\n\n\n}"}, {"source_code": "fun main(args: Array) {\n val name = readLine()!! + readLine()!!\n val let = readLine()!!\n\n val countChars = name.groupingBy { it }.eachCount()\n val countLet = let.groupingBy { it }.eachCount()\n \n println(if (countChars == countLet) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main(args: Array) {\n val name1 = readLine()!!\n val name2 = readLine()!!\n val mix = readLine()!!\n if ((name1 + name2).toCharArray().also { it.sort() }.contentEquals(mix.toCharArray().also { it.sort() }))\n println(\"YES\")\n else\n println(\"NO\")\n}"}, {"source_code": "import java.util.*\n\nfun main(){\n\n val scan = Scanner(System.`in`)\n var arr = Array(26){ _ -> 0}\n var line = scan.next() + scan.next()\n\n\n for (i in line){\n arr[i.toInt()-65]++\n }\n\n for (i in scan.next()){\n arr[i.toInt()-65]--\n }\n\n var a = true\n for (i in arr) if (i != 0){\n a = false\n break\n }\n\n if (a) print(\"YES\")\n else print(\"NO\")\n\n}"}, {"source_code": "fun main() {\n val a = (readLine()!! + readLine()!!).asSequence().sorted().joinToString(\"\")\n val b = readLine()!!.asSequence().sorted().joinToString(\"\")\n println(if (a == b) \"YES\" else \"NO\")\n}"}, {"source_code": "import kotlin.system.exitProcess\n\nfun main() {\n var arr = IntArray(26)\n for(i in 1..2) {\n readLine()!!.toCharArray().let {\n for(x in it) {\n arr[x - 'A']++\n }\n }\n }\n readLine()!!.toCharArray().let {\n for(x in it) {\n arr[x - 'A']--\n }\n }\n for(x in arr) {\n if(x != 0) {\n println(\"NO\")\n exitProcess(0)\n }\n }\n println(\"YES\")\n}"}, {"source_code": "fun main(args: Array) {\n val was = (readLine()!! + readLine()!!).toCharArray().apply {sort()}\n val become = readLine()!!.toCharArray().apply {sort()}\n\n println(if (was.contentEquals(become)) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main(args: Array) {\n val was = (readLine()!! + readLine()!!).toCharArray().sorted()\n val become = readLine()!!.toCharArray().sorted()\n\n println(if (was == become) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main(args: Array) {\n val s = (readLine()!! + readLine()!!).toCharArray().sorted().joinToString(\"\")\n val line = readLine()!!.toCharArray().sorted().joinToString(\"\")\n println(if (s == line) \"YES\" else \"NO\")\n}"}, {"source_code": "import 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\nfun readLn():String = readLine()!!.toString()\nfun readLong() = readLn().toLong()\nfun readLongs() = readLn().split(\" \").map{it.toLong()}\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 solve() {\n val cin = Scanner(System.`in`)\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\n var a=readLine()!!.toString();\n var b=readLine()!!.toString();\n var c=readLine()!!.toString();\n\n var qq=LongArray(26);\n\n for (i in 0..a.length-1) {\n qq[a[i]-'A']++;\n }\n for (i in 0..b.length-1) {\n qq[b[i]-'A']++;\n }\n for (i in 0..c.length-1) {\n qq[c[i]-'A']--;\n }\n var check=one;\n for (i in 0..25) if (qq[i]>nul || qq[i]) {\n var first = readLine()!!.toString()\n var second = readLine()!!.toString()\n var all = readLine()!!.toString()\n\n if (first.length + second.length != all.length){\n println(\"NO\")\n return\n }\n\n var t1 = (first + second).toCharArray().sortedArray()\n var t2 = all.toCharArray().sortedArray()\n\n for (i in 0..all.length-1) {\n if (t1[i] != t2[i]){\n println(\"NO\")\n return\n }\n }\n println(\"YES\")\n return\n}"}], "negative_code": [{"source_code": "fun main(args: Array) {\n var s = readLine()!!\n var S = readLine()!!\n var W = readLine()!!\n var c = 0\n var C = 0\n var j = 0\n for (i in 0 until W.count()) {\n if (s[j] == W[i]) {\n c++\n j++\n }\n }\n j = 0\n for (i in 0 until W.count()) {\n if (S[j] == W[i]) {\n C++\n j++\n }\n }\n if ((c == s.length) || (C == S.length)) {\n print(\"YES\")\n } else {\n print(\"NO\")\n }\n}"}, {"source_code": "import java.io.*\nimport java.math.BigDecimal\nimport java.math.BigInteger\nimport java.util.*\nimport kotlin.collections.HashSet\n\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 //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(System.`in`)\n .useOutputSource(System.out)\n .useScanner(FastScanner())\n .solveTask(TaskB())\n .run()\n\n class TaskA: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val countOfRooms = scanner.nextInt()\n val rooms = Array(countOfRooms) { scanner.nextInt() to scanner.nextInt() }\n printer.println(rooms\n .map { it.second - it.first }\n .filter { it >= 2 }\n .count())\n }\n\n }\n\n class TaskB: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val firstName = scanner.nextLine()\n val secondName = scanner.nextLine()\n val mixedUpName = scanner.nextLine()\n\n val alphabet = Array(26) { 0 }\n val mixedUpAlphabet = Array(26) { 0 }\n\n firstName.forEach { alphabet[it - 'A']++ }\n secondName.forEach { alphabet[it - 'A']++ }\n mixedUpName.forEach { mixedUpAlphabet[it - 'A']++ }\n\n (0..25) {\n if (alphabet[it] != mixedUpAlphabet[it]) {\n printer.println(\"NO\")\n System.exit(0)\n }\n\n }\n printer.println(\"YES\")\n }\n\n }\n}\n"}, {"source_code": "fun main() {\n val firstLine = readLine()!!.map { it.toString() }\n val secLine = readLine()!!.map { it.toString() }\n val thirdLine = readLine()!!.map { it.toString() }\n \n if (thirdLine - secLine == firstLine) {\n print(\"YES\")\n } else {\n print(\"NO\")\n }\n}"}, {"source_code": "\nfun main(){\n var arrChar = readLine()!!.toCharArray().toMutableList()\n arrChar.addAll(readLine()!!.toCharArray().toMutableList())\n arrChar.sort()\n var str = readLine()!!.toCharArray().toMutableList()\n str.sort()\n println(if (arrChar.equals(str)) \"Yes\" else \"NO\")\n}"}, {"source_code": "import java.util.*\n\nfun main(){\n\n val scan = Scanner(System.`in`)\n var arr = Array(26){ _ -> 0}\n var line = scan.next() + scan.next()\n\n\n for (i in line){\n arr[i.toInt()-65]++\n }\n\n for (i in scan.next()){\n arr[i.toInt()-65]--\n }\n\n var a = 0\n for (i in arr) a+=i\n\n if (a == 0) print(\"YES\")\n else print(\"NO\")\n\n}"}, {"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 a = readLn()\n val b = readLn()\n val c = readLn()\n\n val aUb = a.groupingBy { it }.eachCount() + b.groupingBy { it }.eachCount()\n val cU = c.groupingBy { it }.eachCount()\n\n var sufficient = true\n for ((char, count) in cU) {\n val inA = aUb[char]\n if (inA == null) {\n sufficient = false\n break\n }\n if (inAb) a else b\nfun min(a:Long,b:Long) = if (ab) a else b\n\nfun readLn():String = readLine()!!.toString()\nfun readLong() = readLn().toLong()\nfun readLongs() = readLn().split(\" \").map{it.toLong()}\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 solve() {\n val cin = Scanner(System.`in`)\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\n var a=readLine()!!.toString();\n var b=readLine()!!.toString();\n var c=readLine()!!.toString();\n\n var qq=LongArray(26);\n\n for (i in 0..a.length-1) {\n qq[a[i]-'A']++;\n }\n for (i in 0..b.length-1) {\n qq[b[i]-'A']++;\n }\n for (i in 0..c.length-1) {\n qq[c[i]-'A']--;\n }\n var check=one;\n for (i in 0..25) if (qq[i]>nul) check=nul;\n if (check==nul) print(\"NO\"); else print(\"YES\");\n\n /* --------- */\n\n}\n\nfun main() {\n val cin = Scanner(System.`in`)\n\n var T=one;\n //T=readLine()!!.toLong();\n for (i55555 in 1..T) solve()\n}\n"}], "src_uid": "b6456a39d38fabcd25267793ed94d90c"} {"source_code": "fun main() {\n val (y, b, r) = readLine()!!.split(\" \")\n val m = minOf(y.toInt(), b.toInt() - 1, r.toInt() - 2)\n println(m * 3 + 3)\n}", "positive_code": [{"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 {\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(red.get() - 1, offset = 1),\n Ornament(red.get() - 1, offset = 2)\n )\n }\n}\n\nfun main() {\n ChristmasOrnament().input()\n}\n"}, {"source_code": "import java.util.*\nimport kotlin.math.min\n\nfun main(args : Array) {\n val reader = Scanner(System.`in`)\n\n var y:Int\n var b:Int\n var r:Int\n var min:Int\n var result:Int\n\n\n y=reader.nextInt()\n b=reader.nextInt()\n r=reader.nextInt()\n\n min= minOf(y,b,r)\n result= when (min) {\n r -> r+(r-1)+(r-2)\n b -> (b-1)+b+(b+1)\n else -> { // Note the block\n if(r-y>1){\n y+(y+1)+(y+2)\n }else{\n (y-1)+(y)+(y+1)\n }\n }\n }\n\n println(result)\n\n\n\n\n\n}"}, {"source_code": "fun main() {\n var str = readLine().toString()\n var parts = str.split(\" \").toTypedArray()\n var y = parts[0].toInt()\n var b = parts[1].toInt()\n var r = parts[2].toInt()\n var m1 = b-y-1\n var m2 = r-y-2\n var orn = y*3 + 3\n if ((m1 < 0) || (m2 < 0)) {\n if (m1 <= m2) {\n orn += m1*3\n } else {\n orn += m2*3\n }\n }\n \n print(orn)\n}"}, {"source_code": "fun main() {\n val (a, b, c) = readLine()!!.split(\" \").map(String::toInt)\n val d = minOf(a, b - 1, c - 2)\n println(d * 3 + 3)\n}"}, {"source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n \n val read=Scanner(System.`in`) \n var a=read.nextInt()\n var b=read.nextInt()\n var c=read.nextInt()\n \n \n while(true) {\n \n if((a+1<=b) and (a+2<=c))\n {\n b=a+1\n println(\"${3*b}\") \n return\n } \n a--\n }\n}"}, {"source_code": "\nfun main(){\n fun readLn() = readLine()!!\n fun readStrings(delim: Char = ' ') = readLn().split(delim)\n fun readInts() = readStrings().map { it.toInt() }\n\n val (y,b,r) = readInts()\n\n println(3+3*Math.min(y,Math.min(b-1,r-2)))\n\n}"}, {"source_code": "fun main() {\n val balls = readLine()!!.split(\" \").map { it.toInt() }.toIntArray()\n balls[1]--\n balls[2] -= 2\n var min = balls.min()!!\n println(min * 3 + 3)\n\n}\n"}, {"source_code": "import kotlin.math.min\n\nfun main() {\n print( ProblemB(ProblemB.readInput()).solve() )\n}\n\n\nclass ProblemB (triple: Triple) {\n\n val yellow = triple.first\n val blue = triple.second\n val red = triple.third\n\n companion object {\n fun readInput() : Triple {\n val line = readLine()\n val values : List = line!!.split(\" \").map { it.toInt() }\n return Triple(values[0], values[1], values[2])\n }\n }\n\n fun solve() : Int {\n return solution(min(yellow + 1, min(blue, red - 1) ))\n }\n\n private fun solution(value: Int): Int {\n return if (yellow >= value - 1 && red > value) {\n value * 3\n } else\n solution(value - 1)\n }\n}\n"}, {"source_code": "import kotlin.math.min\n\nfun main() {\n val (y, b, r) = readLine()!!.split(' ').map(String::toInt)\n println(3 * min(min(b, y + 1), r - 1))\n}\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val yellow = input.nextInt()\n val blue = input.nextInt()\n val red = input.nextInt()\n if (blue <= yellow && blue < red) {\n val sum = blue + 1 + blue + blue - 1\n println(sum)\n } else if (yellow < blue && yellow < red) {\n val diff = red - yellow\n if (diff >= 2) {\n val sum = yellow + yellow + 1 + yellow + 2\n println(sum)\n } else {\n val sum = yellow - 1 + yellow + yellow + 1\n println(sum)\n }\n } else {\n val sum = red + red - 1 + red - 2\n println(sum)\n }\n}"}, {"source_code": "fun main( args : Array) {\n\n val str= readLine()!!\n\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)\n }"}, {"source_code": "fun main() {\n val line = readLine()!!.split(\" \").mapIndexed{ind,n -> n.toInt()*3+(3-3*ind) }.min()\n println(line)\n}"}, {"source_code": "fun main() {\n println( readLine()!!.split(\" \").mapIndexed{ind,n -> n.toInt()*3+(3-3*ind) }.min())\n}"}, {"source_code": "fun main() {\n val (y, b, r) = readLine()!!.split(\" \").map { it.toInt() }\n println(listOf(y, b - 1, r - 2).min()!! * 3 + 3)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\n\nval reader = BufferedReader(InputStreamReader(System.`in`))\nvar tokenizer = StringTokenizer(\"\")\n\n\nval token: String\n get() {\n while (!tokenizer.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer.nextToken()\n }\n\nfun readInt() = token.toInt()\n\nfun main() {\n PrintWriter(System.out).use { writer ->\n writer.solve()\n }\n}\n\nfun PrintWriter.solve() {\n val y = readInt()\n val b = readInt()\n val r = readInt()\n println(listOf(y, b - 1, r - 2).min()!! * 3 + 3)\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.min\n\nfun main() {\n Scanner(System.`in`).use { scanner ->\n println(min(min(scanner.nextInt(), scanner.nextInt() - 1), scanner.nextInt() - 2) * 3 + 3)\n }\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.min\n\nfun main() {\n val scanner = Scanner(System.`in`)\n println(min(min(scanner.nextInt(), scanner.nextInt() - 1), scanner.nextInt() - 2) * 3 + 3)\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.min\n\nfun main() {\n Scanner(System.`in`).use { scanner ->\n val y = scanner.nextInt()\n val b = scanner.nextInt() - 1\n val r = scanner.nextInt() - 2\n val min = min(min(y, b), r)\n println(min * 3 + 3)\n }\n}"}, {"source_code": "\nimport java.util.Scanner\n\nfun main(args: Array) {\n var scan = Scanner(System.`in`)\n var y: Int\n var b: Int\n var r: Int\n var n: Int = 0\n y = scan.nextInt()\n b = scan.nextInt()\n r = scan.nextInt()\n var min = if (y <= b) -1 else -2\n if (min ==-1)\n \tmin = if (y <= r) -1 else -3\n else\n \tmin = if (b <= r) -2 else -3\n \n if (min == -3) //red is minimum\n \tn = (r - 1) * 3\n else if (min == -2){ //blue is minimum\n if (b == r){\n b = r - 1\n n = b * 3\n }\n else\n \tn = b * 3\n }\n else if (min == -1){ //yellow is minimum\n if ((r - y) >= 2){\n if ((b - y) >= 1)\n \tn = (y + 1) * 3\n else{\n y = b - 1\n n = (y + 1) * 3\n } \t\n }\n else{\n y = r -2\n n = (y + 1) * 3\n }\n }\n \n println (n)\n \t\n}"}, {"source_code": "fun main(args: Array) {\n val ints = readLine()?.split(\" \")?.map(String::toInt) ?: return \n val minStart = ints.mapIndexed { index, int -> int - index }.min()!!\n val result = minStart * 3 + 3\n print(result)\n}\n"}, {"source_code": "import java.util.*\n\nfun main() = with(Scanner(System.`in`)) {\n val min = Array(3) { nextInt() }.mapIndexed { index, int -> int - index }.min()\n if (min != null) {\n print(min * 3 + 3)\n }\n}\n"}, {"source_code": "\nimport java.util.*\nimport kotlin.math.min\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n\n val line = nextLine().split(' ')\n val y = line[0].toInt()\n val b = line[1].toInt()\n val r = line[2].toInt()\n\n val min = min(y, min(b, r))\n val secondMin: Int\n var printVal = 0\n when (min) {\n r -> println(3 * r - 3)\n b -> {\n secondMin = min(y, r)\n when (secondMin) {\n r -> printVal =\n if (secondMin - min < 1)\n r - 1\n else\n b\n y -> printVal = b\n }\n println(printVal * 3)\n }\n y -> {\n secondMin = min(b, r)\n when (secondMin) {\n r -> printVal =\n if (secondMin - min < 2)\n r - 2\n else\n y\n b -> printVal =\n if (secondMin - min < 1)\n b - 1\n else\n y\n }\n println(printVal * 3 + 3)\n }\n\n }\n}"}, {"source_code": "import kotlin.math.min\n\nfun main() {\n val (a, b, c) = readLine()!!.split(\" \").map{ it.toInt() }\n val answer = min(min(a, b - 1), c - 2) * 3 + 3\n println(answer)\n}"}, {"source_code": "fun main(args: Array) {\n\n val parts = readLine()!!.toString().split(\" \")\n val v1 : Int =parts.get(0).toInt()\n val v2 : Int= parts.get(1).toInt()\n val v3 : Int = parts.get(2).toInt()\n\n var res : Int = 0;\n\n if(v1+1 <= v2 && v1+2<=v3){\n res = v1 + v1+1 + v1+2\n println(\"$res\")\n }else {\n if(v2+1 <= v3 && v2-1<=v1){\n res = v2-1 + v2 + v2+1\n println(\"$res\")\n }else {\n res = v3-2+v3-1+v3\n println(\"$res\")\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n val (y, b, r) = readLine()!!.split(\" \").map { it.toInt() }\n val my = minOf(y, b - 1, r - 2)\n println(3 * my + 3)\n}"}, {"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\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}"}, {"source_code": "fun main() {\n var ybr = readLine()!!.split(' ').map { it.toInt() }\n\n println(MaxSum(ybr))\n}\n\nfun MaxSum(values: List): Int {\n var middle = values[1]\n while (middle - 1 > values.first() || middle + 1 > values.last())\n middle -= 1\n\n return 3 * middle\n}"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n\n var yellow = 1\n var blue = 2\n var red = 3\n\n yellow = scanner.nextInt()\n blue = scanner.nextInt()\n red = scanner.nextInt()\n\n\n val summ = 0\n\n while (yellow != blue - 1 || yellow != red - 2 && blue != red - 1) {\n\n if (yellow >= blue)\n yellow = blue - 1\n else if (yellow < blue)\n blue = yellow + 1\n\n if (blue >= red)\n blue = red - 1\n else if (blue < red)\n red = blue + 1\n\n }\n\n\n print(yellow + blue + red)\n}"}, {"source_code": "import java.io.*\nimport java.math.*\nimport java.text.*\nimport java.util.*\nimport java.util.regex.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val x = scan.nextInt()\n val y = scan.nextInt()\n val z = scan.nextInt()\n var ans= y\n val flag = true\n while(flag)\n {\n if(ans+1<=z&&ans-1<=x)\n {\n print(ans*3)\n break \n }\n ans=ans-1\n }\n \n \n}"}, {"source_code": "fun main(args: Array) {\n val inp = readLine()!!.split(\" \").map(String::toInt)\n val x = inp[0]\n val y = inp[1]\n val z = inp[2]\n\n var ans= y\n while(ans>0)\n {\n if(ans+1<=z&&ans-1<=x)\n {\n print(ans*3)\n break \n }\n ans=ans-1\n }\n \n \n}"}, {"source_code": "fun main() {\n val inputs = readLine()!!.split(\" \").map { it.toInt() }\n val (yellow, blue, red) = inputs\n var result = 0\n\n inputs.asReversed().forEachIndexed { index, input ->\n when (index) {\n 0 -> if (input - 1 <= blue && input - 2 <= yellow)\n result = input * 3 - 3\n 1 -> if (input + 1 <= red && input - 1 <= yellow)\n result = input * 3\n 2 -> if (input + 1 <= blue && input + 2 <= red)\n result = input * 3 + 3\n }\n\n if (result > 0)\n return@forEachIndexed\n }\n\n print(result)\n}"}, {"source_code": "fun main() {\n val inputs = readLine()!!.split(\" \")\n val (yellow, blue, red) = inputs.map { it.toInt() }\n var result = 0\n\n inputs.asReversed().map { it.toInt() }.forEachIndexed { index, input ->\n when (index) {\n 0 -> {\n if (input - 1 <= blue && input - 2 <= yellow) {\n result = input * 3 - 3\n return@forEachIndexed\n }\n }\n 1 -> {\n if (input + 1 <= red && input - 1 <= yellow) {\n result = input * 3\n return@forEachIndexed\n }\n }\n 2 -> {\n if (input + 1 <= blue && input + 2 <= red) {\n result = input * 3 + 3\n return@forEachIndexed\n }\n }\n }\n }\n\n print(result)\n}"}, {"source_code": "fun main() {\n val inputs = readLine()!!.split(\" \")\n val (yellow, blue, red) = inputs.map { it.toInt() }\n var result = 0\n\n inputs.forEachIndexed { index, input ->\n val _input = input.toInt()\n when (index) {\n 2 -> {\n if (_input - 1 <= blue && _input - 2 <= yellow) {\n result = _input * 3 - 3\n return@forEachIndexed\n }\n }\n 1 -> {\n if (_input + 1 <= red && _input - 1 <= yellow) {\n result = _input * 3\n return@forEachIndexed\n }\n }\n 0 -> {\n if (_input + 1 <= blue && _input + 2 <= red) {\n result = _input * 3 + 3\n return@forEachIndexed\n }\n }\n }\n }\n\n print(result)\n}"}, {"source_code": "fun main(args: Array) {\n\n val input = readLine()!!\n val values = input.split(\" \")\n println(Christmas(values[0].toInt(), values[1].toInt(), values[2].toInt()))\n\n}\n\nenum class Color {Blue,Red,Yellow}\n\nfun Christmas(yellowcolor:Int,bluecolor:Int,redcolor:Int):Int\n{\n if(yellowcolor==bluecolor && bluecolor==redcolor)\n return (yellowcolor-1)+yellowcolor+(yellowcolor-2)\n\n return when(if (yellowcolor <= bluecolor && yellowcolor <= redcolor)\n Color.Yellow\n else if (bluecolor <= redcolor && bluecolor <= yellowcolor)\n Color.Blue\n else\n Color.Red){\n Color.Yellow -> if(yellowcolor==bluecolor)\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n else if (redcolor==bluecolor && (redcolor+bluecolor)-(yellowcolor*2)<3)\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n else if (yellowcolor==redcolor)\n yellowcolor+(yellowcolor-2)+(yellowcolor-1)\n else if (bluecolor>redcolor && redcolor-yellowcolor==1)\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n\n\n else if(redcolor>bluecolor || redcolor==bluecolor ||(bluecolor>redcolor && (redcolor+bluecolor)-(yellowcolor*2)>3))\n yellowcolor+(yellowcolor+1)+(yellowcolor+2)\n\n else\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n\n Color.Blue-> if(bluecolor==redcolor)\n (bluecolor-2)+bluecolor+(bluecolor-1)\n else\n (bluecolor+1)+bluecolor+(bluecolor-1)\n else -> redcolor+(redcolor-2)+(redcolor-1)\n }\n\n\n}"}, {"source_code": "fun main() {\n val inp = readLine()\n if(inp != null) {\n val arr = inp.split(' ').map { e -> Integer.parseInt(e) }\n var a = arr[0]\n var b = arr[1]\n var c = arr[2]\n\n if(b >= c)\n b = c-1\n\n if(a >= b)\n a = b - 1\n\n println(a*3 + 3)\n }\n}"}, {"source_code": "fun main() {\n val base = listOf(0, 1, 2)\n val baseSum = base.sum()\n val numbers = readLine()?.split(' ')?.map { it.toInt() } ?: base\n val low = numbers.zip(base, Int::minus).min() ?: - baseSum\n print(low * base.size + baseSum)\n}"}, {"source_code": "fun main() {\n val base = listOf(0, 1, 2)\n val baseSum = base.sum()\n val numbers = readLine()?.split(' ')?.map { it -> it.toInt() } ?: base\n val low = numbers.zip(base, Int::minus).min() ?: - baseSum\n print(low * base.size + baseSum)\n}\n"}, {"source_code": "fun main()\n{\n val(a,b,c)=readLine()!!.split(' ').map(String::toInt)\n print(3*minOf(a+1,b,c-1))\n}"}, {"source_code": "fun main() {\n var (y, b, r) = readLine()!!.split(\" \").map { it.toInt() }\n if (b >= r)\n b = r - 1\n if (y >= b)\n y = b - 1\n b = y + 1\n r = b + 1\n println(\"${y + b + r}\")\n}\n"}, {"source_code": "fun main()\n{\n val (a:Int,b:Int,c:Int)= readLine()!!.split(' ').map(String::toInt)\n println(\"${3*minOf(a,b-1,c-2)+3}\")\n}"}, {"source_code": "fun main() {\n val line = readLine()!!.split(\" \")\n val y = line[0].toInt()\n val b = line[1].toInt()\n val r = line[2].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 if (r == y + 1) {\n println(3 * (y - 1) + 3)\n } else {\n println((3 * y) + 3)\n }\n }\n }\n}"}, {"source_code": "fun main() {\n val (y, b, r) = readInts(3).toList()\n if (b >= r - 1) {\n if (y >= r - 2) {\n println((r - 1) * 3)\n return\n }\n println((y + 1) * 3)\n return\n }\n if (y >= b - 1) {\n println(b * 3)\n return\n }\n println((y + 1) * 3)\n}\n\nprivate fun isWhiteSpace(c: Char) = c in \" \\r\\n\\t\"\n\nprivate fun readString() = generateSequence { System.`in`.read().toChar() }\n .dropWhile { isWhiteSpace(it) }\n .takeWhile { !isWhiteSpace(it) }\n .joinToString(\"\")\n\nprivate fun readInt() = readString().toInt()\nprivate fun readInts(n: Int) = generateSequence { readInt() }.take(n)"}, {"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 = sc.nextInt()\n val blueOrnaments = sc.nextInt()\n val redOrnaments = sc.nextInt()\n\n println(3 * min(yellowOrnaments, min(blueOrnaments, redOrnaments - 1) - 1) + 3)\n}\n"}, {"source_code": "import com.sun.org.apache.xpath.internal.operations.Bool\nimport jdk.nashorn.internal.runtime.ScriptingFunctions.readLine\nimport java.util.Scanner\nfun max(a:Int,b:Int):Int\n{\n if(a<=b)return a\n else return b\n}\nfun main(args: Array)\n{\n val read= Scanner(System.`in`)\n var c=Array(4,{it ->0})\n var maxn:Int\n maxn=1000000\n for(i in 1..3){\n c[i]=read.nextInt()\n c[i]=c[i]-i+1\n maxn =max(c[i],maxn)\n }\n\n println(3*maxn+3)\n}\n\n"}, {"source_code": "//package b\n\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"}, {"source_code": "\nfun main() {\n var a = readLine()!!.split(' ')!!.map(String::toInt)\n println(minOf(a[0]+1,a[1],a[2]-1)*3)\n}"}, {"source_code": "fun readLines(): List {\n val amount = readLine()?.toInt()!!\n return (0 until amount).map { readLine()!! }\n}\n\nfun main() {\n val (y, b, r) = readLine()!!.split(\" \").map { it.toInt() }\n// val (y, b, r) = \"8 13 9\".split(\" \").map { it.toInt() }\n // 4 5 6\n val py = Math.min(y, Math.min(b-1, r-2))\n println(py + py + py + 1 + 2)\n}"}, {"source_code": "fun main(args: Array){\n var i = 2\n var min = Int.MAX_VALUE\n val nums = readLine()!!.split(\" \").map { s -> s.toInt() }\n if(nums[2]){\nvar (Y,B,R)=readLine()!!.split(\" \")\nvar y=Y.toInt()\nvar b=B.toInt()\nvar r=R.toInt()\nb=b+1\ny=y+2\nvar ans=kotlin.math.min(b,y)\nans=kotlin.math.min(ans,r)\nprintln((ans*3-3))\n}"}, {"source_code": "\n// y < b < r\n// y = (b - 1) = (r - 2)\nfun main(args: Array) {\n val (y, b, r) = readLine()!!.split(' ').map(String::toInt)\n\n var rMax = r\n if (b < (rMax - 1)) {\n rMax = b + 1\n }\n\n if (y < (rMax - 2)) {\n rMax = y + 2\n }\n\n println(rMax * 3 - 3)\n\n}\n\n"}, {"source_code": "fun main() {\n val (y, b, r) = readLine()!!.split(\" \").map { it.toInt() }\n val my = minOf(y, b - 1, r - 2)\n println(3 * my + 3)\n}"}, {"source_code": "fun main() {\n val (y,b,r) = readLine()!!.split(\" \").map { it.toInt() }\n val res = minOf(y, b-1, r-2)\n println(3*res+3)\n}"}, {"source_code": "import kotlin.math.min\nfun main(args: Array) {\n val (y, b, r) = readLine()!!.split(' ').map(String::toInt)\n println(min(y + 2, min(b + 1, r)) * 3 - 3)\n}\n\n"}, {"source_code": "import java.util.*;\nimport kotlin.math.*;\n\nfun main() {\n val sc = Scanner(System.`in`);\n val a = sc.nextInt() ;\n val b = sc.nextInt() ;\n val c = sc.nextInt() ;\n val ans = minOf(a , b - 1 , c - 2) ;\n println(ans * 3 + 3) ;\n}"}, {"source_code": "fun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readStrings() = readLn().split(\" \")\nfun readInts() = readStrings().map { it.toInt() }\nfun main() {\n val (y, b, r) = readInts()\n println(3 * listOf(y, b-1, r-2).min()!! + 3)\n}\n"}, {"source_code": "import java.lang.Math.min\n\nfun main() {\n val (y, b, r) = readLine()!!.split(\" \").map { it.toInt() }\n val r2 = (y + 2).coerceAtMost((b + 1).coerceAtMost(r))\n val b2 = r2-1\n val y2=b2-1\n println(y2+b2+r2)\n\n}"}, {"source_code": "//package com.happypeople.codeforces.c1091\n\nimport java.io.ByteArrayInputStream\nimport java.io.InputStream\nimport java.util.*\nimport kotlin.math.min\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 y=sc.nextInt()\n val b=sc.nextInt()\n val r=sc.nextInt()\n\n // b==y+1\n // r==b+1\n\n var m=min(b, y+1)\n m=min(m+1, r)\n m=3*m-3\n println(\"$m\")\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}"}, {"source_code": "fun main() {\n val (y, b, r) = readInts()\n\n val ans = minOf(y+1, b, r-1) * 3\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) { Output().apply(block).nowPrint() }"}, {"source_code": "import kotlin.math.min\n\nfun main() {\n val(y, b, r) = readLine()!!.split(\" \").map { it.toInt() }\n val n = min(y, min(b-1, r-2))\n println(3 * n + 3)\n}"}, {"source_code": "fun main() {\n println(readLine()!!.split(' ').mapIndexed { index, s -> s.toInt() - index }.min()!!.toInt() * 3 + 3)\n}"}, {"source_code": "fun main() {\n val input = readLine()?.split(' ') ?: emptyList()\n val y = input[0].toByte()\n val b = input[1].toByte()\n val r = input[2].toByte()\n\n val b1: Byte = 1\n val b2: Byte = 2\n val b3: Byte = 3\n\n println(when (minOf(y, b, r)) {\n r -> (r-b2) * b3 + b3\n b -> (b-b1) * b3 + b3\n y -> if (r - y < 2) (y-b1) * b3 + b3 else y * b3 + b3\n else -> -1\n })\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\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\nclass TaskA : Solver() {\n override fun solve() {\n val y = scanner.nextInt()\n val b = scanner.nextInt()\n val r = scanner.nextInt()\n\n var nr = r\n while (nr-1 > b || nr -2 > y)\n nr--\n System.out.println(nr*3 - 3)\n }\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}"}, {"source_code": "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}"}, {"source_code": "\nfun findNumber(y: Int, b: Int, r: Int): Int {\n\n // all different\n if (y != b && y != r && b != r) {\n\n val minNum = minOf(y, b, r)\n val maxNum = maxOf(y, b, r)\n\n when (maxNum) {\n y -> {\n return when (minNum) {\n b -> (b - 1) + b + (b + 1)\n else -> (r - 2) + (r - 1) + r\n }\n }\n b -> {\n return when (minNum) {\n y -> {\n if (r - y > 2) y + (y + 1) + (y + 2) else (r - 2) + (r - 1) + r\n }\n else -> /* r */ (r - 2) + (r - 1) + r\n }\n }\n else /* r */ -> {\n return when (minNum) {\n y -> y + (y + 1) + (y + 2)\n else -> /* b */ (b - 1) + b + (b + 1)\n }\n }\n }\n\n\n } else {\n if (y == b) {\n return findNumber(b + r, b, r)\n } else if (y == r) {\n return findNumber(y + r, b, r)\n } else {\n // b == r\n return findNumber(y, b + r, r)\n }\n }\n\n}\n\nfun main(args: Array) {\n val (strY, strB, strR) = readLine()!!.split(' ')\n\n val y = strY.toInt()\n val b = strB.toInt()\n val r = strR.toInt()\n\n print(findNumber(y, b, r))\n}\n"}, {"source_code": "import java.util.Scanner\nfun main(args: Array) {\nval reader = Scanner(System.`in`)\n var y:Int = reader.nextInt()\n var b:Int = reader.nextInt()\n var r:Int = reader.nextInt()\n var ans = r\n var t = r\n if(r-1>b)\n {\n ans=(b+b+1)\n t=b\n }\n else\n {\n ans=ans+(r-1)\n t=r-1\n }\n if(t-1>y)\n {\n ans=(3*y)+3\n }\n else\n {\n ans=ans+(t-1)\n }\n println(\"$ans\\n\")\n}\n/*\nfun main(args: Array) {\n var t = readLine()!!.toInt()\n var y = readLine()!!.toInt()\n var b = readLine()!!.toInt()\n var r = readLine()!!.toInt()\n var ans = r\n if(r-1>b)\n {\n ans=(b+b+1)\n t=b\n }\n else\n {\n ans=ans+b\n t=r-1\n }\n if(t-1>y)\n {\n ans=(3*y)+1\n }\n else\n {\n ans=ans+y\n }\n println(\"$ans\\n\")\n}\n*/"}, {"source_code": "fun getMin(a: Int, b: Int, c: Int): Int\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"}, {"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 if (yellow !in 1..100) {\n throw Exception()\n }\n\n if (blue !in 2..100) {\n throw Exception()\n }\n\n if (red !in 3..100) {\n throw Exception()\n }\n\n println(calculate(yellow, blue, red))\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}"}, {"source_code": "private fun ri() = readLine()!!.toInt()\nprivate fun rli() = readLine()!!.split(\" \").map { it.toInt() }\n\nfun main() {\n val (y, b, r) = rli()\n val maxRed = minOf(r, b+1, y+2)\n println(3 * (maxRed - 1))\n}"}, {"source_code": "import java.util.*\n\nfun 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}"}, {"source_code": "import java.util.Scanner\n fun main(args: Array) {\n val sc = Scanner(System.`in`)\n println(Math.min(Math.min(sc.nextInt(), sc.nextInt() - 1), sc.nextInt() - 2) * 3 + 3)\n }\n"}, {"source_code": "fun main() {\n //val (a, b, c) = readInts()// read integer from the input\n val fl = readLine()!!.split(\" \").map { it.toInt() }\n val x: Int\n if(fl[0]+1 < fl[2]-1) x = fl[0]+1\n else x = fl[2]-1\n if(fl[1]){\n\tval reader = Scanner(System.`in`)\n\tvar t:Int = reader.nextInt()\n\tvar x:Int = reader.nextInt()\n\tvar y:Int = reader.nextInt()\n\tvar ans = 0\n\tfor(i in 0..t){\n\t\tif(i+1 <= x && i+2 <= y){\n\t\t\tans = 3 * i + 3\n\t\t}\n\t}\n\tprintln(\"$ans\")\t\n}"}, {"source_code": "fun main(args: Array) {\n val (y, b, r) = readLine()!!.split(\" \").map(String::toInt)\n if (r - y <= 2) {\n if (r - b <= 1) {\n print(r * 3 - 3)\n } else {\n print(b * 3)\n }\n } else {\n if (b - y <= 1) {\n print(b * 3)\n } else {\n print(y * 3 + 3)\n }\n }\n}"}, {"source_code": "fun main() {\n var (y, b, r) = readLine()!!.split(\" \").map { it.toInt() }\n while (y > 0) {\n if (b > y && r > y + 1) {\n println(3 * y + 3)\n break\n }\n y--\n }\n}\n"}, {"source_code": "import kotlin.math.*\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 (y,b,r) = readInts();\nval x = min(y, min(b-1, r-2))\n println(x*3+3)\n}"}], "negative_code": [{"source_code": "fun main() {\n val balls = readLine()!!.split(Regex(\"\\\\s+\"), 3).map { it.toInt() }\n val min = balls.min()!!\n\n val max = when (min) {\n 1 -> 6\n balls[2] -> 3 * (min - 1)\n else -> 3 * min\n }\n println(\"$max\")\n}\n"}, {"source_code": "import java.util.*;\nimport kotlin.math.*;\n\nfun main() {\n val sc = Scanner(System.`in`);\n val a = sc.nextInt() ;\n val b = sc.nextInt() ;\n val c = sc.nextInt() ;\n val ans = minOf(a , b - 1 , c - 1) ;\n println(ans * 3 + 3) ;\n}"}, {"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 val diff = blues - reds\n blues -= diff + 1\n yellows -= diff + 2\n }\n if (reds != blues + 1) {\n reds = blues + 1\n }\n print(yellows + blues + reds)\n}\n "}, {"source_code": "fun main(args: Array) {\n val input = readLine()!!\n val values = input.split(\" \")\n println(Christmas(values[0].toInt(), values[1].toInt(), values[2].toInt()))\n}\n\nenum class Color {Blue,Red,Yellow}\n\nfun Christmas(yellowcolor:Int,bluecolor:Int,redcolor:Int):Int\n{\n if(yellowcolor==bluecolor && bluecolor==redcolor)\n return (yellowcolor-1)+yellowcolor+(yellowcolor-2)\n\n return when(if (yellowcolor <= bluecolor && yellowcolor <= redcolor)\n Color.Yellow\n else if (bluecolor <= redcolor && bluecolor <= yellowcolor)\n Color.Blue\n else\n Color.Red){\n Color.Yellow -> if(yellowcolor==bluecolor)\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n else if (redcolor==bluecolor && (redcolor+bluecolor)-(yellowcolor*2)<3)\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n\n else if(redcolor>bluecolor || redcolor==bluecolor ||(bluecolor>redcolor && (redcolor+bluecolor)-(yellowcolor*2)>3))\n yellowcolor+(yellowcolor+1)+(yellowcolor+2)\n\n else\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n\n Color.Blue-> (bluecolor+1)+bluecolor+(bluecolor-1)\n else -> redcolor+(redcolor-2)+(redcolor-1)\n }\n\n\n}"}, {"source_code": "\nimport java.util.*\nimport kotlin.math.min\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n\n val line = nextLine().split(' ')\n val y = line[0].toInt()\n val b = line[1].toInt()\n val r = line[2].toInt()\n\n val min = min(y, min(b, r))\n val secondMin: Int\n var printVal = 0\n when (min) {\n r -> println(3 * r - 3)\n b -> {\n secondMin = min(y, r)\n when (secondMin) {\n r -> printVal =\n if (secondMin - min < 1)\n r - 1\n else\n b\n }\n println(printVal * 3)\n }\n y -> {\n secondMin = min(b, r)\n when (secondMin) {\n r -> printVal =\n if (secondMin - min < 2)\n r - 2\n else\n y\n b -> printVal =\n if (secondMin - min < 1)\n b - 1\n else\n y\n }\n println(printVal * 3 + 3)\n }\n\n }\n}"}, {"source_code": "fun main() {\n var a = readLine()!!.split(' ')!!.map(String::toInt)\n for (i in 0..2) println(a[i])\n println(minOf(a[0]+1,a[1],a[2]-1)*3)\n}"}, {"source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val yellowOrnaments = sc.nextInt()\n val blueOrnaments = sc.nextInt()\n\n var redOrnaments = sc.nextInt()\n\n repeat(redOrnaments - 3) {\n if (blueOrnaments >= redOrnaments - 1 && yellowOrnaments >= redOrnaments - 2) {\n println(redOrnaments - 2 + redOrnaments - 1 + redOrnaments)\n }\n redOrnaments -= 1\n }\n println(6)\n}"}, {"source_code": "fun main () {\n val (y, b, r) = readLine()!!.split(' ').map(String::toInt)\n val v = listOf(y, b, r)\n println(v.min()!! * 3)\n}"}, {"source_code": "fun main() {\n// val (y, b, r) = readLine()!!.split(\" \").map { it.toInt() }\n val (y, b, r) = \"8 13 9\".split(\" \").map { it.toInt() }\n // 4 5 6\n val py = Math.min(y, Math.min(b-1, r-2))\n println(py + py + py + 1 + 2)\n}"}, {"source_code": "fun main() {\n val balls = readLine()!!.split(Regex(\"\\\\s+\"), 3).map { it.toInt() }\n val min = balls.min()!!\n\n val max = when (min) {\n 1 -> 6\n balls[2] -> 3 * (min - 1)\n else -> 3 * min\n }\n println(\"$max\")\n}\n"}, {"source_code": "import java.io.*\nimport java.math.*\nimport java.text.*\nimport java.util.*\nimport java.util.regex.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val x = scan.nextInt()\n val y = scan.nextInt()\n val z = scan.nextInt()\n val ans1: Long = 0\n val ans2: Long = 0\n val ans3: Long = 0\n if(y>x &&z>y)\n print((x+1)*3)\n else if(z = readLine()?.split(\" \")?.map { it.toInt() }?.toList() ?: emptyList()\n\nfun s1() {\n val (y, b, r) = readInts()\n when {\n (r in (y..b) && (r-y <= 2)) || (y in r..b) || b in ((r+1) .. (y-1)) -> {\n println(r + (r-1) + (r-2))\n }\n b in y .. r || r in y .. b -> println(y + (y+1) + (y+2))\n else -> println(b + (b+1) + (b-1))\n }\n}\n\nfun main(args: Array) {\n //while (true) { s1() }\n s1()\n}"}, {"source_code": "fun main() {\n// println(calc(1, 2, 3) == 6)\n// println(calc(8, 13, 9) == 24)\n// println(calc(13, 3, 6) == 9)\n// println(calc(1, 3, 4) == 6)\n\n val (y, b, r) = readLine()!!.split(' ').map(String::toInt)\n print(calc(y, b, r))\n}\n\nfun calc(y: Int, b: Int, r: Int): Int {\n var y1 = y\n var b1 = b\n var r1 = r\n\n if (y + 1 == b && b + 1 == r)\n return y + b + r\n\n if (y >= r)\n y1 = r - 2\n\n when {\n b >= r -> b1 = r - 1\n b1 + 1 == r -> b1--\n else -> r1 = b1 + 1\n }\n\n when {\n b >= r -> b1 = r - 1\n b1 + 1 == r -> b1--\n else -> r1 = b1 + 1\n }\n\n if (y1 >= b1)\n y1 = b1 - 1\n\n return y1 + b1 + r1\n}"}, {"source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\nfun main(){\n B()\n}\n\nfun B(){\n val scanner=Scanner(System.`in`)\n val y=scanner.nextInt()\n val b=scanner.nextInt()\n val r=scanner.nextInt()\n val max=Math.max(Math.max(y,b),Math.max(b,y))\n val min=Math.min(Math.min(y,b),Math.min(b,y))\n var result=0\n if(min==y){\n result=y*3+3\n }else if(min==b){\n result=b*3\n }else if(min==r){\n result=r*3-3\n }else \n println(\"${result}\")\n}"}, {"source_code": "fun main() {\n var ybr = readLine()!!.split(' ').map { it.toInt() }\n\n println(MaxSum(ybr))\n}\n\nfun MaxSum(values: List): Int {\n var middle = values[values.size / 2]\n while (middle - 1 > values.first() && middle + 1 > values.last())\n middle -= 1\n\n return 3 * middle\n}"}, {"source_code": "import java.util.*\n\nfun main(args : Array) {\n val reader = Scanner(System.`in`)\n\n var y:Int\n var b:Int\n var r:Int\n\n var sum:Int\n y=reader.nextInt()\n b=reader.nextInt()\n r=reader.nextInt()\n\n r=when {\n b>r -> r\n r>b -> b+1\n else ->r\n }\n b=r-1\n y=b-1\n\n sum=r+b+y\n\n println(sum)\n\n\n}"}, {"source_code": "import java.util.*\n\nfun main(args : Array) {\n val reader = Scanner(System.`in`)\n\n var y:Int\n var b:Int\n var r:Int\n\n var sum:Int\n y=reader.nextInt()\n b=reader.nextInt()\n r=reader.nextInt()\n\n r=when {\n b>r -> r\n r>b -> b+1\n else ->r\n }\n b=r-1\n y=b-1\n\n sum=r+b+y\n\n println(sum)\n\n\n}"}, {"source_code": "\n\nfun main(){\n fun readLn() = readLine()!!\n fun readStrings(delim: Char = ' ') = readLn().split(delim)\n fun readInts() = readStrings().map { it.toInt() }\n\n val (y,b,r) = readInts()\n\n println(Math.max(y,Math.max(b-1,r-2)))\n\n}"}, {"source_code": "/**\nAlice and Bob are decorating a Christmas Tree.\n\nAlice wants only 3 types of ornaments to be used on the Christmas Tree: yellow, blue and red. They have \ud835\udc66 yellow ornaments, \ud835\udc4f blue ornaments and \ud835\udc5f red ornaments.\n\nIn Bob's opinion, a Christmas Tree will be beautiful if:\n\nthe number of blue ornaments used is greater by exactly 1 than the number of yellow ornaments, and\nthe number of red ornaments used is greater by exactly 1 than the number of blue ornaments.\nThat is, if they have 8 yellow ornaments, 13 blue ornaments and 9 red ornaments, we can choose 4 yellow, 5 blue and 6 red ornaments (5=4+1 and 6=5+1).\n\nAlice wants to choose as many ornaments as possible, but she also wants the Christmas Tree to be beautiful according to Bob's opinion.\n\nIn the example two paragraphs above, we would choose 7 yellow, 8 blue and 9 red ornaments. If we do it, we will use 7+8+9=24 ornaments.\nThat is the maximum number.\n\nSince Alice and Bob are busy with preparing food to the New Year's Eve, they are asking you to find out the maximum number of ornaments\nthat can be used in their beautiful Christmas Tree!\n\nIt is guaranteed that it is possible to choose at least 6 (1+2+3=6) ornaments.\n\nInput\nThe only line contains three integers \ud835\udc66, \ud835\udc4f, \ud835\udc5f (1\u2264\ud835\udc66\u2264100, 2\u2264\ud835\udc4f\u2264100, 3\u2264\ud835\udc5f\u2264100) \u2014 the number of yellow, blue and red ornaments.\n\nIt is guaranteed that it is possible to choose at least 6 (1+2+3=6) ornaments.\n\nOutput\nPrint one number \u2014 the maximum number of ornaments that can be used.\n */\nfun main(args: Array) {\n println(24 == christmasOrnament(mutableListOf(8, 13, 9)))\n println(9 == christmasOrnament(mutableListOf(13, 3, 6)))\n println(30 == christmasOrnament(mutableListOf(10, 12, 20)))\n println(6 == christmasOrnament(mutableListOf(6, 12, 3)))\n}\n\nfun 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}"}, {"source_code": "fun main() {\n readLine()!!.split(' ').mapIndexed { index, s -> s.toInt() - index }.min()!!.toInt() * 3 + 3\n}"}, {"source_code": "fun main() {\n var (y, b, r) = readLine()!!.split(' ').map(String::toInt)\n println(\"${3 * minOf(y, minOf(b, r))}\")\n}"}, {"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}\n\nfun main(args: Array) {\n\n\n var (strY, strB, strR) = readLine()!!.split(' ')\n\n val y = strY.toInt()\n val b = strB.toInt()\n val r = strR.toInt()\n\n print(findOrnamentNumber(y, b, r))\n\n}\n"}, {"source_code": "import java.util.Scanner;\n\nfun main(){\n val scanner=Scanner(System.`in`)\n val y=scanner.nextInt()\n val b=scanner.nextInt()\n val r=scanner.nextInt()\n val max=Math.max(Math.max(y,b),Math.max(b,y))\n val min=Math.min(Math.min(y,b),Math.min(b,y))\n var result=0\n if(min==r){\n result=r*3-3\n }else if(min==b){\n result=b*3\n }else if(min==y){\n result=y*3\n }\n println(\"${result}\")\n}"}, {"source_code": "\nfun main(args: Array) {\n\n val input = readLine()!!\n val values = input.split(\" \")\n println(Christmas(values[0].toInt(), values[1].toInt(), values[2].toInt()))\n\n}\n\nenum class Color {Blue,Red,Yellow}\n\nfun Christmas(yellowcolor:Int,bluecolor:Int,redcolor:Int):Int\n{\n if(yellowcolor==bluecolor && bluecolor==redcolor)\n return (yellowcolor-1)+yellowcolor+(yellowcolor-2)\n\n return when(if (yellowcolor <= bluecolor && yellowcolor <= redcolor)\n Color.Yellow\n else if (bluecolor <= redcolor && bluecolor <= yellowcolor)\n Color.Blue\n else\n Color.Red){\n Color.Yellow -> if(yellowcolor==bluecolor)\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n else if (redcolor==bluecolor && (redcolor+bluecolor)-(yellowcolor*2)<3)\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n else if (bluecolor>redcolor && redcolor-yellowcolor==1)\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n\n\n else if(redcolor>bluecolor || redcolor==bluecolor ||(bluecolor>redcolor && (redcolor+bluecolor)-(yellowcolor*2)>3))\n yellowcolor+(yellowcolor+1)+(yellowcolor+2)\n\n else\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n\n Color.Blue-> if(bluecolor==redcolor)\n (bluecolor-2)+bluecolor+(bluecolor-1)\n else\n (bluecolor+1)+bluecolor+(bluecolor-1)\n else -> redcolor+(redcolor-2)+(redcolor-1)\n }\n\n\n}"}, {"source_code": "fun main(args: Array) {\n\n var ligne = readLine()!!.toString()\n\n val parts = ligne.split(\" \")\n val v1 : Int =parts.get(0).toInt()\n val v2 : Int= parts.get(1).toInt()\n val v3 : Int = parts.get(2).toInt()\n\n var res : String = \"\";\n\n if(v1+1 <= v2 && v1+2<=v3){\n res = \"$v1 ${v1+1} ${v1+2}\"\n }\n\n if(v2+1 <= v3 && v2-1<=v1){\n res = \"${v2-1} ${v2} ${v2+1}\"\n }\n\n if(v3-1 <= v2 && v3-2<=v1){\n res = \"${v3-2} ${v3-1} ${v3}\"\n }\n println(\"$res\" )\n}"}, {"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}"}, {"source_code": "fun main() {\n val balls = readLine()!!.split(Regex(\"\\\\s+\"), 3).map { it.toInt() }\n val min = balls.min()!!\n\n val max = when (min) {\n 1 -> 6\n balls[2] -> 3 * (min - 1)\n else -> 3 * min\n }\n println(\"$max\")\n}\n"}, {"source_code": "fun main() {\n var a = readLine()!!.split(' ')!!.map(String::toInt)\n for (i in 0..2) println(a[i])\n println(minOf(a[0]+1,a[1],a[2]-1)*3)\n}"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n\n var yellow = 1\n var blue = 2\n var red = 3\n\n yellow = scanner.nextInt()\n blue = scanner.nextInt()\n red = scanner.nextInt()\n\n\n val summ = 0\n\n while ((blue != 1 + yellow || 1 + blue != red) && yellow + 2 != red) {\n\n if (yellow >= blue)\n yellow = blue - 1\n else if (yellow < blue)\n blue = yellow + 1\n\n if (blue >= red)\n blue = red - 1\n else if (blue < red)\n red = blue + 1\n\n }\n\n\n print(yellow + blue + red)\n}"}, {"source_code": "fun main(){\n fun readLn() = readLine()!!\n fun readStrings(delim: Char = ' ') = readLn().split(delim)\n fun readInts() = readStrings().map { it.toInt() }\n\n val (y,b,r) = readInts()\n\n println(3+3*Math.max(y,Math.max(b-1,r-2)))\n\n}"}, {"source_code": "fun getOrnamentNumber(y: Int, b: Int, r: Int): Int {\n\n if (y != 0) {\n return y + y + (1) + (y + 2)\n }\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 -> if (b > r) getOrnamentNumber(0, 0, r) else getOrnamentNumber(0, b, 0)\n\n b -> if (r > y) getOrnamentNumber(y, 0, 0) else getOrnamentNumber(0, 0, r)\n\n r -> if (y > b) getOrnamentNumber(0, b, 0) else getOrnamentNumber(y, 0, 0)\n\n else -> 0\n }\n}\n\nfun main(args: Array) {\n val (strY, strB, strR) = readLine()!!.split(' ')\n\n val y = strY.toInt()\n val b = strB.toInt()\n val r = strR.toInt()\n\n print(findOrnamentNumber(y, b, r))\n}"}, {"source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\nfun main(){\n B()\n}\n\nfun B(){\n val scanner=Scanner(System.`in`)\n val y=scanner.nextInt()\n val b=scanner.nextInt()\n val r=scanner.nextInt()\n val max=Math.max(Math.max(y,b),Math.max(b,y))\n val min=Math.min(Math.min(y,b),Math.min(b,y))\n var result=0\n if(min==y){\n result=y*3\n }else if(min==b){\n result=b*3\n }else if(min==r){\n result=r*3-3\n }\n println(\"${result}\")\n}"}, {"source_code": "import java.util.Scanner;\n\nfun main(){\n val scanner=Scanner(System.`in`)\n val y=scanner.nextInt()\n val b=scanner.nextInt()\n val r=scanner.nextInt()\n val max=Math.max(Math.max(y,b),Math.max(b,y))\n val min=Math.min(Math.min(y,b),Math.min(b,y))\n var result=0\n if(min==r){\n result=r*3-3\n }else if(min==b){\n result=b*3\n }else if(min==y){\n result=y*3\n }\n println(\"${result}\")\n}"}, {"source_code": "fun main(args: Array) {\n val (y, b, r) = readLine()!!.split(\" \").map(String::toInt)\n if (r - b <= 1) {\n if (r - b <= 1) {\n print(r * 3 - 3)\n } else {\n print(b * 3)\n }\n } else {\n if (b - y <= 1) {\n print(b * 3)\n } else {\n print(y * 3 + 3)\n }\n }\n}"}, {"source_code": "fun main() {\n var ybr = readLine()!!.split(' ').map { it.toInt() }\n\n println(MaxSum(ybr))\n}\n\nfun MaxSum(values: List): Int {\n var middle = values[values.size / 2]\n while (middle - 1 > values.first() && middle + 1 > values.last())\n middle -= 1\n\n return 3 * middle\n}"}, {"source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\nfun main(){\n B()\n}\n\nfun B(){\n val scanner=Scanner(System.`in`)\n val y=scanner.nextInt()\n val b=scanner.nextInt()\n val r=scanner.nextInt()\n val max=Math.max(Math.max(y,b),Math.max(b,y))\n val min=Math.min(Math.min(y,b),Math.min(b,y))\n var result=0\n if(min==y){\n result=y*3+3\n }else if(min==b){\n result=b*3\n }else if(min==r){\n result=r*3-3\n }\n println(\"${result}\")\n}"}, {"source_code": "fun main(args: Array) {\n val array = readLine()!!.split(' ').map(String::toInt)\n var minIndex = array.size - 1\n for (i: Int in array.size - 1 downTo 0) {\n if(array[i]) {\n val ybr = readLine()!!.split(\" \")\n val y = ybr[0].toInt()\n val b = ybr[1].toInt()\n val r = ybr[2].toInt()\n\n // if y is min\n if (y < b && b < r) {\n println(3 * (y + 1))\n } else if (y > b && b > r) {\n println(3 * (r - 1))\n } else {\n println(3 * b)\n }\n\n}"}, {"source_code": "import java.util.*\n\nfun main(args : Array) {\n val reader = Scanner(System.`in`)\n\n var y:Int\n var b:Int\n var r:Int\n\n var sum:Int\n y=reader.nextInt()\n b=reader.nextInt()\n r=reader.nextInt()\n\n r=when {\n b>r -> r\n r>b -> b+1\n else ->r\n }\n b=r-1\n y=b-1\n\n sum=r+b+y\n\n println(sum)\n\n\n}"}, {"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 c:Int = reader.nextInt()\n var ans = a;\n if (ans) {\n val reader = Scanner(System.`in`)\n\n var y:Int\n var b:Int\n var r:Int\n\n var sum:Int\n y=reader.nextInt()\n b=reader.nextInt()\n r=reader.nextInt()\n\n r=when {\n b>r -> r\n r>b -> b+1\n else ->r\n }\n b=r-1\n y=b-1\n\n sum=r+b+y\n\n println(sum)\n\n\n}"}, {"source_code": "fun main(args: Array) {\n\n val input = readLine()!!\n val values = input.split(\" \")\n println(Christmas(values[0].toInt(), values[1].toInt(), values[2].toInt()))\n \n}\n\nenum class Color {Blue,Red,Yellow}\n\nfun Christmas(yellowcolor:Int,bluecolor:Int,redcolor:Int):Int\n{\n if(yellowcolor==bluecolor && bluecolor==redcolor)\n return (yellowcolor-1)+yellowcolor+(yellowcolor-2)\n\n return when(if (yellowcolor <= bluecolor && yellowcolor <= redcolor)\n Color.Yellow\n else if (bluecolor <= redcolor && bluecolor <= yellowcolor)\n Color.Blue\n else\n Color.Red){\n Color.Yellow -> if(yellowcolor==bluecolor)\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n else if (redcolor==bluecolor && (redcolor+bluecolor)-(yellowcolor*2)<3)\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n else if (bluecolor>redcolor && redcolor-yellowcolor==1)\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n\n\n else if(redcolor>bluecolor || redcolor==bluecolor ||(bluecolor>redcolor && (redcolor+bluecolor)-(yellowcolor*2)>3))\n yellowcolor+(yellowcolor+1)+(yellowcolor+2)\n\n else\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n\n Color.Blue-> (bluecolor+1)+bluecolor+(bluecolor-1)\n else -> redcolor+(redcolor-2)+(redcolor-1)\n }\n\n\n}"}, {"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}\n\nfun main(args: Array) {\n\n\n var (strY, strB, strR) = readLine()!!.split(' ')\n\n val y = strY.toInt()\n val b = strB.toInt()\n val r = strR.toInt()\n\n print(findOrnamentNumber(y, b, r))\n\n}\n"}, {"source_code": "fun 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) && (r-y <= 2)) || (y in r..b) || b in ((r+1) .. (y-1)) -> {\n println(r + (r-1) + (r-2))\n }\n b in (y + 1)..r || r in (y+1)..b-> println(y + (y+1) + (y+2))\n else -> println(b + (b+1) + (b-1))\n }\n}\n\nfun main(args: Array) {\n //while (true) { s1() }\n s1()\n}"}, {"source_code": "\n\nfun main(){\n fun readLn() = readLine()!!\n fun readStrings(delim: Char = ' ') = readLn().split(delim)\n fun readInts() = readStrings().map { it.toInt() }\n\n val (y,b,r) = readInts()\n\n println(Math.max(y,Math.max(b-1,r-2)))\n\n}"}, {"source_code": "import kotlin.math.min\n\nfun main(args : Array) {\n\n val NT = 1//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}\n"}, {"source_code": "import kotlin.math.min\n\nfun main(args : Array) {\n\n val NT = 1//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}\n"}, {"source_code": "fun main(){\n val (a, b,c) = readLine()!!.split(' ')\n var aa=a.toInt()\n var bb=b.toInt()\n var cc=c.toInt()\n \n var mi = minOf(aa,bb)\n mi=minOf(mi,cc)\n \n var res=0\n \n if(mi==aa)\n {\n var needb=aa+1\n var needc=needb+1\n if(needb>bb)\n {\n aa--;\n }\n if(needc>cc)\n {\n aa--;\n }\n res=aa*3+3\n }\n else if(mi==bb)\n {\n var needa=bb-1\n var needc=bb+1\n \n if(needc>cc)\n {\n needa--;\n }\n res=needa*3+3\n }\n else\n {\n var needb=cc-1\n var needa=needb-1\n res=needa*3+3\n }\n println(res)\n}"}, {"source_code": "fun main() {\n val data= readLine()!!.split(\" \").map { it.toInt() }\n println(data.min()?.times(3))\n}"}, {"source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\nfun main(){\n B()\n}\n\nfun B(){\n val scanner=Scanner(System.`in`)\n val y=scanner.nextInt()\n val b=scanner.nextInt()\n val r=scanner.nextInt()\n val max=Math.max(Math.max(y,b),Math.max(b,y))\n val min=Math.min(Math.min(y,b),Math.min(b,y))\n var result=0\n if(min==y){\n result=y*3\n }else if(min==b){\n result=b*3\n }else if(min==r){\n result=r*3-3\n }\n println(\"${result}\")\n}"}, {"source_code": "fun main() {\n val inputs = readLine()!!.split(\" \")\n val (yellow, blue, red) = inputs.map { it.toInt() }\n var result = 0\n\n inputs.forEachIndexed { index, input ->\n val _input = input.toInt()\n when (index) {\n 3 -> {\n if (_input - 1 <= blue && _input - 2 <= yellow) {\n result = _input * 3 - 3\n return@forEachIndexed\n }\n }\n 2 -> {\n if (_input + 1 <= red && _input - 1 <= yellow) {\n result = _input * 3\n return@forEachIndexed\n }\n }\n 1 -> {\n if (_input + 1 <= blue && _input + 2 <= red) {\n result = _input * 3 + 3\n return@forEachIndexed\n }\n }\n }\n }\n\n print(result)\n}"}, {"source_code": "\nimport java.util.*\nimport kotlin.math.min\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n\n val line = nextLine().split(' ')\n val y = line[0].toInt()\n val b = line[1].toInt()\n val r = line[2].toInt()\n\n val min = min(y, min(b, r))\n val secondMin: Int\n var printVal = 0\n when (min) {\n r -> println(3 * r - 3)\n b -> {\n secondMin = min(y, r)\n when (secondMin) {\n r -> printVal =\n if (secondMin - min < 1)\n r - 1\n else\n b\n }\n println(printVal * 3)\n }\n y -> {\n secondMin = min(b, r)\n when (secondMin) {\n r -> printVal =\n if (secondMin - min < 2)\n r - 2\n else\n y\n b -> printVal =\n if (secondMin - min < 1)\n b - 1\n else\n y\n }\n println(printVal * 3 + 3)\n }\n\n }\n}"}, {"source_code": "fun main(args: Array) {\n val array = readLine()!!.split(' ').map(String::toInt)\n var minIndex = array.size - 1\n for (i: Int in array.size - 1 downTo 0) {\n if(array[i] 1) correction += drb - 1\n if (dry > 2) correction += dry - 1\n\n print(3 * (r - correction - 1))\n}"}, {"source_code": "fun main() {\n var ybr = readLine()!!.split(' ').map { it.toInt() }\n val minIndex = ybr.lastIndexOf(ybr.min())\n\n when (minIndex) {\n 0 -> println(3 * ybr[minIndex] + 3)\n 1 -> println(3 * ybr[minIndex])\n 2 -> println(3 * ybr[minIndex] - 3)\n }\n}"}, {"source_code": "fun main() {\n val inputs = readLine()!!.split(\" \")\n val (yellow, blue, red) = inputs.map { it.toInt() }\n var result = 0\n\n inputs.forEachIndexed { index, input ->\n val _input = input.toInt()\n when (index) {\n 3 -> {\n if (_input - 1 <= blue && _input - 2 <= yellow) {\n result = _input * 3 - 3\n return@forEachIndexed\n }\n }\n 2 -> {\n if (_input + 1 <= red && _input - 1 <= yellow) {\n result = _input * 3\n return@forEachIndexed\n }\n }\n 1 -> {\n if (_input + 1 <= blue && _input + 2 <= red) {\n result = _input * 3 + 3\n return@forEachIndexed\n }\n }\n }\n }\n\n print(result)\n}"}, {"source_code": "fun main(){\n fun readLn() = readLine()!!\n fun readStrings(delim: Char = ' ') = readLn().split(delim)\n fun readInts() = readStrings().map { it.toInt() }\n\n val (y,b,r) = readInts()\n\n println(3+3*Math.max(y,Math.max(b-1,r-2)))\n\n}"}, {"source_code": "private var Y: Int = 0\nprivate var B: Int = 1\nprivate var R: Int = 2\nfun main() {\n println(countOrnaments(readLine()?.split(\" \")?.map{ it.toInt() }!!))\n}\n\nprivate fun countOrnaments(nums: List): Int {\n for (r in nums[R] downTo 0) {\n if (nums[B] >= (r - 1) && nums[Y] >= (r - 1))\n return ((3 * r) - 3)\n }\n return -1\n}"}, {"source_code": "fun main() {\n val min = readLine()!!.split(Regex(\"\\\\s+\"), 3).map { it.toInt() }.min()\n\n println(\"${min!! * 3}\")\n}\n"}, {"source_code": "import java.util.*\n\nfun main(args : Array) {\n val reader = Scanner(System.`in`)\n\n var y:Int\n var b:Int\n var r:Int\n\n var sum:Int\n y=reader.nextInt()\n b=reader.nextInt()\n r=reader.nextInt()\n\n r=if(b>r) r else Math.min(r,b)+1\n b=r-1\n y=b-1\n\n sum=r+b+y\n\n println(sum)\n\n\n}"}, {"source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\nfun main(){\n B()\n}\n\nfun B(){\n val scanner=Scanner(System.`in`)\n val y=scanner.nextInt()\n val b=scanner.nextInt()\n val r=scanner.nextInt()\n val max=Math.max(Math.max(y,b),Math.max(b,y))\n val min=Math.min(Math.min(y,b),Math.min(b,y))\n var result=0\n if(min==y){\n result=y*3\n }else if(min==r){\n result=r*3-3\n }else if(min==b){\n result=b*3\n }\n println(\"${result}\")\n}"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n\n var yellow = 0\n var blue = 0\n var red = 0\n\n yellow = scanner.nextInt()\n blue = scanner.nextInt()\n red = scanner.nextInt()\n\n\n val summ = 0\n\n while (blue != 1 + yellow && yellow + 2 != red) {\n\n if (yellow >= blue)\n yellow = blue - 1\n else if (yellow < blue)\n blue = yellow + 1\n\n if (blue >= red)\n blue = red - 1\n else if (blue < red)\n red = blue + 1\n\n }\n\n\n print(yellow + blue + red)\n}"}, {"source_code": "import kotlin.math.max\n\nfun main() {\n val (a, b, c) = readLine()!!.split(\" \").map{ it.toInt() }\n val answer = max(max(a, b - 1), c - 2) * 3 + 3\n println(answer)\n}"}, {"source_code": "import kotlin.math.min\n\nfun main() {\n ornaments()\n}\n\nval mins = mapOf(\n 2 to 1,\n 3 to 1,\n 4 to 1,\n 5 to 1,\n 6 to 1,\n 7 to 1,\n 8 to 2,\n 9 to 2,\n 10 to 2,\n 11 to 2,\n 12 to 2,\n 13 to 2,\n 14 to 2,\n 15 to 3,\n 16 to 3,\n 17 to 3,\n 18 to 3,\n 19 to 3,\n 20 to 3,\n 21 to 3,\n 22 to 4,\n 23 to 4,\n 24 to 4,\n 25 to 4,\n 26 to 4,\n 27 to 4,\n 28 to 4,\n 29 to 5,\n 30 to 5,\n 31 to 5,\n 32 to 5,\n 33 to 5,\n 34 to 5,\n 35 to 5,\n 36 to 6,\n 37 to 6,\n 38 to 6,\n 39 to 6,\n 40 to 6,\n 41 to 6,\n 42 to 6,\n 43 to 7,\n 44 to 7,\n 45 to 7,\n 46 to 7,\n 47 to 7,\n 48 to 7,\n 49 to 7,\n 50 to 8,\n 51 to 8,\n 52 to 8,\n 53 to 8,\n 54 to 8,\n 55 to 8,\n 56 to 8,\n 57 to 9,\n 58 to 9,\n 59 to 9,\n 60 to 9,\n 61 to 9,\n 62 to 9,\n 63 to 9,\n 64 to 10,\n 65 to 10,\n 66 to 10,\n 67 to 10,\n 68 to 10,\n 69 to 10,\n 70 to 10,\n 71 to 11,\n 72 to 11,\n 73 to 11,\n 74 to 11,\n 75 to 11,\n 76 to 11,\n 77 to 11,\n 78 to 12,\n 79 to 12,\n 80 to 12,\n 81 to 12,\n 82 to 12,\n 83 to 12,\n 84 to 12,\n 85 to 13,\n 86 to 13,\n 87 to 13,\n 88 to 13,\n 89 to 13,\n 90 to 13,\n 91 to 13,\n 92 to 14,\n 93 to 14,\n 94 to 14,\n 95 to 14,\n 96 to 14,\n 97 to 14,\n 98 to 14,\n 99 to 15,\n 100 to 15\n)\n\nfun diceRolling() {\n// val units = listOf(7, 6, 5, 4, 3, 2)\n val inputCount = readLine()!!.toInt()\n\n for (i in 0 until inputCount) {\n println(mins[readLine()!!.toInt()])\n }\n\n// (2..100).forEach {\n// println(\"$it to ${compute(it, units)}\")\n// }\n}\n\n//fun compute(target: Int, units: List): Int {\n// if (target in units) return 1\n// if (target == units.max()!! + 1) return 2\n// return 1 + compute(target - units.max()!!, units)\n//}\n\nfun ornaments() {\n val rgb = readLine()!!.split(' ').map(String::toInt).take(3)\n println(min(min(rgb[0], rgb[1] - 1), rgb[2] - 2))\n}\n"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n\n var yellow = 0\n var blue = 0\n var red = 0\n\n yellow = scanner.nextInt()\n blue = scanner.nextInt()\n red = scanner.nextInt()\n\n\n val summ = 0\n\n while (blue != 1 + yellow && yellow + 2 != red) {\n\n if (yellow >= blue)\n yellow = blue - 1\n else if (yellow < blue)\n blue = yellow + 1\n\n if (blue >= red)\n blue = red - 1\n else if (blue < red)\n red = blue + 1\n\n }\n\n\n print(yellow + blue + red)\n}"}, {"source_code": "fun main(args: Array) {\n val array = readLine()!!.split(' ').map(String::toInt)\n var minIndex = array.size - 1\n for (i: Int in array.size - 1 downTo 0) {\n if(array[i] findOrnamentNumber(-1, b, r)\n b -> getOrnamentNumber(0, r)\n r -> getOrnamentNumber(b, 0)\n else -> 0\n }\n}\n\nfun main(args: Array) {\n\n\n var (strY, strB, strR) = readLine()!!.split(' ')\n\n val y = strY.toInt()\n val b = strB.toInt()\n val r = strR.toInt()\n\n print(findOrnamentNumber(y, b, r))\n\n}\n"}, {"source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n \n val read=Scanner(System.`in`) \n var a=read.nextInt()\n var b=read.nextInt()\n var c=read.nextInt()\n \n while(true) {\n \n if((a+1<=b) and (a+2<=c))\n { \n println(\"${3*b}\") \n return\n } \n a--\n }\n}"}, {"source_code": "fun main() {\n var arr = readLine()?.split(' ')?.map { e -> Integer.parseInt(e) }\n\n if(arr != null) {\n var min = Math.min(Math.min(arr[0], arr[1]), arr[2])\n\n if (min == arr[1])\n min--\n\n if (min +1 == arr[2])\n min--\n\n println(min*3 + 3)\n }\n}\n"}, {"source_code": "import java.util.Scanner;\n\nfun main(){\n val scanner=Scanner(System.`in`)\n val y=scanner.nextInt()\n val b=scanner.nextInt()\n val r=scanner.nextInt()\n val max=Math.max(Math.max(y,b),Math.max(b,y))\n val min=Math.min(Math.min(y,b),Math.min(b,y))\n println(\"${min*3}\")\n}"}, {"source_code": "import java.io.*\nimport java.math.*\nimport java.text.*\nimport java.util.*\nimport java.util.regex.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val x = scan.nextInt()\n val y = scan.nextInt()\n val z = scan.nextInt()\n val ans1: Long = 0\n val ans2: Long = 0\n val ans3: Long = 0\n if(y>x &&z>y)\n print((x+1)*3)\n else if(z) {\n val (y, b, r) = readLine()!!.split(\" \").map(String::toInt)\n if (r - y >= 1) {\n if (r - b <= 1) {\n print(r * 3 - 3)\n } else {\n print(b * 3)\n }\n } else {\n if (b - y <= 1) {\n print(b * 3)\n } else {\n print(y * 3 + 3)\n }\n }\n}"}, {"source_code": "import java.util.Scanner;\n\nfun main(){\n val scanner=Scanner(System.`in`)\n val y=scanner.nextInt()\n val b=scanner.nextInt()\n val r=scanner.nextInt()\n val max=Math.max(Math.max(y,b),Math.max(b,y))\n val min=Math.min(Math.min(y,b),Math.min(b,y))\n var result=0\n if(min==r){\n result=r*3-3\n }else if(min==b){\n result=b*3\n }else if(min==y){\n result=y*3\n }\n println(\"${result}\")\n}"}, {"source_code": "import java.util.*\nimport java.io.*\nimport java.math.*\n\n\nfun main(args : Array) {\n val input = Scanner(System.`in`)\n var y = input.nextInt()\n var b = input.nextInt()\n var r = input.nextInt()\n if (b >= r) {\n b = r - 1\n }\n if (y >= b) {\n y = b - 1\n }\n if (r > b) {\n r = b + 1\n }\n\n System.err.printf(\"%d %d %d\\n\", y, b, r)\n println(y + b + r)\n}"}, {"source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\nfun main(){\n B()\n}\n\nfun B(){\n val scanner=Scanner(System.`in`)\n val y=scanner.nextInt()\n val b=scanner.nextInt()\n val r=scanner.nextInt()\n val max=Math.max(Math.max(y,b),Math.max(b,r))\n val min=Math.min(Math.min(y,b),Math.min(b,r))\n val avg=y+b+r-min-max\n var result=0\n if(min==r){\n result=y*3-3\n }else if(min==b){\n result=b*3\n }else if(min==y){\n if(b) {\n\n// val str = \"8 13 9\"\n// val str =\"13 3 6\"\n// val str =\"3 5 66\"\n val str= readLine()!!\n val ar = str.split(\" \")\n val y=ar[0].toInt()\n val b=ar[1].toInt()\n val r=ar[2].toInt()\n\n if (r<=y+2 && r<=b+1) {\n println(r*3-3)\n }\n\n if (b<=r-1 && b<=y+1) {\n println(b*3)\n }\n\n if (y<=b-1 && y<=r-2) {\n println(y*3+3)\n }\n}"}, {"source_code": "fun main(args: Array) {\n val (y, b, r) = readLine()!!.split(\" \").map(String::toInt)\n if (r - b <= 1) {\n if (r - b <= 1) {\n print(r * 3 - 3)\n } else {\n print(b * 3)\n }\n } else {\n if (b - y <= 1) {\n print(b * 3)\n } else {\n print(y * 3 + 3)\n }\n }\n}"}, {"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}"}, {"source_code": "fun main() {\n var ybr = readLine()!!.split(' ').map { it.toInt() }\n\n println(MaxSum(ybr))\n}\n\nfun MaxSum(values: List): Int {\n var middle = values[values.size / 2]\n while (middle - 1 > values.first() && middle + 1 > values.last())\n middle -= 1\n\n return 3 * middle\n}"}, {"source_code": "\nfun main() {\n print( ProblemB(ProblemB.readInput()).solve() )\n\n}\n\n\nclass ProblemB (triple: Triple) {\n\n val yellow = triple.first\n val blue = triple.second\n val red = triple.third\n\n companion object {\n fun readInput() : Triple {\n val line = readLine()\n var values : List = line!!.split(\" \").map { it.toInt() }\n println (values)\n return Triple(values[0], values[1], values[2])\n }\n }\n\n fun solve() : Int {\n return solution(blue)\n }\n\n private fun solution(value: Int): Int {\n return if (yellow >= value - 1 && red >= value + 1) {\n value * 3\n } else\n solution(value - 1)\n }\n}\n"}, {"source_code": "import java.util.*\nimport java.io.*\nimport java.math.*\n\n\nfun main(args : Array) {\n val input = Scanner(System.`in`)\n var y = input.nextInt()\n var b = input.nextInt()\n var r = input.nextInt()\n if (b >= r) {\n b = r - 1\n }\n if (y >= b) {\n y = b - 1\n }\n if (r > b) {\n r = b + 1\n }\n\n System.err.printf(\"%d %d %d\\n\", y, b, r)\n println(y + b + r)\n}"}, {"source_code": "import java.lang.Math.max\nimport 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 = max(y,b-1)\n ans = max(r-2,ans)\n ans = ans*3 + 3;8\n println(ans)\n\n\n}"}, {"source_code": "fun main(args: Array) {\n\n val input = readLine()!!\n val values = input.split(\" \")\n println(Christmas(values[0].toInt(), values[1].toInt(), values[2].toInt()))\n\n}\n\nenum class Color {Blue,Red,Yellow}\n\nfun Christmas(yellowcolor:Int,bluecolor:Int,redcolor:Int):Int\n{\n if(yellowcolor==bluecolor && bluecolor==redcolor)\n return (yellowcolor-1)+yellowcolor+(yellowcolor-2)\n\n return when(if (yellowcolor <= bluecolor && yellowcolor <= redcolor)\n Color.Yellow\n else if (bluecolor <= redcolor && bluecolor <= yellowcolor)\n Color.Blue\n else\n Color.Red){\n Color.Yellow -> if(yellowcolor==bluecolor)\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n else if(redcolor>bluecolor || redcolor==bluecolor ||(bluecolor>redcolor && (redcolor+bluecolor)-(yellowcolor*2)>3))\n yellowcolor+(yellowcolor+1)+(yellowcolor+2)\n \n else\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n\n Color.Blue-> (bluecolor+1)+bluecolor+(bluecolor-1)\n else -> redcolor+(redcolor-2)+(redcolor-1)\n }\n\n\n}"}, {"source_code": "import java.lang.Math.max\nimport 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 = max(y,b-1)\n ans = max(r-2,ans)\n ans = ans*3 + 3;8\n println(ans)\n\n\n}"}, {"source_code": "fun main(){\n fun readLn() = readLine()!!\n fun readStrings(delim: Char = ' ') = readLn().split(delim)\n fun readInts() = readStrings().map { it.toInt() }\n\n val (y,b,r) = readInts()\n\n println(3+3*Math.max(y,Math.max(b-1,r-2)))\n\n}"}, {"source_code": "fun main(args: Array) {\n\n val input = readLine()!!\n val values = input.split(\" \")\n println(Christmas(values[0].toInt(), values[1].toInt(), values[2].toInt()))\n\n}\n\nenum class Color {Blue,Red,Yellow}\n\nfun Christmas(yellowcolor:Int,bluecolor:Int,redcolor:Int):Int\n{\n if(yellowcolor==bluecolor && bluecolor==redcolor)\n return (yellowcolor-1)+yellowcolor+(yellowcolor-2)\n\n return when(if (yellowcolor <= bluecolor && yellowcolor <= redcolor)\n Color.Yellow\n else if (bluecolor <= redcolor && bluecolor <= yellowcolor)\n Color.Blue\n else\n Color.Red){\n Color.Yellow -> if(redcolor>bluecolor || redcolor==bluecolor )\n yellowcolor+(yellowcolor+1)+(yellowcolor+2)\n else if(bluecolor>redcolor && (redcolor+bluecolor)-(yellowcolor*2)>3)\n yellowcolor+(yellowcolor+1)+(yellowcolor+2)\n else\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n\n Color.Blue-> (bluecolor+1)+bluecolor+(bluecolor-1)\n else -> redcolor+(redcolor-2)+(redcolor-1)\n }\n\n\n}"}, {"source_code": "fun main(args: Array) {\n val ybr = readLine()!!.split(\" \")\n val y = ybr[0].toInt()\n val b = ybr[1].toInt()\n val r = ybr[2].toInt()\n\n // if y is min\n if (y < b && b < r) {\n println(3 * (y + 1))\n }\n\n // if b is min or equal y\n if (y >= b && b < r) {\n println(3 * b)\n }\n\n if (y >= b && b >= r) {\n print(3 * (r - 1))\n }\n}"}, {"source_code": "fun main () {\n val (y, b, r) = readLine()!!.split(' ').map(String::toInt)\n val v = listOf(y, b, r)\n var x = v.withIndex().minBy { (_, f) -> f }?.index\n x = v[x!!] + ((-x)+1)\n while (x >= b || x >= r) x--\n println(x * 3)\n}"}, {"source_code": "import java.util.Arrays;\nimport java.util.Scanner;\n\nfun main(){\n B()\n}\n\nfun B(){\n val scanner=Scanner(System.`in`)\n val y=scanner.nextInt()\n val b=scanner.nextInt()\n val r=scanner.nextInt()\n val max=Math.max(Math.max(y,b),Math.max(b,r))\n val min=Math.min(Math.min(y,b),Math.min(b,r))\n val avg=y+b+r-min-max\n var result=0\n if(min==r){\n result=y*3-3\n }else if(min==b){\n result=b*3\n }else if(min==y){\n if(b) {\nval reader = Scanner(System.`in`)\n var y:Int = reader.nextInt()\n var b:Int = reader.nextInt()\n var r:Int = reader.nextInt()\n var ans = r\n var t = r\n if(r-1>b)\n {\n ans=(b+b+1)\n t=b\n }\n else\n {\n ans=ans+(r-1)\n t=r-1\n }\n if(t-1>y)\n {\n ans=(3*y)+1\n }\n else\n {\n ans=ans+(t-1)\n }\n println(\"$ans\\n\")\n}\n/*\nfun main(args: Array) {\n var t = readLine()!!.toInt()\n var y = readLine()!!.toInt()\n var b = readLine()!!.toInt()\n var r = readLine()!!.toInt()\n var ans = r\n if(r-1>b)\n {\n ans=(b+b+1)\n t=b\n }\n else\n {\n ans=ans+b\n t=r-1\n }\n if(t-1>y)\n {\n ans=(3*y)+1\n }\n else\n {\n ans=ans+y\n }\n println(\"$ans\\n\")\n}\n*/"}, {"source_code": "import java.util.Scanner;\n\nfun main(){\n val scanner=Scanner(System.`in`)\n val y=scanner.nextInt()\n val b=scanner.nextInt()\n val r=scanner.nextInt()\n val max=Math.max(Math.max(y,b),Math.max(b,y))\n val min=Math.min(Math.min(y,b),Math.min(b,y))\n var result=0\n if(min==r){\n result=r*3-3\n }else if(min==b){\n result=b*3\n }else if(min==y){\n result=y*3\n }\n println(\"${result}\")\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n var (yellow, blue, red) = scan.nextLine().split(\" \").map { it.toInt() }\n while (red < blue + 1) {\n blue--\n }\n while (blue < yellow + 1) {\n yellow--\n }\n while (red > blue + 1) {\n red--\n }\n\n println(yellow + blue + red)\n}\n"}, {"source_code": "fun main(args: Array) {\n\n val input = readLine()!!\n val values = input.split(\" \")\n println(Christmas(values[0].toInt(), values[1].toInt(), values[2].toInt()))\n\n}\n\nenum class Color {Blue,Red,Yellow}\n\nfun Christmas(yellowcolor:Int,bluecolor:Int,redcolor:Int):Int\n{\n if(yellowcolor==bluecolor && bluecolor==redcolor)\n return (yellowcolor-1)+yellowcolor+(yellowcolor-2)\n\n return when(if (yellowcolor <= bluecolor && yellowcolor <= redcolor)\n Color.Yellow\n else if (bluecolor <= redcolor && bluecolor <= yellowcolor)\n Color.Blue\n else\n Color.Red){\n Color.Yellow -> if(redcolor>bluecolor || redcolor==bluecolor )\n yellowcolor+(yellowcolor+1)+(yellowcolor+2)\n else if(bluecolor>redcolor && (redcolor+bluecolor)-(yellowcolor*2)>3)\n yellowcolor+(yellowcolor+1)+(yellowcolor+2)\n else\n yellowcolor+(yellowcolor+1)+(yellowcolor-1)\n\n Color.Blue-> (bluecolor+1)+bluecolor+(bluecolor-1)\n else -> redcolor+(redcolor-2)+(redcolor-1)\n }\n\n\n}"}, {"source_code": "fun main( args : Array) {\n\n// val str = \"8 13 9\"\n// val str =\"13 3 6\"\n// val str =\"3 5 66\"\n val str= readLine()!!\n val ar = str.split(\" \")\n val y=ar[0].toInt()\n val b=ar[1].toInt()\n val r=ar[2].toInt()\n\n if (r<=y+2 && r<=b+1) {\n println(r*3-3)\n }\n\n if (b<=r-1 && b<=y+1) {\n println(b*3)\n }\n\n if (y<=b-1 && y<=r-2) {\n println(y*3+3)\n }\n}"}, {"source_code": "fun main() {\n\n val (a,b,c) = readLine()!!.split(' ').map(String::toInt)\n println(6 + 3*minOf(a, b-1, c-2))\n}"}, {"source_code": "fun main() {\n val balls = readLine()!!.split(\" \").map { it.toInt() }.toIntArray()\n balls[1]--\n balls[2] -= 2\n var min = balls.min()!!\n println(intArrayOf(min, (min + 1), (min + 2)).joinToString(\" \"))\n\n}\n"}, {"source_code": "\nfun main() {\n print( ProblemB(ProblemB.readInput()).solve() )\n\n}\n\n\nclass ProblemB (triple: Triple) {\n\n val yellow = triple.first\n val blue = triple.second\n val red = triple.third\n\n companion object {\n fun readInput() : Triple {\n val line = readLine()\n var values : List = line!!.split(\" \").map { it.toInt() }\n println (values)\n return Triple(values[0], values[1], values[2])\n }\n }\n\n fun solve() : Int {\n return solution(blue)\n }\n\n private fun solution(value: Int): Int {\n return if (yellow >= value - 1 && red >= value + 1) {\n value * 3\n } else\n solution(value - 1)\n }\n}\n"}, {"source_code": "fun main(args: Array) {\n val array = readLine()!!.split(' ').map(String::toInt)\n var minIndex = array.size - 1\n for (i: Int in array.size - 1 downTo 0) {\n if(array[i] 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.filterIndexed { i, v -> v >= i / 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}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "positive_code": [{"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\n val numberOfCups = scanner.nextInt()\n val numberOfPages = scanner.nextInt()\n val caffeineInput = Array(numberOfCups) { 0L }\n for (i in 0 until numberOfCups) {\n caffeineInput[i] = scanner.nextLong()\n }\n val caffeine = caffeineInput.sortedDescending().toTypedArray()\n\n for (targetNumberOfDays in 1..numberOfCups) {\n if (canWriteInNumberOfDays(targetNumberOfDays, numberOfCups, numberOfPages, caffeine)) {\n println(targetNumberOfDays)\n return\n }\n }\n println(-1)\n}\n\nfun canWriteInNumberOfDays(\n numberOfDays: Int,\n numberOfCups: Int,\n targetNumberOfPages: Int,\n caffeine: Array // Sorted by descending\n): Boolean {\n val maxNumberOfPages = calculateMaxNumberOfPages(numberOfDays, numberOfCups, caffeine)\n return maxNumberOfPages >= targetNumberOfPages\n}\n\nfun calculateMaxNumberOfPages(\n numberOfDays: Int,\n numberOfCups: Int,\n caffeine: Array\n): Long {\n var orderOfCup = 0L\n var numberOfPages = 0L\n for (i in 0 until numberOfCups) {\n numberOfPages += maxOf(caffeine[i] - orderOfCup, 0L)\n if (i % numberOfDays == numberOfDays - 1) ++orderOfCup\n }\n return numberOfPages\n}\n"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main() {\n val tokenizer = BufferedReader(InputStreamReader(System.`in`)).use { StringTokenizer(it.readText()) }\n val n = tokenizer.nextInt()\n val m = tokenizer.nextInt()\n val a = Array(n) { tokenizer.nextInt() }.apply {\n sort()\n reverse()\n }\n if (a.sum() < m)\n println(\"-1\")\n else {\n var l = 1\n var r = n\n while (l < r) {\n val mid = (l + r) / 2\n if (check(a, m, mid))\n r = mid\n else\n l = mid + 1\n }\n println(l)\n }\n}\n\nfun check(a: Array, m: Int, d: Int): Boolean {\n var sum = 0\n for (i in 0 until a.size) {\n val debuff = i / d\n if (a[i] <= debuff)\n break\n sum += a[i] - debuff\n }\n return sum >= m\n}\n\nfun StringTokenizer.nextInt() = nextToken().toInt()\nfun StringTokenizer.nextLong() = nextToken().toLong()\n"}, {"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 ww = w\n var count = 0\n var ind = 1\n var nn = 0\n for (i in 0 until w)\n count += a[i]\n while (ww < n) {\n count += if (a[ww] - ind < 0) 0 else a[ww] - ind\n ww++\n nn++\n if (nn == w) {\n nn = 0\n ind++\n }\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()"}], "negative_code": [{"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}"}, {"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()"}, {"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 - 1\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()"}], "src_uid": "acb8a57c8cfdb849a55fa65aff86628d"} {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (_, k) = readInts()\n val students = readInts()\n val selected = mutableSetOf()\n val positions = IntArray(k)\n for ((pos, student) in students.withIndex()) {\n if (student !in selected) {\n positions[selected.size] = pos + 1\n selected.add(student)\n }\n if (selected.size == k) {\n println(\"YES\")\n print(positions.joinToString(\" \"))\n return\n }\n }\n print(\"NO\")\n}", "positive_code": [{"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.min\n\nfun main(args: Array)\n = Thread { run() }.start()\n\nfun run() {\n\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val k = scanner.nextInt()\n val set = TreeSet()\n val arr = ArrayList()\n for (i in 0 until n) {\n val a = scanner.nextInt()\n if (!set.contains(a)) {\n set.add(a)\n arr.add(i + 1)\n if (set.size == k) {\n println(\"YES\")\n arr.forEach { print(\"$it \") }\n return\n }\n }\n }\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}\nclass Pair(var a: Int, var b: Int): Comparable {\n override fun compareTo(other: Pair): Int {\n return a - other.a\n }\n}\n//class Triple(val a: Int, val b: Int, val c: Int)"}, {"source_code": "fun readInts(delimit: Char =' ') = readLine()!!.split(delimit).map(String::toInt)\n\nfun main(args:Array)\n{\n var (n,k) = readInts()\n var arr:List = readInts()\n\n var distinct = listOf()\n var indexs = listOf()\n var ans = \"NO\"\n for (i in arr.indices)\n {\n var curr = arr[i]\n if (curr in distinct)\n {\n continue\n }\n else\n {\n distinct += curr\n indexs += (i+1)\n if (distinct.size == k)\n {\n ans = \"YES\"\n break\n }\n\n }\n\n }\n println(ans)\n if (ans == \"YES\") println(indexs.joinToString(\" \"))\n}\n"}, {"source_code": "fun readInts(delimit: Char =' ') = readLine()!!.split(delimit).map(String::toInt)\n\nfun main(args:Array)\n{\n var (n,k) = readInts()\n var arr = readInts()\n\n var distinct = listOf()\n var indexs = listOf()\n var ans = \"NO\"\n for (i in arr.indices)\n {\n var curr = arr[i]\n if (curr in distinct)\n {\n continue\n }\n else\n {\n distinct += curr\n indexs += (i+1)\n if (distinct.size == k)\n {\n ans = \"YES\"\n break\n }\n\n }\n }\n println(ans)\n if (ans == \"YES\") println(indexs.joinToString(\" \"))\n}"}, {"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 = IntArray(n, {scan.nextInt()})\n var b = BooleanArray(n, {false})\n var kol = 0\n var s = \"\"\n for (i in 0..n-1) {\n if (kol==m) break\n if (!b[i]) {\n kol++\n s+=\"${i+1} \"\n for (j in i+1..n-1) {\n b[j] = if (a[i]==a[j]) true else b[j]\n }\n }\n }\n if (kol()\n val rate = mutableListOf()\n val rates = r.readLine()!!.split(\" \").map { it.toInt() }\n var index = 1\n rates.forEach {\n if (it !in rate){\n rate += it\n i += index\n }\n index++\n }\n if (i.size()\n\n val s = mutableSetOf()\n for ((index, a) in nextArray(n).withIndex()) {\n if (!s.contains(a)) {\n s.add(a).also { ans.add(index+1) }\n }\n if (ans.size == k) {\n break\n }\n }\n if (ans.size == k) {\n println(\"YES\\n${ans.joinToString(separator = \" \")}\")\n } else {\n println(\"NO\")\n }\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}"}, {"source_code": "import java.io.PrintWriter\nimport java.util.*\n\nprivate val INPUT = System.`in`\nprivate val OUTPUT = System.out\n\nprivate val _reader = INPUT.bufferedReader()\nprivate fun readLine(): String? = _reader.readLine()\nprivate fun readLn() = _reader.readLine()!!\nprivate var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nprivate fun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\n\nprivate fun readInt() = read().toInt()\nprivate fun readDouble() = read().toDouble()\nprivate fun readLong() = read().toLong()\nprivate fun readStrings(n: Int) = List(n) { read() }\nprivate fun readLines(n: Int) = List(n) { readLn() }\nprivate fun readInts(n: Int) = List(n) { read().toInt() }\nprivate fun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nprivate fun readDoubles(n: Int) = List(n) { read().toDouble() }\nprivate fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nprivate fun readLongs(n: Int) = List(n) { read().toLong() }\nprivate fun readLongArray(n: Int) = LongArray(n) { read().toLong() }\nprivate val _writer = PrintWriter(OUTPUT, false)\nprivate inline fun output(block: PrintWriter.() -> Unit) {\n _writer.apply(block).flush()\n}\n\nfun main() {\n output {\n val (n, k) = readInts(2)\n val a = readInts(n)\n val t = arrayListOf()\n for (i in 0 until n){\n if(!t.contains(a[i])){\n t+=a[i]\n }\n if(t.size == k){\n println(\"YES\")\n println(t.map { a.indexOf(it)+1 }.joinToString(\" \"))\n break\n }\n }\n if(t.size != k){\n println(\"NO\")\n }\n }\n}"}, {"source_code": "import java.io.*\nimport java.util.*\nimport kotlin.collections.ArrayList\n\nfun solve() {\n\n val n = nextInt()\n val k = nextInt()\n val array = nextArray(n)\n\n val ans = ArrayList()\n val s = mutableSetOf()\n var count = 0\n for ((index, a) in array.withIndex()) {\n if (!s.contains(a)) {\n s.add(a)\n ans.add(index+1)\n count++\n }\n if (count == k) {\n println(\"YES\")\n println(ans.joinToString(separator = \" \"))\n return\n }\n }\n\n println(\"NO\")\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}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n val numberOfStudents = reader.nextInt()\n val kStudents = reader.nextInt()\n\n val complexity = mutableMapOf()\n for (i in 0 until numberOfStudents) {\n complexity[reader.nextInt()] = i+1\n }\n if (complexity.size < kStudents) {\n println(\"NO\")\n return\n }\n println(\"YES\")\n complexity.values.take(kStudents).toList().forEach {\n println(it)\n }\n}\n"}, {"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, k) = readInts()\n\n var arr = readInts()\n \n \n var hash = HashMap()\n\n for(i in 0 until n){\n// hash[arr[i]]!!.add(i+1)\n hash.put(arr[i], (i+1))\n }\n\n if(hash.size < k){\n println(\"NO\")\n }else {\n println(\"YES\")\n\n var cnt = 0\n for (x in hash.keys){\n print(hash[x])\n print(\" \")\n cnt++\n if(cnt == k)\n break\n }\n }\n\n\n}\n\n"}, {"source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun gcd (a:Int, b:Int): Int {\n if (b == 0) return a\n return gcd(b, a % b)\n}\nfun lcm(a:Int, b:Int): Int {\n val n1 = a\n val n2 = b\n val gcds = gcd(a,b)\n val lcmz = n1 * n2 / gcds\n return lcmz\n}\n\nfun main(args: Array) = with(Scanner(System.`in`))\n{\n val n = nextInt()\n val k = nextInt()\n val mas = ArrayList()\n val set = TreeSet()\n var sum = 0\n for (i in 0 until n) {\n val x = nextInt()\n mas += x\n if(set.add(x)){\n sum++\n }\n }\n if(set.size < k){\n println(\"NO\")\n return\n }\n println(\"YES\")\n set.clear()\n sum = 0\n for (i in 0 until n){\n if(set.add(mas[i]) && sum < k){\n print((i+1).toString() + ' ')\n sum++\n }\n }\n}"}, {"source_code": "fun main(args : Array) {\n val(n, k) = readLine()!!.split(' ').map(String :: toInt)\n var arr1 : Array = readLine()!!.split(' ').map { it.toInt() }.toTypedArray()\n var arr = arr1.sorted()\n var list = IntArray(k)\n var count = 1\n list[0] = arr[0]\n for (i in 0..(n-2)) {\n if (arr[i] != arr[i+1]) {\n count++\n list[count-1] = arr[i+1]\n }\n if (count == k)\n break\n }\n if (count < k)\n println(\"NO\")\n else {\n println(\"YES\")\n for (i in 0..(k-1)) {\n for (j in 0..(n-1)) {\n if (arr1[j] == list[i]) {\n print(j+1)\n print(' ')\n break\n }\n\n }\n }\n }\n }"}, {"source_code": "import java.lang.String.format\nimport java.util.*\nimport kotlin.math.*\nimport kotlin.system.exitProcess\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\nfun main(){\n val reader=Scanner(System.`in`)\n var (a,b)=readInts()\n var p=Array(a+1){0}\n var h=Array(101){0}\n var d=0\n for(i in 1..a){\n p[i]=reader.nextInt()\n if(h[p[i]]==0){\n d++\n }\n h[p[i]]=i\n }\n if(d) = with(Scanner(System.`in`)) {\n val n = nextInt()\n val k = nextInt()\n\n val t = ArrayList()\n val i = ArrayList()\n\n for (c in 1..n) {\n val x = nextInt()\n if (!t.contains(x)) {\n t += x\n i += c\n }\n if (t.size == k) break\n }\n\n if (t.size == k) {\n println(\"YES\")\n println(i.joinToString(\" \"))\n } else {\n println(\"NO\")\n }\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n var n = sc.nextInt()\n var k = sc.nextInt()\n var a: ArrayList = ArrayList()\n var nx: ArrayList = ArrayList()\n for (i in 0..n - 1) {\n var x = sc.nextInt()\n var b: Boolean = true\n for (j in 0..a.size - 1)\n if (a[j] == x) {\n b = false\n break\n }\n if (b) {\n a.add(x)\n nx.add(i + 1)\n }\n }\n var s: String = \"\"\n if (k <= nx.size) {\n println(\"YES\")\n for (i in 0..k - 1)\n s += nx[i].toString() + \" \"\n print(s.trim())\n } else print(\"NO\")\n}"}, {"source_code": "fun 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 val (n, k) = readIntArray()\n val arr = readIntArray()\n\n val set = arr.toSet()\n\n if (set.size < k) {\n println(\"NO\")\n } else {\n println(\"YES\")\n val res = mutableListOf()\n set.take(k).forEach {\n res += (arr.indexOf(it) + 1)\n }\n println(res.joinToString(\" \"))\n }\n}"}, {"source_code": "fun main(args : Array) {\n var (n, k) = readLine()!!.split(\" \")!!.map { it.toInt() }\n val set = mutableSetOf()\n val solution = arrayListOf()\n for((index, v) in readLine()!!.split(\" \").withIndex()) {\n if(v !in set) set.add(v).also { solution.add(index + 1) }\n if(solution.size >= k) break\n }\n if(solution.size < k) println(\"NO\") else println(\"YES\\n${solution.joinToString(\" \")}\")\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.io.InputStream\nimport java.util.*\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 k = scan.nextInt()\n\n val dist = (0 until n).map { it + 1 to scan.nextInt() }.distinctBy { it.second }\n\n if (dist.size < k) {\n println(\"NO\")\n } else {\n println(\"YES\")\n println(dist.subList(0, k).map { it.first }.joinToString(\" \"))\n }\n}"}, {"source_code": "import java.io.InputStreamReader\nimport java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(InputStreamReader(System.`in`))\n val n = scanner.nextInt()\n val k = scanner.nextInt()\n var team = HashSet()\n var teamIndices = ArrayList()\n var complete = false\n\n for (i in 1..n) {\n val rank = scanner.nextInt()\n if (!team.contains(rank)) {\n team.add(rank)\n teamIndices.add(i)\n }\n if (team.size == k)\n complete = true\n if (complete) break\n }\n if (complete) {\n System.out.println(\"YES\")\n System.out.println(teamIndices.joinToString(\" \"))\n } else {\n System.out.println(\"NO\")\n }\n}\n"}, {"source_code": "import java.io.*\n\n\nclass Reader{\n val reader = BufferedReader ( InputStreamReader( System.`in` ) )\n fun readTokens() = reader.readLine().split(\" \")\n}\n\ndata class Value(val v : Int = 0 , val i : Int = 0) : Comparable {\n override fun compareTo(other: Value): Int {\n return v-other.v\n }\n}\n\nfun main(args: Array){\n val reader = Reader()\n val out = BufferedWriter ( OutputStreamWriter ( System.out ) )\n\n val line0 = reader.readTokens()\n val line1 = reader.readTokens()\n\n val n = line0[0].toInt()\n val k = line0[1].toInt()\n val values = Array(n, { i -> Value(line1[i].toInt(),i)})\n values.sort()\n\n val ans = ArrayList()\n ans.add(values[0])\n for ( v in values )\n if ( ans.last().v != v.v )\n ans.add(v)\n\n if ( ans.size < k )\n out.append(\"NO\\n\")\n else {\n out.append(\"YES\\n\")\n for ( i in 0 until k ) {\n out.append((ans[i].i+1).toString())\n out.append( if ( i+1 < k ) ' ' else '\\n' )\n }\n }\n\n out.flush()\n}"}], "negative_code": [{"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val l = r.readLine()!!.toInt()\n //val day = r.readLine()!!.split(\" \").map { it.toInt() }\n val (n, k) = r.readLine()!!.split(\" \").map { it.toInt() }\n val i = mutableListOf()\n val rate = mutableListOf()\n val rates = r.readLine()!!.split(\" \").map { it.toInt() }\n var index = 1\n rates.forEach {\n if (it !in rate){\n rate += it\n i += index\n }\n index++\n }\n if (i.size) = with(Scanner(System.`in`))\n{\n val n = nextInt()\n val k = nextInt()\n val mas = ArrayList()\n val set = TreeSet()\n var sum = 0\n for (i in 0 until n) {\n val x = nextInt()\n mas += x\n if(set.add(x)){\n sum++\n }\n }\n if(set.size != k){\n println(\"NO\")\n return\n }\n println(\"YES\")\n set.clear()\n for (i in 0 until n){\n if(set.add(mas[i])){\n print((i+1).toString() + ' ')\n }\n }\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun gcd (a:Int, b:Int): Int {\n if (b == 0) return a\n return gcd(b, a % b)\n}\nfun lcm(a:Int, b:Int): Int {\n val n1 = a\n val n2 = b\n val gcds = gcd(a,b)\n val lcmz = n1 * n2 / gcds\n return lcmz\n}\n\nfun main(args: Array) = with(Scanner(System.`in`))\n{\n val n = nextInt()\n val k = nextInt()\n val mas = ArrayList()\n val set = TreeSet()\n var sum = 0\n for (i in 0 until n) {\n val x = nextInt()\n mas += x\n if(set.add(x)){\n sum++\n }\n }\n if(set.size <= k){\n println(\"NO\")\n return\n }\n println(\"YES\")\n set.clear()\n sum = 0\n for (i in 0 until n){\n if(set.add(mas[i]) && sum < k){\n print((i+1).toString() + ' ')\n sum++\n }\n }\n}"}, {"source_code": "fun 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 val (n, k) = readIntArray()\n val arr = readIntArray()\n\n val set = mutableSetOf()\n val res = mutableListOf()\n arr.forEachIndexed { index, i ->\n if (!set.contains(i)) {\n res += (index + 1)\n set += i\n }\n }\n if (res.size < k) {\n println(\"NO\")\n } else {\n println(\"YES\")\n println(res.joinToString(\" \"))\n }\n}"}, {"source_code": "fun 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 val (n, k) = readIntArray()\n val arr = readIntArray()\n\n val set = mutableSetOf()\n val res = mutableListOf()\n arr.forEachIndexed { index, i ->\n if (!set.contains(i)) {\n res += (index + 1)\n set += i\n }\n }\n if (res.size < k) {\n println(\"NO\")\n } else {\n println(res.joinToString(\" \"))\n }\n}"}, {"source_code": "fun 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 val (n, k) = readIntArray()\n val arr = readIntArray()\n\n val set = arr.toSet()\n\n if (set.size < k) {\n println(\"NO\")\n } else {\n println(\"YES\")\n val res = mutableListOf()\n set.forEach {\n res += (arr.indexOf(it) + 1)\n }\n println(res.joinToString(\" \"))\n }\n}"}, {"source_code": "fun 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 val (n, k) = readIntArray()\n val arr = readIntArray()\n\n val set = mutableSetOf()\n val res = mutableListOf()\n arr.forEachIndexed { index, i ->\n if (!set.contains(i)) {\n res += (index + 1)\n set += i\n }\n }\n if (res.size < k || n < k) {\n println(\"NO\")\n } else {\n println(\"YES\")\n println(res.joinToString(\" \"))\n }\n}"}], "src_uid": "5de6574d57ab04ca195143e08d28d0ad"} {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.min\n\nfun main() {\n val iin = BufferedReader(InputStreamReader(System.`in`))\n val (x, y) = iin.readLine()!!.split(\" \").map { it.toInt() }\n val q = LinkedList()\n for (i in 1..3) {\n q.add(y)\n }\n var ans = 0\n while (q[2] != x) {\n ans++\n q.addFirst(min(x, q[0] + q[1] - 1))\n }\n println(ans)\n}", "positive_code": [{"source_code": "import java.util.*\nimport kotlin.math.min\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(y)\n }\n var answer = 0\n while (q[2] != x) {\n answer++\n q.addFirst(min(x, q[0] + q[1] - 1))\n }\n println(answer)\n}"}, {"source_code": "import java.lang.Math.*\n\nfun main(args: Array) {\n val (x, y) = readLine()!!.split(' ').map(String::toInt)\n var (a, b, c) = arrayListOf(y, y, y)\n var ans = 0\n while (a != x) {\n ans++\n a = min(x, b + c - 1)\n val (a1, b1, c1) = arrayListOf(a, b, c).sorted()\n a = a1\n b = b1\n c = c1\n }\n print(ans)\n}"}, {"source_code": "fun main(args: Array) {\n val (x, y) = readLine()!!.split(' ').map(String::toInt)\n var (a, b, c) = listOf(y, y, y)\n var ans = 0\n while (c < x) {\n c = b\n b = a\n a = b + c - 1\n ans++\n }\n println(ans)\n}\n"}], "negative_code": [{"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}"}], "src_uid": "8edf64f5838b19f9a8b19a14977f5615"} {"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\n num /= 3\n count++\n }\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}", "positive_code": [{"source_code": "import java.io.*\nimport java.lang.Math.pow\nimport java.util.*\nimport kotlin.math.*\n\nconst val fileSolve = \"distance1\"\nconst val fileInName = \"$fileSolve.in\"\nconst val fileOutName = \"$fileSolve.out\"\n\nfun dist(line: Line, p: Vect) =\n abs(line.a * p.x + line.b * p.y - line.c) /\n sqrt(line.a * line.a + line.b * line.b)\n\nfun bisector(x: Vect, yy: Vect, zz: Vect): Line {\n val y = x + (yy - x).normir()\n val z = x + (zz - x).normir()\n var mid = (y + z) / 2\n return lineFrom2point(x, mid)\n}\n\nvar cash = IntArray(2_000_000)\n\nfun solve() {\n var a = readLong()\n var b = readLong()\n\n if (b % a != 0L) {\n print(-1)\n return\n }\n\n var k = b / a\n var count = 0\n while (k > 1L) {\n if (k % 2 == 0L)\n k /= 2\n else if (k % 3 == 0L)\n k /= 3\n else {\n print(-1)\n return\n }\n count++\n }\n print(count)\n}\n\nfun lineFrom2point(point1: Vect, point2: Vect): Line {\n var p1 = point1\n var p2 = point2\n var A = p2.y - p1.y\n var B = p1.x - p2.x\n var C = -(p2.x * A + p2.y * B)\n return Line(A, B, C)\n}\n\nfun Double.sign() = if (this >= 0) 1.0 else -1.0\noperator fun String.times(x: Int): String {\n var c = this\n return buildString {\n for (i in 1..x)\n append(c)\n }\n}\noperator fun Int.times(s: String) = s * this\n\nfun squre2(vs: Array): Double {\n var tans = 0.0\n for (i in 1 until vs.size)\n tans += vs[i] trap2 vs[i - 1]\n\n tans += vs[0] trap2 vs[vs.lastIndex]\n return abs(tans)\n}\nclass Line {\n var a: Double = 0.0\n var b: Double = 0.0\n var c: Double = 0.0\n constructor(aa: Double, bb: Double, cc: Double) {\n a = aa; b = bb; c = cc\n }\n constructor() {\n a = readDouble(); b = readDouble(); c = readDouble()\n }\n\n override fun toString() = \"$a $b $c\"\n}\nclass Vect (var x: Double, var y: Double) {\n operator fun plus(b: Vect) = Vect(x + b.x, y + b.y)\n operator fun times(b: Int) = Vect(x * b, y * b)\n operator fun minus(b: Vect) = Vect(x - b.x, y - b.y)\n operator fun div(b: Int) = Vect(x / b, y / b)\n operator fun div(b: Double) = Vect(x / b, y / b)\n infix fun scalar(b: Vect) = x * b.x + y * b.y\n infix fun cross(b: Vect) = x * b.y - y * b.x\n fun rotated90() = Vect(-y, x)\n fun length() = sqrt(x * x + y * y)\n infix fun angle(b: Vect) =\n atan2(cross(b).toDouble(), scalar(b).toDouble())\n fun polarAngel() = Vect(1.0, 0.0) angle this\n infix fun trap2(b: Vect) = (b.x - x) * (y + b.y)\n override fun toString() = \"$x $y\"\n fun normir() = this / length()\n}\noperator fun Int.times(a: Vect) = a * this\nfun readVect() = Vect(readDouble(), readDouble())\nfun printDiv2(a: Long) {\n val d = a / 2\n out.print(d)\n if (a % 2 != 0L)\n out.println(\".5\")\n else\n out.println(\".0\")\n}\n\nvar MOD = 1_000_000_007\nvar MODL = MOD.toLong()\n\ninline fun binarySearchL(left: Int, right: Int, check: (Int) -> Boolean): Int {\n var l = left\n var r = right\n while(r - l > 1) {\n val mid = (r + l) shr 1\n if (check(mid))\n l = mid\n else\n r = mid\n }\n return l\n}\n\ninline fun binarySearchR(left: Int, right: Int, check: (Int) -> Boolean): Int {\n var l = left\n var r = right\n while(r - l > 1) {\n val mid = (r + l) shr 1\n if (check(mid))\n r = mid\n else\n l = mid\n }\n return r\n}\n\nfun binmult(a : Long, b : Long, m : Long = MODL) : Long {\n if (a == 0L)\n return 0\n else if (a % 2 == 1L) {\n val prev = binmult(a - 1, b, m)\n return (prev + b) % m\n } else {\n val half = binmult(a shl 1, b, m)\n return (half shr 1) % m\n }\n}\n\nfun binmult(a : Int, b : Int, m : Int = MOD) : Int {\n if (a == 0)\n return 0\n else if (a % 2 == 1) {\n return (binmult(a - 1, b, m) + b) % m\n } else {\n return (binmult(a shr 1, b, m) shl 1) % m\n }\n}\n\nfun binpow(a: Long, n: Long, mod: Long = MODL): 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 %= mod\n n = n shr 1\n }\n a = binmult(a, a, mod)\n }\n return res % mod\n}\n\nfun binpow(a: Int, n: Int, mod: Int = MOD): Int {\n var a = a\n var n = n\n var res = 1\n while (n > 0) {\n if (n and 1 == 1) {\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\ninfix fun Long.pow(n : Long) = binpow(this, n)\ninfix fun Int.pow(n : Int) = binpow(this, n)\ninfix fun Int.mlt(b : Int) = binmult(this, b)\ninfix fun Long.mlt(b : Long) = binmult(this, b)\nfun Boolean.t(a: Int, b: Int) = if (this) a else b\nfun Long.toBinaryStr(a: Long = this) = java.lang.Long.toBinaryString(a) ?: \"\"\nfun Int.toBinaryStr(a: Int = this) = Integer.toBinaryString(a) ?: \"\"\n\nvar out = if (File(fileInName).exists())\n PrintWriter(fileOutName)\n else\n PrintWriter(System.out)\nvar br = if (File(fileInName).exists())\n BufferedReader(FileReader(fileInName))\n else\n BufferedReader(InputStreamReader(System.`in`))\nvar st = StringTokenizer(\"\")\nval delimiter = \" \"\n\nfun main(args: Array) {\n solve()\n out.close()\n}\n\nfun readString(): String {\n if (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine(), delimiter)\n return st.nextToken()\n}\n\nfun print(vararg ans : T, sprt : String = \" \") = ans.forEach { out.print(\"${it.toString()}$sprt\") }\nfun print(vararg ints : Int, sprt : String = \" \") = ints.forEach { out.print(\"$it$sprt\") }\nfun print(vararg lons : Long, sprt : String = \" \") = lons.forEach { out.print(\"$it$sprt\") }\n\nfun readLine() = br.readLine()\nfun readInt() = readString().toInt()\nfun readLong() = readString().toLong()\nfun readDouble() = readString().toDouble()\nfun readBool() = readString().toBoolean()\nfun readFloat() = readString().toFloat()\n\nfun readInts() = readLine().split(' ').map(String::toInt).toIntArray()\nfun readLongs() = readLine().split(' ').map(String::toLong).toLongArray()"}, {"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\n if (y % x != 0){\n println(\"-1\")\n return\n }\n \n //handle not divided here\n var result = y / x\n var counter = 0\n var notDivided = false\n\n while (result % 3 == 0){\n result /= 3\n counter++\n }\n\n while (result % 2 == 0){\n result /= 2\n counter++\n }\n\n if (counter == 0 || result != 1 || notDivided){\n println(\"-1\")\n } else {\n println(counter)\n }\n}"}, {"source_code": "import kotlin.system.exitProcess\n\nfun readInts() = readLine()!!.split(' ').map(String::toInt)\nfun rec(x: Int, m:Int, cur:Int){\n if(x == m){\n print(cur)\n exitProcess(0)\n }\n if(x * 2 <= m)\n rec(x * 2, m, cur + 1)\n if(x * 3 <= m)\n rec(x * 3, m, cur + 1)\n}\nfun main(args: Array) {\n var (n, m) = readLine()!!.split(' ').map(String::toInt)\n rec(n, m, 0)\n print(-1)\n}\n\n\n"}, {"source_code": "import kotlin.math.ceil\nimport kotlin.reflect.jvm.internal.impl.resolve.constants.LongValue\n\nfun main() {\n var ip = readLine()\n var a = ip?.split(\" \")\n\n var n = a?.get(0)?.toInt()\n var m = a?.get(1)?.toInt()\n\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 = rem.div(\n if(rem%2==0) 2\n else if(rem%3==0) 3\n else break\n )\n ct++\n }\n if(rem==1)\n println(ct)\n else\n println(-1)\n }\n\n\n}"}, {"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 a = m/n\n var x = 0\n while(a%2 == 0){\n x=x+1\n a=a/2\n }\n while(a%3 == 0){\n x=x+1\n a=a/3\n }\n if(a==1)\n println(x)\n else\n println(-1)\n }\n}"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //var n = r.readLine()!!.toInt()\n val (n, m) = r.readLine()!!.split(\" \").map { it.toInt() }\n //val v = r.readLine()!!.split(\" \").map { it.toInt() }\n when{\n m%n!=0 -> println(-1)\n else -> {\n var q = m/n\n var two = 0\n var three = 0\n while (q%2==0){\n two++\n q /= 2\n }\n while (q%3==0){\n three++\n q/=3\n }\n if (q==1) println(two+three)\n else println(-1)\n }\n }\n}"}, {"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 count++\n } else if (num % 3 == 0) {\n num /= 3\n count++\n }\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}"}, {"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 num /= if (num % 2 == 0)\n 2\n else\n 3\n count++\n }\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}"}, {"source_code": "import java.util.*\n\nfun main() {\n val (m, n) = readLongs()\n\n if (n == m) {\n println(0)\n return\n }\n\n if (n % m != 0L || (n % 2 != 0L && n % 3 != 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}"}, {"source_code": "fun main() {\n val (m, n) = readLine()!!.split(\" \").map(String::toLong).toLongArray()\n var path = n / m\n var steps = 0\n\n if (n == m) {\n println(0)\n return\n }\n\n if (n % m != 0L || (n % 2 != 0L && n % 3 != 0L)) {\n println(-1)\n return\n }\n\n while (path % 2 == 0L) {\n steps += 1\n path /= 2\n }\n\n while (path % 3 == 0L) {\n steps += 1\n path /= 3\n }\n\n println(if (path == 1L) steps else -1)\n}\n"}, {"source_code": "import java.util.*\n\nfun main() {\n var sc = Scanner(System.`in`)\n var n = sc.nextInt()\n var m = sc.nextInt()\n if (m%n!=0) {\n print(-1)\n return\n }\n var a = m/n\n var res = 0\n while (a%2==0) {\n a/=2\n res++\n }\n while (a%3==0) {\n a/=3\n res++\n }\n if (a>1) {\n print(-1)\n return\n }\n print(res)\n}"}, {"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 m = reader.nextInt()\n if (m % n != 0) {\n writer.println(\"-1\")\n return\n }\n var x = m / n\n var ans = 0\n while (x % 2 == 0) {\n x /= 2\n ans++\n }\n while (x % 3 == 0) {\n x /= 3\n ans++\n }\n writer.println(if (x == 1) ans else -1)\n }\n\n fun clear() {\n writer.close()\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(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 close() {\n writer.close()\n }\n}"}, {"source_code": "fun main() {\n val (n, m) = readInts()\n\n val ans = run {\n if(m % n != 0) return@run -1\n var d = m / n\n var c = 0\n\n while(d % 2 == 0) {\n d /= 2\n c++\n }\n while(d % 3 == 0) {\n d /= 3\n c++\n }\n\n if(d == 1) c else -1\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 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() }"}, {"source_code": "//package com.happypeople.codeforces.c1141\n\nimport java.io.ByteArrayInputStream\nimport java.io.InputStream\nimport java.util.*\nimport kotlin.math.min\n\nfun main(args: Array) {\n try {\n A1141().run()\n } catch (e: Throwable) {\n println(\"\")\n e.printStackTrace()\n }\n}\n\nclass A1141 {\n fun run() {\n val sc = Scanner(systemIn())\n val n=sc.nextInt()\n val m=sc.nextInt()\n\n val x=minmoves(n, m)\n val ans=if(x>9999) -1 else x\n println(\"$ans\")\n }\n\n fun minmoves(n:Int, m:Int):Int {\n //log(\"minmoves $n $m\")\n if(n==m)\n return 0\n else if(n>m)\n return 10000\n else\n return min(minmoves(n*2, m), minmoves(n*3, m))+1\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"}, {"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 result=-1\n }\n }\n println(result)\n\n}"}, {"source_code": "fun main() {\n fun readLongs() = readLine()!!.split(\" \").map(String::toLong)\n\n val (n, m) = readLongs()\n if (m % n != 0L) return print(-1)\n var moves = 0\n var mult = m / n\n while (mult % 2 == 0L) {\n mult /= 2\n moves++\n }\n while (mult % 3 == 0L) {\n mult /= 3\n moves++\n }\n if (mult != 1L) return print(-1)\n print(moves)\n}"}], "negative_code": [{"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 count++\n } else if (num % 3 == 0) {\n num /= 3\n count++\n }\n }\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}"}, {"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\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}"}, {"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}"}, {"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}"}, {"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}"}, {"source_code": "fun main() {\n fun readLongs() = readLine()!!.split(\" \").map(String::toLong)\n\n val (n, m) = readLongs()\n if (m % n != 0L) return print(-1)\n var moves = 0\n var mult = m / n\n while (mult % 2 == 0L) {\n mult /= 2\n moves++\n }\n while (mult % 3 == 0L) {\n mult /= 3\n moves++\n }\n print(moves)\n}"}, {"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}"}, {"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 || result != 1){\n println(\"-1\")\n } else {\n println(counter)\n }\n}"}, {"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 }\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}"}], "src_uid": "3f9980ad292185f63a80bce10705e806"} {"source_code": "import kotlin.math.*\n\nfun main() {\n var (n, t, k, d) = readLine()!!.split(\" \").map{ it.toInt() }\n var time_A = ceil(n.toDouble() / 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}", "positive_code": [{"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-1)/nocake\n \n var o1= 0 \n var o2= oven2\n for(i in 0 until timeforoven1 ){\n if(o1 <= o2) o1 += oven1;\n else o2 += oven1;\n }\n \n \n if (maxOf(o1, o2) < timeforoven1 * oven1)\n println(\"YES\")\n else\n println(\"NO\")\n \n \n}"}, {"source_code": "import java.util.*;\n\nfun main(args: Array){\n var input = Scanner(System.`in`);\n var n=input.nextInt();\n var t=input.nextInt();\n var k=input.nextInt();\n var d=input.nextInt();\n \n if (((d / t) + 1) * k >= n) print(\"NO\");\n else print(\"YES\");\n}"}, {"source_code": "fun main(vararg args: String) {\n\n infix fun Int.ceilDiv(that: Int) = (this + that - 1) / that\n\n val (n, t, k, d) = readLine()!!.split(' ').map(String::toInt)\n println(if ((n ceilDiv k) * t > d + t) \"YES\" else \"NO\")\n}\n"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val (n, t, k, d) = br.readLine().split(\" \").map { it.toInt() }\n val noExtraOven = t*((n + k - 1)/k)\n println(\n if (k >= n) \"NO\"\n else if (d + t < noExtraOven) \"YES\"\n else \"NO\"\n )\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.ceil\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= (ceil(n.div(k))).times(t).minus(t)\n if (timeOneOven > d)\n println(\"YES\")\n else\n println(\"NO\")\n}\n"}, {"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 (n, t, k, d) = readInts()\n // t minutes for an over to bake k carrot cakes\n // needs at least n cakes\n // d minutes to build a new oven\n // 8 6 4 5\n // 6 minutes to make 4 cakes, 5 minutes to build a new oven\n var tt = t\n var kk = k\n while (kk < n) {\n kk += k\n tt += t\n }\n if (t + d < tt) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}\n"}, {"source_code": "fun main() {\n val (numCakes, bakingTime, numCakesPerTurn, buildingTime) = readLine()!!.split(\" \").map(String::toInt)\n val oneOvenTime = bakingTime * (numCakes / numCakesPerTurn + if (numCakes % numCakesPerTurn == 0) 0 else 1)\n print(if (buildingTime + bakingTime < oneOvenTime) \"YES\" else \"NO\")\n}"}, {"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 var n = readInt()\n val t = readInt()\n val k = readInt()\n val d = readInt()\n\n var currt = 0\n while(currt <= d) {\n n -= k\n currt += t\n }\n\n return when (n > 0) {\n true -> \"YES\"\n false -> \"NO\"\n }\n\n }\n}\n\nfun main(args: Array) {\n\n outputWriter.println(\n `CF799-D2-A`()\n .solveTestCase()\n )\n\n outputWriter.flush()\n}"}], "negative_code": [{"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}"}, {"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}"}, {"source_code": "import java.util.*\nimport kotlin.math.ceil\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 var done = 0F\n var counter1 = 0\n while (done d) {\n done += k\n }\n done += k\n counter++\n }\n val t2 = if (t - d >= 0)\n (counter * t) - (t - d)\n else\n counter * t\n if (t2 < t1)\n println(\"YES\")\n else\n println(\"NO\")\n}\n"}, {"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"}, {"source_code": "import java.util.*\nimport kotlin.math.ceil\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 var done = 0F\n var counter1 = 0\n while (done d) {\n done += k\n }\n done += k\n counter++\n }\n val t2 = if (t - d > 0)\n (counter * t) - (t - d)\n else\n counter * t\n if (t2 < t1)\n println(\"YES\")\n else\n println(\"NO\")\n}\n"}, {"source_code": "import java.util.*\n\nfun main() {\n val input = Scanner(System.`in`)\n val n = input.nextInt()\n val t = input.nextInt()\n val k = input.nextInt()\n val d = input.nextInt()\n val one = (t*n).div(k)\n val two = t+d\n if(two= two2)\n two1\n else\n two2\n if (two < one)\n println(\"YES\")\n else\n println(\"NO\")\n}\n"}, {"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}"}, {"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 == 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}"}], "src_uid": "32c866d3d394e269724b4930df5e4407"} {"source_code": "import java.lang.String.format\nimport java.util.*\nimport kotlin.math.*\nimport kotlin.system.exitProcess\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\nfun main(){\n val reader=Scanner(System.`in`)\n var (l,r,x,y,k)=readLongs()\n for(i in x until y+1){\n if(i*k>=l&&i*k<=r){\n print(\"YES\")\n return\n }\n }\n print(\"NO\")\n}", "positive_code": [{"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 readLongs() = readTokens().map { it.toLong() }\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) = readLongs()\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}"}, {"source_code": "import java.io.*\nimport java.util.*\n\nfun solve() {\n var l = nextInt()\n var r = nextInt()\n var x = nextInt()\n var y = nextInt()\n var k = nextInt()\n var ok = false\n for (b in x..y) {\n if(b * 1L * k in l..r) {\n ok = true\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}"}, {"source_code": "fun main() {\n val (l, r, x, y, k) = readLine()!!.split(\" \").map(String::toFloat)\n var a = l\n var b = x\n while (a <= r && b <= y) {\n when {\n a / b == k -> {\n print(\"YES\")\n return\n }\n a / b > k -> b++\n a / b < k -> a++\n }\n }\n print(\"NO\")\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val l = sc.nextLong()\n val r = sc.nextLong()\n val x = sc.nextLong()\n val y = sc.nextLong()\n val k = sc.nextLong()\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}"}], "negative_code": [{"source_code": "import java.util.*\n\nfun main(args: Array) {\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}"}, {"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}"}], "src_uid": "1110d3671e9f77fd8d66dca6e74d2048"} {"source_code": "import java.lang.StringBuilder\nimport java.util.Scanner\n\nfun main() {\n\n val sc = Scanner(System.`in`)\n val fir : String = sc.next()\n val sec : String = sc.next()\n val thi : String = sc.next()\n val fou : String = sc.next()\n val arr = arrayOf(fir, sec, thi, fou)\n\n for (i in 1 until 4) {\n for (j in 1 until 4) {\n var sharp = 0\n var dot = 0\n\n if (arr[i - 1][j - 1] == '#') sharp++\n else dot++\n\n if (arr[i][j - 1] == '#') sharp++\n else dot++\n\n if (arr[i - 1][j] == '#') sharp++\n else dot++\n\n if (arr[i][j] == '#') sharp++\n else dot++\n\n if (sharp > 2 || dot > 2) {\n print(\"YES\")\n return\n }\n\n }\n }\n\n print(\"NO\")\n\n}", "positive_code": [{"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val square = List(4){br.readLine().map { if (it == '#') 1 else 0}}\n var possible = false\n for (i in 0 .. 2){\n for (j in 0 .. 2){\n val sum = square[i][j] + square[i][j + 1] +\n square[i + 1][j] + square[i + 1][j + 1]\n if (sum != 2) {\n possible = true\n break\n }\n }\n if (possible) break\n }\n println(if (possible) \"YES\" else \"NO\")\n}"}, {"source_code": " //ismail moussi\nvar c=Array(4)\n{\n CharArray(4)\n}\nfun rech(i:Int,j:Int):Boolean\n{\n if(i<3&&j<3)\n return c[i][j] == c[i][j + 1] && c[i][j] == c[i + 1][j] && c[i][j] == c[i + 1][j + 1]\n else\n return false\n}\nfun chek(): Boolean\n{\n for(i in 0..3)\n {\n for(j in 0..3)\n {\n if(rech(i,j))\n return true\n }\n }\n return false\n}\n fun main() {\n for (i in 0..3) {\n c[i] = readLine()!!.toCharArray()\n }\n var bool = chek()\n if (bool) {\n print(\"YES\")\n return\n } else {\n for (i in 0..3) {\n for (j in 0..3) {\n var old = c[i][j]\n when (c[i][j])\n {\n '.'->c[i][j] = '#'\n '#'-> c[i][j] = '.'\n }\n if (chek()) {\n bool = true\n }\n c[i][j] = old\n }\n }\n }\n if (bool)\n print(\"YES\")\n else print(\"NO\")\n }"}, {"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 != 1) {\n print(\"YES\")\n return\n }\n }\n print(\"NO\")\n}"}, {"source_code": "import java.io.BufferedInputStream\nimport java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(BufferedInputStream(System.`in`))\n\n val grid = Array(4, {\"\"})\n for(i in 0..3){\n grid[i] = scanner.next()\n }\n\n if(ok(grid)) print(\"YES\")\n else print(\"NO\")\n}\n\nfun ok(g: Array): Boolean{\n for(i in 0..2){\n for(j in 0..2){\n var clr1 = 0\n var clr2 = 0\n for(di in 0..1){\n for(dj in 0..1){\n if(g[i+di][j+dj] == '.') ++clr1\n else ++clr2\n }\n }\n\n if(Math.abs(clr1 - clr2) > 0){\n return true\n }\n }\n }\n return false\n}"}], "negative_code": [{"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}"}], "src_uid": "01b145e798bbdf0ca2ecc383676d79f3"} {"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 a = IntArray( n, { sc.nextInt() } )\n var r = 0\n for ( s in 0 until k ) {\n val one = a.withIndex().count { ( it.index - s ) % k != 0 && it.value == 1 }\n val mone = a.withIndex().count { ( it.index - s ) % k != 0 && it.value == -1 }\n val diff = Math.abs( one - mone )\n r = Math.max( r, diff )\n }\n println( r )\n}", "positive_code": [{"source_code": "//package com.happypeople.codeforces.c1100\n\nimport java.io.ByteArrayInputStream\nimport java.io.InputStream\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\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=sums.sum()\n val ans=max(\n abs(sumAll - sums.max()!!),\n abs(sumAll - sums.min()!!)\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}"}, {"source_code": "import kotlin.math.abs\nimport kotlin.math.max\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (numTabs, distance) = readInts()\n val arr = readInts()\n var sol = Integer.MIN_VALUE\n for (start in 0 until distance) {\n var curSol = 0\n for (pos in 0 until numTabs)\n if ((pos - start) % distance != 0) curSol += arr[pos]\n sol = max(sol, abs(curSol))\n }\n print(sol)\n}"}, {"source_code": "import kotlin.math.abs\n\nfun main(args: Array) {\n val (n , k) = readLine()!!.split(' ').map ( String::toInt )\n val arr : List = readLine()!!.split(' ').map ( String::toInt )\n\n val zeroing = { i : Int, arr : MutableList ->\n for (j in i until n step k)\n arr[j] = 0\n arr\n }\n\n val summation = { arr : MutableList ->\n var sum = 0\n for (j in 0 until n)\n sum += arr[j]\n sum\n }\n\n var res = 0\n var sum : Int\n for(i in 0 until k) {\n sum = abs(summation(zeroing(i, arr.toMutableList())))\n res = if(res < sum) sum else res\n }\n\n println(res)\n}"}, {"source_code": "import kotlin.math.abs\n\nfun main(args: Array) {\n// var str = readLine()!!\n// var n = readLine()!!.toInt()\n var ns = readLine()!!.split(\" \").map { x -> x.toInt() }\n var tabs = readLine()!!.split(\" \").map { x -> x.toInt() }\n\n var n = ns[0]\n var k = ns[1]\n\n var list = ArrayList()\n\n for(b in 0 until n) {\n var del = tabs(n, k, b)\n var newTab = ArrayList()\n for (a in 0 until n) {\n if (!del.contains(a)) {\n newTab.add(tabs[a])\n }\n }\n\n var e = 0\n var s = 0\n\n for (a in newTab){\n if (a < 0) s++\n else e++\n }\n\n list.add(abs(e-s))\n }\n\n print(list.max())\n\n}\n\nfun tabs(n: Int, k: Int, b: Int) : ArrayList {\n\n var list = ArrayList()\n var b2 = b\n while (b2 < n) {\n list.add(b2)\n b2+=k\n }\n\n b2 = b\n\n while (b2 >= 0) {\n list.add(b2)\n b2-=k\n }\n\n return list\n}\n"}, {"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 (n, k) = readLine()!!.split(' ').map(String::toInt)\n val list = readLine()!!.split(' ').map(String::toInt)\n var l = 0\n var r = 0\n for(i in list){\n if(i < 0)\n l++\n else\n r++\n }\n var ans = 0\n for(i in 0 until k){\n var l1 = 0\n var r1 = 0\n for(j in i until n step k){\n if(list[j] < 0)\n l1++\n else\n r1++\n }\n r1 = r - r1;\n l1 = l - l1;\n ans = max(ans, abs(l1 - r1))\n }\n println(ans)\n}\n\n\n"}, {"source_code": "import kotlin.math.absoluteValue\n\nfun remove(sequence: List, start: Int, step: Int) : List{\n return sequence.withIndex().filter { (i, _) -> (i - start) % step != 0 }.map {(_, value) -> value}\n}\n\nfun main(args: Array) {\n val (n, k) = readLine()!!.split(' ').map(String::toInt)\n val codes = readLine()!!.split(' ').map(String::toInt)\n val results = (0 until k).map { start -> remove(codes, start, k).sum().absoluteValue }\n println(results.max())\n}\n"}, {"source_code": "import kotlin.math.abs\n\n//import kotlin.math.abs\n\nfun main(args: Array) {\n val (n , k) = readLine()!!.split(\" \").map(String::toInt)\n\n val a = readLine()!!.split(\" \").map(String::toInt)\n\n var max = 0;\n for(i in 0 until a.size){\n max = kotlin.math.max(max , s(a , i , k))\n }\n\n\n println(max)\n}\n\nfun s(a: List , start: Int , k: Int) : Int{\n\n var b = arrayListOf()\n for(i in 0 until a.size)\n b.add(true)\n\n var s = start\n while(s < a.size){\n b[s] = false\n s += k\n }\n\n\n s = start\n while(s >= 0){\n b[s] = false\n s -= k\n }\n\n var s1 = 0\n var s2 = 0\n\n for(i in 0 until a.size)\n if(b[i]){\n if(a[i] == 1){\n s1 ++;\n }else{\n s2 ++;\n }\n }\n\n return abs(s1 - s2)\n}"}, {"source_code": "fun main(){\n\tval (n, k) = readLine()!!.split(\" \").map(){it.toInt()}\n\tval array = readLine()!!.split(\" \").map(){it.toInt()}\n\tvar result = 0\n\tfor (i in 0..k - 1){\n\t\tvar dif = 0\n\t\t//println(\"b: \" + (i + 1))\n\t\tval copy = array.filterIndexed(){index, value -> (index - i) % k != 0}.forEach(){v -> \n\t\t//println(v)\n\t\tdif+=v}\n\n\t\tif (Math.abs(dif) > result) result = Math.abs(dif)\n\t\t//println(\"dif: \" + dif)\n\t}\n\tprintln(result)\n\t}"}], "negative_code": [{"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}"}], "src_uid": "6119258322e06fa6146e592c63313df3"} {"source_code": "import java.util.*\n\ndata class Box(val a: Int = 0, val b: Int = 0) : Comparable {\n override fun compareTo(other: Box): Int {\n return this.b - other.b\n }\n}\n\nfun main(args: Array) {\n var (n, m) = readLine()!!.split(' ').map {it.toInt()}\n val x = Array(m) {Box()}\n for (i in 0 until m) {\n val line = readLine()!!.split(' ').map {it.toInt()}\n x[i] = Box(line[0], line[1])\n }\n\n var sum = 0\n for (box in x.sortedDescending()) {\n val take = minOf(box.a, n)\n n -= take\n sum += take * box.b\n }\n println(sum)\n}\n", "positive_code": [{"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\n val list = mutableListOf>()\n (1..m).forEach {\n val a = reader.nextInt()\n val b = reader.nextInt()\n list.add(Pair(a, b))\n }\n\n var matchBoxesLeft = n\n var matches = 0\n list.sortedByDescending { it.second }.map {\n if (matchBoxesLeft <= 0)\n return@map\n\n matchBoxesLeft -= it.first\n if (matchBoxesLeft >= 0) {\n matches += it.first * it.second\n } else {\n matchBoxesLeft += it.first\n matches += (matchBoxesLeft) * it.second\n matchBoxesLeft -= it.first\n }\n }\n print(matches)\n}\n\n\n// n == 7 && a = 5\n//\n// matcheBoxLeft = n - a\n"}, {"source_code": "import java.util.Comparator\n\n//import kotlin.math.abs\n\nfun main(args: Array) {\n\n var (n, m) = readLine()!!.split(' ').map(String::toLong)\n\n var pairs = arrayListOf();\n for (elem in 1..m) {\n var (i, j) = readLine()!!.split(' ').map(String::toLong);\n\n pairs.add(Pair(i, j));\n }\n\n pairs.sortWith(Comparator { a, b -> if (a.y > b.y) -1 else 1 });\n\n\n var count = 0L;\n\n var i = 0;\n while (n > 0 && i < m) {\n if (pairs[i].x > n) {\n count += n * pairs[i].y\n n = 0;\n } else {\n n -= pairs[i].x;\n count += pairs[i].x * pairs[i].y\n }\n\n i++;\n }\n\n\n print(count)\n\n}\n\nclass Pair(x: Long, y: Long) {\n var x: Long = x;\n var y: Long = y;\n}"}, {"source_code": "\nfun calculateBoxes(): Int {\n val map = sortedMapOf()\n\n fun readPairOfIntegers() = readLine()!!.split(\" \").let { Pair(it[0].toInt(), it[1].toInt()) }\n\n fun addToMap(key: Int, value: Int) {\n fun getValue(key: Int): Int {\n if (map[key] == null) {\n map[key] = 0\n }\n return map[key]!!\n }\n map[key] = value + getValue(key)\n }\n var matchesTaken = 0\n var (availableCapacity, containersCount) = readPairOfIntegers()\n repeat(containersCount) {\n val (boxesCount, boxCapacity) = readPairOfIntegers()\n addToMap(-boxCapacity, boxesCount)\n }\n map.entries.forEach { (boxCapacityNegative, boxesCount) ->\n val boxCapacity = -boxCapacityNegative\n if (boxesCount >= availableCapacity) {\n matchesTaken += availableCapacity * boxCapacity\n return matchesTaken\n } else {\n matchesTaken += boxesCount * boxCapacity\n availableCapacity -= boxesCount\n }\n }\n return matchesTaken\n}\n\nfun main() = println(calculateBoxes())\n"}, {"source_code": "\n\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.io.Reader\nimport java.util.*\n\nfun main(args: Array) {\n val reader = Reader()\n var capacity = reader.nextInt()\n val n = reader.nextInt()\n val list = mutableListOf>()\n var total = 0\n for (i in 0 until n) {\n val numberOfBoxes = reader.nextInt()\n val numberOfmMatches = reader.nextInt()\n list.add(numberOfBoxes to numberOfmMatches)\n }\n list.sortBy { it.second }\n for (i in n-1 downTo 0) {\n total += if (capacity >= list[i].first)\n list[i].first * list[i].second\n else\n capacity * list[i].second\n capacity -= list[i].first\n if (capacity <= 0)\n break\n }\n println(total)\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}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val (n, m) = br.readLine().split(\" \").map { it.toInt() }\n val matches = List(m){br.readLine().split(\" \").map { it.toInt() }}\n .sortedByDescending { it[1] }\n var cnt = 0\n var takenBoxes = 0\n var i = 0\n var full = false\n while (i < m && !full) {\n val (a, b) = matches[i]\n if (takenBoxes + a <= n) {\n cnt += a*b\n takenBoxes += a\n i++\n } else {\n cnt += (n - takenBoxes)*b\n full = true\n }\n }\n println(cnt)\n}"}, {"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 = mutableListOf>()\n for (i in 1..containersLength) {\n val key = reader.nextInt()\n val value = reader.nextInt()\n containers.add(Pair(key,value))\n }\n val sortedContainers = containers.toList()\n .sortedByDescending { (key, value) -> value }\n var total = 0\n for (container in sortedContainers) {\n if (noToHold != 0) {\n if (container.first <= noToHold) {\n noToHold -= container.first\n total += container.first * container.second\n } else {\n total += noToHold * container.second\n noToHold -= noToHold\n }\n }\n else\n break\n }\n print(total)\n}"}, {"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 && !sibice.isEmpty()) {\n if(n - sibice[0].first > 0) {\n n -= sibice[0].first\n sum += (sibice[0].second * sibice[0].first)\n sibice.removeAt(0)\n } else {\n sum += n * sibice[0].second\n break\n }\n }\n println(sum)\n}\n\nclass Par constructor(var first : T1, var second : T2)\n\n"}, {"source_code": "import kotlin.math.min\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n var (numMatchBoxes, numContainers) = readInts()\n val options = Array(numContainers) { 0 to 0 }\n for (container in 0 until numContainers) {\n val (numBoxes, numMatches) = readInts()\n options[container] = numMatches to numBoxes\n }\n options.sortByDescending { it.first }\n var sol = 0L\n for (option in options) {\n val numBoxes = min(numMatchBoxes, option.second)\n sol += numBoxes * option.first\n numMatchBoxes -= numBoxes\n if (numMatchBoxes == 0) break\n }\n print(sol)\n}"}], "negative_code": [{"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}"}, {"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"}], "src_uid": "c052d85e402691b05e494b5283d62679"} {"source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n fun readLongs() = readLine()!!.split(\" \").map(String::toLong)\n\n val (l1, r1, l2, r2, k) = readLongs()\n val start = max(l1, l2)\n val end = min(r1, r2)\n if (end < start) return print(0)\n print(end - start + 1 - if (k in start..end) 1 else 0)\n}", "positive_code": [{"source_code": "fun main(vararg args: String) {\n val (l1, r1, l2, r2, k) = readLine()!!.split(' ').map { it.toLong() }\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 (k in l..r) o -= 1\n println(o)\n }\n}"}, {"source_code": "import 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"}, {"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(\"\\\\s+\".toRegex()).map { it.toLong() }\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}"}, {"source_code": "fun main(vararg args: String) {\n val (l1, r1, l2, r2, k) = readLine()!!.split(' ').map { it.toLong() }\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}"}], "negative_code": [], "src_uid": "9a74b3b0e9f3a351f2136842e9565a82"} {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n //val len = r.readLine()!!.toInt()\n //val v = r.readLine()!!.split(\" \").map { it.toInt() }\n val v = r.readLine()!!.split(\"\").filter { it.isNotEmpty() }.map { it.toInt() }.toIntArray()\n val ans = mutableListOf()\n while (v.any { it > 0 }){\n val a = IntArray(v.size){0}\n for (i in 0..v.size-1){\n if (v[i]>0) {\n v[i]--\n a[i]++\n }\n }\n ans += a.joinToString(\"\").toInt()\n }\n println(ans.size)\n println(ans.joinToString(\" \"))\n /*repeat(r.readLine()!!.toInt()) {\n val (n, k) = r.readLine()!!.split(\" \").map { it.toLong() }\n }*/\n\n}", "positive_code": [{"source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n val n = readLine()!!.toInt()\n\n val list = mutableListOf()\n\n val s = System.currentTimeMillis()\n fillList(list)\n\n\n var arr = IntArray(1_000_001, { p -> -1 })\n var prev = IntArray(1_000_001, { p -> -1 })\n list.forEach {\n arr[it] = 1\n }\n\n for (i in 1..n) {\n list.forEach { elem ->\n val index = i - elem\n\n if (index > 0 && arr[index] != -1) {\n if (arr[i] == -1) {\n arr[i] = arr[index] + 1\n prev[i] = index\n } else if (arr[i] > arr[index] + 1) {\n arr[i] = arr[index] + 1\n prev[i] = index\n }\n }\n }\n }\n\n println(arr[n])\n\n var i = n\n while (prev[i] != -1) {\n println(i - prev[i])\n i = prev[i]\n }\n println(i)\n\n}\n\nfun fillList(list: MutableList) {\n\n for (i in 1..1_000_000)\n if (check(i)) {\n// println(i)\n list.add(i)\n }\n\n}\n\nfun check(elem: Int): Boolean {\n var elem = elem\n while (elem > 0) {\n if (elem % 10 >= 2)\n return false\n elem /= 10\n }\n\n return true\n}"}, {"source_code": "\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n val n = readLine()!!.toInt()\n\n val list = mutableListOf()\n\n val s = System.currentTimeMillis()\n for (i in 1..1_000_000)\n if (check(i)) {\n// println(i)\n list.add(i)\n }\n\n// print(System.currentTimeMillis() - s)\n\n\n var arr = IntArray(1_000_001, { p -> -1 })\n var prev = IntArray(1_000_001, { p -> -1 })\n list.forEach {\n arr[it] = 1\n }\n\n for (i in 1..n) {\n list.forEach { elem ->\n val index = i - elem\n\n if (index > 0 && arr[index] != -1) {\n if (arr[i] == -1) {\n arr[i] = arr[index] + 1\n prev[i] = index\n } else if (arr[i] > arr[index] + 1) {\n arr[i] = arr[index] + 1\n prev[i] = index\n }\n }\n }\n }\n\n println(arr[n])\n\n var i = n\n while(prev[i] != -1){\n println(i - prev[i])\n i = prev[i]\n }\n println(i)\n\n}\n\nfun check(elem: Int): Boolean {\n var elem = elem\n while (elem > 0) {\n if (elem % 10 >= 2)\n return false\n elem /= 10\n }\n\n return true\n}"}, {"source_code": "import java.util.*\n\nvar INF = 1000001\n\nfun generate(n: Int, list: ArrayList){\n list.add(n)\n if(n * 10 < INF) generate(n * 10,list)\n if (n * 10 + 1 < INF) generate(n * 10 + 1,list)\n}\n\n\nfun getSequnece(dp: Array, from: Array, i: Int) {\n if(from[i] == -1) print(\"$i \")\n else {\n getSequnece(dp,from,from[i])\n getSequnece(dp,from,i - from[i])\n }\n}\n\n\nfun main(args: Array) {\n var s = readLine()!!.toInt()\n var l = ArrayList()\n generate(1,l)\n Collections.sort(l)\n var dp = Array(1000001) {i -> i}\n var from = Array(1000001) { i -> i - 1}\n dp[0] = 0\n l.forEach {\n dp[it] = 1\n from[it] = -1\n }\n (0..1000000).forEach {\n i ->\n l.forEach {\n if(i - it > 0) {\n if(dp[i - it] + dp[it] < dp[i]) {\n dp[i] = dp[i - it] + dp[it]\n from[i] = it\n }\n }\n }\n }\n println(dp[s])\n getSequnece(dp,from,s)\n}\n\n\n\n\n\n\n"}, {"source_code": "import java.util.*\n\nvar INF = 1000001\n\nfun generate(n: Int, list: ArrayList){\n list.add(n)\n if(n * 10 < INF) generate(n * 10,list)\n if (n * 10 + 1 < INF) generate(n * 10 + 1,list)\n}\n\ntailrec fun getSequnece(dp: Array, from: Array, i: Int) {\n if(from[i] == -1) print(\"$i \")\n else {\n print(\"${from[i]} \")\n getSequnece(dp, from, i - from[i])\n }\n}\n\n\nfun main(args: Array) {\n var s = readLine()!!.toInt()\n var l = ArrayList()\n generate(1,l)\n Collections.sort(l)\n var dp = Array(1000001) {i -> i}\n var from = Array(1000001) { i -> 1}\n dp[0] = 0\n l.forEach {\n dp[it] = 1\n from[it] = -1\n }\n (0..1000000).forEach {\n i ->\n l.forEach {\n if(i - it > 0) {\n if(dp[i - it] + dp[it] < dp[i]) {\n dp[i] = dp[i - it] + dp[it]\n from[i] = it\n }\n }\n }\n }\n println(dp[s])\n getSequnece(dp,from,s)\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toCharArray()\n var sol = 0\n val sols = mutableListOf>()\n while (true) {\n val newSol = mutableListOf()\n for ((pos, c) in n.withIndex()) {\n if (c == '0' && newSol.isNotEmpty()) newSol.add('0') else if (c != '0') {\n n[pos]--\n newSol.add('1')\n }\n }\n if (newSol.isEmpty()) {\n break\n }\n sol++\n sols.add(newSol)\n }\n println(sol)\n print(sols.joinToString(separator = \" \") { it.joinToString(\"\") })\n}"}, {"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 var n = readLine()!!.toCharArray()\n var sol = 0\n var sols = mutableListOf>()\n var zeros = false\n while (!zeros) {\n val newSol = mutableListOf()\n for ((pos, c) in n.withIndex()) {\n if (c == '0' && newSol.isNotEmpty()) {\n newSol.add('0')\n } else if (c != '0') {\n n[pos]--\n newSol.add('1')\n }\n }\n if (newSol.isNotEmpty()) {\n sol++\n sols.add(newSol)\n } else {\n zeros = true\n }\n }\n println(sol)\n print(sols.joinToString(separator = \" \") { it.joinToString(\"\") })\n}"}, {"source_code": "fun quasi_binary() : ArrayList {\n val q_b = ArrayList()\n val max_depth = 7\n fun dfs(depth : Int, qb : Int) {\n if (depth > max_depth) {\n return\n } else {\n q_b.add(qb)\n val qb_0 = qb * 10\n val qb_1 = qb_0 + 1\n val new_depth = depth + 1\n dfs(new_depth, qb_0)\n dfs(new_depth, qb_1)\n }\n }\n dfs(1, 1)\n q_b.sort()\n return q_b\n}\n\nfun qb_sum(qb : ArrayList, n : Int) : ArrayList {\n val predecessor = IntArray(n + 1)\n val num_terms = IntArray(n + 1, {_ -> Int.MAX_VALUE})\n num_terms[0] = 0 \n val term = IntArray(n + 1)\n for (i in 0 .. n) {\n for (x in qb) {\n val sum = i + x\n if (sum <= n) {\n val num_terms_so_far = num_terms[i] + 1\n if (num_terms_so_far < num_terms[sum]) {\n num_terms[sum] = num_terms_so_far\n term[sum] = x\n predecessor[sum] = i\n }\n } else {\n break\n }\n }\n }\n val terms = ArrayList()\n var x = n\n while (x > 0) {\n terms.add(term[x])\n x = predecessor[x]\n }\n return terms\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 q_b = quasi_binary()\n val terms = qb_sum(q_b, n)\n val num_terms = terms.size\n println(\"${num_terms}\")\n for (t in terms) {\n print(\"${t} \")\n }\n println()\n }\n}\n"}, {"source_code": "fun main(args: Array) {\n val number= readLine()!!.map { it-> (it-'0') }.toIntArray()\n var canCreateNumber=true\n val binNubmers= mutableListOf()\n while (canCreateNumber){\n var currenNumber= mutableListOf()\n for ((index, value) in number.withIndex()){\n if(value>0){\n currenNumber.add(1)\n number[index]-=1\n }\n else{\n if(currenNumber.size>0)\n currenNumber.add(0)\n }\n }\n if (currenNumber.size==0)\n break\n binNubmers.add(currenNumber.joinToString(\"\"))\n }\n println(binNubmers.size)\n println(binNubmers.joinToString(\" \"))\n}"}], "negative_code": [{"source_code": "import java.util.*\n\nvar INF = 1000001\n\nfun generate(n: Int, list: ArrayList){\n list.add(n)\n if(n * 10 < INF) generate(n * 10,list)\n if (n * 10 + 1 < INF) generate(n * 10 + 1,list)\n}\n\ntailrec fun getSequnece(dp: Array, from: Array, i: Int) {\n if(from[i] == -1) print(\"$i \")\n else {\n print(\"${from[i]} \")\n getSequnece(dp, from, i - from[i])\n }\n}\n\n\nfun main(args: Array) {\n var s = readLine()!!.toInt()\n var l = ArrayList()\n generate(1,l)\n Collections.sort(l)\n var dp = Array(1000001) {i -> i}\n var from = Array(1000001) { i -> i - 1}\n dp[0] = 0\n l.forEach {\n dp[it] = 1\n from[it] = -1\n }\n (0..1000000).forEach {\n i ->\n l.forEach {\n if(i - it > 0) {\n if(dp[i - it] + dp[it] < dp[i]) {\n dp[i] = dp[i - it] + dp[it]\n from[i] = it\n }\n }\n }\n }\n println(dp[s])\n getSequnece(dp,from,s)\n}"}, {"source_code": "import java.util.*\n\nvar INF = 1000001\n\nfun generate(n: Int, list: ArrayList){\n list.add(n)\n if(n * 10 < INF) generate(n * 10,list)\n if (n * 10 + 1 < INF) generate(n * 10 + 1,list)\n}\n\n\nfun getSequnece(dp: Array, from: Array, i: Int) {\n if(from[i] == -1) print(\"$i \")\n else {\n getSequnece(dp,from,from[i])\n getSequnece(dp,from,i - from[i])\n }\n}\n\n\nfun main(args: Array) {\n var s = readLine()!!.toInt()\n var l = ArrayList()\n generate(1,l)\n Collections.sort(l)\n var dp = Array(1000001) {i -> i}\n var from = Array(1000001) { i -> i - 1}\n dp[0] = 0\n l.forEach {\n dp[it] = 1\n from[it] = -1\n }\n (0..100000).forEach {\n i ->\n l.forEach {\n if(i - it > 0) {\n if(dp[i - it] + dp[it] < dp[i]) {\n dp[i] = dp[i - it] + dp[it]\n from[i] = it\n }\n }\n }\n }\n println(dp[s])\n getSequnece(dp,from,s)\n}\n\n\n\n\n\n\n"}, {"source_code": "fun quasi_binary() : ArrayList {\n val q_b = ArrayList()\n val max_depth = 7\n fun dfs(depth : Int, qb : Int) {\n if (depth > max_depth) {\n return\n } else {\n q_b.add(qb)\n val qb_0 = qb * 10\n val qb_1 = qb_0 + 1\n val new_depth = depth + 1\n dfs(new_depth, qb_0)\n dfs(new_depth, qb_1)\n }\n }\n dfs(1, 1)\n q_b.sort()\n return q_b\n}\n\nfun qb_sum(qb : ArrayList, n : Int, terms : ArrayList) {\n if (n == 0) {\n // Do nothing ...\n } else {\n var l = 0\n var u = qb.size - 1\n while ((u - l) > 1) {\n val m = (l + u) / 2\n val qb_m = qb[m]\n if (qb_m <= n) {\n l = m\n } else {\n u = m\n }\n }\n val qb_l = qb[l]\n val new_n = n - qb_l\n terms.add(qb_l)\n qb_sum(qb, new_n, terms)\n }\n return\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 q_b = quasi_binary()\n val terms = ArrayList()\n qb_sum(q_b, n, terms)\n val num_terms = terms.size\n println(\"${num_terms}\")\n for (t in terms) {\n print(\"${t} \")\n }\n println()\n }\n}\n"}], "src_uid": "033068c5e16d25f09039e29c88474275"} {"source_code": "// based on tutorial\nfun main() {\n val (a, b, c) = readLine()!!.split(\" \").map(String::toInt)\n if ((a + b + c) % 2 == 1) return print(\"Impossible\")\n val y = (b - a + c) / 2\n val x = a + y - c\n val z = a - x\n if (x < 0 || y < 0 || z < 0) return print(\"Impossible\")\n print(\"$x $y $z\")\n}\n\n// 36 minutes, debugging needed\n//fun main() {\n// fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n//\n// val valences = readInts().mapIndexed { index, i -> i to index }.sortedBy { it.first }.toTypedArray()\n// if (valences[0].first + valences[1].first < valences[2].first) return print(\"Impossible\")\n// if (valences.sumBy { it.first } % 2 == 1) return print(\"Impossible\")\n// val sumToPos = mapOf(1 to 0, 3 to 1, 2 to 2)\n// val bonds = arrayOf(0, 0, 0)\n// // step 1: valences 0 and 1 became the same\n// if (valences[0].first != valences[1].first) {\n// val delta = valences[1].first - valences[0].first\n// bonds[sumToPos[valences[1].second + valences[2].second]!!] = delta\n// valences[1] = valences[1].first - delta to valences[1].second\n// valences[2] = valences[2].first - delta to valences[2].second\n// }\n// // step 2: all valences became the same\n// if (valences[0].first != valences[2].first) {\n// val delta = valences[2].first - valences[0].first\n// bonds[sumToPos[valences[0].second + valences[2].second]!!] += delta\n// bonds[sumToPos[valences[1].second + valences[2].second]!!] += delta\n// valences[0] = valences[0].first - delta to valences[0].second\n// }\n// // step 3: all valences are the same, add to bonds the value\n// for (pos in 0 .. 2)\n// bonds[pos] += valences[0].first / 2\n// print(bonds.joinToString(\" \"))\n//}", "positive_code": [{"source_code": "import java.io.*\nimport java.math.BigDecimal\nimport java.math.BigInteger\nimport java.util.*\n\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 //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(System.`in`)\n .useOutputSource(System.out)\n .useScanner(FastScanner())\n .solveTask(TaskA())\n .run()\n\n\n class TaskA: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val (firstValency, secondValency, thirdValency) = scanner.nextLine()\n .split(\" \")\n .map { it.toLong() }\n val averageValency = (firstValency + secondValency + thirdValency) / 2\n\n if ((firstValency + secondValency + thirdValency) % 2 != 0L ) { printer.println(\"Impossible\"); return }\n\n val countOfConnectionsFirst = averageValency - thirdValency\n val countOfConnectionsSecond = averageValency - firstValency\n val countOfConnectionsThird = averageValency - secondValency\n\n when {\n countOfConnectionsFirst < 0 -> { printer.println(\"Impossible\"); return }\n countOfConnectionsSecond < 0 -> { printer.println(\"Impossible\"); return }\n countOfConnectionsThird < 0 -> { printer.println(\"Impossible\"); return }\n else -> printer.println(\"$countOfConnectionsFirst $countOfConnectionsSecond $countOfConnectionsThird\")\n }\n }\n\n }\n}\n"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val valences = readInts().mapIndexed { index, i -> i to index }.sortedBy { it.first }.toTypedArray()\n if (valences[0].first + valences[1].first < valences[2].first) return print(\"Impossible\")\n if (valences.sumBy { it.first } % 2 == 1) return print(\"Impossible\")\n val sumToPos = mapOf(1 to 0, 3 to 1, 2 to 2)\n val bonds = arrayOf(0, 0, 0)\n // step 1: valences 0 and 1 became the same\n if (valences[0].first != valences[1].first) {\n val delta = valences[1].first - valences[0].first\n bonds[sumToPos[valences[1].second + valences[2].second]!!] = delta\n valences[1] = valences[1].first - delta to valences[1].second\n valences[2] = valences[2].first - delta to valences[2].second\n }\n // step 2: all valences became the same\n if (valences[0].first != valences[2].first) {\n val delta = valences[2].first - valences[0].first\n bonds[sumToPos[valences[0].second + valences[2].second]!!] += delta\n bonds[sumToPos[valences[1].second + valences[2].second]!!] += delta\n valences[0] = valences[0].first - delta to valences[0].second\n }\n // step 3: all valences are the same, add to bonds the value\n for (pos in 0 .. 2)\n bonds[pos] += valences[0].first / 2\n print(bonds.joinToString(\" \"))\n}"}], "negative_code": [{"source_code": "import java.io.*\nimport java.math.BigDecimal\nimport java.math.BigInteger\nimport java.util.*\n\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 //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(System.`in`)\n .useOutputSource(System.out)\n .useScanner(FastScanner())\n .solveTask(TaskA())\n .run()\n\n\n class TaskA: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val (firstValency, secondValency, thirdValency) = scanner.nextLine()\n .split(\" \")\n .map { it.toLong() }\n val averageValency = (firstValency + secondValency + thirdValency) / 2\n val countOfConnectionsFirst = averageValency - thirdValency\n val countOfConnectionsSecond = averageValency - firstValency\n val countOfConnectionsThird = averageValency - secondValency\n\n when {\n (firstValency + secondValency + thirdValency) / 2 % 1 != 0L -> { printer.println(\"Impossible\"); return }\n countOfConnectionsFirst < 0 -> { printer.println(\"Impossible\"); return }\n countOfConnectionsSecond < 0 -> { printer.println(\"Impossible\"); return }\n countOfConnectionsThird < 0 -> { printer.println(\"Impossible\"); return }\n else -> printer.println(\"$countOfConnectionsFirst $countOfConnectionsSecond $countOfConnectionsThird\")\n }\n }\n\n }\n}\n"}], "src_uid": "b3b986fddc3770fed64b878fa42ab1bc"} {"source_code": "fun main(){\n val b = readLine()!!.split(\"\").distinct().count()\n if ( b % 2 == 1) print( \"CHAT WITH HER!\" ) else print( \"IGNORE HIM!\")\n}", "positive_code": [{"source_code": "fun main(args: Array) {\n val count = readLine()!!.toSet().size\n println(if (count % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}\n\n"}, {"source_code": "fun main() {\n print(if (readLine()!!.split(\"\").distinct().drop(1).count() % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}"}, {"source_code": "fun main(args:Array){\n val word = readLine()!!\n\n val symbols = mutableSetOf()\n\n word.forEach {\n symbols.add(it)\n }\n\n if (symbols.size %2 == 0){\n print(\"CHAT WITH HER!\")\n } else {\n print(\"IGNORE HIM!\")\n }\n}"}, {"source_code": "fun main(args: Array) {\n var s=readLine()\n if (s == null) s=\"ADS\"\n if (s.chars().distinct().count().toInt() % 2 == 0) print(\"CHAT WITH HER!\")\n else print(\"IGNORE HIM!\")\n}"}, {"source_code": "import java.util.*\n\n fun main(){\n var input = Scanner(System.`in`)\n var inputString = input.nextLine()\n if(inputString.toCharArray().distinct().size % 2 == 0){\n print(\"CHAT WITH HER!\")\n }else{\n print(\"IGNORE HIM!\")\n }\n\n\n\n }\n\n\n\n\n\n\n\n\n"}, {"source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\nimport java.util.TreeSet\n\nfun main() {\n output {\n val s = readLn()\n\n val ans = s.toCollection(HashSet()).size % 2 == 0\n\n println(if(ans) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n }\n}\n\ndata class Run(val item: T, val num: Int)\n\nfun String.runs() = sequence {\n val i = iterator()\n\n if(i.hasNext().not()) return@sequence\n var last = i.next()\n var num = 1\n\n for(e in i) {\n if(last == e) num++\n else {\n yield(Run(last, num))\n last = e\n num = 1\n }\n }\n yield(Run(last, num))\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"}, {"source_code": "// https://codeforces.com/problemset/problem/236/A\n\nfun main(args: Array) {\n //even female\n //odd mail\n\n val name = readLn()\n val characterSet = mutableSetOf()\n for (character in name) {\n characterSet.add(character)\n }\n if (characterSet.size % 2 == 0) {\n print(\"CHAT WITH HER!\")\n } else {\n print(\"IGNORE HIM!\")\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"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val str = scan.next()\n val symbolsList = mutableSetOf()\n str.forEach {\n symbolsList.add(it)\n }\n if(symbolsList.count() % 2 == 0) {\n println(\"CHAT WITH HER!\")\n } else {\n println(\"IGNORE HIM!\")\n }\n}"}, {"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 distinct = s.groupBy { it }.keys.size\n println(\n if (distinct % 2 == 1){\n \"IGNORE HIM!\"\n } else {\n \"CHAT WITH HER!\"\n }\n )\n}"}, {"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.*\n\nfun main(args: Array) {\n\n val scanner = Scanner(System.`in`)\n val n = scanner.next()\n val set = TreeSet()\n for (i in n)\n set.add(i)\n if (set.size % 2 == 0)\n println(\"CHAT WITH HER!\")\n else\n println(\"IGNORE HIM!\")\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//}"}, {"source_code": "fun 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\n\nfun getUnique(s: String): Int {\n val unique = hashSetOf()\n for (ch in s) unique.add(ch)\n return unique.size\n}\n\nfun main(args: Array) {\n val s = readLn()\n println(if (getUnique(s) % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}"}, {"source_code": "// kotlin oj template code from uwi(Codeforces), and convert to kotlin by lety\nimport java.io.ByteArrayInputStream\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.PrintWriter\nimport java.util.Arrays\nimport java.util.InputMismatchException\nimport kotlin.math.absoluteValue\n\nlateinit var `is`: InputStream\nlateinit var out: PrintWriter\nvar INPUT = \"\"\n\n//val oj = System.getProperty(\"ONLINE_JUDGE\") != null\nval oj = true\nval inbuf = ByteArray(1024)\nvar lenbuf = 0\nvar ptrbuf = 0\n\nlateinit var cum: Array\n\nfun solve()\n{\n val s = ns()\n val cnt = IntArray(26)\n\n for(i in 0 until s.length) {\n cnt[(s[i] - 'a')] = 1\n }\n\n if(cnt.sum() % 2 == 0)\n {\n println(\"CHAT WITH HER!\" )\n }\n else\n {\n println(\"IGNORE HIM!\")\n }\n}\n\n\nfun main() {\n `is` = if (oj) System.`in` else ByteArrayInputStream(INPUT.toByteArray())\n out = PrintWriter(System.out)\n\n val s = System.currentTimeMillis()\n solve()\n out.flush()\n tr((System.currentTimeMillis() - s).toString() + \"ms\")\n}\n\nprivate fun readByte(): Int {\n if (lenbuf == -1) throw InputMismatchException()\n if (ptrbuf >= lenbuf) {\n ptrbuf = 0\n try {\n lenbuf = `is`.read(inbuf)\n } catch (e: IOException) {\n throw InputMismatchException()\n }\n\n if (lenbuf <= 0) return -1\n }\n return inbuf[ptrbuf++].toInt()\n}\n\nprivate fun isSpaceChar(c: Int): Boolean = !(c >= 33 && c <= 126)\n\nprivate fun skip(): Int {\n var b: Int = readByte()\n while (b != -1 && isSpaceChar(b)) {\n b = readByte()\n }\n return b\n}\n\n// using ns()\nprivate fun nd(): Double = ns().toDouble()\n\n// using ns()\nprivate fun nc(): Char = skip().toChar()\n\n// input until whitespace\nprivate fun ns(): String {\n var b = skip()\n val sb = StringBuilder()\n while (!isSpaceChar(b)) { // when nextLine, (isSpaceChar(b) && b != ' ')\n sb.appendCodePoint(b)\n b = readByte()\n }\n return sb.toString()\n}\n\nprivate fun ns(n: Int): CharArray {\n val buf = CharArray(n)\n var b = skip()\n var p = 0\n while (p < n && !isSpaceChar(b)) {\n buf[p++] = b.toChar()\n b = readByte()\n }\n return if (n == p) buf else Arrays.copyOf(buf, p)\n}\n\n// matrix\nprivate fun nm(n: Int, m: Int): Array {\n val map = Array(n) { CharArray(m) }\n for (i in 0 until n) map[i] = ns(m)\n return map\n}\n\nprivate fun pm(matrix: Array) {\n val n = matrix.size\n val m = matrix[0].size\n repeat(n)\n {\n repeat(m)\n { jt ->\n out.print(matrix[it][jt])\n }\n out.println()\n }\n out.flush()\n}\n\n// int array\nprivate fun na(n: Int): IntArray {\n val a = IntArray(n)\n for (i in 0 until n) a[i] = ni()\n return a\n}\n\nprivate fun ni(): Int {\n var num = 0\n var b: Int = readByte()\n var minus = false\n while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {\n b = readByte()\n }\n if (b == '-'.toInt()) {\n minus = true\n b = readByte()\n }\n\n while (true) {\n if (b >= '0'.toInt() && b <= '9'.toInt()) {\n num = num * 10 + (b - '0'.toInt())\n } else {\n return if (minus) -num else num\n }\n b = readByte()\n }\n}\n\nprivate fun nl(): Long {\n var num: Long = 0\n var b: Int = readByte()\n var minus = false\n while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {\n b = readByte()\n }\n if (b == '-'.toInt()) {\n minus = true\n b = readByte()\n }\n\n while (true) {\n if (b >= '0'.toInt() && b <= '9'.toInt()) {\n num = num * 10 + (b - '0'.toInt())\n } else {\n return if (minus) -num else num\n }\n b = readByte()\n }\n}\n\nprivate fun tr(vararg o: Any) {\n// if (!oj) println(Arrays.deepToString(o))\n}\n\n"}, {"source_code": "fun main(args: Array) {\n val firstString =readLine()!!.toSet()\n if (firstString.size % 2 == 0 ) print(\"CHAT WITH HER!\") else print(\"IGNORE HIM!\")\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n var scan = Scanner(System.`in`)\n\n var name = scan.nextLine()\n\n var _name = name.toCharArray().distinct()\n\n if(_name.size %2 == 0) {\n println(\"CHAT WITH HER!\")\n } else {\n println(\"IGNORE HIM!\")\n }\n}"}, {"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) = 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 t = io.readToken()\n val l = t.toSet().size\n io.println(if (l % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n io.close()\n}\n\nfun main(args: Array) {\n Thread({ solve() }).start()\n}\n"}, {"source_code": "fun main()\n{\n var given = readLine()!!\n var done = \"\"\n var has = 0\n for (i in given)\n {\n if (done.contains(i)) continue\n else {\n done += i\n has++\n }\n }\n if (has % 2 == 0)\n {\n println(\"CHAT WITH HER!\" )\n }\n else\n {\n println(\"IGNORE HIM!\")\n }\n}\n"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val n = r.readLine()!!.split(\"\").toSet().size\n println(if (n%2==1) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}"}, {"source_code": "fun main(args: Array) {\n val s = readLine()!!\n if (s.chars().distinct().count() % 2 == 0L)\n print(\"CHAT WITH HER!\")\n else\n print(\"IGNORE HIM!\")\n}"}, {"source_code": "fun main(args: Array) {\n var s = readLine()!!\n if (s.chars().distinct().count() % 2 == 0L)\n print(\"CHAT WITH HER!\")\n else\n print(\"IGNORE HIM!\")\n}"}, {"source_code": "fun main(args: Array) {\n val a = readLine()!!.toCharArray()\n if (a.distinct().count() % 2 == 0) {\n print(\"CHAT WITH HER!\")\n } else {\n print(\"IGNORE HIM!\")\n }\n}"}, {"source_code": "fun main() {\n\tval nick = readLine()!!\n\tval charSet = hashSetOf()\n\tnick.forEach {charSet += it }\n\tprintln(if (charSet.size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}\n"}, {"source_code": "import java.util.regex.Pattern\nfun main(args: Array) {\n\n var text = readLine()!!\n if (Pattern.matches(\"[a-z]+\", text))\n {\n var charArray = text.toCharArray().distinct()\n if (charArray.joinToString(\"\").length%2==0)\n {\n print(\"CHAT WITH HER!\")\n }else\n print(\"IGNORE HIM!\")\n\n }\n\n\n}"}, {"source_code": "fun main() {\n\n val input = readLine()!!.split(\"\")\n\n val distinctChar = input.distinct()\n\n if (distinctChar.size % 2 == 0) {\n print(\"IGNORE HIM!\")\n } else {\n print(\"CHAT WITH HER!\")\n }\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.min\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`);\n val n = scanner.next()\n val set = mutableSetOf()\n for (c in n.asIterable()) {\n set.add(c);\n }\n\n if (set.count() % 2 == 0) print(\"CHAT WITH HER!\")\n else print(\"IGNORE HIM!\")\n}\n"}, {"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 print(if (readLn().split(\"\").distinct().count() % 2 == 1) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}\n"}, {"source_code": "\n\nfun main() {\n readLine()?.let {\n checkGender(it)\n }\n}\n\nfun checkGender(name : String) {\n val counts = name.toSet().size\n val answer = if (counts % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\"\n println(answer)\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.HashSet\n\nfun main() {\n val sc = Scanner(System.`in`)\n val s1 = sc.nextLine().toLowerCase()\n val set = HashSet()\n for (ch in s1)\n set.add(ch)\n print(if(set.size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}"}, {"source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\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 `CF236-D2-A` {\n fun solveTestCase(): String {\n val set = mutableSetOf()\n for (c in read()) {\n set.add(c)\n }\n\n return if (set.size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\"\n }\n}\n\nfun main(args: Array) {\n outputWriter.println(\n `CF236-D2-A`()\n .solveTestCase()\n )\n\n outputWriter.flush()\n}"}, {"source_code": "fun main(args: Array) {\n val name: String = readLine()!!\n val chars: MutableSet = name.toCharArray().toMutableSet()\n if (chars.count() %2 == 0) {\n print(\"CHAT WITH HER!\")\n } else {\n print(\"IGNORE HIM!\")\n }\n}"}, {"source_code": "fun main() = readLine()!!.let(String::toHashSet).run { size % 2 == 0 }.let { isGirl -> if (isGirl) \"CHAT WITH HER!\" else \"IGNORE HIM!\" }.run(::println)"}, {"source_code": "fun main(args: Array) {\n val str = readLine()!!\n (str.toCharArray().distinct().size % 2 == 0).sheOrHe()\n .also { println(it) }\n}\n\nprivate fun Boolean.sheOrHe() = if (this) \"CHAT WITH HER!\" else \"IGNORE HIM!\"\n"}, {"source_code": "fun main(args: Array) {\n readLine()!!.let {\n println(if (it.toSet().size.rem(2) == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n }\n }"}, {"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 word = s.next()\n if(Distinct(word)% 2 == 0){\n print(\"CHAT WITH HER!\")\n }else{\n print(\"IGNORE HIM!\")\n }\n\n}\n\nfun Distinct(str:String):Int{\n \n val distinct = LinkedHashSet()\n val builder = StringBuilder()\n for(i in 0 .. str.length-1){\n if(distinct.add(str.get(i))){\n builder.append(str.get(i))\n }\n }\n return builder.length\n}\n"}, {"source_code": "fun main(args: Array) {\nval s = readLine()!!\nvar c = \"\"\n for(item in s){\nif(!c.contains(item)){\nc+=item\n}\n\n }\nvar x = c.length\nwhen {\n x%2 != 0 -> print(\"IGNORE HIM!\")\n else -> print(\"CHAT WITH HER!\")\n \n}\n \n \n }"}, {"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 string = reader.next()\n val set = hashSetOf()\n for (i in 0 until string.length) {\n set.add(string.elementAt(i))\n }\n println(if (set.count() % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\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}"}, {"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(if (input.next().toSet().size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\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}"}, {"source_code": "/* https://codeforces.com/problemset/problem/236/A */\n\nfun main() {\n val name = readLine()!!\n val numOfDistinctChars = name.toSet().size\n if (numOfDistinctChars % 2 == 1) {\n println(\"IGNORE HIM!\")\n } else {\n println(\"CHAT WITH HER!\")\n }\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.lang.StringBuilder\n\nfun main(){\n var chars :Set = BufferedReader(InputStreamReader(System.`in`)).readLine().toCharArray().toSet()\n println(if (chars.size % 2 == 0)\"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}\n\n\n"}, {"source_code": "fun main(args: Array) {\n var s = readLine()\n var l = arrayListOf()\n for (i in s!!){\n l.add(i.toString())\n }\n if (l.toSet().size%2==1){\n println(\"IGNORE HIM!\")\n }else{\n println(\"CHAT WITH HER!\")\n }\n}"}, {"source_code": "import java.util.*\n fun main()\n {\n var str = readLine();\n val hash: MutableMap = HashMap()\n for (i in 0 until str!!.length)\n {\n hash[str!![i]] = str[i]\n }\n if (hash.size % 2 == 0)\n {\n println(\"CHAT WITH HER!\")\n }\n else\n {\n println(\"IGNORE HIM!\")\n }\n }\n"}, {"source_code": "import java.util.*\n\n\n fun main(args: Array)\n {\n val `in` = Scanner(System.`in`)\n val str = `in`.nextLine()\n val hash: MutableMap = HashMap()\n for (i in 0 until str.length)\n {\n hash[str[i]] = str[i]\n }\n if (hash.size % 2 == 0)\n {\n println(\"CHAT WITH HER!\")\n }\n else\n {\n println(\"IGNORE HIM!\")\n }\n }\n"}, {"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 username = readLn().toSet()\n\n if (username.size % 2 == 0) {\n println(\"CHAT WITH HER!\")\n } else {\n println(\"IGNORE HIM!\")\n }\n}\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val s: Scanner = Scanner(System.`in`)\n val str: String = s.next()\n val set = str.toHashSet()\n print(if (set.size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}"}, {"source_code": "fun main(args: Array) {\n\n print(if (readLine()!!.toCharArray().distinct().size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n reader.use {\n var el = it.readLine().toSet()\n print(if (el.size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n }\n}"}, {"source_code": "import java.util.Scanner\n\nprivate const val CHAT_WITH_HER = \"CHAT WITH HER!\"\nprivate const val IGNORE_HIM = \"IGNORE HIM!\"\nprivate const val OFFSET = 'a'\nprivate const val LATIN_ALPHABET_LENGTH = 26\nprivate val BUCKET = IntArray(LATIN_ALPHABET_LENGTH)\n\nfun main(args: Array) {\n Scanner(System.`in`).use {\n val answer = determineGender(it.next())\n clearBucket()\n println(answer)\n }\n}\n\nprivate fun determineGender(nickname: String): String {\n return if (uniqueCharactersCount(nickname).isEven()) {\n CHAT_WITH_HER\n } else {\n IGNORE_HIM\n }\n}\n\nprivate fun uniqueCharactersCount(word: String): Int {\n var uniqueCount = 0\n val charsCount = word.length\n for (i in 0 until charsCount) {\n val index = word[i] - OFFSET\n if (BUCKET[index] == 0) {\n ++uniqueCount\n BUCKET[index] = 1\n }\n }\n return uniqueCount\n}\n\nprivate fun clearBucket() {\n for (i in 0 until LATIN_ALPHABET_LENGTH) {\n BUCKET[i] = 0\n }\n}\n\nprivate fun Int.isEven() = this % 2 == 0"}, {"source_code": "fun main(args: Array) {\n val s = readLine()!!\n val m = s.groupingBy { it }.eachCount().size\n println(if (m % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n\n}"}, {"source_code": "fun main(args: Array) {\n val userName = readLine()!!\n val singleSet = mutableSetOf()\n userName.forEach{ char->\n singleSet.add(char)\n }\n println(if(singleSet.size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}"}, {"source_code": "// codeforces problem 236 A\n\nfun main() {\n println( if (readLine()!!.groupBy { it }.size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}\n"}, {"source_code": "fun main(args:Array){val a=hashSetOf();for(z in readLine()!!.toList())a.add(z);print(\"${if(a.size%2==0)\"CHAT WITH HER!\" else \"IGNORE HIM!\"}\")}"}, {"source_code": "//1.2 | CodeForces.Com\nfun main(args: Array)\n{\n val distinctChars = hashSetOf() //Abbreviation: Distinct characters\n \n for(input in readLine()!!.toList())\n distinctChars.add(input)\n\n print(\"${if (distinctChars.size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\"}\")\n}"}, {"source_code": "//rextester.com:1.1--codeforces.com:1.0.5-2\nfun main(args:Array){\n val b=hashSetOf();for(c in readLine()!!.toList())if(!b.contains(c))b.add(c)\n print(\"${if(b.size%2==0)\"CHAT WITH HER!\" else \"IGNORE HIM!\"}\")\n}"}, {"source_code": "import java.lang.AssertionError\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 = readLn()\n var x = mutableSetOf()\n for (c in s) {\n x.add(c)\n }\n if (x.size % 2 == 0) {\n println(\"CHAT WITH HER!\")\n } else {\n println(\"IGNORE HIM!\")\n }\n}\n"}, {"source_code": "fun main(args: Array) {\n println(if (readLine()!!.toCharArray().toSet().size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}"}, {"source_code": "//rextester.com:1.1--codeforces.com:1.0.5-2\nfun main(args:Array){\n val a=readLine()!!.toList()\n val b=hashSetOf();for(c in a)if(!b.contains(c))b.add(c)\n print(\"${if(b.size%2==0)\"CHAT WITH HER!\" else \"IGNORE HIM!\"}\")\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\n/**\n * Created by Hamza on 17/02/2018.\n */\nfun main(args: Array) {\n var br = BufferedReader(InputStreamReader(System.`in`))\n var st = StringTokenizer(br.readLine())\n var str = st!!.nextToken()\n var l = str.length\n var count = IntArray(26)\n for (i in 0..l - 1) {\n count[str[i].toInt() - 'a'.toInt()]++\n }\n var countor = 0\n for (i in 0..25) {\n if (count[i] != 0) {\n countor++\n }\n }\nif (countor%2 == 0) println(\"CHAT WITH HER!\")else println(\"IGNORE HIM!\")\n}\n"}, {"source_code": "fun main(){\n var s = readLine()!!\n var a = arrayOf(\"q\",\"w\",\"e\",\"r\",\"t\",\"y\",\"u\",\"i\",\"o\",\"p\",\"a\",\"s\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"z\",\"x\",\"c\",\"v\",\"b\",\"n\",\"m\")\n var k = \"\"\n for (i in 0..25){\n for (j in 0..s.length -1){\n if (a[i].compareTo(s[j].toString()) == 0){\n k = k + a.get(i)\n break\n }\n }\n }\n if ((k.length) % 2 == 0) println(\"CHAT WITH HER!\") else println(\"IGNORE HIM!\")\n}"}, {"source_code": "fun main() {\n val v = readLine()!!.toCharArray().distinct().size % 2 != 0\n println(if (v) \"IGNORE HIM!\" else \"CHAT WITH HER!\")\n }"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val name = reader.readLine()\n val set = setOf(*name.toCharArray().toTypedArray())\n val output = if (set.size % 2 != 0) \"IGNORE HIM!\" else \"CHAT WITH HER!\"\n println(output)\n}"}, {"source_code": "fun main(args : Array) {\n var name = readLine()!!\n var s = name[0].toString()\n var dif = true\n for (i in 1..(name.length-1)){\n dif = true\n for (j in 0..(s.length-1)){\n if (name[i] == s[j])\n dif = false\n }\n if(dif)\n s += name[i]\n }\n if (s.length % 2 == 0)\n println(\"CHAT WITH HER!\")\n else\n println(\"IGNORE HIM!\")\n}"}, {"source_code": "fun main() {\n val s = readLine()!!\n if (s.toSet().size % 2 == 1) {\n println(\"IGNORE HIM!\")\n } else {\n println(\"CHAT WITH HER!\")\n }\n}\n"}, {"source_code": "import java.util.*\nfun main(args: Array) {\n val input = Scanner(System.`in`).nextLine()\n val count = input.chars().distinct().count().toInt()\n if (count % 2 == 0) {\n println(\"CHAT WITH HER!\")\n } else {\n println(\"IGNORE HIM!\")\n }\n\n}"}, {"source_code": "fun main(args: Array) {\n print(\n if (readLine()!!.toSet().size % 2 == 0)\n \"CHAT WITH HER!\"\n else\n \"IGNORE HIM!\"\n )\n}\n"}, {"source_code": "fun main() {\n\n val userName = readLine()!!\n val myList = ArrayList()\n\n userName.forEach {\n if(!myList.contains(it)){\n myList.add(it)\n }\n }\n\n if(myList.size%2 == 0) print(\"CHAT WITH HER!\")\n else print(\"IGNORE HIM!\")\n}\n\n\n"}, {"source_code": "fun main(args: Array) {\n var chat = readLine()!!.toSet().size % 2 == 0\n println(if (chat) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}"}, {"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\nconst val success = \"CHAT WITH HER!\"\nconst val failure = \"IGNORE HIM!\"\n\nfun main() {\n val username = readLn()\n\n if (username.toList().distinct().size % 2 == 0) println(success) else println(failure)\n}\n"}, {"source_code": "fun main() {\n val s = readLine()!!.toCharArray().toMutableSet()\n if(s.size % 2 == 1)\n println(\"IGNORE HIM!\")\n else\n println(\"CHAT WITH HER!\")\n}"}, {"source_code": "fun main() {\n println(if (hashSetOf().apply { addAll(readLine()!!.toList()) }.size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}\n\n\n\n\n"}, {"source_code": "fun main(args: Array) {\n val s = readLine()!!\n val arr = Array(s.length, { i -> s[i]})\n arr.sort()\n var cnt = 0\n for (i in arr.indices) {\n if (i == 0) {\n cnt++\n } else if (i > 0 && arr[i] != arr[i-1]) {\n cnt++\n }\n }\n if (cnt % 2 == 0) {\n print(\"CHAT WITH HER!\\n\")\n } else {\n print(\"IGNORE HIM!\\n\")\n }\n}\n"}, {"source_code": "//package problem236A\n\nfun numDistinctCharacters(username: String): Int {\n val letterMap = hashMapOf()\n\n for (char in username) {\n letterMap[char] = (letterMap[char] ?: 0) + 1\n }\n return letterMap.size\n}\n\nfun main() {\n val input = readLine()!!\n println(if (numDistinctCharacters(input) % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}\n"}, {"source_code": "\nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\n\n\nfun boyOrGirl(): String {\n\n val usrname = readLn().toSet()\n\n return if (usrname.size % 2 == 0)\n \"CHAT WITH HER!\"\n else \"IGNORE HIM!\"\n}\n\nfun main() {\n print(boyOrGirl())\n}\n"}, {"source_code": "import java.util.*\n\nfun main()\n{\n var scanner = Scanner(System.`in`)\n var str = scanner.next()\n var flag = true\n var counter = 0\n var visited = mutableMapOf()\n for(i in 0 until str.length)\n {\n if(visited[str[i]]==null)\n {\n visited[str[i]] = true\n counter++\n }\n }\n if(counter % 2 == 0)\n println(\"CHAT WITH HER!\")\n else\n println(\"IGNORE HIM!\")\n\n}\n"}, {"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 name = readLn()\n when (name.toCharArray().distinct().size % 2) {\n 0 -> println(\"CHAT WITH HER!\")\n else -> println(\"IGNORE HIM!\")\n }\n}\n"}, {"source_code": "fun main(args: Array)\n{\n val s = readLine()!!\n val a = Array(26, {0})\n for (c in s)\n a[c - 'a'] = 1\n val diff = a.count({i -> i > 0})\n println(if (diff % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}"}, {"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 }"}, {"source_code": "fun main() {\n if (readLine()!!.toSet().size % 2 == 1) {\n println(\"IGNORE HIM!\")\n }\n else{\n println(\"CHAT WITH HER!\")\n }\n}"}, {"source_code": "fun main(args: Array) {\n val name = readLine()!!\n\n if (name.toSet().count().rem(2) == 0)\n println(\"CHAT WITH HER!\")\n else\n println(\"IGNORE HIM!\")\n}"}, {"source_code": "fun main() {\n val name: String? = readLine()\n val charSet: MutableSet = mutableSetOf()\n\n // covert string to char\n name!!.forEach { index -> charSet.add(index)}\n\n if (charSet.size % 2 == 0)\n println(\"CHAT WITH HER!\")\n else\n println(\"IGNORE HIM!\")\n}"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array){\n val scan = Scanner(System.`in`)\n val s = scan.next().toCharArray()\n var count = 0\n\n for (i in 0 until s.size){\n for (x in i+1 until s.size){\n if (s[i] == s[x]) s[x] = ' '\n }\n if (s[i] != ' ') count++\n }\n if (count%2 == 0) print(\"CHAT WITH HER!\")\n else print(\"IGNORE HIM!\")\n}"}, {"source_code": "typealias int = Int\n\nfun main() {\n var s1 = readLine()\n var set : MutableSet = mutableSetOf();\n for(i in 0..s1!!.lastIndex){\n set.add(s1[i])\n }\n println(if(set.size % 2== 0 ) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}"}, {"source_code": "fun main() {\n var chars = readLine()!!.toCharArray()\n var set : Set = chars.toSet()\n println(if(set.size % 2== 0 ) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}"}, {"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(\"CHAT WITH HER!\")\n else\n println(\"IGNORE HIM!\")\n}"}, {"source_code": "import java.util.Scanner\n\nfun main(){\n var input = Scanner(System.`in`)\n var s = input.next()\n var length = removeDistincts(s).length\n if(length % 2 == 0)\n println(\"CHAT WITH HER!\")\n else\n println(\"IGNORE HIM!\")\n}\nfun removeDistincts(str : String) : String {\n\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 var j = 1\n while (i < arr.size-1){\n j = i +1\n while (j < arr.size) {\n if (arr.get(i) == arr.get(j)) {\n arr.removeAt(j)\n } else\n j++\n }\n i++\n }\n return arr.toString()\n\n}"}, {"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\tval str = readLn()\n\n\tif (str.toSet().size % 2 == 0)\n\t\tprintln(\"CHAT WITH HER!\")\n\telse\n\t\tprintln(\"IGNORE HIM!\")\n}\n"}, {"source_code": "import java.util.*\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val username = scanner.next().toSet()\n\n if (username.size % 2 == 0) {\n println(\"CHAT WITH HER!\")\n } else {\n println(\"IGNORE HIM!\")\n }\n}"}, {"source_code": "fun main() {\n val data = readLine()!!.map { it.toString() }.sorted()\n\n val unique = data.reduce { acc, s ->\n if (acc.last().toString() == s) acc else acc + s\n }.length\n if (unique % 2 == 0) {\n println(\"CHAT WITH HER!\")\n } else {\n println(\"IGNORE HIM!\")\n }\n}"}, {"source_code": "fun main(args: Array) {\n\tval userInput: String? = readLine()\n\tval user = userInput!!\n\tprintln(checkIfMale(user))\n}\n\nfun checkIfMale(user: String): String {\n\tval listOfChars = user.toList();\n\tval set = hashSetOf()\n\tfor(char in listOfChars){\n\t\tif(!set.contains(char)){\n\t\t\tset.add(char)\n\t\t}\n\t}\n\t\n\treturn if(set.size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\"\n}"}, {"source_code": "/**\n *\n * Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a\n * user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so).\n * After that they talked very often and eventually they became a couple in the network.\n *\n * But yesterday, he came to see \"her\" in the real world and found out \"she\" is actually a very strong man! Our hero is\n * very sad and he is too tired to love again now. So he came up with a way to recognize users' genders by their user names.\n *\n * This is his method: if the number of distinct characters in one's user name is odd, then he is a male, otherwise she\n * is a female. You are given the string that denotes the user name, please help our hero to determine the gender of this user by his method.\n *\n * Input\n * The first line contains a non-empty string, that contains only lowercase English letters \u2014 the user name. This string contains at most 100 letters.\n *\n * Output\n * If it is a female by our hero's method, print \"CHAT WITH HER!\" (without the quotes), otherwise, print \"IGNORE HIM!\" (without the quotes).\n */\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(\"CHAT WITH HER!\")\n }\n else{\n // the number of distinct chars is odd\n println(\"IGNORE HIM!\")\n }\n}"}, {"source_code": "fun main() {\n val username = readLine()!!.toCharArray()\n val distinctChars = username.distinct()\n print(if(distinctChars.size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}"}], "negative_code": [{"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 }"}, {"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}"}, {"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"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val result = reader.readLine().length % 2 == 0\n println(if (result) \"IGNORE HIM!\" else \"CHAT WITH HER!\")\n}"}, {"source_code": "fun main(args: Array) {\n val count = readLine()!!.toSet().size\n println(if (count % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM\")\n}\n\n"}, {"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}"}], "src_uid": "a8c14667b94b40da087501fd4bdd7818"} {"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++\n }\n }\n println(ans)\n}", "positive_code": [{"source_code": "import java.util.*\n\nval reader = Scanner(System.`in`)\nvar c = 0\nvar ans = 0\nfun main(args: Array) {\n val n = reader.nextInt()\n for (i in 1..n)\n c+=reader.nextInt()\n for (i in 1..5)\n {\n if ((i+c)%(n+1) !=1)\n ans++\n }\n /*if ((c+1)%(n+1)==1)\n println(2)\n else\n println(3)*/\n println(ans)\n}"}, {"source_code": "fun main(args: Array) {\n\n var n = readLine()!!.toLong()\n n++\n\n var sum = 0L\n var res = 0L\n\n readLine()!!.split(' ').map { sum += it.toLong() }\n\n sum--;\n\n for (i in 1..5) {\n if ((sum + i) % n != 0L) res++\n }\n\n print(res)\n\n\n\n}\n"}, {"source_code": "fun main() {\n var n = readLine()!!.toInt() + 1\n val total = readLine()!!.split(\" \").map{ it.toInt() }.reduce{ sum, e -> sum + e }\n var count = 0\n for(i in 1..5) {\n if((i + total) % n != 1)\n count++\n }\n println(count)\n}"}], "negative_code": [{"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}"}, {"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}"}], "src_uid": "ff6b3fd358c758324c19a26283ab96a4"} {"source_code": "fun main(args: Array) {\n val reg = Regex(\" \")\n var s = readLine()!!.split(reg)\n val n = s[0].toInt()\n var w = s[1].toLong()\n s = readLine()!!.split(reg)\n var a: List = (0..n - 1).map { s[it].toLong() }\n //a = a.sorted().reversed()\n val b: List = (0..n - 1).map { if (a[it] % 2 == 1L) (a[it] + 1) / 2 else a[it] / 2 }\n if (b.sum() > w)\n println(-1)\n else{\n w -= b.sum()\n var c: List> = (0..n - 1).map { Pair(a[it], it) }\n c = c.sortedBy { it.first }.reversed()\n val ans = Array(n, {i -> 0L})\n var i = 0\n while (w > 0 && i < n){\n val pos = c[i].second\n ans[pos] = if (a[pos] < b[pos] + w) a[pos] else b[pos] + w\n w -= (ans[pos] - b[pos])\n ++i\n }\n if (w > 0)\n println(-1)\n else {\n for (j in 0..n - 1)\n print(\"${if (ans[j] == 0L) b[j] else ans[j]} \")\n }\n }\n}", "positive_code": [{"source_code": "import java.lang.*\nimport java.util.*\nimport kotlin.collections.*\nimport kotlin.math.*\n\nval read = Scanner(System.`in`)\n\nfun main(){\n var n = read.nextInt()\n var w = read.nextInt()\n var a = Array>(n){Pair(30, 5)}\n for (i in a.indices){\n var t = read.nextInt()\n a[i] = Pair(t, i)\n }\n a.sortByDescending { it.first }\n var b = Array>(n){Pair(30, 5)}\n var Sum = 0\n for (i in a.indices){\n var t = ceil(a[i].first.toDouble() / 2).toInt()\n b[i] = Pair(t, a[i].second)\n Sum += t\n }\n\n if (Sum > w){\n print(-1)\n }\n else{\n var cont = w - Sum\n for (i in a.indices){\n //println(\"${b[i].first} $cont\")\n if (b[i].first + cont > a[i].first){\n cont -= (a[i].first - b[i].first)\n b[i] = b[i].copy(first = a[i].first)\n }\n else{\n b[i] = b[i].copy(first = b[i].first + cont)\n cont = 0\n }\n }\n b.sortBy { it.second }\n for (i in b) print(\"${i.first} \")\n }\n}"}, {"source_code": "import java.util.*\n\nfun main(vararg args: String) {\n\n data class Cup(val p: Int, val a: Int, var f: Int = 0)\n\n fun Int.halfUp() = (this + 1) shr 1\n\n with(Scanner(System.`in`)) {\n val n = nextInt()\n val w = nextInt()\n val cups = Array(n) { i -> Cup(i, nextInt()) }\n val halfSum = cups.sumBy { it.a.halfUp() }\n if (halfSum > w) println(-1)\n else {\n var extra = w - halfSum\n val s = cups.sortedBy { -it.a }\n var c = 0\n s.forEach {\n it.f = it.a.halfUp()\n val e = extra.coerceAtMost(it.a - it.f)\n it.f += e\n extra -= e\n }\n println(cups.joinToString(\" \") { it.f.toString() })\n }\n }\n}\n"}, {"source_code": "\nfun debug(x: Any) {\n System.err.println(x)\n}\n\nfun main(args: Array) {\n val (n, w) = readLine()!!.split(\" \").map { it.toInt() }\n val a = readLine()!!.split(\" \").map { it.toInt() }.toMutableList()\n val indexes = a.mapIndexed { index, x -> x to index }.sortedBy { it.first }.map { it.second }\n val sa = a.sorted()\n val b = IntArray(a.size)\n var rem = w\n for ((index, x) in sa.withIndex()) {\n val min = (x + 1) / 2\n if (rem < min) {\n println(-1)\n return\n }\n b[index] = min\n rem -= min\n }\n require(b.toList() == b.sorted())\n for (i in sa.size - 1 downTo 0) {\n val add = Math.min(sa[i] - b[i], rem)\n b[i] += add\n rem -= add\n if (rem == 0) {\n break\n }\n }\n val answer = b.mapIndexed { index, x -> indexes[index] to x }.sortedBy { it.first }.map { it.second }\n println(answer.joinToString(\" \"))\n}"}], "negative_code": [{"source_code": "import java.lang.*\nimport java.util.*\nimport kotlin.collections.*\nimport kotlin.math.*\n\nval read = Scanner(System.`in`)\n\nfun main(){\n var n = read.nextInt()\n var w = read.nextInt()\n var a = Array>(n){Pair(30, 5)}\n for (i in a.indices){\n var t = read.nextInt()\n a[i] = Pair(t, i)\n }\n a.sortByDescending { it.first }\n var b = Array>(n){Pair(30, 5)}\n var Sum = 0\n for (i in a.indices){\n var t = ceil(a[i].first.toDouble() / 2).toInt()\n b[i] = Pair(t, a[i].second)\n Sum += t\n }\n\n if (Sum > w){\n print(-1)\n }\n else{\n var cont = w - Sum\n for (i in a.indices){\n //println(\"${b[i].first} $cont\")\n if (b[i].first + cont >= a[i].first){\n cont = a[i].first - b[i].first\n b[i] = b[i].copy(first = a[i].first)\n }\n else{\n b[i] = b[i].copy(first = b[i].first + cont)\n cont = 0\n }\n }\n b.sortBy { it.second }\n for (i in b) print(\"${i.first} \")\n }\n}"}, {"source_code": "import java.lang.*\nimport java.util.*\nimport kotlin.collections.*\nimport kotlin.math.*\n\nval read = Scanner(System.`in`)\n\nfun main(){\n var n = read.nextInt()\n var w = read.nextInt()\n var a = Array(n){0}\n for (i in a.indices) a[i] = read.nextInt()\n a.sort()\n var b = Array(n){0}\n for (i in a.indices) b[i] = ceil(a[i].toDouble() / 2).toInt()\n\n //println(b.sum())\n if (b.sum() > w){\n print(-1)\n }\n else{\n var cont = w - b.sum()\n for (i in a.indices){\n if (b[i] + cont > a[i]){\n cont = a[i] - b[i]\n b[i] = a[i]\n }\n else{\n b[i] += cont\n cont = 0\n }\n }\n print(b.joinToString(\" \"))\n }\n}"}, {"source_code": "import java.lang.*\nimport java.util.*\nimport kotlin.collections.*\nimport kotlin.math.*\n\nval read = Scanner(System.`in`)\n\nfun main(){\n var n = read.nextInt()\n var w = read.nextInt()\n var a = Array>(n){Pair(30, 5)}\n for (i in a.indices){\n var t = read.nextInt()\n a[i] = Pair(t, i)\n }\n a.sortBy { it.first }\n var b = Array>(n){Pair(30, 5)}\n var Sum = 0\n for (i in a.indices){\n var t = ceil(a[i].first.toDouble() / 2).toInt()\n b[i] = Pair(t, a[i].second)\n Sum += t\n }\n\n //println(b.sum())\n if (Sum > w){\n print(-1)\n }\n else{\n var cont = w - Sum\n for (i in a.indices){\n if (b[i].first + cont > a[i].first){\n cont = a[i].first - b[i].first\n b[i] = b[i].copy(first = a[i].first)\n //b[i].first = a[i].first\n }\n else{\n b[i] = b[i].copy(first = b[i].first + cont)\n //b[i].first += cont\n cont = 0\n }\n }\n b.sortBy { it.second }\n for (i in b) print(\"${i.first} \")\n }\n}"}, {"source_code": "import java.lang.*\nimport java.util.*\nimport kotlin.collections.*\nimport kotlin.math.*\n\nval read = Scanner(System.`in`)\n\nfun main(){\n var n = read.nextInt()\n var w = read.nextInt()\n var a = Array>(n){Pair(30, 5)}\n for (i in a.indices){\n var t = read.nextInt()\n a[i] = Pair(t, i)\n }\n a.sortByDescending { it.first }\n var b = Array>(n){Pair(30, 5)}\n var Sum = 0\n for (i in a.indices){\n var t = ceil(a[i].first.toDouble() / 2).toInt()\n b[i] = Pair(t, a[i].second)\n Sum += t\n }\n\n //println(b.sum())\n if (Sum > w){\n print(-1)\n }\n else{\n var cont = w - Sum\n for (i in a.indices){\n if (b[i].first + cont > a[i].first){\n cont = a[i].first - b[i].first\n b[i] = b[i].copy(first = a[i].first)\n //b[i].first = a[i].first\n }\n else{\n b[i] = b[i].copy(first = b[i].first + cont)\n //b[i].first += cont\n cont = 0\n }\n }\n b.sortBy { it.second }\n for (i in b) print(\"${i.first} \")\n }\n}"}, {"source_code": "fun main(args: Array) {\n val reg = Regex(\" \")\n var s = readLine()!!.split(reg)\n val n = s[0].toInt()\n var w = s[1].toLong()\n s = readLine()!!.split(reg)\n var a: List = (0..n - 1).map { s[it].toLong() }\n //a = a.sorted().reversed()\n val b: List = (0..n - 1).map { if (a[it] % 2 == 1L) (a[it] + 1) / 2 else a[it] / 2 }\n if (b.sum() > w)\n println(-1)\n else{\n w -= b.sum()\n var c: List> = (0..n - 1).map { Pair(a[it], it) }\n c = c.sortedBy { it.first }.reversed()\n val ans = Array(n, {i -> 0L})\n var i = 0\n while (w > 0 && i < n){\n val pos = c[i].second\n ans[pos] = if (a[pos] < b[pos] + w) a[pos] else b[pos] + w\n w -= (ans[pos] - b[pos])\n ++i\n }\n if (i == n)\n println(-1)\n else {\n for (j in 0..n - 1)\n print(\"${if (ans[j] == 0L) b[j] else ans[j]} \")\n }\n }\n}"}], "src_uid": "5d3bb9e03f4c5c8ecb6233bd5f90f3a3"} {"source_code": "import java.io.*\nimport java.math.BigInteger\nimport java.util.*\nimport kotlin.Comparator\nimport kotlin.math.ceil\nimport kotlin.math.max\nimport kotlin.math.min\n\nval reader = BufferedReader(InputStreamReader(System.`in`))\n\nfun readIntList() = reader.readLine().split(' ').map(String::toInt)\nfun readLongList() = reader.readLine().split(' ').map(String::toLong)\nfun readStringList() = reader.readLine().split(' ')\nfun readInt() = reader.readLine().toInt()\nfun readLong() = reader.readLine().toLong()\nfun readDouble() = reader.readLine().toDouble()\n\nfun main(args: Array) {\n val list = listOf(\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\")\n val n = readInt()\n\n var i = 0\n var d = 1\n while (i < n){\n i += d\n if(n <= i){\n println(list[0])\n return\n }\n\n i += d\n if(n <= i){\n println(list[1])\n return\n }\n\n i += d\n if(n <= i){\n println(list[2])\n return\n }\n\n i += d\n if(n <= i){\n println(list[3])\n return\n }\n\n i += d\n if(n <= i){\n println(list[4])\n return\n }\n\n d *= 2\n }\n\n}", "positive_code": [{"source_code": "\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"}, {"source_code": "fun main(args: Array) {\n DoubleCola()\n}\n\nfun DoubleCola() {\n val names = arrayOf(\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\")\n var n = readLine()!!.toInt()\n var min: Int = 1\n var max: Int = 0\n for (k in 0..Int.MAX_VALUE) {\n var t = (Math.pow(2.0, k.toDouble())).toInt()\n min += 5 * (t / 2)\n max += 5 * t\n if (n <= max) {\n n = (n - min) / t\n println(names[n])\n break\n }\n }\n}\n"}, {"source_code": "fun 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 var width = 5\n var num = 0L\n while (num + width < n) {\n num += width\n width *= 2\n }\n when{\n (n-num)/width.toDouble()<=0.2 -> println(\"Sheldon\")\n (n-num)/width.toDouble()<=0.4 -> println(\"Leonard\")\n (n-num)/width.toDouble()<=0.6 -> println(\"Penny\")\n (n-num)/width.toDouble()<=0.8 -> println(\"Rajesh\")\n (n-num)/width.toDouble()<=1.0 -> println(\"Howard\")\n }\n}\n"}, {"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 main(){\n var n=readInt();n--\n var names=arrayOf(\"Sheldon\",\"Leonard\",\"Penny\",\"Rajesh\",\"Howard\")\n var sz=1\n while(sz*5<=n){\n n-=sz*5\n sz*=2\n }\n printLine(names[n/sz])\n output()\n}"}, {"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 fun main(args: Array) {\n val scanner = FastScanner(System.`in`)\n val n = scanner.nextInt()\n val set = arrayListOf(\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\")\n var s = 5\n var r = 1\n var k = 0\n while(n - s > 0) {\n k = s\n r *= 2\n s += r * 5\n }\n println(set[(n-k-1)/r])\n }\n}"}, {"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 until multiplier -> \"Sheldon\"\n in multiplier until 2 * multiplier -> \"Leonard\"\n in 2 * multiplier until 3 * multiplier -> \"Penny\"\n in 3 * multiplier until 4 * multiplier -> \"Rajesh\"\n in 4 * multiplier until 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}\n"}, {"source_code": "fun main(args: Array) {\n var n= readLine()!!.toInt()\n val arr=ArrayList()\n arr.add(\"Sheldon\")\n arr.add(\"Leonard\")\n arr.add(\"Penny\")\n arr.add(\"Rajesh\")\n arr.add(\"Howard\")\n while (n>5)\n n=n/2-2\n println(arr[n-1])\n\n}"}, {"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 (w, sum) = findWindow(n)\n val segmentSize = pow(2, w.toLong())\n val i = if (n <= 5) 1 else sum - 5*segmentSize\n val j = n - i\n println(\n when (j / segmentSize){\n 0L -> \"Sheldon\"\n 1L -> \"Leonard\"\n 2L -> \"Penny\"\n 3L -> \"Rajesh\"\n else -> \"Howard\"\n }\n )\n\n}\n\nfun pow(a: Long, n: Long): Long {\n tailrec fun go(a: Long, n: Long, acc: Long): Long =\n if (a == 0L) 0\n else if (n == 0L) 1\n else if (n == 1L) a * acc\n else if (n % 2 == 0L) go(a * a, n/2, acc)\n else go(a * a, (n - 1)/2, a * acc)\n\n return go(a, n, 1)\n}\n\nfun findWindow (n: Int): Pair{\n tailrec fun go (i: Int, sum: Int, exp: Int): Pair =\n if (n <= sum) i to sum\n else go(i + 1, sum + 5*exp, exp*2)\n\n return go(0, 5, 2)\n}"}, {"source_code": "import kotlin.math.pow\nfun main(args: Array) {\n doubleCola(Integer.parseInt(readLine()))\n}\n\nfun doubleCola(nthCola:Int){\n\n var elements = 5*(2.0.pow(0))\n var nthEbene = 1\n var range = 0.0\n\n while(elements println(\"Sheldon\")\n nthCola <= range+((elements-range)/5)*2 -> println(\"Leonard\")\n nthCola <= range+((elements-range)/5)*3 -> println(\"Penny\")\n nthCola <= range+((elements-range)/5)*4 -> println(\"Rajesh\")\n nthCola <= range+((elements-range)/5)*5 -> println(\"Howard\")\n }\n}"}, {"source_code": "import kotlin.math.sign\n\nfun main(args: Array) {\n val n = readLine()!!.toInt()\n var m = 0\n var c = 1\n while (n > m + c * 5) {\n m += c * 5\n c *= 2\n }\n println(arrayOf(\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\")[(n - m - 1) / c])\n}"}, {"source_code": "fun main() {\n var n = readLine()!!.toInt()\n var k = 1\n while (k * 5 < n) {\n n -= k * 5\n k *= 2\n }\n\n n = (n - 1) / k\n println(arrayOf(\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\")[n])\n}"}, {"source_code": "fun main() {\n fun readLong() = readLine()!!.toLong()\n\n val people = arrayOf(\"\", \"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\")\n val n = readLong()\n var current = 0L\n var multiplier = 1L\n while (current + multiplier * 5 < n) {\n current += multiplier * 5\n multiplier *= 2\n }\n val pos = (n - current) / multiplier + (if ((n - current) % multiplier == 0L) 0 else 1)\n print(people[pos.toInt()])\n}\n"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport kotlin.math.ceil\n\nval names = listOf(\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\")\n\nval size = names.count()\n\nfun f(n: Int): Int {\n if (n <= size) {\n return n - 1\n }\n var sum: Int = size\n var prevSum: Int = size\n var perLevel = 2\n var prevPerLevel = 2\n var height = 1\n while (sum < n) {\n prevSum = sum\n prevPerLevel = perLevel\n sum += perLevel * 5\n perLevel *= 2\n height++\n }\n val offset: Int = n - prevSum\n val result = ceil(offset / prevPerLevel.toDouble()).toInt()\n return result - 1\n}\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val n: Int = reader.readLine().toInt()\n val result = f(n)\n println(names[result])\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toLong()\n var s = 1L\n var l = 1L\n var p = 1L\n var r = 1L\n var h = 1L\n var sum = 0L\n while (true) {\n sum += s\n if (sum >= n) {\n println(\"Sheldon\")\n return\n }\n s *= 2\n\n sum += l\n if (sum >= n) {\n println(\"Leonard\")\n return\n }\n l *= 2\n\n sum += p\n if (sum >= n) {\n println(\"Penny\")\n return\n }\n p *= 2\n\n sum += r\n if (sum >= n) {\n println(\"Rajesh\")\n return\n }\n r *= 2\n\n sum += h\n if (sum >= n) {\n println(\"Howard\")\n return\n }\n h *= 2\n }\n}\n"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val a = arrayOf(\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\")\n\n val map = IntArray(5, { 1 })\n\n var step = 0\n var i = 0\n\n while (step < n) {\n step += map[i]\n if (step >= n) println(a[i])\n\n map[i]*=2\n i++\n if (i >= 5) i = 0\n }\n\n\n}"}, {"source_code": "fun printAnswer(number: Int) {\n val names = arrayOf(\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\")\n println(names[number - 1])\n}\n\nfun main(args: Array) {\n val n = readLine()!!.toInt()\n\n if (n <= 5) {\n printAnswer(n)\n return\n }\n\n var doubles = 1\n var c = 5\n \n while (c < n) {\n doubles *= 2\n c += doubles * 5\n }\n var bottom = c - doubles * 5\n var answer = 0\n while (bottom < n) {\n answer ++\n bottom += doubles\n }\n printAnswer(answer)\n}"}, {"source_code": "import java.io.InputStreamReader\nimport java.util.Scanner\n\nfun main(args: Array) {\n val reader = Scanner(InputStreamReader(System.`in`))\n val n = reader.nextInt()\n val names = listOf(\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\")\n var queueSize = 5\n var queueStart = 0\n while (queueStart + queueSize < n) {\n queueStart += queueSize\n queueSize *= 2\n }\n println(names[(n - queueStart - 1) / (queueSize / 5)])\n}"}, {"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\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}"}], "negative_code": [{"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}"}, {"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}"}, {"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}"}, {"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}"}, {"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}"}], "src_uid": "023b169765e81d896cdc1184e5a82b22"} {"source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\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 */\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n val a = readInt()\n val b = readInt()\n val n = readInt()\n\n val mc = ArrayModCombinatorics(n)\n\n var ans = ModInt(0)\n for(i in 0..n) {\n val sum = a * i + b * (n-i)\n if(sum.toString().all { (it - '0').let { it == a || it == b } }) ans += mc.C(n, i)\n }\n println(ans.int)\n}\n\nclass ArrayModCombinatorics(val maxn: Int) {\n val factorial = ModIntArray(maxn + 1).also {\n it[0] = ModInt(1)\n for(i in 1 .. maxn) {\n it[i] = it[i-1] * i\n }\n }\n\n val invf = ModIntArray(maxn + 1).also {\n it[maxn] = factorial[maxn].inv_unmemoized()\n for(i in maxn downTo 1) {\n it[i-1] = it[i] * i\n }\n }\n\n fun P(n: Int, k: Int) = if(k > n) ModInt(0) else factorial[n] * invf[n-k]\n fun C(n: Int, k: Int) = if(k > n) ModInt(0) else factorial[n] * invf[k] * invf[n-k]\n}\n\nconst val BILLION7 = 1e9.toInt() + 7\nconst val MOD = BILLION7\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) }\ninline fun Array.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }\ninline fun Array.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\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)\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}", "positive_code": [{"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nval m = (1e9 + 7).toLong()\nval maxN = (1e6 + 300).toInt()\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)\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 * acc) % m\n else if (x % 2 == 0L) go((a * a) % m, x/2, acc)\n else go((a * a) % m, (x - 1)/2, (a * acc) % m)\n }\n return go(a % m, x ,1)\n}\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}"}], "negative_code": [{"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}"}], "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81"} {"source_code": "class C {\n fun run() {\n val sourceLine = readLine()!!\n val alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n var alphabetIndex = 0\n val result = StringBuilder()\n for (letter in sourceLine) {\n if(alphabetIndex < alphabet.length) {\n result.append(if (letter <= alphabet[alphabetIndex]) {\n alphabet[alphabetIndex++]\n } else letter)\n } else result.append(letter)\n }\n println(if(alphabetIndex < alphabet.length) \"-1\" else result.toString())\n }\n}\n\nfun main(args: Array) {\n C().run()\n}", "positive_code": [{"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 val s = reader.next().toCharArray()\n var i = 0\n var t = 0\n while (i < s.size && t != 26) {\n val c = 'a' + t\n if (c < s[i]) {\n i++\n continue\n }\n\n s[i] = c\n i++\n t++\n }\n if (t != 26) {\n writer.print(\"-1\")\n } else {\n writer.print(StringBuilder().append(s))\n }\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"}, {"source_code": "\nfun main(args: Array) {\n System.`in`.bufferedReader().use {\n val s = it.readLine()\n\n // Find 'a'.\n var i = 0\n while (i < s.length && s[i] != 'a')\n ++i\n\n if (i >= s.length) {\n println(-1)\n return\n }\n\n val start = i\n ++i\n var ok = true\n for (ch in 'b' .. 'z') {\n while (i < s.length && s[i] > ch)\n ++i\n if (i >= s.length) {\n ok = false\n break\n }\n ++i\n }\n\n if (!ok) {\n println(-1)\n return\n }\n\n for (j in 0 .. start)\n print(s[j])\n\n i = start + 1\n for (ch in 'b' .. 'z') {\n while (i < s.length && s[i] > ch) {\n print(s[i])\n ++i\n }\n assert(i < s.length)\n print(ch)\n ++i\n }\n while (i < s.length)\n print(s[i++])\n println()\n }\n}\n"}, {"source_code": "fun main() {\n val text = readLine()!!.toCharArray()\n var expected = 'a'\n for (pos in 0 until text.size) {\n if (text[pos] <= expected) {\n text[pos] = expected\n expected++\n if (expected > 'z') {\n break\n }\n }\n }\n print(if (expected > 'z') text.joinToString(\"\") else -1)\n}\n"}], "negative_code": [{"source_code": "fun main() {\n val text = readLine()\n var found = false\n var start = 0\n var pos = start\n var expected = 'a'\n while (pos < text!!.length && !found) {\n if(text[pos] <= expected) {\n expected++\n if (expected > 'z') {\n found = true\n }\n } else {\n start = pos + 1\n expected = 'a'\n }\n pos++\n }\n if (!found) {\n print(-1)\n } else {\n if(start > 0) {\n print(text.substring(0, start))\n }\n print(\"abcdefghijklmnopqrstuvwxyz\")\n if(start + 26 < text.length) {\n print(text.substring(start + 26 - 1))\n }\n }\n}"}, {"source_code": "fun main() {\n val text = readLine()\n if (text!!.startsWith(\"kilxjakqdnsopqjyylldfwahknloaiqyhulluazaiacxsthvpsyvsaxwjjeukaqkndvnnamjdoygfxweyarcvxfxgjbqgusleydluvixsvgyaojqfaheitonqtnng\")) {\n print(text.substring(500))\n }\n var found = false\n var start = 0\n var pos = start\n var expected = 'a'\n while (pos < text!!.length && !found) {\n if(text[pos] <= expected) {\n expected++\n if (expected > 'z') {\n found = true\n }\n } else {\n start = pos + 1\n expected = 'a'\n }\n pos++\n }\n if (!found) {\n print(-1)\n } else {\n if(start > 0) {\n print(text.substring(0, start))\n }\n print(\"abcdefghijklmnopqrstuvwxyz\")\n if(start + 26 < text.length) {\n print(text.substring(start + 26 - 1))\n }\n }\n}"}, {"source_code": "fun main() {\n val text = readLine()\n var found = false\n var start = 0\n var pos = start\n var expected = 'a'\n while (start < text!!.length && !found) {\n if(text[pos] <= expected) {\n expected++\n if (expected > 'z') {\n found = true\n }\n } else {\n start = pos + 1\n expected = 'a'\n }\n pos++\n }\n if (!found) {\n print(-1)\n } else {\n if(start > 0) {\n print(text.substring(0, start))\n }\n print(\"abcdefghijklmnopqrstuvwxyz\")\n if(start + 26 < text.length) {\n print(text.substring(start + 26 - 1))\n }\n }\n}"}], "src_uid": "f8ad543d499bcc0da0121a71a26db854"} {"source_code": "import java.util.Queue\nimport java.util.LinkedList\nimport kotlin.collections.*\nimport kotlin.math.*\nimport java.util.Scanner\nimport java.lang.Math.floorMod\nimport java.lang.Math.floorDiv\nimport java.io.File\nimport kotlin.comparisons.compareBy\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\ndata class Point(val x: Long, val y: Long)\n\n\n\nfun main(args: Array) {\n val mod = 1000000007L\n val n = readLong()\n var prevCnt = 4L\n var fact = 6L\n for (i in 4..n) {\n \n prevCnt = (2L*prevCnt) % mod\n fact = (fact*i) % mod\n } \n \n println(floorMod(fact - prevCnt, mod))\n\n}\n", "positive_code": [{"source_code": "/* template start */\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.util.*\n\nprivate val br = BufferedReader(InputStreamReader(System.`in`))\nprivate var st = StringTokenizer(\"\")\n\nprivate fun readString(): String {\n while (!st.hasMoreTokens()) try {\n st = StringTokenizer(br.readLine())\n } catch (e: IOException) {\n e.printStackTrace()\n }\n return st.nextToken()\n}\n\nprivate fun readInt(): Int = readString().toInt()\nprivate fun readLong(): Long = readString().toLong()\nprivate fun readDouble(): Double = readString().toDouble()\nprivate fun readArray(n: Int) = IntArray(n) { readInt() }\nprivate fun readLongArray(n: Int) = LongArray(n) { readLong() }\nprivate fun readDoubleArray(n: Int) = DoubleArray(n) { readDouble() }\n\nprivate fun queries(block: (Int) -> Unit) = repeat(readInt(), block)\n\n/* template end */\n\nprivate val MOD = (1e9 + 7).toInt()\n\nfun main() {\n val n = readInt()\n var ans = 1L\n for (i in 2..n) {\n ans = (ans * i) % MOD\n }\n var pow = 1L\n for (i in 1..n-1)\n pow = (pow * 2L) % MOD\n\n println((ans - pow + MOD) % MOD)\n}"}, {"source_code": "import java.math.BigInteger\n\ntailrec fun fac(n: BigInteger, acc: BigInteger): BigInteger =\n if (n == BigInteger.ONE) acc else fac(\n n - BigInteger.ONE,\n acc * n % BigInteger.valueOf(1000000007)\n )\n\nfun pow(a: Int):Long{\n var n = a\n var base = 2L\n var num = 1L\n while (n> 0){\n if (n% 2== 1){\n num = num* base%1000000007L\n }\n n /= 2\n base = base*base%1000000007L\n }\n return num\n}\nfun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val len = r.readLine()!!.toInt()\n //val (n, m, k) = r.readLine()!!.split(\" \").map { it.toInt() }\n val n = r.readLine()!!.toLong()\n var ans = fac(BigInteger.valueOf(n), BigInteger.ONE) - pow((n-1).toInt()).toBigInteger()\n if (ans< BigInteger.ZERO) ans += BigInteger.valueOf(1000000007)\n println(ans)\n}"}, {"source_code": "import javafx.scene.layout.Priority\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashMap\nimport kotlin.math.*\nimport kotlin.system.exitProcess\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 MOD = 1_000_000_000 + 7\n val n = readInt()\n\n var result = 1L\n\n for (i in 1..n) {\n result = result * i % MOD\n }\n\n var x = 1L\n for (i in 1..n-1) {\n x = (2 * x) % MOD\n }\n\n result = (result - x) % MOD\n if (result < 0) {\n result += MOD\n }\n\n println(result)\n}"}, {"source_code": "fun main() {\n val n = readInt()\n\n val mod = 1000000007L\n val factorial = (1L..n).reduce { acc, num -> (acc * num) % mod }\n val pow2 = (1 until n).fold(1L) { acc, _ -> (acc * 2) % mod }\n\n println(((factorial + mod) - pow2) % mod)\n}\n\n// Input Reader\nprivate fun readLn() = readLine()!!\n\nprivate fun readInt() = readLn().toInt()"}, {"source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n//@file:OptIn(ExperimentalStdlibApi::class)\n\nimport java.io.File\nimport java.io.PrintWriter\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 */\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n// val startTime = System.nanoTime()\n\n val numCases = 1//readInt()\n case@ for(case in 1..numCases) {\n// print(\"Case #$case: \")\n\n val n = readInt()\n\n val ans = (1..n).productByModInt { ModInt(it) } - ModInt(2).pow(n-1)\n\n println(ans)\n }\n\n// iprintln(\"Time: ${(System.nanoTime() - startTime) / 1000000} ms\")\n}\n\nconst val BILLION7 = 1e9.toInt() + 7\nconst val MOD = BILLION7\nconst val TOTIENT = MOD - 1 // assumes MOD is prime\n\ninfix fun Int.modulo(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }\ninfix fun Long.modulo(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }\ninfix fun Long.modulo(mod: Int) = modulo(mod.toLong()).toInt()\n\nfun Int.mulMod(other: Int, mod: Int) = toLong() * other modulo mod\n\nfun Int.powMod(exponent: Long, mod: Int): Int {\n if(exponent < 0) error(\"Inverse not implemented\")\n var res = 1L\n var e = exponent\n var b = modulo(mod).toLong()\n\n while(e > 0) {\n if(e and 1 == 1L) {\n res = res * b % mod\n }\n e = e shr 1\n b = b * b % mod\n }\n return res.toInt()\n}\nfun Int.powMod(exponent: Int, mod: Int) = powMod(exponent.toLong(), mod)\nfun Int.modPowArray(n: Int, mod: Int): IntArray {\n val res = IntArray(n+1)\n res[0] = 1\n for(i in 1..n) res[i] = mulMod(res[i-1], mod)\n return res\n}\n\ninline fun Int.toModInt() = ModInt(this modulo MOD)\ninline fun Long.toModInt() = ModInt(this modulo 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 modulo 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 modulo 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(int.modPowArray(n, MOD))\n\ninline fun ModIntArray.first() = get(0)\ninline fun ModIntArray.last() = get(lastIndex)\ninline fun ModIntArray.joinToString(separator: CharSequence) = intArray.joinToString(separator)\ninline fun ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }\ninline fun ModIntArray.foldRight(init: R, op: (ModInt, acc: R) -> R) = intArray.foldRight(init) { i, acc -> op(ModInt(i), acc) }\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) }\ninline fun Array.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }\ninline fun Array.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 */\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\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(c != '\\n' && c != Char.MIN_VALUE) {\n append(c)\n c = readChar()\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\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)\n"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\n\n// ModInt\n// region\nclass ModInt(x: Long) {\n\n companion object {\n const val MOD = 1000000007L\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()\nval invfac = mutableListOf()\n\nfun fact(n: Long, b: Boolean): ModInt {\n if (fac.count() == 0) {\n fac.add(ModInt(1))\n invfac.add(ModInt(1))\n }\n while (fac.count() <= n) {\n fac.add(fac.last() * ModInt(fac.count().toLong()))\n invfac.add(fac.last().inv())\n }\n return if (b) {\n fac[n.toInt()]\n } else {\n invfac[n.toInt()]\n }\n}\n\nfun comb(n: Long, k: Long): ModInt {\n return fact(n, true) * fact(k, false) * fact(n - k, false)\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 var fac = ModInt(1)\n for (i in 1..n) {\n fac *= ModInt(i)\n }\n println(fac - ModInt(2).pow(n - 1))\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}"}, {"source_code": "fun main() {\n val mod = 1000000007\n val n = readLine()!!.toLong()\n var yes = 0L\n var no = 2L\n for (i in 3..n) {\n yes = (i * yes + (i - 2) * no) % mod\n no = (2 * no) % mod\n }\n println(yes)\n}"}, {"source_code": "import java.util.*\nconst val MOD=1000000007\nconst val MODL=1000000007L\n\n\nfun main() {\n val n = readInt()\n var ans = 1L\n for (i in 2..n) ans=(ans*i)%MODL\n ans=(ans-mp(2L,(n-1).toLong())+MODL)%MODL\n println(ans)\n}\n\nfun gcd (a: Int,b: Int): Int = if (b==0) a else gcd(b,a%b)\nfun mp (a: Long,p: Long): Long {\n var ret=1L\n var pow=p\n var x=a\n while (pow>0) {\n if ((pow and 1)>0) ret=(ret*x)%MODL\n pow=pow.shr(1)\n x=(x*x)%MODL\n }\n return ret\n}\nfun YN(b: Boolean) : String { return if (b) \"YES\" else \"NO\" }\nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readLong() = readLn().toLong()\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of longs\nfun readDoubles() = readStrings().map { it.toDouble() } // list of doubles"}, {"source_code": "fun modFactorial (n: Long, mod: Long) : Long {\n var result = 1L\n for (i in 1..n) result = (result * i) % mod\n return result\n}\n\nfun modExp (base: Long, exp: Long, mod: Long) : Long {\n var b = base\n var e = exp\n var result = 1L\n while (e > 0) {\n if (e % 2L == 0L) {\n b = (b * b) % mod\n e /= 2L\n } else {\n result = (result * b) % mod\n e--\n }\n }\n return result\n}\n\nfun cyclePermutations (n : Long, mod : Long) : Long {\n val r = modFactorial(n, mod) - modExp(2, n - 1, mod)\n return (r + mod) % mod\n}\n\nfun main() {\n val p = 1000000007L\n val n = readLine()!!.toLong()\n println(cyclePermutations(n, p))\n}"}, {"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 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\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}\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\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 val fact = n.factorialModulo()\n val pow = 2.moduloArithmetic().pow(n-1)\n\n println(fact - pow)\n}\n"}, {"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 = 1.moduloArithmetic()\n for (i in 1 until n) {\n fact *= i+1\n pow *= 2\n }\n\n println(fact - pow)\n}\n"}, {"source_code": "import java.util.*\n\nprivate inline fun debug(str: () -> Any?) = println(str().toString()) //{}\nprivate inline fun readInt() = reader.nextInt()\nprivate inline fun readLong() = reader.nextLong()\nprivate inline fun readDouble() = reader.nextDouble()\nprivate inline fun readArr() = readLine()!!.split(\" \").map { it.toInt() }\nprivate inline fun readArr(n: Int) = List(n) { reader.nextInt() }\nprivate inline fun readArrLong() = readLine()!!.split(\" \").map { it.toLong() }\nprivate inline fun readArrLong(n: Int) = List(n) { reader.nextLong() }\nprivate inline fun readArrDouble() = readLine()!!.split(\" \").map { it.toDouble() }\nprivate inline fun readArrDouble(n: Int) = List(n) { reader.nextDouble() }\nprivate inline fun readLineAsCharList() = reader.nextLine().asSequence().toList()\nprivate inline fun readAndSolve(f: () -> Unit): Unit {\n val n = readInt()\n // usually n is the only value in string\n reader.nextLine()\n repeat(n) { f() }\n}\n\nprivate fun Boolean.yn() = if (this) \"YES\" else \"NO\"\nprivate fun Iterable.out() = this.joinToString(\" \")\nprivate val reader = Scanner(System.`in`.bufferedReader()).apply { useLocale(Locale.US) }\n\n\n@ExperimentalStdlibApi\nfun main() = solve1391C()\n\n@ExperimentalStdlibApi\nprivate fun solve1391C() {\n\n val n = readInt()\n\n val mod = 1000_000_007L\n\n // ans = n! - 2^(n-1)\n\n var fact = 1L\n for (i in 2..n)\n fact = (fact * i) % mod\n\n var powtwo = 2L\n for (i in 3..n)\n powtwo = (powtwo * 2) % mod\n\n val ans = (fact + (mod - powtwo) % mod ) % mod\n\n println(ans)\n\n}\n"}, {"source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.*\n\nfun main(){\n\tval f = BufferedReader(InputStreamReader(System.`in`))\n\n\tval n = f.readLine().toInt()\n\n\tval MOD : Long = 1000000007L\n\n\tval fac = LongArray(1000005){0L}\n\tval pow2 = LongArray(1000005){0L}\n\tfac[0] = 1L\n\tpow2[0] = 1L\n\n\tfor(k in 1 until 1000005){\n\t\tfac[k] = (k.toLong()*fac[k-1] + MOD)%MOD\n\t\tpow2[k] = (2L*pow2[k-1] + MOD)%MOD\n\t}\n\n\tval answer = ((fac[n]-pow2[n-1] + MOD)%MOD+MOD)%MOD\n\tprintln(answer)\n}\n"}, {"source_code": "const val MOD = 1000000007L\n\nfun main() {\n val n = readLine()!!.toInt()\n var answer = 1L\n for (j in 1L..n.toLong()) {\n answer *= j\n answer %= MOD\n }\n var subtractend = 1L\n for (j in 2..n) {\n subtractend *= 2L\n subtractend %= MOD\n }\n answer -= subtractend\n answer %= MOD\n answer += MOD\n answer %= MOD\n println(answer)\n}"}, {"source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.*\n\nfun min(a: Int, b: Int): Int {\n if (a < b) {\n return a\n } else { \n return b\n }\n}\n\nfun max(a: Int, b: Int): Int {\n if (a > 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-1) {\n\tans *= i\n\tans %= mn\n\n\tif (i.toInt() != 1) {\n\t minus *= 2\n\t minus %= mn\n\t}\n }\n\n ans = (n*ans - minus*2) % mn\n\n writer.write(\"$ans\\n\")\n \n writer.flush()\n reader.close()\n writer.close()\n}\n"}], "negative_code": [{"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"}, {"source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.*\n\nfun min(a: Int, b: Int): Int {\n if (a < b) {\n return a\n } else { \n return b\n }\n}\n\nfun max(a: Int, b: Int): Int {\n if (a > 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"}], "src_uid": "3dc1ee09016a25421ae371fa8005fce1"} {"source_code": "fun main(args: Array) {\n var count=0\n var n = readLine()!!.toInt()\n var C = readLine()!!\n for (i in 1..C.length -1) {\n if (C[i] == C[i-1]){\n count+=1\n }\n }\n print(count)\n }", "positive_code": [{"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 n = inp.readlnInt()\n val a = inp.readln()\n var i = 0\n var ans = 0\n while(i < n){\n var j = i\n while(j < n && a[i] == a[j]){\n ++j\n }\n ans += j - i - 1\n i = j\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}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val stones = sc.next()\n println(removeCount(stones))\n}\n\nfun removeCount(stones: String) = (0..stones.length - 2).filter { stones[it] == stones[it+1] }.count()\n"}, {"source_code": "import java.util.*\nimport kotlin.math.min\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n var stack = ' '\n val n = scanner.nextInt()\n val str = scanner.next()\n var res = 0\n (0 until n)\n .asSequence()\n .map { str[it] }\n .forEach {\n if (it == stack)\n res++\n else\n stack = it\n }\n print(res)\n}"}, {"source_code": "// kotlin oj template code from uwi(Codeforces), and convert to kotlin by lety\nimport java.io.ByteArrayInputStream\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.PrintWriter\nimport java.util.Arrays\nimport java.util.InputMismatchException\nimport kotlin.math.absoluteValue\n\nlateinit var `is`: InputStream\nlateinit var out: PrintWriter\nvar INPUT = \"\"\n\n//val oj = System.getProperty(\"ONLINE_JUDGE\") != null\nval oj = true\nval inbuf = ByteArray(1024)\nvar lenbuf = 0\nvar ptrbuf = 0\n\nlateinit var cum: Array\n\nfun solve()\n{\n val n = ni()\n val s = ns()\n var r = 0\n\n for(i in 1 until n)\n {\n if( s[i] == s[i-1] )\n {\n r++\n }\n }\n\n println(r)\n}\n\n\nfun main() {\n `is` = if (oj) System.`in` else ByteArrayInputStream(INPUT.toByteArray())\n out = PrintWriter(System.out)\n\n val s = System.currentTimeMillis()\n solve()\n out.flush()\n tr((System.currentTimeMillis() - s).toString() + \"ms\")\n}\n\nprivate fun readByte(): Int {\n if (lenbuf == -1) throw InputMismatchException()\n if (ptrbuf >= lenbuf) {\n ptrbuf = 0\n try {\n lenbuf = `is`.read(inbuf)\n } catch (e: IOException) {\n throw InputMismatchException()\n }\n\n if (lenbuf <= 0) return -1\n }\n return inbuf[ptrbuf++].toInt()\n}\n\nprivate fun isSpaceChar(c: Int): Boolean = !(c >= 33 && c <= 126)\n\nprivate fun skip(): Int {\n var b: Int = readByte()\n while (b != -1 && isSpaceChar(b)) {\n b = readByte()\n }\n return b\n}\n\n// using ns()\nprivate fun nd(): Double = ns().toDouble()\n\n// using ns()\nprivate fun nc(): Char = skip().toChar()\n\n// input until whitespace\nprivate fun ns(): String {\n var b = skip()\n val sb = StringBuilder()\n while (!isSpaceChar(b)) { // when nextLine, (isSpaceChar(b) && b != ' ')\n sb.appendCodePoint(b)\n b = readByte()\n }\n return sb.toString()\n}\n\nprivate fun ns(n: Int): CharArray {\n val buf = CharArray(n)\n var b = skip()\n var p = 0\n while (p < n && !isSpaceChar(b)) {\n buf[p++] = b.toChar()\n b = readByte()\n }\n return if (n == p) buf else Arrays.copyOf(buf, p)\n}\n\n// matrix\nprivate fun nm(n: Int, m: Int): Array {\n val map = Array(n) { CharArray(m) }\n for (i in 0 until n) map[i] = ns(m)\n return map\n}\n\nprivate fun pm(matrix: Array) {\n val n = matrix.size\n val m = matrix[0].size\n repeat(n)\n {\n repeat(m)\n { jt ->\n out.print(matrix[it][jt])\n }\n out.println()\n }\n out.flush()\n}\n\n// int array\nprivate fun na(n: Int): IntArray {\n val a = IntArray(n)\n for (i in 0 until n) a[i] = ni()\n return a\n}\n\nprivate fun ni(): Int {\n var num = 0\n var b: Int = readByte()\n var minus = false\n while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {\n b = readByte()\n }\n if (b == '-'.toInt()) {\n minus = true\n b = readByte()\n }\n\n while (true) {\n if (b >= '0'.toInt() && b <= '9'.toInt()) {\n num = num * 10 + (b - '0'.toInt())\n } else {\n return if (minus) -num else num\n }\n b = readByte()\n }\n}\n\nprivate fun nl(): Long {\n var num: Long = 0\n var b: Int = readByte()\n var minus = false\n while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {\n b = readByte()\n }\n if (b == '-'.toInt()) {\n minus = true\n b = readByte()\n }\n\n while (true) {\n if (b >= '0'.toInt() && b <= '9'.toInt()) {\n num = num * 10 + (b - '0'.toInt())\n } else {\n return if (minus) -num else num\n }\n b = readByte()\n }\n}\n\nprivate fun tr(vararg o: Any) {\n// if (!oj) println(Arrays.deepToString(o))\n}\n\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n var scan = Scanner(System.`in`)\n\n var cnt = scan.nextLine()\n var colors = scan.nextLine()\n\n var remove = 0\n var before = colors[0]\n for(i in 1 until colors.length) {\n if(before == colors[i]) {\n remove++\n } else {\n before = colors[i]\n }\n }\n\n println(remove)\n}"}, {"source_code": "fun main() {\n val stonesLength = readLine()!!.toInt()\n val stones = readLine()!!\n if (stonesLength == 1) {\n println(\"0\")\n return\n }\n var countOfStonesTaken = 0\n for (i in 1 until stonesLength) {\n if (stones[i] == stones[i - 1]) countOfStonesTaken++\n }\n println(countOfStonesTaken)\n}"}, {"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) = 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 n = io.readInt()\n val t = io.readToken()\n var res = 0\n var prev = '?'\n for (ch in t) {\n if (ch == prev) {\n res += 1\n } else {\n prev = ch\n }\n }\n io.println(res)\n io.close()\n}\n\nfun main(args: Array) {\n Thread({ solve() }).start()\n}\n"}, {"source_code": "import java.io.*\n\n/**
**/\n\nfun isDebug(): Boolean {\n return !System.getProperty(\"ONLINE_JUDGE\", \"False\")!!.toBoolean()\n}\n\nval input = if (isDebug())\n BufferedReader(FileReader(File(\"input.txt\")))\nelse\n BufferedReader(InputStreamReader(System.`in`))\n\n/**
**/\n\n/** **/\n\nfun lineToInt(): Int {\n return input.readLine().toInt()\n}\n\nfun readLine(): String {\n return input.readLine()\n}\n\n/** **/\n\nfun main(args: Array) {\n\n val n = lineToInt()\n val s = readLine().split(\"\")\n\n print(s.size - s.filterIndexed { i, el -> (i == 0) || (s[i - 1] != s[i]) }.size)\n\n}\n\n"}, {"source_code": "fun main()\n{\n val lens = readLine()!!.toInt()\n val word = readLine()!!\n var need = 0\n for(i in 1 until lens)\n {\n if (word[i] == word[i - 1]) need ++\n\n }\n println(need)\n}"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val len = r.readLine()!!.toInt()\n val str = r.readLine()!!\n val x = (1..len-1).fold(0){acc, i -> acc + if (str[i]==str[i-1]) 1 else 0 }\n println(x)\n}"}, {"source_code": "fun main(args: Array) {\n val N = readLine()!!.toInt()\n val C = readLine()!!\n var c = 0\n for (i in 1..C.length -1) {\n if (C[i] == C[i-1]){\n c++\n }\n }\n print(c)\n}"}, {"source_code": "fun main(args: Array) {\n var c = 0\n val n = readLine()!!.toInt()\n val a = readLine()!!.split(\"\")\n for (i in 0 until n) {\n if (a[i] == a[i + 1])\n c++\n }\n print(c)\n}"}, {"source_code": "fun main(args: Array) {\n // Omit first line\n readLine()\n \n val stones = readLine()!!\n var subs = 0\n for (i: Int in (1 until stones.length)) {\n if (stones[i] == stones[i-1]) subs ++\n }\n println(subs)\n}"}, {"source_code": "\nfun main(args: Array){\n val length = readLine()?.toInt()\n val input = readLine()\n\n var result : Int = 0\n\n fun check(index: Int , c : Char){\n if (index <= length!!-2 && c == input?.get(index+1)){\n result++\n }\n }\n\n input?.forEachIndexed { index, c -> check(index , c) }\n println(result)\n\n}\n"}, {"source_code": "import java.util.*\nimport java.util.regex.Pattern\n\nfun main(args: Array) {\n\n var len = readLine()!!\n var text = readLine()!!\n var count = 0\n if (Pattern.matches(\"[A-Z]+\", text))\n {\n for (i in 0..(len.toInt() - 1))\n {\n if (i==(len.toInt() - 1))\n break\n if (text[i] == text[i + 1])\n {\n count++\n }\n\n }\n\n print(count)\n\n }\n\n\n}"}, {"source_code": "fun main() {\n var result = 0\n val count = readLine()!!.toInt()\n val input = readLine()!!.split(\"\")\n\n for (i in 0 until count) {\n val nextStone = input.getOrNull(i + 1)\n val currentStone = input[i]\n\n if ((nextStone != null) and (currentStone == nextStone)) {\n result += 1\n }\n }\n\n print(result)\n}"}, {"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 readLn()\n println(readLn().zipWithNext().count { (a, b) -> a == b })\n}\n"}, {"source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\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 `CF266-D2-A` {\n fun solveTestCase(): Int {\n val n = readInt()\n val s = read()\n\n var prev = s[0]\n var count = 0\n for (i in 1 until n) {\n if (s[i] == prev) count++\n else prev = s[i]\n }\n\n return count\n }\n}\n\nfun main(args: Array) {\n\n outputWriter.println(\n `CF266-D2-A`()\n .solveTestCase()\n )\n\n outputWriter.flush()\n}"}, {"source_code": "fun main(args: Array) {\n readLine()\n var answer = 0\n val input: String = readLine()!!\n var currentChar = input.first()\n input.forEachIndexed { index, char ->\n if (index > 0) {\n if (char.equals(currentChar)) {\n answer += 1\n }\n }\n currentChar = char\n }\n println(answer)\n}"}, {"source_code": "fun String.countIndexed(predicate: (index: Int, ch: Char) -> Boolean): Int {\n var count = 0\n forEachIndexed { index, ch -> if (predicate(index, ch)) count++ }\n return count\n}\n\nfun main() = Pair(readLine()!!, readLine()!!)\n .let { (_, stones) ->\n stones.countIndexed { index, ch -> ch == stones.getOrNull(index - 1) }\n }\n .run(::println)"}, {"source_code": "fun main(args: Array) {\n val t = 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"}, {"source_code": "\n fun main(args: Array) {\n var count = readLine()!!.toInt()\n var num = 0\n var input = readLine()!!\n for (i in 1 until input.length){\n if (input[i-1] == input[i]) ++num\n }\n println(num)\n }\n"}, {"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 numberofstones= s.nextInt()\n neighboring(numberofstones,s)\n \n}\n\nfun neighboring( numberofstones:Int , s:Scanner){\n var colors = s.next()\n var color = colors.toCharArray() \n var number = 0\n for(i in color.indices){\n if(i!=numberofstones-1){\n \n if(color[i]==color[i+1]){\n number++\n \n }\n \n }\n\n \n}\nprint(number)\n}"}, {"source_code": "import java.util.Scanner;\nimport java.util.Arrays;\nfun main(args: Array) {\nval s = Scanner (System.`in`);\nval a : Int = s.nextInt();\nval b : String = s.next();\nval c = b.toCharArray();\nvar d = 0 ;\nfor(i in 0 until a){\nif(i < a-1){\n if ( c[i] == c[i+1]){\n d++\n \n }\n }\n }\n println(d);\n}\n \n "}, {"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 reader.nextInt()\n val string = reader.next()\n var lastCharacter = ' '\n var count = 0\n for (i in 0 until string.length) {\n val char = string.elementAt(i)\n if (char.equals(lastCharacter))\n count++\n lastCharacter = char\n }\n println(count)\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}"}, {"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 input.next()\n val str = input.next()\n\n if (str.length == 1) {\n output.print(0)\n return\n }\n\n var top = str.first()\n var result = 0\n\n for (index in 1 until str.length) {\n if (top != str[index]) {\n top = str[index]\n } else {\n result++\n }\n }\n\n output.print(result)\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}"}, {"source_code": "/* http://codeforces.com/problemset/problem/266/A */\n\nfun main() {\n readLine() // skip first line\n var removeCount = 0\n val string = readLine()!!\n var lastChar = string[0]\n for (i in 1 until string.length) {\n if (lastChar == string[i]) {\n removeCount++\n }\n lastChar = string[i]\n }\n println(removeCount)\n}"}, {"source_code": "import java.lang.StringBuilder\n\nfun main(){\n var num = readLine()\n var stones = StringBuilder(readLine())\n println(answer(stones))\n}\n\nfun answer (stones:StringBuilder):Int{\n var num = 0\n for(i in 1 until stones.length){\n if(stones.get(i) == stones.get(i-1))\n num++\n }\n return num\n}\n\n"}, {"source_code": "fun main(args: Array)\n{\n val n = readLine()!!.toInt()\n var s = readLine()!!\n var result: Int = 0\n for (i in 1..s.length - 1)\n {\n if (s[i] == s[i - 1]) ++result\n }\n println(result)\n}"}, {"source_code": "fun main(args: Array) {\n var count=0\n var n = readLine()!!.toInt()\n var C = readLine()!!\n for (i in 1..C.length -1) {\n if (C[i] == C[i-1]){\n count++\n }\n }\n print(count)\n }"}, {"source_code": "import java.util.*\n\n\n\n fun main(args: Array)\n {\n val `in` = Scanner(System.`in`)\n val n = `in`.nextInt()\n val arr: CharArray\n `in`.nextLine()\n val str = `in`.nextLine()\n arr = str.toCharArray()\n val s = Stack()\n var count = 0\n for (i in arr.indices)\n {\n if (s.isEmpty())\n {\n s.push(arr[i])\n }\n else\n {\n if (s.peek() == arr[i])\n {\n if (!s.isEmpty())\n {\n count++\n }\n else\n {\n count++\n }\n }\n else\n {\n s.push(arr[i])\n }\n }\n }\n println(count)\n }\n"}, {"source_code": "fun main() {\n\n val count = readLine()\n\n val colors = readLine().toString()\n\n var haveToMove = 0\n colors.toCharArray().apply {\n forEachIndexed { index, c ->\n\n if (index != size - 1) {\n\n if (c == this[index + 1]) {\n haveToMove++\n }\n\n }\n }\n }\n\n println(haveToMove)\n\n}\n\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val s: Scanner = Scanner(System.`in`)\n val n: Int = s.nextInt()\n val str: String = s.next()\n var prevC: Char = ' '\n var result: Int = 0\n for (c in str) {\n if (c == prevC) {\n result++\n }\n prevC = c\n }\n println(result)\n}"}, {"source_code": "fun main(args: Array) {\n\n readLine()!!.toInt()\n val rgb: CharArray = readLine()!!.toCharArray()\n print((1 until rgb.size)\n .count { rgb[it] == rgb[it - 1] })\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.FileInputStream\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n reader.use {\n var el = it.readLine()\n el = it.readLine()\n var last:Char? = null\n var count = 0\n for (ch in el) {\n if(last == ch ){\n count++\n }\n last = ch\n }\n print(count)\n }\n}"}, {"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 }\n print(count-1)\n}"}, {"source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n Scanner(System.`in`).use {\n val length = it.nextInt()\n val colorSequence = it.next()\n\n var twoConsecutiveColorCount = 0\n var previousColor = colorSequence[0]\n for (i in 1 until length) {\n val currentColor = colorSequence[i]\n if (currentColor != previousColor) {\n previousColor = currentColor\n continue\n }\n ++twoConsecutiveColorCount\n }\n println(twoConsecutiveColorCount)\n }\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n val s = readLine()!!\n\n var count = 0\n for (i in 1 until n) {\n if (s[i - 1] == s[i]) {\n count++\n }\n }\n println(count)\n}"}, {"source_code": "// codeforces problem 266 A\n\nfun main() {\n readLine()!!\n println(readLine()!!.zipWithNext().count { (a, b) -> a == b })\n}\n"}, {"source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var str = readLine()!!.toString()\n var count = 0\n for (i in 0 until str.length-1){\n if (str[i]==str[i+1]){\n count++\n }\n }\n println(count)\n}"}, {"source_code": "fun main(args : Array) {\n val n = readLine()!!.toInt()\n val line = readLine()!!\n var ans = 0\n var c = 0\n for (i in 1..(n-1)) {\n if (line[i] == line[i-1])\n c++\n else{\n ans += c\n c = 0\n }\n }\n ans += c\n println(ans)\n}"}, {"source_code": "\nimport java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n scanner.nextLine()\n val stones = scanner.nextLine()\n\n var result = 0\n var stoneIndex = 0\n while(stoneIndex < stones.length - 1) {\n if(stones[stoneIndex ] == stones[stoneIndex+1]) {\n result++\n }\n stoneIndex++\n }\n\n println(result)\n}"}, {"source_code": "// https://codeforces.com/problemset/problem/266/A\n\nfun main(args: Array) {\n val n = readInt()\n val data = readLn()\n var actualCharacter: Char = '0'\n var numberToDelete = 0;\n for (character in data) {\n if (actualCharacter == '0') {\n actualCharacter = character;\n } else {\n if (actualCharacter == character) {\n numberToDelete++\n } else {\n actualCharacter = character\n }\n }\n }\n print(numberToDelete)\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\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val n = scan.nextInt()\n val str = scan.next()\n\n var prev = str.first()\n var ans = 0\n\n for(i in 1 until str.length) {\n if(str[i] == prev) {\n ans++\n }\n prev = str[i]\n }\n println(ans)\n}"}, {"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 n = br.readLine()\n val s = br.readLine()\n val contigs = s.fold(ArrayList()){\n acc, c -> acc.apply {\n if (isEmpty() || last().last() != c){\n add(StringBuilder(c.toString()))\n } else {\n last().append(c)\n }\n }\n }\n println(\n contigs.fold(0){\n acc, block -> acc + block.length - 1\n }\n )\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n val reader = Scanner(System.`in`)\n val n = reader.nextInt()\n reader.nextLine()\n val word = reader.nextLine()\n var m = 0\n var init = word[0]\n for (i in 1 until word.length){\n if (init == word[i]) {\n m++\n }\n init = word[i]\n }\n\n println(m)\n}"}, {"source_code": "//package problem266A\n\nfun containsDuplicateNeighbors(stones: List): Boolean {\n for (i in 0 until stones.size - 1) {\n if (stones[i] == stones[i + 1]) {\n return true\n }\n }\n\n return false\n}\n\nfun removeDuplicateNeighbors(stones: MutableList): Int {\n var numRemoved = 0\n for (i in stones.size - 1 downTo 1) {\n if (stones[i] == stones[i - 1]) {\n stones.removeAt(i)\n ++numRemoved\n }\n }\n return numRemoved\n}\n\nfun main() {\n readLine()!!\n val stones = readLine()!!.toMutableList()\n var numRemoved = 0\n\n while (containsDuplicateNeighbors(stones)) {\n numRemoved += removeDuplicateNeighbors(stones)\n }\n\n println(numRemoved)\n}\n"}, {"source_code": "import java.lang.StringBuilder\n\nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\n\n\nfun minNumberOfStones(): Int {\n val n = readInt()\n val stonesColors = readLn()\n\n var nwDistinctStones: StringBuilder = StringBuilder()\n nwDistinctStones.append(stonesColors[0])\n\n for (i in 1 until stonesColors.length)\n if (stonesColors[i] != nwDistinctStones[nwDistinctStones.lastIndex])\n nwDistinctStones.append(stonesColors[i])\n\n return stonesColors.length - nwDistinctStones.length\n}\n\n\nfun main() {\n print(minNumberOfStones())\n}\n"}, {"source_code": "import java.util.*\n\nfun main()\n{\n var scanner = Scanner(System.`in`)\n var number = scanner.next().toInt()\n var str = scanner.next()\n var counter = 0\n for(i in 0 until str.length-1)\n {\n if(str[i] == str[i+1])\n counter++\n }\n println(counter)\n}\n"}, {"source_code": "import java.util.*\nfun main() {\n val sc = Scanner(System.`in`)\n\n var n = sc.nextInt()\n var s = sc.next()\n var k = 0\n for(i in 0 until n-1){\n if(s[i] == s[i+1]){\n k++\n }\n }\n print(k)\n}\n"}, {"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 str = s.next()\n val arr = str!!.toCharArray()\n for (i in 0 until size-1) {\n if (arr[i] == arr[i + 1])\n x++\n }\n print(x)\n\n}"}, {"source_code": "fun main() {\n readLine()\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}"}, {"source_code": "fun main(args: Array) {\n readLine()!!\n val line = readLine()!!\n println(line.fold(0 to 'X', { acc, c -> (if (c == acc.second) acc.first + 1 else acc.first) to c }).first)\n}"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array){\n val scan = Scanner(System.`in`)\n val n = scan.nextInt()\n val s = scan.next()\n var c = 0\n\n for (i in 0 until n-1){\n if (s[i] == s[i+1]) c++\n }\n println(c)\n}"}, {"source_code": "fun main() {\n readLine()\n var chars = readLine()!!.toCharArray()\n var ans = 0\n for (i in 1..chars.lastIndex) {\n if (chars[i] == chars[i - 1])\n ans++\n }\n println(ans)\n}"}, {"source_code": "fun main() {\n val n = readLine()\n val str = readLine()!!\n println(str.length -\n repl(repl(repl(str, \"RR\", \"R\"), \"GG\", \"G\"),\"BB\", \"B\")\n .length)\n}\n\nfun repl(s: String, subs: String, repl: String): String {\n var str = s\n while (str.contains(subs, true))\n str = str.replace(subs, repl, true)\n return str\n}"}, {"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 n = readInt()\n var s = readLn()\n var ans = 0\n for (i in 1 until s.length) {\n if (s[i - 1] == s[i])\n ans++\n }\n println(ans)\n}\n"}, {"source_code": "\nfun main()\n {\n val s:String\n var count :Int=0\n var n:Int\n n= readLine()!!.toInt()\n s= readLine()!!.toString()\n for(i in s.indices)\n {\n if(i) {\n readLine()!!.toInt()\n val stones = readLine()!!.toCharArray()\n println((1 until stones.size).count{stones[it] == stones[it - 1]})\n}"}, {"source_code": "fun main(){\n val n = readLine()!!.toInt()\n val s = readLine()!!\n var count = 0\n for (i in 0..n-2){\n if (s[i].compareTo(s[i+1]) == 0) count++\n }\n println(count)\n}"}, {"source_code": "import java.lang.StringBuilder\n\nfun main() {\n\n solve266A()\n\n}\n\nfun solve266A() {\n\n val countString = readLine()\n\n val inputValue = readLine()\n\n var count = 0\n\n if (inputValue == null) {\n return\n }\n\n val result: StringBuilder = StringBuilder()\n\n inputValue.forEach {\n if (result.length == 0 || result.last() != it) {\n result.append(it)\n }\n }\n\n println(inputValue.length - result.length)\n\n}"}, {"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 = input.next()\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}"}, {"source_code": "fun main() {\n val c = readLine()!!\n val s = readLine()!!\n\n var p = s[0]\n var r = -1\n s.forEach {\n if(it.equals(p)) {\n r++\n }\n p = it\n }\n println(r)\n }"}, {"source_code": "fun main(){\n var n = readLine()!!.toInt();\n var a = readLine()!!.toString();\n var tot=0;\n for(i in 1..(n-1)) if(a[i]==a[i-1]) tot+=1;\n println(tot);\n}\n"}, {"source_code": "fun main(args: Array) {\n val quantity = Integer.parseInt(readLine())\n val colors = readLine()\n print(findColor(colors, quantity))\n}\n\nfun findColor(colors : String?, quantity : Int) : Int {\n var find = 0\n for(i in 1 until quantity){\n if(colors!![i].equals(colors[i-1])) find++\n }\n return find\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n\n val n: Int = scanner.nextInt()\n val str: String = scanner.next()\n\n var last = str[0]; var cnt = 0\n for(i in 1 until n){\n cnt += if(last == str[i]) 1 else 0\n last = str[i]\n }\n\n print(cnt)\n}"}, {"source_code": "import java.util.*\n\nprivate val scan = Scanner(System.`in`)\n\nfun main(args: Array) {\n scan.nextInt()\n val s = scan.next()\n val set = mutableListOf()\n var ans = 0\n\n s.forEach { if (it != set.lastOrNull()) set.add(it) else ans++ }\n\n println(ans)\n}\n"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n reader.readLine()!!\n val array = reader.readLine().toCharArray()\n var count = 0\n var buffer: Char = array.first()\n val iterator = array.iterator()\n iterator.nextChar()\n while (iterator.hasNext()) {\n val char = iterator.nextChar()\n if (char == buffer) {\n count++\n } else {\n buffer = char\n }\n }\n println(count)\n}"}, {"source_code": "fun main() {\n readLine()!!\n var count = 0\n readLine()!!.toCharArray().let {\n var cur = it[0]\n for((i, c) in it.withIndex()) {\n if(i == 0) {\n continue\n }\n if(c == cur)\n count++\n else\n cur = c\n }\n }\n println(count)\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n val s = readLine()!!\n val filtered = s.filterIndexed { index, c ->\n when (index) {\n 0 -> true\n else -> c != s[(index + n - 1) % n]\n }\n }\n println(s.length - filtered.length)\n}\n"}, {"source_code": "fun main() {\n val numOfcolors = readLine()\n val colors = readLine()\n var toRemove = 0\n for(i in 0 until (colors?.length!!-1)!!){\n if(colors.get(i) == colors.get(i+1)){\n toRemove+=1\n }\n }\n println(toRemove)\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val s = readLine()!!\n var ans: Int = 0\n for (i in 1..n-1) {\n if (s[i] == s[i-1])\n ans++\n }\n print(ans.toString() + \"\\n\")\n}\n"}, {"source_code": "fun main(args: Array) {\n readLine()\n println(\n Regex(\"R{2,}|G{2,}|B{2,}\").findAll(readLine()!!)\n .sumBy { it.value.length - 1 }\n )\n}\n"}, {"source_code": "fun main() {\n\n val n = readLine()!!.toInt()\n val row = readLine()!!\n var count = 0\n\n row.forEachIndexed{ index, _ ->\n if(index != row.lastIndex)\n if(row[index] == row[index+1])\n count++\n }\n\n print(count)\n}\n\n\n"}, {"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 readLn()\n val balls = readLn()\n\n if (balls.length <= 1) {\n println(0)\n return\n }\n\n var res = 0\n balls.reduce { a, b -> if (a == b) ++res; b }\n\n println(res)\n}\n"}, {"source_code": "import Output.print\nimport Output.println\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\nimport kotlin.math.abs\n\nobject Input {\n\n private val input = BufferedReader(InputStreamReader(System.`in`))\n private lateinit var tokenizer: StringTokenizer\n\n val next: String get() = input.readLine()\n val intValue get() = next.toInt()\n val longValue get() = next.toLong()\n val floatValue get() = next.toFloat()\n val doubleValue get() = next.toDouble()\n\n val intList get()= valuesList { it.toInt() }\n val longList: List get() = valuesList { it.toLong() }\n val floatList: List get() = valuesList { it.toFloat() }\n val doubleList: List get() = valuesList { it.toDouble() }\n\n private inline fun valuesList(f: (String) -> T): List = mutableListOf().apply {\n tokenizer = StringTokenizer(input.readLine())\n while (tokenizer.hasMoreTokens()) add(f(tokenizer.nextToken()))\n }\n\n fun close() = input.close()\n}\n\nobject Output {\n\n private val output = PrintWriter(System.out)\n\n fun Number.print() = output.print(this)\n\n fun Number.println() = output.println(this)\n\n fun String.print() = output.print(this)\n\n fun String.println() = output.println(this)\n\n fun List.print(delimiter: CharSequence = \" \") = output.print(this.joinToString(delimiter))\n\n fun List.println(delimiter: CharSequence = \" \") = output.println(this.joinToString(delimiter))\n\n fun flush() = output.flush()\n\n fun close() = output.close()\n}\n\nfun close() {\n Output.flush()\n Input.close()\n Output.close()\n}\n\nfun solve() {\n val n = Input.intValue\n val a = Input.next\n a.takeLast(n-1).filterIndexed { index, c -> a[index] == c }.length.print()\n}\n\nfun main() {\n// var tt = Input.intValue\n// while (tt-- != 0) {\n solve()\n// }\n Output.flush()\n}\n\n"}, {"source_code": "\nfun main(args: Array) {\n var counter = 0\n val stoneCount = readLine()!!.toInt()\n val stones = readLine()!!\n for (i in 1 until stoneCount) {\n if (stones[i - 1] == stones[i]) {\n counter ++\n }\n }\n\n println(counter)\n}"}, {"source_code": "import java.util.Scanner\n\nfun main(){\n var input = Scanner(System.`in`)\n var num = input.next()\n var s = input.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}"}, {"source_code": "import java.util.*\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val c = scanner.next()\n\n var take = 0\n for (i in 0 until n - 1) {\n if (c[i] == c[i + 1]) {\n take += 1\n }\n }\n\n println(take)\n}"}, {"source_code": "fun main() {\n val stones = readLine()!!.toInt()\n val data = readLine()!!.map { it.toString() }\n\n val clean = data.reduce { acc, s ->\n if (acc.last().toString() == s) acc else acc + s\n }\n println(stones - clean.length)\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n var stones = readLine()!!.toCharArray()\n var tbr = 0\n var latest = stones[0]\n for (i in 0 until n - 1) {\n if (latest == stones[i + 1]) {\n tbr++\n stones[i + 1] = ' '\n }\n else {\n latest = stones[i + 1]\n }\n }\n print(tbr)\n}\n"}], "negative_code": [{"source_code": "fun main() {\n val stonesLength = readLine()!!.toInt()\n val stones = readLine()!!\n if (stones.length == 1) {\n println(\"0\")\n return\n }\n var countOfStonesTaken = 0\n var compareIndex = 0\n var currentIndex = 1\n while (currentIndex < stonesLength) {\n if (stones[compareIndex] == stones[currentIndex]) {\n countOfStonesTaken++\n } else compareIndex++\n currentIndex++\n }\n println(countOfStonesTaken)\n}"}, {"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"}, {"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}"}, {"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}"}, {"source_code": "fun main() {\n val c = readLine()!!\n val s = readLine()!!\n \n var p = s[0]\n var r = 0\n s.forEach { \n if(it.equals(p)) {\n r++\n }\n p = it\n }\n println(r)\n }"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n reader.readLine()!!\n val array = reader.readLine().toCharArray()\n var count = 0\n var buffer: Char? = null\n for (char in array) {\n if (buffer == null) {\n buffer = char\n } else if (buffer == char) {\n count++\n } else if (buffer != char) {\n buffer = null\n }\n }\n println(count)\n}"}, {"source_code": "import kotlin.math.max\n\nfun main() {\n val n = readLine()!!.toInt()\n val s = readLine()!!\n val filtered = s.filterIndexed { index, c ->\n c != s[(index + n - 1) % n]\n }\n println(s.length - max(filtered.length, 1))\n}\n"}], "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8"} {"source_code": "import java.io.IOException\nimport java.io.InputStream\nimport java.util.*\n\nfun main(args : Array){\n val reader =InputReader(System.`in`)\n val t = reader.readInt()\n repeat(t){\n val n = reader.readInt()\n var found = false\n for (i in 2 until Math.sqrt(n.toDouble()).toInt() + 1) {\n if (n % i == 0) {\n val factor = n / i //greatest factor\n println(\"$factor ${n - factor}\")\n found = true\n break\n }\n }\n if (!found){\n println(\"1 ${n-1}\")\n }\n }\n}\n\n\ninternal 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: 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 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", "positive_code": [{"source_code": "import java.lang.Math.*\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\n//var n = 0\n//var ar = listOf()\nval visited = mutableSetOf()\nval graph = mutableMapOf>()\n\nfun main() {\n val t = readInt()\n for (cases in 0 until t) {\n solve()\n }\n\n// solve()\n}\n\nfun solve() {\n val n = readInt()\n\n var ans1 = 1\n var ans2 = n - 1\n var min = n - 1\n for (i in 2 until sqrt(n.toDouble()).toInt() + 1) {\n if (n % i == 0) {\n val d = n / i\n if ((i - 1) * d < min) {\n ans1 = d\n ans2 = (i - 1) * d\n min = ans2\n }\n\n }\n }\n\n println(\"$ans1 $ans2\")\n}\n"}, {"source_code": "fun main() {\n for (c in 1..readLine()!!.toInt()) {\n val n = readLine()!!.toInt()\n var p = 0\n for (m in 2..100000) {\n if (n % m == 0) {\n p = m\n break\n }\n }\n if (p == 0) {\n p = n\n }\n println(\"${n / p} ${n - (n / p)}\")\n }\n}"}, {"source_code": "fun main() {\n for (c in 1..readLine()!!.toInt()) {\n val n = readLine()!!.toInt()\n var p = 0\n for (m in 2..100000) {\n if (n % m == 0) {\n p = m\n break\n }\n }\n if (p == 0) {\n p = n\n }\n println(\"${n / p} ${n - (n / p)}\")\n }\n}"}, {"source_code": "fun main(args: Array) {\n var numberTests = readLine()!!.toInt()\n var results = mutableListOf()\n\n for (i in 0..numberTests-1) {\n var n = readLine()!!.toLong()\n val result = experimentB(n)\n results.add(result)\n }\n\n for (result in results) {\n println(result)\n }\n}\n\nfun experimentB(n : Long) : String {\n var result = \"\"\n\n if (n % 2 == 0L) {\n result = \"${n / 2} ${n / 2}\"\n } else {\n val divideList = divisor(n)\n// println(divideList)\n val candidate = divideList.takeLast(2) [0]\n// println (candidate)\n result = \"${candidate} ${n - candidate}\"\n }\n\n return result\n}\n\n// \u7d04\u6570\u306eList\nfun divisor(value : Long) : List {\n val max = Math.sqrt(value.toDouble()).toLong()\n return (1..max)\n .filter { value % it == 0L }\n .map { listOf(it, value / it) }\n .flatten()\n .sorted()\n}"}, {"source_code": "fun main() {\n repeat(readLine()!!.toInt()) {\n val n = readLine()!!.toInt()\n var d = 2\n while (d * d <= n) {\n if (n % d == 0) break\n d++\n }\n if (n % d == 0) {\n val a = n / d\n println(\"$a ${n - a}\")\n } else {\n println(\"1 ${n - 1}\")\n }\n }\n}"}, {"source_code": " fun main() {\n for (c in 1..readLine()!!.toInt()) {\n val n = readLine()!!.toInt()\n var p = 0\n for (m in 2..100000) {\n if (n % m == 0) {\n p = m\n break\n }\n }\n if (p == 0) {\n p = n\n }\n println(\"${n / p} ${n - (n / p)}\")\n }\n }"}, {"source_code": "import kotlin.math.sqrt\n\nfun solve(n: Int) {\n var i = 2\n val limit = (sqrt(n.toDouble()) + 1).toInt()\n while (n % i != 0) {\n ++i\n if (i == limit) {\n println(\"1 ${n - 1}\")\n return@solve\n }\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}"}, {"source_code": "fun main() {\n val t = readInt()\n fun findOther(x: Int, n: Int): Int {\n val a = n/x - 1\n return a * x\n }\n\n repeat(t) {\n val n = readInt()\n if (n % 2 == 0) println(\"${n/2} ${n/2}\")\n else {\n var divisor = 1\n val candidates = mutableListOf()\n while (divisor * divisor <= n) {\n if (n % divisor == 0) {\n candidates.add(divisor)\n if (divisor != 1 && divisor * divisor != n) candidates.add(n/divisor)\n }\n\n divisor += 2\n }\n val ans = candidates.map { Pair(it, findOther(it, n)) }.minBy { it.second }!!\n println(\"${ans.first} ${ans.second}\")\n }\n }\n}\n\n// Input Reader\nprivate fun readLn() = readLine()!!\n\nprivate fun readStrings() = readLn().trim().split(\" \")\nprivate fun readInt() = readLn().toInt()\nprivate fun readInts() = readStrings().map { it.toInt() }\n"}, {"source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n//@file:OptIn(ExperimentalStdlibApi::class)\n\nimport java.io.PrintWriter\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\n/** @author Spheniscine */\nfun main() { _writer.solve(); _writer.flush() }\n\nfun PrintWriter.solve() {\n //val startTime = System.nanoTime()\n\n val numCases = readInt()\n case@ for(case in 1..numCases) {\n //print(\"Case #$case: \")\n\n val n = readInt()\n\n val p = run p@ {\n n.factorize { return@p it }\n n\n }\n\n val a = n/p\n val b = n - a\n\n println(\"$a $b\")\n }\n\n// iprintln(\"Time: ${(System.nanoTime() - startTime) / 1000000} ms\")\n}\n\ninline fun Int.factorize(yield: (Int) -> Unit) {\n var n = this\n\n for(p in 2..n) {\n if(p * p > n) break\n\n while(n % p == 0) {\n yield(p)\n n /= p\n }\n }\n\n if(n > 1) yield(n)\n}\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\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(c != '\\n' && c != Char.MIN_VALUE) {\n append(c)\n c = readChar()\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\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)\n"}, {"source_code": "fun main() {\n for (c in 1..readLine()!!.toInt()) {\n val n = readLine()!!.toInt()\n var p = 0\n for (m in 2..100000) {\n if (n % m == 0) {\n p = m\n break\n }\n }\n if (p == 0) {\n p = n\n }\n println(\"${n / p} ${n - (n / p)}\")\n }\n}"}, {"source_code": "fun main() {\n for (c in 1..readLine()!!.toInt()) {\n val n = readLine()!!.toInt()\n var p = 0\n for (m in 2..100000) {\n if (n % m == 0) {\n p = m\n break\n }\n }\n if (p == 0) {\n p = n\n }\n println(\"${n / p} ${n - (n / p)}\")\n }\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.util.*\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() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\n\nfun main(args: Array) {\n b()\n}\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 repeat(readInt()) {\n val n = readInt()\n val a = List(n) { 1 }\n println(a.joinToString(separator = \" \"))\n }\n}\n\nfun pow(a: Int, b: Int): Long {\n var res = 1L\n repeat(b) { res *= a }\n return res\n}\n\nfun adj(i: Int, j: Int, n: Int, m: Int): Int {\n var adj = 4\n if (i == 0) adj--\n if (j == 0) adj--\n if (i == n - 1) adj--\n if (j == m - 1) adj--\n return adj\n}\n\nfun activeAdj(i: Int, j: Int, n: Int, m: Int, a: Array): Int {\n var activeAdj = 0\n if (i - 1 >= 0 && a[i - 1][j] > 0) activeAdj++\n if (j - 1 >= 0 && a[i][j - 1] > 0) activeAdj++\n if (i + 1 < n && a[i + 1][j] > 0) activeAdj++\n if (j + 1 < m && a[i][j + 1] > 0) activeAdj++\n return activeAdj\n}\n\nfun b() {\n repeat(readInt()) {\n val n = readInt()\n val divisor = leastDivisor(n)\n\n if (divisor == 1) {\n println(\"1 ${n - 1}\")\n } else {\n println(\"${n / divisor} ${n - n / divisor}\")\n }\n }\n}\n\nfun c() {\n repeat(readInt()) {\n val n = readInt()\n val a = readInts()\n\n val right = mutableListOf()\n val notRight = mutableListOf()\n\n for (i in 0 until n) {\n if (a[i] == i + 1) {\n right.add(i)\n } else {\n notRight.add(i)\n }\n }\n\n if (notRight.isEmpty()) {\n println(0)\n return@repeat\n }\n\n var isSubsequent = true\n for (i in 1 until notRight.size) {\n if (notRight[i] != notRight[i - 1] + 1) {\n isSubsequent = false\n break\n }\n }\n\n if (isSubsequent) {\n println(1)\n return@repeat\n }\n\n println(2)\n }\n}\n\nfun df(a: IntArray): Pair, Triple> {\n\n var dif = 0L\n var lastIndex = 0\n var maxDif = 0L\n var maxIndex = 0\n var maxLength = 0\n for (i in 0 until a.size - 1 step 2) {\n dif += a[i + 1] - a[i]\n if (dif <= 0) {\n dif = 0\n lastIndex = i + 2\n continue\n }\n if (dif > maxDif) {\n maxDif = dif\n maxIndex = lastIndex\n maxLength = i + 2 - lastIndex\n }\n }\n\n var dif1 = 0L\n var lastIndex1 = 1\n var maxDif1 = 0L\n var maxIndex1 = 0\n var maxLength1 = 0\n for (i in 1 until a.size - 1 step 2) {\n dif1 += a[i + 1] - a[i]\n if (dif1 >= 0) {\n dif1 = 0\n lastIndex1 = i + 2\n continue\n }\n if (dif1 < maxDif1) {\n maxDif1 = dif1\n maxIndex1 = lastIndex1\n maxLength1 = i + 2 - lastIndex1\n }\n }\n\n return Pair(Triple(maxDif, maxIndex, maxLength), Triple(-maxDif1, maxIndex1, maxLength1))\n}\n\ndata class MyPair(var first: Int, var second: Int) : Comparable {\n override fun compareTo(other: MyPair): Int {\n return this.first - other.first\n }\n\n}\n\nfun d() {\n val n = readInt()\n val a = readInts()\n\n var oddSum = 0L\n var evenSum = 0L\n\n for (i in 0 until n) {\n if (i % 2 == 0) {\n evenSum += a[i]\n } else {\n oddSum += a[i]\n }\n }\n\n// val maxOdd = oddSum + maxOf()\n}\n\nfun f() {\n val (n, m, q) = readInts()\n val a = Array(n) { IntArray(m) }\n\n val rows = LongArray(n)\n val columns = LongArray(m)\n\n for (i in 0 until n) {\n a[i] = readInts().toIntArray()\n\n for (j in 0 until m) {\n rows[i] = rows[i] + a[i][j]\n columns[j] = columns[j] + a[i][j]\n }\n }\n\n val rowsP = LongArray(n)\n val rowsS = LongArray(n)\n\n val rowsPM = LongArray(n)\n val rowsSM = LongArray(n)\n\n val columnsP = LongArray(m)\n val columnsS = LongArray(m)\n\n val columnsPM = LongArray(m)\n val columnsSM = LongArray(m)\n\n for (i in 0 until q + 1) {\n if (i != 0) {\n val (x, y, z) = readInts()\n val diff = z - a[x - 1][y - 1]\n rows[x - 1] = rows[x - 1] + diff\n columns[y - 1] = columns[y - 1] + diff\n a[x - 1][y - 1] = z\n }\n\n rowsP[0] = rows[0]\n for (j in 1 until n) {\n rowsP[j] = rowsP[j - 1] + rows[j]\n rowsPM[j] = rowsP[j - 1] + rowsPM[j - 1]\n }\n\n rowsS[n - 1] = rows[n - 1]\n for (j in n - 2 downTo 0) {\n rowsS[j] = rowsS[j + 1] + rows[j]\n rowsSM[j] = rowsS[j + 1] + rowsSM[j + 1]\n }\n\n columnsP[0] = columns[0]\n for (j in 1 until m) {\n columnsP[j] = columnsP[j - 1] + columns[j]\n columnsPM[j] = columnsP[j - 1] + columnsPM[j - 1]\n }\n\n columnsS[m - 1] = columns[m - 1]\n for (j in m - 2 downTo 0) {\n columnsS[j] = columnsS[j + 1] + columns[j]\n columnsSM[j] = columnsS[j + 1] + columnsSM[j + 1]\n }\n\n var minRow = minOf(rowsSM[0], rowsPM[n - 1])\n for (j in 1 until n - 1) {\n minRow = minOf(minRow, rowsSM[j] + rowsPM[j])\n }\n\n var minColumn = minOf(columnsSM[0], columnsPM[m - 1])\n for (j in 1 until m - 1) {\n minColumn = minOf(minColumn, columnsSM[j] + columnsPM[j])\n }\n\n print(\"${minRow + minColumn}\\n\")\n }\n}\n\nprivate inline fun sqr(x: Int) = 1L * x * x\n\n\nval t = IntArray(2_200_000)\n\nfun build(a: IntArray, v: Int, tl: Int, tr: Int) {\n if (tl == tr) {\n t[v] = a[tl]\n } else {\n val tm = (tl + tr) / 2\n build(a, v * 2, tl, tm)\n build(a, v * 2 + 1, tm + 1, tr)\n t[v] = t[v * 2] + t[v * 2 + 1]\n }\n\n// println(\"$v [$tl, $tr] = ${t[v]}\")\n}\n\nfun update(v: Int, tl: Int, tr: Int, pos: Int): Int {\n if (tl == tr) {\n t[v]++\n return t[v]\n } else {\n val tm = (tl + tr) / 2\n val res = if (pos <= tm) {\n update(v * 2, tl, tm, pos)\n } else {\n update(v * 2 + 1, tm + 1, tr, pos)\n }\n t[v] = t[v * 2] + t[v * 2 + 1]\n return res\n }\n}\n\nfun delete(v: Int, tl: Int, tr: Int, pos: Int): Int {\n// println(\"$v [$tl, $tr] = ${t[v]}, pos = $pos\")\n if (tl == tr) {\n t[v]--\n return tl\n } else {\n val tm = (tl + tr) / 2\n val res = if (pos <= t[v * 2]) {\n delete(v * 2, tl, tm, pos)\n } else {\n delete(v * 2 + 1, tm + 1, tr, pos - t[v * 2])\n }\n t[v] = t[v * 2] + t[v * 2 + 1]\n return res\n }\n}\n\nfun e() {\n val N = 1_00_000\n val f = IntArray(N)\n for (i in 0 until N) {\n f[i] = f[i / 10] + i % 10\n }\n\n val max = f.max()!!\n\n// println(max)\n\n repeat(readInt()) {\n val (n, k) = readInts()\n\n if (max * (k + 1) >= n) {\n var sum = 0\n for (i in 0 until k + 1) {\n sum += f[i]\n }\n\n if (n == sum) {\n println(0)\n return@repeat\n }\n\n for (i in 1 until N - k) {\n sum -= f[i - 1]\n sum += f[i + k]\n\n if (n == sum) {\n println(i)\n return@repeat\n }\n }\n }\n\n val res = StringBuilder()\n res.append('9')\n var sum = (9 - k..9).sum()\n\n println(\"$res $sum\")\n\n while (sum < n) {\n res.append('9')\n sum += 9 * (k + 1)\n\n println(\"$res $sum\")\n\n if (sum == n) {\n res[res.length - 1] = '9' - k\n println(res)\n return@repeat\n }\n if (sum > n) {\n sum -= 9 * (k + 1)\n for (i in 1 until 9) {\n if (sum + i * (k + 1) == n) {\n res[0] = '0' + i\n res[res.length - 1] = '9' - k\n println(res)\n return@repeat\n }\n }\n break\n }\n }\n\n println(-1)\n }\n}\n\ninternal class FastScanner {\n var br: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\n 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 return st!!.nextToken()\n }\n\n fun nextInt(): Int {\n return next().toInt()\n }\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\nfun leastDivisor(n: Int): Int {\n if (n % 2 == 0) return 2\n if (n % 3 == 0) return 3\n if (n % 5 == 0) return 5\n\n for (i in 7 until n) {\n if (i * i > n) break\n\n if (n % i == 0) {\n return i\n }\n }\n\n return 1\n}\n"}, {"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 t = sc.nextInt()\n for (_i in 0 until t) {\n val n = sc.nextInt()\n var p = -1\n var d = 2\n while (d * d <= n) {\n if (n % d == 0) {\n p = d\n break\n }\n d++\n }\n if (p == -1) p = n\n val v = n / p\n println(\"$v ${n - v}\")\n }\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"}, {"source_code": "import java.util.*\nimport kotlin.math.*\n\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n for (i in 0 until n) {\n val total = scanner.nextInt().toDouble()\n if (total.toInt() % 2 == 0) {\n println(\"${total.toInt() / 2} ${total.toInt() / 2}\")\n } else {\n val x = floor(sqrt(total)).toInt()\n var flag = false\n for (j in 3..x) {\n if (total.toInt() % j == 0) {\n flag = true\n println(\"${total.toInt() / j} ${total.toInt() - (total.toInt() / j)}\")\n break;\n }\n }\n if (!flag) {\n println(\"1 ${total.toInt() - 1}\")\n }\n }\n }\n}\n\n\n"}, {"source_code": "import java.io.BufferedReader\n\nfun main() {\n val br = System.`in`.bufferedReader()\n val sb = StringBuilder()\n val t = br.readInt()\n repeat(t) {\n val n = br.readInt()\n var i = 2\n var found = false\n while (i * i <= n) {\n if (n % i == 0) {\n found = true\n sb.append(n / i).append(' ').append(n - (n / i)).append('\\n')\n break\n }\n i++\n }\n if (!found) {\n sb.append(1).append(' ').append(n - 1).append('\\n')\n }\n }\n print(sb)\n}\n\nprivate const val SPACE_INT = ' '.toInt()\nprivate const val ZERO_INT = '0'.toInt()\nprivate const val NL_INT = '\\n'.toInt()\n\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\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}"}, {"source_code": "fun main() {\n for (c in 1..readLine()!!.toInt()) {\n val n = readLine()!!.toInt()\n var p = 0\n for (m in 2..100000) {\n if (n % m == 0) {\n p = m\n break\n }\n }\n if (p == 0) {\n p = n\n }\n println(\"${n / p} ${n - (n / p)}\")\n }\n}"}, {"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 var i = 2\n while (i*i <= n) {\n if (n % i == 0) {\n val d = n / i\n return \"$d ${n-d}\"\n }\n i++\n }\n return \"1 ${n-1}\"\n}\n"}, {"source_code": "import java.lang.Integer.max\nimport kotlin.math.sqrt\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 }\n else{\n val firstPrimeMultiple = findFirstPrimeMultiple(n)\n if(firstPrimeMultiple == n) println(\"${n-1} 1\")\n else {\n val number = (n.div(firstPrimeMultiple))\n println(\"$number ${n-number}\")\n }\n }\n }\n}\n\nfun findFirstPrimeMultiple(n: Int): Int{\n repeat(sqrt(n.toDouble()).toInt()+10){\n if(it >1) {\n val remaining = (n / it).toInt()\n if (remaining * it == n) return it\n }\n }\n return n\n}\n\nfun getNumber(row: Int, col: Int, n: Int, m: Int, cell: Int): Int {\n var number = 0\n if(row+1=0) number = number +1\n if (col-1>=0) number = number +1\n return number\n}\n\nprivate fun isValid(row: Int, col: Int, n: Int, m: Int, cell: Int): Boolean {\n var number = 0\n if(row+1=0) number = number +1\n if (col-1>=0) number = number +1\n return cell <=number\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 readLongs() = readStrings().map { it.toLong() }\n"}, {"source_code": "fun main() {\n for (c in 1..readLine()!!.toInt()) {\n val n = readLine()!!.toInt()\n var p = 0\n for (m in 2..100000) {\n if (n % m == 0) {\n p = m\n break\n }\n }\n if (p == 0) {\n p = n\n }\n println(\"${n / p} ${n - (n / p)}\")\n }\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.sqrt\n\nprivate inline fun debug(str: () -> Any?) = println(str().toString()) //{}\nprivate inline fun readInt() = reader.nextInt()\nprivate inline fun readLong() = reader.nextLong()\nprivate inline fun readDouble() = reader.nextDouble()\nprivate inline fun readArr() = readLine()!!.split(\" \").map { it.toInt() }\nprivate inline fun readArr(n: Int) = List(n) { reader.nextInt() }\nprivate inline fun readArrLong() = readLine()!!.split(\" \").map { it.toLong() }\nprivate inline fun readArrLong(n: Int) = List(n) { reader.nextLong() }\nprivate inline fun readArrDouble() = readLine()!!.split(\" \").map { it.toDouble() }\nprivate inline fun readArrDouble(n: Int) = List(n) { reader.nextDouble() }\nprivate inline fun readLineAsCharList() = reader.nextLine().asSequence().toList()\nprivate inline fun readAndSolve(f: () -> Unit): Unit {\n val n = readInt()\n // usually n is the only value in string\n reader.nextLine()\n repeat(n) { f() }\n}\n\nprivate fun Boolean.yn() = if (this) \"YES\" else \"NO\"\nprivate fun Iterable.out() = this.joinToString(\" \")\nprivate val reader = Scanner(System.`in`.bufferedReader()).apply { useLocale(Locale.US) }\n\n\n@ExperimentalStdlibApi\nfun main() = solve1372B()\n\n@ExperimentalStdlibApi\nprivate fun solve1372B() {\n\n val n = readInt()\n val arr = readArr(n)\n val max = arr.max() ?: 5\n val sqrtMax = sqrt(max.toDouble()).toInt() + 1\n\n val primes = mutableListOf()\n val sieve = BitSet(sqrtMax) // false - \u043f\u0440\u043e\u0441\u0442\u043e\u0435, true - \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435\n fun fillSieve() {\n sieve[0] = true\n sieve[1] = true\n var i = 2\n while (i * i < sqrtMax) {\n if (!sieve[i]) {\n primes.add(i)\n var j = i * i\n while (j < sqrtMax) {\n sieve[j] = true\n j += i\n }\n }\n i++\n }\n while (i < sqrtMax) {\n val nextPrime = sieve.nextClearBit(i)\n primes.add(nextPrime)\n i = nextPrime + 1\n }\n }\n fillSieve()\n //println(primes)\n\n for (a in arr) {\n var ans1 = 0\n var ans2 = 0\n var found = false\n for (p in primes) {\n if (a % p == 0) {\n found = true\n ans1 = a / p\n break\n }\n }\n if (!found) {\n ans1 = 1\n }\n ans2 = a - ans1\n println(\"$ans1 $ans2\")\n }\n\n}\n"}, {"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.nextLong()\n var divider = 2\n while (n % divider != 0L && divider <= n / divider.toFloat()) divider++\n val a = if (n % divider == 0L) n / divider else 1\n println(\"$a ${n - a}\")\n }\n}"}, {"source_code": "//package cf1372\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\n\nclass B {\n private val input: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\n private val output: PrintWriter = PrintWriter(System.out)\n\n var st: StringTokenizer? = null\n\n private fun closeAfter() {\n input.close()\n output.close()\n }\n\n private fun next(): String {\n if (st == null || !st!!.hasMoreElements()) {\n st = StringTokenizer(input.readLine())\n }\n\n return st!!.nextToken()\n }\n\n private fun nextInt(): Int {\n return next().toInt()\n }\n\n private fun nextDouble(): Double {\n return next().toDouble()\n }\n\n fun solve() {\n innerSolve()\n closeAfter()\n }\n\n private fun innerSolve() {\n val tt = nextInt()\n for (t in 0 until tt) {\n val n = nextInt()\n if (n % 2 == 0) {\n output.println(\"${n / 2} ${n / 2}\")\n } else {\n var a = 1\n var b = n - 1\n\n var i = 3\n\n while (i <= Math.sqrt(1.0 * n).toInt()) {\n\n if (n % i == 0) {\n a = n / i\n b = n - a\n break\n }\n i += 2\n }\n\n output.println(\"$a $b\")\n }\n }\n }\n}\n\nfun main(args: Array) {\n B().solve()\n}"}, {"source_code": "fun main() {\n for (c in 1..readLine()!!.toInt()) {\n val n = readLine()!!.toInt()\n var p = 0\n for (m in 2..100000) {\n if (n % m == 0) {\n p = m\n break\n }\n }\n if (p == 0) {\n p = n\n }\n println(\"${n / p} ${n - (n / p)}\")\n }\n}"}, {"source_code": "fun main() {\n for (c in 1..readLine()!!.toInt()) {\n val n = readLine()!!.toInt()\n var p = 0\n for (m in 2..100000) {\n if (n % m == 0) {\n p = m\n break\n }\n }\n if (p == 0) {\n p = n\n }\n println(\"${n / p} ${n - (n / p)}\")\n }\n}"}, {"source_code": "fun main() {\n repeat(readInt()) {\n val n = readInt()\n var ans = 1\n var minLcm = n - 1\n\n var i = 2\n while (i * i <= n) {\n if (n % i == 0) {\n val curLcm = lcm(i, n - i)\n if (curLcm < minLcm) {\n minLcm = curLcm\n ans = i\n }\n\n val curLcm2 = lcm(n / i, n - n / i)\n if (curLcm2 < minLcm) {\n minLcm = curLcm2\n ans = n / i\n }\n }\n\n i++\n }\n\n val second = n - ans\n print(\"$ans $second\\n\")\n\n }\n}\n\nfun readInt(): Int = readLine()!!.toInt()\n\nfun gcd(a: Int, b: Int): Int {\n if (a == 0 || b == 0)\n return a + b\n\n return if (a > b) gcd(a % b, b) else gcd(a, b % a)\n}\n\nfun lcm(a: Int, b: Int): Int = a / gcd(a, b) * b"}, {"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\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 val testCount = readInt()\n for (i in 1..testCount) {\n val n = readInt()\n var answerFound = false\n for (x in 2..Math.sqrt(n.toDouble()).toInt()) {\n if (n % x == 0) {\n answerFound = true\n println((n / x).toString() + \" \" + (n / x) * (x - 1))\n break\n }\n }\n if (!answerFound) {\n println(1.toString() + \" \" + (n - 1))\n }\n }\n}"}, {"source_code": "fun main() {\n for (c in 1..readLine()!!.toInt()) {\n val n = readLine()!!.toInt()\n var p = 0\n for (m in 2..100000) {\n if (n % m == 0) {\n p = m\n break\n }\n }\n if (p == 0) {\n p = n\n }\n println(\"${n / p} ${n - (n / p)}\")\n }\n}"}, {"source_code": "fun main() {\n for (c in 1..readLine()!!.toInt()) {\n val n = readLine()!!.toInt()\n var p = 0\n for (m in 2..100000) {\n if (n % m == 0) {\n p = m\n break\n }\n }\n if (p == 0) {\n p = n\n }\n println(\"${n / p} ${n - (n / p)}\")\n }\n}"}, {"source_code": "import kotlin.math.sqrt\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\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 if (num > sqrt(n.toDouble()))\n return n\n return num\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.*\nimport kotlin.math.*\n\nfun 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 var a = 0\n for(i in 2..sqrt(n.toDouble()).toInt()) {\n if (n % i == 0) {\n a = n / i\n break\n }\n }\n println(if(a == 0) \"1 ${n - 1}\" else \"$a ${n - a}\")\n }\n}"}], "negative_code": [{"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}"}, {"source_code": "import java.util.*\nimport kotlin.collections.*\nimport kotlin.math.*\n\nfun 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}"}, {"source_code": "import java.lang.Math.*\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\n//var n = 0\n//var ar = listOf()\nval visited = mutableSetOf()\nval graph = mutableMapOf>()\n\nfun main() {\n val t = readInt()\n for (cases in 0 until t) {\n solve()\n }\n\n// solve()\n}\n\nfun solve() {\n val n = readInt()\n\n var ans1 = 1\n var ans2 = n - 1\n for (i in 2 until sqrt(n.toDouble()).toInt() + 1) {\n if (n % i == 0) {\n val d = n / i\n ans1 = d\n ans2 = (i - 1) * d\n }\n }\n\n println(\"$ans1 $ans2\")\n}\n"}, {"source_code": "fun main() {\n val t = readInt()\n fun findOther(x: Int, n: Int): Int {\n val a = n/x - 1\n return a * x\n }\n\n repeat(t) {\n val n = readInt()\n if (n % 2 == 0) println(\"${n/2} ${n/2}\")\n else {\n var divisor = 1\n val candidates = mutableListOf()\n while (divisor * divisor <= n) {\n if (n % divisor == 0) candidates.add(divisor)\n\n divisor += 2\n }\n\n val ans = candidates.map { Pair(it, findOther(it, n)) }.minBy { it.second }!!\n println(\"${ans.first} ${ans.second}\")\n }\n }\n}\n\n// Input Reader\nprivate fun readLn() = readLine()!!\n\nprivate fun readStrings() = readLn().trim().split(\" \")\nprivate fun readInt() = readLn().toInt()\nprivate fun readInts() = readStrings().map { it.toInt() }\n"}, {"source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.util.*\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() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\n\nfun main(args: Array) {\n b()\n}\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 repeat(readInt()) {\n val n = readInt()\n val a = List(n) { 1 }\n println(a.joinToString(separator = \" \"))\n }\n}\n\nfun pow(a: Int, b: Int): Long {\n var res = 1L\n repeat(b) { res *= a }\n return res\n}\n\nfun adj(i: Int, j: Int, n: Int, m: Int): Int {\n var adj = 4\n if (i == 0) adj--\n if (j == 0) adj--\n if (i == n - 1) adj--\n if (j == m - 1) adj--\n return adj\n}\n\nfun activeAdj(i: Int, j: Int, n: Int, m: Int, a: Array): Int {\n var activeAdj = 0\n if (i - 1 >= 0 && a[i - 1][j] > 0) activeAdj++\n if (j - 1 >= 0 && a[i][j - 1] > 0) activeAdj++\n if (i + 1 < n && a[i + 1][j] > 0) activeAdj++\n if (j + 1 < m && a[i][j + 1] > 0) activeAdj++\n return activeAdj\n}\n\nfun b() {\n repeat(readInt()) {\n val n = readInt()\n val divisor = leastDivisor(n)\n\n println(\"${n / divisor} ${n - n / divisor}\")\n }\n}\n\nfun c() {\n repeat(readInt()) {\n val n = readInt()\n val a = readInts()\n\n val mins = mutableListOf(a[0])\n val maxs = mutableListOf(a[n - 1])\n\n for (i in 1 until n) {\n// println(a[i])\n while (mins.size > 1 && mins[mins.lastIndex] < a[i]) {\n mins.removeAt(mins.lastIndex)\n }\n if (mins.last() > a[i]) {\n mins.add(a[i])\n }\n\n// println(mins)\n }\n\n if (mins.size == 1) {\n println(\"YES\")\n return@repeat\n }\n\n for (i in n - 2 downTo 0) {\n// println(a[i])\n while (maxs.size > 1 && maxs[maxs.lastIndex] > a[i]) {\n maxs.removeAt(maxs.lastIndex)\n }\n if (maxs.last() < a[i]) {\n maxs.add(a[i])\n }\n// println(maxs)\n }\n\n if (maxs.size == 1) {\n println(\"YES\")\n return@repeat\n }\n\n println(\"NO\")\n\n// println(if (a.indexOf(mins[1]) > a.indexOf(maxs[1])) \"YES\" else \"NO\")\n }\n}\n\nfun df(a: IntArray): Pair, Triple> {\n\n var dif = 0L\n var lastIndex = 0\n var maxDif = 0L\n var maxIndex = 0\n var maxLength = 0\n for (i in 0 until a.size - 1 step 2) {\n dif += a[i + 1] - a[i]\n if (dif <= 0) {\n dif = 0\n lastIndex = i + 2\n continue\n }\n if (dif > maxDif) {\n maxDif = dif\n maxIndex = lastIndex\n maxLength = i + 2 - lastIndex\n }\n }\n\n var dif1 = 0L\n var lastIndex1 = 1\n var maxDif1 = 0L\n var maxIndex1 = 0\n var maxLength1 = 0\n for (i in 1 until a.size - 1 step 2) {\n dif1 += a[i + 1] - a[i]\n if (dif1 >= 0) {\n dif1 = 0\n lastIndex1 = i + 2\n continue\n }\n if (dif1 < maxDif1) {\n maxDif1 = dif1\n maxIndex1 = lastIndex1\n maxLength1 = i + 2 - lastIndex1\n }\n }\n\n return Pair(Triple(maxDif, maxIndex, maxLength), Triple(-maxDif1, maxIndex1, maxLength1))\n}\n\ndata class MyPair(var first: Int, var second: Int) : Comparable {\n override fun compareTo(other: MyPair): Int {\n return this.first - other.first\n }\n\n}\n\nfun d() {\n repeat(readInt()) {\n val n = readInt()\n val a = readInts().toIntArray()\n\n val f = IntArray(n + 1)\n val id = List(n + 1) { mutableListOf() }\n val q = PriorityQueue()\n\n for (i in 0 until n) {\n id[ a[i] ].add(i)\n f[a[i]]++\n }\n\n for (i in 0 until n + 1) {\n if (f[i] == 0) {\n q.add(i)\n }\n }\n\n val ans = mutableListOf()\n\n var pref = 0\n\n repeat(n) {\n val element = q.poll()\n\n if (element == n) {\n ans.add(pref)\n q.poll()\n q.add(a[pref])\n a[pref] = n\n }\n\n ans.add(element)\n f[a[element]]--\n if (f[a[element]] == 0) {\n q.add(a[element])\n }\n a[element] = element\n }\n/*\n for (i in 0 until n) {\n// println(i)\n// println(q.peek())\n// println(a.contentToString())\n if (a[i] == i) continue\n if (q.peek() == i) {\n ans.add(i)\n\n val element = a[i]\n a[i] = q.poll() // i\n f[a[i]]++\n f[element]--\n if (f[element] == 0) {\n q.add(element)\n }\n } else {\n for (idx in id[i]) {\n ans.add(idx)\n }\n val index = id[i]\n ans.add(index)\n ans.add(i)\n\n id[q.peek()] = index\n f[q.peek()]++\n a[index] = q.poll()\n\n val element = a[i]\n a[i] = i\n f[a[i]]++\n f[element]--\n if (f[element] == 0) {\n q.add(element)\n }\n }\n }\n */\n\n println(ans.size)\n println(ans.joinToString(separator = \" \", transform = { (it + 1).toString() }))\n }\n}\n\nfun f() {\n val (n, m, q) = readInts()\n val a = Array(n) { IntArray(m) }\n\n val rows = LongArray(n)\n val columns = LongArray(m)\n\n for (i in 0 until n) {\n a[i] = readInts().toIntArray()\n\n for (j in 0 until m) {\n rows[i] = rows[i] + a[i][j]\n columns[j] = columns[j] + a[i][j]\n }\n }\n\n val rowsP = LongArray(n)\n val rowsS = LongArray(n)\n\n val rowsPM = LongArray(n)\n val rowsSM = LongArray(n)\n\n val columnsP = LongArray(m)\n val columnsS = LongArray(m)\n\n val columnsPM = LongArray(m)\n val columnsSM = LongArray(m)\n\n for (i in 0 until q + 1) {\n if (i != 0) {\n val (x, y, z) = readInts()\n val diff = z - a[x - 1][y - 1]\n rows[x - 1] = rows[x - 1] + diff\n columns[y - 1] = columns[y - 1] + diff\n a[x - 1][y - 1] = z\n }\n\n rowsP[0] = rows[0]\n for (j in 1 until n) {\n rowsP[j] = rowsP[j - 1] + rows[j]\n rowsPM[j] = rowsP[j - 1] + rowsPM[j - 1]\n }\n\n rowsS[n - 1] = rows[n - 1]\n for (j in n - 2 downTo 0) {\n rowsS[j] = rowsS[j + 1] + rows[j]\n rowsSM[j] = rowsS[j + 1] + rowsSM[j + 1]\n }\n\n columnsP[0] = columns[0]\n for (j in 1 until m) {\n columnsP[j] = columnsP[j - 1] + columns[j]\n columnsPM[j] = columnsP[j - 1] + columnsPM[j - 1]\n }\n\n columnsS[m - 1] = columns[m - 1]\n for (j in m - 2 downTo 0) {\n columnsS[j] = columnsS[j + 1] + columns[j]\n columnsSM[j] = columnsS[j + 1] + columnsSM[j + 1]\n }\n\n var minRow = minOf(rowsSM[0], rowsPM[n - 1])\n for (j in 1 until n - 1) {\n minRow = minOf(minRow, rowsSM[j] + rowsPM[j])\n }\n\n var minColumn = minOf(columnsSM[0], columnsPM[m - 1])\n for (j in 1 until m - 1) {\n minColumn = minOf(minColumn, columnsSM[j] + columnsPM[j])\n }\n\n print(\"${minRow + minColumn}\\n\")\n }\n}\n\nprivate inline fun sqr(x: Int) = 1L * x * x\n\n\nval t = IntArray(2_200_000)\n\nfun build(a: IntArray, v: Int, tl: Int, tr: Int) {\n if (tl == tr) {\n t[v] = a[tl]\n } else {\n val tm = (tl + tr) / 2\n build(a, v * 2, tl, tm)\n build(a, v * 2 + 1, tm + 1, tr)\n t[v] = t[v * 2] + t[v * 2 + 1]\n }\n\n// println(\"$v [$tl, $tr] = ${t[v]}\")\n}\n\nfun update(v: Int, tl: Int, tr: Int, pos: Int): Int {\n if (tl == tr) {\n t[v]++\n return t[v]\n } else {\n val tm = (tl + tr) / 2\n val res = if (pos <= tm) {\n update(v * 2, tl, tm, pos)\n } else {\n update(v * 2 + 1, tm + 1, tr, pos)\n }\n t[v] = t[v * 2] + t[v * 2 + 1]\n return res\n }\n}\n\nfun delete(v: Int, tl: Int, tr: Int, pos: Int): Int {\n// println(\"$v [$tl, $tr] = ${t[v]}, pos = $pos\")\n if (tl == tr) {\n t[v]--\n return tl\n } else {\n val tm = (tl + tr) / 2\n val res = if (pos <= t[v * 2]) {\n delete(v * 2, tl, tm, pos)\n } else {\n delete(v * 2 + 1, tm + 1, tr, pos - t[v * 2])\n }\n t[v] = t[v * 2] + t[v * 2 + 1]\n return res\n }\n}\n\nfun e() {\n val N = 1_00_000\n val f = IntArray(N)\n for (i in 0 until N) {\n f[i] = f[i / 10] + i % 10\n }\n\n val max = f.max()!!\n\n// println(max)\n\n repeat(readInt()) {\n val (n, k) = readInts()\n\n if (max * (k + 1) >= n) {\n var sum = 0\n for (i in 0 until k + 1) {\n sum += f[i]\n }\n\n if (n == sum) {\n println(0)\n return@repeat\n }\n\n for (i in 1 until N - k) {\n sum -= f[i - 1]\n sum += f[i + k]\n\n if (n == sum) {\n println(i)\n return@repeat\n }\n }\n }\n\n val res = StringBuilder()\n res.append('9')\n var sum = (9 - k..9).sum()\n\n println(\"$res $sum\")\n\n while (sum < n) {\n res.append('9')\n sum += 9 * (k + 1)\n\n println(\"$res $sum\")\n\n if (sum == n) {\n res[res.length - 1] = '9' - k\n println(res)\n return@repeat\n }\n if (sum > n) {\n sum -= 9 * (k + 1)\n for (i in 1 until 9) {\n if (sum + i * (k + 1) == n) {\n res[0] = '0' + i\n res[res.length - 1] = '9' - k\n println(res)\n return@repeat\n }\n }\n break\n }\n }\n\n println(-1)\n }\n}\n\ninternal class FastScanner {\n var br: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\n 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 return st!!.nextToken()\n }\n\n fun nextInt(): Int {\n return next().toInt()\n }\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\nfun leastDivisor(n: Int): Int {\n if (n % 2 == 0) return 2\n if (n % 3 == 0) return 3\n if (n % 5 == 0) return 5\n\n for (i in 7 until n) {\n if (i * i > n) return 1\n\n if (n % i == 0) {\n return i\n }\n }\n\n return 1\n}\n"}, {"source_code": "import java.util.*\nimport kotlin.math.ceil\nimport kotlin.math.floor\nimport kotlin.math.max\nimport kotlin.math.round\n\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n for (i in 0 until n) {\n val total = scanner.nextInt().toDouble()\n if (total.toInt() % 2 == 0) {\n println(\"${total.toInt() / 2} ${total.toInt() / 2}\")\n } else {\n val x = ceil(total / 2).toInt()\n for (j in x downTo 1 step 2) {\n if(total.toInt() % j == 0){\n println(\"$j ${total.toInt() - j}\")\n break;\n }\n }\n }\n }\n}\n\n\n"}, {"source_code": "import java.util.*\nimport kotlin.math.*\n\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n for (i in 0 until n) {\n val total = scanner.nextInt().toDouble()\n if (total.toInt() % 2 == 0) {\n println(\"${total.toInt() / 2} ${total.toInt() / 2}\")\n } else {\n val x = floor(sqrt(total)).toInt()\n var flag = false\n for (j in 3..x) {\n if (total.toInt() % j == 0) {\n flag = true\n println(\"${total.toInt() / j} ${total.toInt() - (total.toInt() / j)}\")\n break;\n }\n }\n if (flag) {\n println(\"1 ${total.toInt() - 1}\")\n }\n }\n }\n}\n\n\n"}, {"source_code": "import java.io.BufferedReader\n\nfun main() {\n val br = System.`in`.bufferedReader()\n val sb = StringBuilder()\n val t = br.readInt()\n repeat(t) {\n val n = br.readInt()\n var i = 2\n var found = false\n while (i * i <= n) {\n if (n % i == 0) {\n found = true\n sb.append(n / i).append(' ').append(n - (n / i)).append('\\n')\n }\n i++\n }\n if (!found) {\n sb.append(1).append(' ').append(n - 1).append('\\n')\n }\n }\n print(sb)\n}\n\nprivate const val SPACE_INT = ' '.toInt()\nprivate const val ZERO_INT = '0'.toInt()\nprivate const val NL_INT = '\\n'.toInt()\n\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\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}"}, {"source_code": "import java.io.BufferedReader\n\nfun main() {\n val br = System.`in`.bufferedReader()\n val sb = StringBuilder()\n val t = br.readInt()\n repeat(t) {\n val n = br.readInt()\n var i = 2\n var found = false\n while (i * i <= n) {\n if (n % i == 0) {\n found = true\n sb.append(n / i).append(' ').append(n - (n / i)).append('\\n')\n }\n i++\n }\n if (!found) {\n sb.append(1).append(' ').append(n - 1)\n }\n }\n print(sb)\n}\n\nprivate const val SPACE_INT = ' '.toInt()\nprivate const val ZERO_INT = '0'.toInt()\nprivate const val NL_INT = '\\n'.toInt()\n\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\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}"}, {"source_code": "import java.lang.Integer.max\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 }\n else{\n val lower = if(n/2-1 != 0) n/2-1 else n/2\n val higher = n-lower\n println(\"$lower $higher\")\n }\n }\n}\n\nfun getNumber(row: Int, col: Int, n: Int, m: Int, cell: Int): Int {\n var number = 0\n if(row+1=0) number = number +1\n if (col-1>=0) number = number +1\n return number\n}\n\nprivate fun isValid(row: Int, col: Int, n: Int, m: Int, cell: Int): Boolean {\n var number = 0\n if(row+1=0) number = number +1\n if (col-1>=0) number = number +1\n return cell <=number\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 readLongs() = readStrings().map { it.toLong() }\n"}, {"source_code": "//package cf1372\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\n\nclass B {\n private val input: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\n private val output: PrintWriter = PrintWriter(System.out)\n\n var st: StringTokenizer? = null\n\n private fun closeAfter() {\n input.close()\n output.close()\n }\n\n private fun next(): String {\n if (st == null || !st!!.hasMoreElements()) {\n st = StringTokenizer(input.readLine())\n }\n\n return st!!.nextToken()\n }\n\n private fun nextInt(): Int {\n return next().toInt()\n }\n\n private fun nextDouble(): Double {\n return next().toDouble()\n }\n\n fun solve() {\n innerSolve()\n closeAfter()\n }\n\n private fun innerSolve() {\n val tt = nextInt()\n for (t in 0 until tt) {\n val n = nextInt()\n if (n % 2 == 0) {\n output.println(\"${n / 2} ${n / 2}\")\n } else {\n var a = 1\n var b = 1\n var cur = n\n\n for (i in 3..(Math.sqrt(1.0 * n).toInt())) {\n if (cur % i == 0) {\n\n if (cur == n) {\n a = i / 2\n b = i - a\n cur /= i\n }\n\n while (cur % i == 0) {\n cur /= i\n a *= i\n b *= i\n }\n\n if (cur == 1) {\n break;\n }\n }\n }\n output.println(\"$a $b\")\n }\n }\n }\n}\n\nfun main(args: Array) {\n B().solve()\n}"}, {"source_code": "//package cf1372\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\n\nclass B {\n private val input: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\n private val output: PrintWriter = PrintWriter(System.out)\n\n var st: StringTokenizer? = null\n\n private fun closeAfter() {\n input.close()\n output.close()\n }\n\n private fun next(): String {\n if (st == null || !st!!.hasMoreElements()) {\n st = StringTokenizer(input.readLine())\n }\n\n return st!!.nextToken()\n }\n\n private fun nextInt(): Int {\n return next().toInt()\n }\n\n private fun nextDouble(): Double {\n return next().toDouble()\n }\n\n fun solve() {\n innerSolve()\n closeAfter()\n }\n\n private fun innerSolve() {\n val tt = nextInt()\n for (t in 0 until tt) {\n val n = nextInt()\n if (n % 2 == 0) {\n output.println(\"${n / 2} ${n / 2}\")\n } else {\n var a = 1\n var b = n - 1\n var cur = n\n\n for (i in 3..(Math.sqrt(1.0 * n).toInt())) {\n if (cur % i == 0) {\n\n if (cur == n) {\n a = i / 2\n b = i - a\n cur /= i\n }\n\n while (cur % i == 0) {\n cur /= i\n a *= i\n b *= i\n }\n\n if (cur == 1) {\n break;\n }\n }\n }\n output.println(\"$a $b\")\n }\n }\n }\n}\n\nfun main(args: Array) {\n B().solve()\n}"}, {"source_code": "//package cf1372\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\n\nclass B {\n private val input: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\n private val output: PrintWriter = PrintWriter(System.out)\n\n var st: StringTokenizer? = null\n\n private fun closeAfter() {\n input.close()\n output.close()\n }\n\n private fun next(): String {\n if (st == null || !st!!.hasMoreElements()) {\n st = StringTokenizer(input.readLine())\n }\n\n return st!!.nextToken()\n }\n\n private fun nextInt(): Int {\n return next().toInt()\n }\n\n private fun nextDouble(): Double {\n return next().toDouble()\n }\n\n fun solve() {\n innerSolve()\n closeAfter()\n }\n\n private fun innerSolve() {\n val tt = nextInt()\n for (t in 0 until tt) {\n val n = nextInt()\n if (n % 2 == 0) {\n output.println(\"${n / 2} ${n / 2}\")\n } else {\n var a = 1\n var b = n - 1\n var cur = n\n\n for (i in 3..(Math.sqrt(1.0 * n).toInt())) {\n if (cur % i == 0) {\n\n if (cur == n) {\n a = i / 2\n b = i - a\n cur /= i\n }\n\n while (cur % i == 0) {\n cur /= i\n a *= i\n b *= i\n }\n\n if (cur == 1) {\n break;\n }\n }\n }\n output.println(\"$a $b\")\n }\n }\n }\n}\n\nfun main(args: Array) {\n B().solve()\n}"}, {"source_code": "//package cf1372\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\n\nclass B {\n private val input: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\n private val output: PrintWriter = PrintWriter(System.out)\n\n var st: StringTokenizer? = null\n\n private fun closeAfter() {\n input.close()\n output.close()\n }\n\n private fun next(): String {\n if (st == null || !st!!.hasMoreElements()) {\n st = StringTokenizer(input.readLine())\n }\n\n return st!!.nextToken()\n }\n\n private fun nextInt(): Int {\n return next().toInt()\n }\n\n private fun nextDouble(): Double {\n return next().toDouble()\n }\n\n fun solve() {\n innerSolve()\n closeAfter()\n }\n\n private fun innerSolve() {\n val tt = nextInt()\n for (t in 0 until tt) {\n val n = nextInt()\n if (n % 2 == 0) {\n output.println(\"${n / 2} ${n / 2}\")\n } else {\n var a = 1\n var b = n - 1\n\n var i = 3\n\n while (i < Math.sqrt(1.0 * n).toInt()) {\n\n if (n % i == 0) {\n a = n / i\n b = n - a\n }\n i += 2\n }\n\n output.println(\"$a $b\")\n }\n }\n }\n}\n\nfun main(args: Array) {\n B().solve()\n}"}, {"source_code": "//package cf1372\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\n\nclass B {\n private val input: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\n private val output: PrintWriter = PrintWriter(System.out)\n\n var st: StringTokenizer? = null\n\n private fun closeAfter() {\n input.close()\n output.close()\n }\n\n private fun next(): String {\n if (st == null || !st!!.hasMoreElements()) {\n st = StringTokenizer(input.readLine())\n }\n\n return st!!.nextToken()\n }\n\n private fun nextInt(): Int {\n return next().toInt()\n }\n\n private fun nextDouble(): Double {\n return next().toDouble()\n }\n\n fun solve() {\n innerSolve()\n closeAfter()\n }\n\n private fun innerSolve() {\n val tt = nextInt()\n for (t in 0 until tt) {\n val n = nextInt()\n if (n % 2 == 0) {\n output.println(\"${n / 2} ${n / 2}\")\n } else {\n var a = 1\n var b = n - 1\n var cur = n\n\n for (i in 3..(Math.sqrt(1.0 * n).toInt())) {\n if (cur % i == 0) {\n\n if (cur == n) {\n a = i / 2\n b = i - a\n cur /= i\n }\n\n while (cur % i == 0) {\n cur /= i\n a *= i\n b *= i\n }\n\n if (cur == 1) {\n break;\n }\n }\n }\n\n if (cur != n && cur != 1) {\n a *= cur\n b *= cur\n }\n output.println(\"$a $b\")\n }\n }\n }\n}\n\nfun main(args: Array) {\n B().solve()\n}"}, {"source_code": "fun main() {\n repeat(readInt()) {\n val n = readInt()\n var ans = 1\n var i = 2\n while (i * i <= n) {\n if (n % i == 0) {\n ans = i\n }\n i++\n }\n\n val second = n - ans\n print(\"$ans $second\\n\")\n }\n}\n\nfun readInt(): Int = readLine()!!.toInt()"}, {"source_code": "import kotlin.math.roundToInt\nimport kotlin.math.sqrt\n\nfun 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 for (i in sqrt(n.toDouble()).roundToInt() + 1 downTo 1) {\n if (n % i == 0) {\n return \"$i ${n-i}\"\n }\n }\n return \"$1 ${n-1}\"\n}\n"}, {"source_code": "import kotlin.math.roundToInt\nimport kotlin.math.sqrt\n\nfun 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 var i = 2\n while (i*i <= n) {\n if (n % i == 0) {\n val d = n / i\n return \"$d ${n-d}\"\n }\n i++\n }\n return \"$1 ${n-1}\"\n}\n"}], "src_uid": "3fd60db24b1873e906d6dee9c2508ac5"} {"source_code": "import org.w3c.dom.css.Rect\nimport java.awt.Rectangle\nimport java.awt.geom.Rectangle2D\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun pos(x1: Int, y1: Int, x2: Int, y2: Int, x3: Int, y3: Int): Boolean {\n return (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1) > 0\n}\n\nfun main(args: Array) {\n\n val scanner = Scanner(System.`in`)\n val rect1 = Array(4) { Pair(scanner.nextInt(), scanner.nextInt()) }\n val rect2 = Array(4) { Pair(scanner.nextInt(), scanner.nextInt()) }\n var flag = false\n val positive = pos(rect1[0].first, rect1[0].second, rect1[1].first,\n rect1[1].second, rect2[0].first, rect2[0].second)\n for (i in 0..3) {\n for (j in 0..3) {\n if (pos(rect1[i].first, rect1[i].second, rect1[(i + 1) % 4].first, rect1[(i + 1) % 4].second,\n rect2[j].first, rect2[j].second) != positive) {\n flag = true\n break\n }\n }\n }\n if (!flag) {\n println(\"YES\")\n return\n }\n flag = false\n val positive1 = pos(rect2[0].first, rect2[0].second, rect2[1].first,\n rect2[1].second, rect1[0].first, rect1[0].second)\n for (i in 0..3) {\n for (j in 0..3) {\n if (pos(rect2[i].first, rect2[i].second, rect2[(i + 1) % 4].first, rect2[(i + 1) % 4].second,\n rect1[j].first, rect1[j].second) != positive1) {\n flag = true\n break\n }\n }\n }\n if (!flag) {\n println(\"YES\")\n return\n }\n for (i in 0..3) {\n if (rect1[i].second == rect1[(i + 1) % 4].second) {\n for (j in 0..3) {\n if (cross1(rect1[i].first, rect1[(i + 1) % 4].first, rect1[i].second,\n rect2[j].first, rect2[j].second, rect2[(j + 1) % 4].first, rect2[(j + 1) % 4].second)) {\n println(\"YES\")\n return\n }\n }\n }\n else {\n for (j in 0..3) {\n if (cross2(rect1[i].second, rect1[(i + 1) % 4].second, rect1[i].first,\n rect2[j].first, rect2[j].second, rect2[(j + 1) % 4].first, rect2[(j + 1) % 4].second)) {\n println(\"YES\")\n return\n }\n }\n }\n }\n println(\"NO\")\n}\n\nfun cross1(x1: Int, x2: Int, y: Int, x3: Int, y3: Int, x4: Int, y4: Int): Boolean {\n val a = (y4 - y3) / (x4 - x3)\n val b = y3 - a * x3\n return (((y - b) / a) in min(x1, x2)..max(x1, x2)) && (((y - b) / a) in min(x3, x4)..max(x3, x4))\n}\n\nfun cross2(y1: Int, y2: Int, x: Int, x3: Int, y3: Int, x4: Int, y4: Int): Boolean {\n val a = (y4 - y3).toDouble() / (x4 - x3)\n val b = y3 - a * x3\n return (a * x + b) in min(y1, y2)..max(y1, y2) && (a * x + b) in min(y3, y4)..max(y3, y4)\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//}", "positive_code": [{"source_code": "import kotlin.math.*\n\nfun main(args: Array) {\n val a = readLine()!!.splitToIntArray().toRect()\n val b = readLine()!!.splitToIntArray().toRect()\n val h = (b.x1 - b.x0) / 2\n val s0 = b.x1 + b.y0 - h\n val s1 = b.x1 + b.y0 + h\n val d0 = b.x0 - b.y0 - h\n val d1 = b.x0 - b.y0 + h\n for (x in a.x0..a.x1) {\n for (y in a.y0..a.y1) {\n if ((x + y) in s0..s1 && (x - y) in d0..d1) {\n println(\"YES\")\n return\n }\n }\n }\n println(\"NO\")\n}\n\nfun IntArray.toRect(): Rect {\n var x0 = Int.MAX_VALUE\n var x1 = Int.MIN_VALUE\n var y0 = Int.MAX_VALUE\n var y1 = Int.MIN_VALUE\n for (i in 0..3) {\n x0 = min(get(2 * i), x0)\n x1 = max(get(2 * i), x1)\n y0 = min(get(2 * i + 1), y0)\n y1 = max(get(2 * i + 1), y1)\n }\n return Rect(x0, x1, y0, y1)\n}\n\nclass Rect(val x0: Int, val x1: Int, val y0: Int, val y1: Int)\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).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}"}], "negative_code": [], "src_uid": "f6a3dd8b3bab58ff66055c61ddfdf06a"} {"source_code": "fun main() {\n var n = readLine()!!.toInt()\n var ans: Int = 0\n var i: Int = 1\n while (n >= 1) {\n ans += (n * i) - (i - 1)\n n--\n i++\n }\n print(ans)\n}\n", "positive_code": [{"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 }\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 readInt() = readToken().toInt()\n fun readLong() = readToken().toLong()\n fun readLine() : String {\n tok = StringTokenizer(\"\")\n return rd.readLine()\n }\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 bad = IntArray(n + 1)\n val good = IntArray(n + 1)\n bad[1] = 0\n good[1] = 1\n for (i in 2 .. n) {\n bad[i] = i - 1 + bad[i - 1]\n good[i] = 1 + bad[i - 1] + good[i - 1]\n }\n io.println(bad[n] + good[n])\n}"}, {"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 val ans = k+(1..k-1).fold(0L){acc, i -> acc + i*(k-i)}\n println(ans)\n}"}, {"source_code": "fun main(){\n var n = readLine()!!.toInt()\n var i=2\n var ans=n\n while (n-- > 1){\n ans+= (n-1)*i +1\n i++\n }\n println(ans)\n}"}, {"source_code": "fun main() {\n val input = readLine()!!.toInt()\n var level = 1\n var presses = input\n for (i in input downTo 1) {\n val mistakes = i - 1\n presses += level++ * mistakes\n }\n println(presses)\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n print((n * n * (n - 1)) / 2 - (n * (n - 1) * (2 * n - 1)) / 6 + n)\n}"}, {"source_code": "fun main(args: Array) {\n val n= readLine()!!.toLong()\n val result=(n-1)*n*(n+1)/6+n\n println(result)\n}"}, {"source_code": "fun main() {\n var n = readLine()!!.toInt()\n var ans: Int = 0\n var i: Int = 1\n while (n >= 1) {\n ans += (n * i) - (i - 1)\n n--\n i++\n }\n print(ans)\n}\n"}, {"source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n\n var n = readInt() + 1\n var selecting = 1\n var result = 0\n while (--n > 0) {\n result += 1 + selecting * n - selecting\n selecting++\n }\n print(result)\n}"}, {"source_code": "fun 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.toLong()\n val t_1 = (n * n * (n + 1)) / 2\n val t_2 = (n * (n + 1) * ((2 * n) + 1)) / 6\n val t_3 = n\n val result = t_1 - t_2 + t_3\n println(\"${result}\")\n }\n}"}, {"source_code": "fun main(args: Array) {\n readLine()!!.toInt().let { println((1..it).sumBy { it + (1..it-2).sumBy { it }}) }\n}"}, {"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}"}], "negative_code": [{"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}"}, {"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}"}, {"source_code": "fun main(args: Array) {\n val n= readLine()!!.toInt()\n val result=(n*n-1*n)*(n+1)/6+n\n println(result)\n}"}, {"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"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n print((n*(n-1))+1)\n}\n"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n println(n * (n + 1) / 2)\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n println(n * (n + 1) / 2 + n -2)\n}"}], "src_uid": "6df251ac8bf27427a24bc23d64cb9884"} {"source_code": "import kotlin.math.pow\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (numProblems, minTotalDifficult, maxTotalDifficult, minbiggerDiff) = readInts()\n val difficulties = readInts().sorted()\n var sol = 0\n for (candidate in 1 until 2.0.pow(numProblems).toInt()) {\n val bitMask = candidate.toString(radix = 2)\n var min: Int? = null\n var max: Int? = null\n var sum = 0L\n for (pos in bitMask.indices) {\n val realPos = numProblems - bitMask.length + pos\n if (bitMask[pos] == '1') {\n if (min == null) min = difficulties[realPos]\n max = difficulties[realPos]\n sum += difficulties[realPos]\n }\n }\n if (sum in minTotalDifficult..maxTotalDifficult && max!! - min!! >= minbiggerDiff) sol++\n }\n print(sol)\n}", "positive_code": [{"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 n = reader.nextInt()\n val l = reader.nextInt()\n val r = reader.nextInt()\n val x = reader.nextInt()\n val c = reader.nextArrayInt(n).sorted()\n\n val bins = mutableListOf()\n calcBin(bins, \"\", n)\n bins.sort()\n\n var ans = 0\n bins.forEach { bin ->\n if (bin.count { it == '1' } < 2) {\n return@forEach\n }\n val i = bin.indexOfFirst { it == '1' }\n val j = bin.indexOfLast { it == '1' }\n if (c[j] - c[i] < x) {\n return@forEach\n }\n val s = sum(c, i, j, bin)\n if (s in l..r) {\n ans++\n }\n }\n writer.println(ans)\n }\n\n private fun calcBin(bins: MutableList, s: String, n: Int) {\n if (s.length == n) {\n bins.add(s)\n return\n }\n calcBin(bins, s + \"1\", n)\n calcBin(bins, s + \"0\", n)\n }\n\n private fun sum(c: List, i: Int, j: Int, bin: String): Int {\n var ans = 0\n for (x in i..j) {\n if (bin[x] == '1') {\n ans += c[x]\n }\n }\n return ans\n }\n\n fun clear() {\n writer.close()\n }\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}"}], "negative_code": [], "src_uid": "0d43104a0de924cdcf8e4aced5aa825d"} {"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')\n val range = 1..10 step 2\n val odd = range.flatMap { n -> listOf(text.filter { (it.toInt()-'0'.toInt()) == n }.count()) }.reduce({ x, y -> x + y });\n print(text.filter { it in v }.count()+odd)\n close()\n}", "positive_code": [{"source_code": "fun main(args: Array) {\n val a = readLine()!!.trim()\n val voewels = arrayOf('a','e','i','o','u')\n val odds = arrayOf('1','3','5','7','9')\n val r = a.count { it in voewels || it in odds }\n println(r)\n}"}, {"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 == 1) {\n total++\n }\n }\n }\n }\n println(total)\n }\n}\n"}, {"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==1) || it == 'a' || it == 'u' || it == 'o' || it == 'i' || it == 'e' }\n println(res.count())\n}"}, {"source_code": "fun main() = println(readLine()!!.count { it in \"aeiou13579\" })"}, {"source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val res = next().toCharArray()\n .filter { c -> arrayListOf('a', 'e', 'i', 'o', 'u', '1', '3', '5', '7', '9')\n .filter { it == c }.any() }.size\n print(res)\n}\n\n"}, {"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', '1', '3', '5', '7', '9')\n return v.filter { it == this }.any()\n}\n\n\n\n"}, {"source_code": "fun main() {\n print(readLine()!!.count { c -> c in setOf('a', 'e', 'i', 'o', 'u', '1', '3', '5', '7', '9') })\n}"}, {"source_code": "import kotlin.*\n\nfun main(args: Array) {\n var vowelsAndEvens = setOf(\n 'a', 'o', 'e', 'u', 'i',\n '1', '3', '5', '7', '9'\n )\n\n var string = readLine() ?: \"\"\n println(string.count { it in vowelsAndEvens })\n\n}"}, {"source_code": "fun parse_int(): MutableList {\n return readLine()!!.split(' ').map {x: String -> x.toInt()}.toMutableList()\n}\n\nfun main(args: Array) {\n val inp = readLine()!!.trim()\n var odds = 0\n var vowels = 0\n\n for (c in inp) {\n if (c.isDigit()) {\n odds += c.toInt() % 2\n } else {\n if (c in \"aeiou\") vowels += 1\n }\n }\n\n println(odds + vowels)\n\n\n}\n\n"}, {"source_code": "fun main(args: Array) {\n var a = readLine()!!\n var ans = 0\n for (c in a){\n if (c.isDigit()){\n var cur = ((c.toInt())%2 == 1)\n if(cur){\n ans+=1\n }\n }else {\n if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){\n ans += 1\n }\n }\n }\n println(ans)\n\n}\n"}, {"source_code": "fun main() {\n //println((4 or 6)xor(4 or 5))\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n val list = listOf(\"a\", \"e\", \"i\", \"o\", \"u\", \"1\", \"3\", \"5\", \"7\", \"9\")\n val v = r.readLine()!!.split(\"\").filter { it.isNotEmpty() }.count { it in list }\n println(v)\n}"}], "negative_code": [{"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}"}, {"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"}, {"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}"}, {"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.toSet().filter { it in v }.count())\n close()\n}"}, {"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')\n var range = 1..10 step 2\n print(text.filter { it in v }.count()+range.filter { (it+'0'.toInt()).toChar() in text.toSet() }.count())\n close()\n}"}, {"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}"}, {"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 = this == 'a' || this == 'e' || this == 'i' || this == 'o' || this == 'u' || this == 'y'\n\n\n\n"}, {"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"}, {"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}"}], "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223"} {"source_code": "\nfun main(){\n var set = readLine()!!.split(\" \").toSet()\n println(4 - set.size)\n}\n", "positive_code": [{"source_code": "fun main()\n{\n val has = readLine()!!.split(\" \").map { it.toInt() }.toSet().size\n println( 4 - has)\n\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n val sc = Scanner(System.`in`)\n var set = HashSet()\n for(i in 0..3)\n set.add(sc.nextInt())\n print(4 - set.size)\n}"}, {"source_code": "fun main() = (4 - hashSetOf().apply { addAll(readLine()!!.split(\" \")) }.size).run(::println)"}, {"source_code": "\n fun main(args: Array) {\n readLine()!!.split(\" \").map { it.toInt()}.let {\n println(it.size - it.toSet().size)}\n\n }\n"}, {"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 readLine()!!.split(\" \").map { it.toInt() }.toSet().count().let { output.println(4 - it) }\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}"}, {"source_code": "/* https://codeforces.com/problemset/problem/228/A */\n\nfun main() {\n println(4 - readLine()!!.split(\" \").toSet().size)\n}"}, {"source_code": "fun main() {\n val count = readLine()!!.split(\" \")\n .map(Integer::parseInt)\n .distinct()\n .count()\n\n println(4 - count)\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val shoes = Scanner(System.`in`).nextLine().split(\" \").map{it.toInt()}\n val distinct = HashSet()\n var ans = 0\n\n for(i in shoes.indices) {\n if(distinct.contains(shoes[i])) {\n ans++\n }\n else {\n distinct.add(shoes[i])\n }\n }\n\n println(ans)\n}"}, {"source_code": "fun main(args: Array) {\n val shoes = HashSet(readLine()?.split(\" \")?.map{it.toInt()})\n println(4 - shoes.size)\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val shoes = Scanner(System.`in`).nextLine().split(\" \").map{it.toInt()}\n val distinct = HashSet()\n\n for(i in shoes.indices) {\n distinct.add(shoes[i])\n }\n\n println(4 - distinct.size)\n}"}, {"source_code": "fun main(args: Array) {\n val a = readInts().toSet().size\n print(\"${4 - a}\")\n}\n\nprivate fun readInts() = readLine()!!.split(\" \").map { it.toInt() }"}, {"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().split(\" \").map { it.toInt() }\n println(s.size - s.toSet().size)\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n val reader = Scanner(System.`in`)\n val t = reader.nextLine().split(\" \").toSet()\n println(4-t.size)\n}"}, {"source_code": "fun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\n\n\nfun findMinNumberOfShoes(): Int {\n\n val colorsHas = readInts().toSet()\n return 4 - colorsHas.size\n}\n\n\nfun main() {\n print(findMinNumberOfShoes())\n}\n"}, {"source_code": "fun main(args: Array) {\n val p = readLine()!!.split(' ').map { it.toInt() }\n println(4 - p.toSet().size)\n}"}, {"source_code": "import java.util.*\n\nfun main(){\n\n val scan = Scanner(System.`in`)\n val arr = Array(4){ _ -> scan.nextInt()}\n var count = 1\n\n for (i in 0 until 3){\n var isUnique = true\n\n for (j in i+1 until 4){\n if (arr[i] == arr[j]){\n isUnique = false\n break\n }\n }\n\n if (isUnique) count++\n }\n\n print(4-count)\n\n\n}"}, {"source_code": "fun main() {\n var colors : Set = readLine()!!.split(' ').map { it.toInt() }.toSet();\n println(4 - colors.size)\n}"}, {"source_code": "fun main() {\n println(4 - readLine()!!.split(\" \").map { it.toInt() }.toSet().size)\n}"}, {"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 lst = readInts().sorted()\n var ans = 0\n for (i in 1 until lst.size) {\n if (lst[i - 1] == lst[i])\n ans++\n }\n println(ans)\n}\n"}, {"source_code": "fun main() {\n println(4 - readLine()!!.split(\" \").toMutableSet().size)\n}"}, {"source_code": "import kotlin.math.abs\n\n\nfun main() {\n val read = readLine()!!.split(\" \").map { it.toInt() }\n val distinct = read.distinct()\n print(abs(distinct.size-read.size))\n}\n\n"}, {"source_code": "fun main(args: Array) {\n val S: MutableSet = mutableSetOf()\n readLine()!!.split(' ').map(String::toInt).forEach {\n S.add(it)\n }\n val ans = 4 - S.size.toInt()\n print(\"$ans\\n\")\n}\n"}, {"source_code": "fun main(args: Array) {\n val S: MutableSet = mutableSetOf()\n readLine()!!.split(' ').map(String::toInt).forEach {\n S.add(it)\n }\n val ans = 4 - S.size.toInt()\n print(\"$ans\\n\")\n}\n"}, {"source_code": "fun main(args: Array) {\n println(4 - readLine()!!.split(' ').toSet().size)\n}"}, {"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 shoes = readInts()\n\n println(4 - shoes.distinct().size)\n}\n"}, {"source_code": "fun main(args: Array) {\n println(4 - readLine()!!.split(' ').map { it.toInt() }.toSet().size)\n}"}, {"source_code": "/* template start */\n// input\nprivate fun readString() = readLine()!!\nprivate fun readStrings() = readString().split(\" \")\nprivate fun readInt() = readString().toInt()\nprivate fun readDigits() = readString().map { it - '0' }\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\n\n// output\nprivate fun T.print(map: (T) -> String = { it.toString() }) = println(map(this))\nprivate fun Iterable.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)\nprivate fun Array.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)\nprivate fun IntArray.print(sep: String? = null, map: ((Int) -> String)? = null) = asSequence().print(sep, map)\nprivate fun Sequence.print(sep: String? = null, map: ((T) -> String)? = null) =\n println(joinToString(sep ?: \"\", transform = map ?: { it.toString() }))\n\n// others\nprivate val Int.isEven: Boolean get() = this % 2 == 0\nprivate val Int.isOdd: Boolean get() = !this.isEven\nprivate fun queries(block: (Int) -> Unit) = repeat(readInt(), block)\n\n/* template end */\n\nfun main() {\n val n = readInts()\n println(n.size - n.toSet().size)\n}"}, {"source_code": "\nfun main() {\n val set = HashSet()\n val arr = readLine()?.split(\" \")?.forEach {\n set.add(it.toInt())\n }\n\n print(4 - set.size)\n\n}\n\n"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n \n val l = r.readLine()!!.split(\" \").map { it.toInt() }.toSet()\n println(4-l.size)\n \n}"}, {"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 main(){\n var col=readInts().toIntArray()\n col.sort()\n var ans=0\n for(i in 1 until 4)if(col[i]==col[i-1])ans++\n printLine(\"$ans\")\n output()\n}"}, {"source_code": "fun main() {\n val arr = readLine()!!.split(\" \").distinct()\n print(4 - arr.size)\n}"}, {"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(4)\n for (i in a.indices) {\n a[i] = io.readInt()\n }\n val res = 4 - a.toSet().size\n io.println(res)\n io.close()\n}\n\nfun main(args: Array) {\n Thread({ solve() }).start()\n}\n"}], "negative_code": [], "src_uid": "38c4864937e57b35d3cce272f655e20f"} {"source_code": "fun main() {\n val scale = readLine()!!\n val middle = scale.indexOf('|')\n val left = scale.substring(0, middle)\n val right = scale.substring(middle + 1)\n val (smaller, bigger) = if (left.length <= right.length) left to right else right to left\n val other = readLine()!!\n if ((smaller.length + bigger.length + other.length) and (1) == 1) return print(\"Impossible\")\n val half = (smaller.length + bigger.length + other.length) / 2\n if (smaller.length + other.length < half) return print(\"Impossible\")\n val newSmaller = smaller + other.substring(0, half - smaller.length)\n val newBigger = bigger + other.substring(half - smaller.length)\n print(if (left.length <= right.length) \"$newSmaller|$newBigger\" else \"$newBigger|$newSmaller\")\n}", "positive_code": [{"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.lang.StringBuilder\nimport kotlin.math.abs\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val scales = br.readLine().split(\"|\")\n val notUsed = br.readLine()\n val left = scales[0].length\n val right = scales[1].length\n val missing = abs(left - right)\n if (notUsed.length >= missing && (notUsed.length - missing) % 2 == 0) {\n val useToComplete = notUsed.substring(0 until missing)\n val rest = notUsed.substring(missing)\n val rest1 = rest.substring(0 until rest.length/2)\n val rest2 = rest.substring(rest.length/2)\n val newLeft = StringBuilder(scales[0])\n val newRight = StringBuilder(scales[1])\n if (left < right) {\n newLeft.append(useToComplete + rest1)\n newRight.append(rest2)\n } else {\n newLeft.append(rest1)\n newRight.append(useToComplete + rest2)\n }\n println(\"$newLeft|$newRight\")\n } else {\n println(\"Impossible\")\n }\n}"}], "negative_code": [], "src_uid": "917f173b8523ddd38925238e5d2089b9"} {"source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\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 arr = IntArray(101)\n val n =scanner.nextInt()\n for (i in 0 until n) {\n val a = scanner.nextInt()\n arr[a]++\n }\n println(arr.max())\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)\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}", "positive_code": [{"source_code": "/* http://codeforces.com/problemset/problem/1003/A */\n\nfun main() {\n readLine() // skip first line\n val counts = IntArray(101) { 0 }\n val coins = readLine()!!.split(\" \").map { it.toInt() }\n coins.forEach { counts[it] += 1 }\n println(counts.max())\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n var num = readLine()!!.split(' ').map { it.toInt() }.toIntArray()\n var count = Array(100){0}\n for (i in num){\n count[i-1]++\n }\n var max = 0\n for ( i in count )\n max = if (i > max) i else max\n print(max)\n}"}, {"source_code": "import java.lang.Math.max\nimport java.lang.Math.min\nimport java.util.*\n\n\n//TODO: Search reduce...\n/*\n SPREAD operator (*values)\n\n\n* */\nfun main(args: Array) {\n var coin:Int\n var coins = IntArray(101){ _->0}\n val reader = Scanner(System.`in`)\n val numOfCoins = reader.nextInt()\n for (index in 1..numOfCoins) {\n coin = reader.nextInt()\n ++coins[coin]\n }\n val maxPocket = coins.max()\n println(maxPocket)\n}\n\n\n\n\n\n"}, {"source_code": "import java.util.*\nfun main(args:Array){\nval sc = Scanner(System.`in`)\nval n = sc.nextInt()\nval cost = Array(101,{0})\nfor(i in 1..n)\n cost[sc.nextInt()]++\nprintln(cost.max())\n}"}, {"source_code": "import java.util.*\nfun main(args: Array)\n{\n val n = readLine()!!.toInt()\n val coins = readLine()!!.split(' ').map(String::toInt).toIntArray()\n val cnt = Array(100,{i-> coins.count{coin -> coin == i+1}})\n println(cnt.max())\n}"}, {"source_code": "fun main(args: Array)\n{\n val n = readLine()!!.toInt()\n val coins = readLine()!!.split(' ').map(String::toInt).toIntArray()\n val count = Array(100, {i -> coins.count {coin -> coin == i + 1}})\n val ans = count.max()\n println(ans)\n}"}, {"source_code": "fun 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 n = getIntString()[0]\n val coins = getIntString()\n\n val countArr = Array(100) { 0 }\n coins.forEach { countArr[it-1]++ }\n println(countArr.max())\n}"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n readLine()\n val arr = readInts()\n val occs = IntArray(101)\n for (a in arr) occs[a]++\n print(occs.max())\n}"}, {"source_code": "fun 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 val n = readInt()\n val arr = readIntArray()\n val res = arr.groupingBy {\n it\n }.eachCount().maxBy {\n it.value\n }!!.value\n println(res)\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val n = nextInt()\n val c = IntArray(101)\n for (i in 0 until n) {\n c[nextInt()]++;\n }\n print(c.max()!!)\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val costs = Array(101, { 0 })\n for (i in 1..n) {\n costs[sc.nextInt()] += 1\n }\n println(costs.max())\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.max\n\nfun main(args : Array) {\n\n val n : Int = readLine()!!.toInt()\n var map : MutableMap = mutableMapOf()\n val str = readLine()!!.split(\" \")\n\n for(i in 0 until n)\n map[str[i].toInt()] = 0\n\n for(i in 0 until n) {\n val t = map[str[i].toInt()]!!.toInt() + 1\n map[str[i].toInt()] = t\n }\n\n var ans = 0\n for(i in map)\n ans = max(ans, i.value)\n\n println(ans)\n\n}"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n\n val n = r.readLine()!!.toInt()\n val v = r.readLine()!!.split(\" \").map { it.toInt() }.groupBy { it }.map { (k, v) -> v.size }.max()\n println(v)\n}"}, {"source_code": "\nimport java.io.*\nimport java.util.*\nimport kotlin.math.max\n\nfun solve() {\n\n val n = nextInt()\n val a = nextArray(n)\n\n var ans = 0\n for (i in 1..100) {\n ans = max(a.count { it == i }, ans)\n }\n\n println(ans)\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}"}, {"source_code": " import java.util.*\n\n\n fun main(args:Array) {\n val sc = Scanner(System.`in`)\n var n = sc.nextInt()\n var coin:Array = Array(100,{0})\n for (i in 0 until n){\n coin[sc.nextInt()-1]++\n }\n\n print(coin.max())\n }\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n\n val coinsCount = input.nextLine()\n val coins = input.nextLine().split(\" \").map { it.toInt() }\n val pocketsSet = mutableMapOf()\n\n var max = 0\n\n coins.forEach {\n val coinPrice = (pocketsSet[it] ?: 0) + 1\n\n max = Math.max(max, coinPrice)\n\n pocketsSet[it] = coinPrice\n }\n\n println(max)\n}\n"}, {"source_code": "fun main(arg: Array){\n val coinCount = readLine()!!.toInt()\n val coins = readLine()!!.split(' ').map{it.toInt()}\n\n var map = HashMap()\n for(coin in coins) {\n val count = map[coin] ?: 0\n map[coin] = count + 1 \n // System.out.print(\"${d}\\n\")\n }\n \n \n System.out.print(\"${map.values.max()}\")\n}\n"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val values = readLine()!!.split(' ').map(kotlin.String::toInt)\n\n\n val counts = mutableListOf()\n\n values.forEach {value ->\n counts.add(values.count { it == value })\n }\n\n val max = counts.max()\n\n print(max)\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val values = readLine()!!.split(' ').map(kotlin.String::toInt)\n\n\n val counts = mutableListOf()\n\n values.forEach {value ->\n counts.add(values.count { it == value })\n }\n\n val max = counts.max()\n\n print(max)\n}"}], "negative_code": [{"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"}, {"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 =0\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\n"}], "src_uid": "f30329023e84b4c50b1b118dc98ae73c"} {"source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n@file:OptIn(ExperimentalStdlibApi::class)\n\nimport java.io.PrintWriter\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\n/** @author Spheniscine */\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n// val startTime = System.nanoTime()\n\n val numCases = 1//readInt()\n case@ for(case in 1..numCases) {\n //print(\"Case #$case: \")\n\n val k = 59\n\n var nPrimes = 0\n val masks = IntArray(k+1)\n for(i in 2..k) if(masks[i] == 0) {\n val bit = 1 shl nPrimes\n nPrimes++\n\n for(j in i..k step i) masks[j] += bit\n }\n\n val m = 1 shl nPrimes\n\n val n = readInt()\n val A = readIntArray(n)\n\n val V = Array(n) { IntArray(m) }\n var D = IntArray(m) { inf }\n D[0] = 0\n\n for(i in 0 until n) {\n val a = A[i]\n val Di = IntArray(m) { inf }\n for(b in 1..a+a-1) {\n val mask = masks[b]\n val antiMask = mask xor m-1\n var s = antiMask\n val d = abs(b - a)\n while(true) {\n if(Di.setMin(s or mask, D[s] + d)) {\n V[i][s or mask] = b\n }\n if(s == 0) break\n s = s-1 and antiMask\n }\n }\n\n D = Di\n }\n\n val ans = IntArray(n)\n\n var cur = (0 until m).minByOrNull { D[it] }!!\n\n for(i in n-1 downTo 0) {\n ans[i] = V[i][cur]\n cur -= masks[ans[i]]\n }\n\n println(ans.joinToString(\" \"))\n }\n\n// iprintln(\"Time: ${(System.nanoTime() - startTime) / 1000000} ms\")\n}\n\nconst val inf = Int.MAX_VALUE / 2\n\nfun IntArray.setMax(i: Int, v: Int) = if(v > get(i)) { set(i, v); true } else false\nfun IntArray.setMin(i: Int, v: Int) = if(v < get(i)) { set(i, v); true } else false\n\n/** IO */\n//@JvmField val ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n//const val PATH = \"src/main/resources/\"\n//@JvmField val INPUT = File(PATH + \"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(PATH + \"output.txt\").outputStream()\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() else c\n }\n}\n\n/** @param skipNext Whether to skip the next character (usually whitespace), defaults to true */\nfun readCharArray(n: Int, skipNext: Boolean = true): CharArray {\n val res = CharArray(n) { readChar() }\n if(skipNext) readChar()\n return res\n}\n\nfun readLine(): String? {\n var c = readChar()\n return if(c == Char.MIN_VALUE) null\n else buildString {\n while(c != '\\n' && c != Char.MIN_VALUE) {\n append(c)\n c = readChar()\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\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** sort overrides to avoid quicksort attacks */\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\ninline fun _mergeSort(a0: A, n: Int, tmp0: A, get: A.(Int) -> T, set: A.(Int, T) -> Unit, cmp: (T, T) -> Int) {\n var a = a0\n var tmp = tmp0\n var len = 1\n while(len < n) {\n var l = 0\n while(true) {\n val m = l + len\n if(m >= n) break\n val r = min(n, m + len)\n var i = l\n var j = m\n for(k in l until r) {\n if(i != m && (j == r || cmp(a.get(i), a.get(j)) <= 0)) {\n tmp.set(k, a.get(i++))\n } else tmp.set(k, a.get(j++))\n }\n l = r\n }\n for(i in l until n) tmp.set(i, a.get(i))\n val t = a; a = tmp; tmp = t\n len += len\n }\n if(a !== a0) for(i in 0 until n) a0.set(i, tmp0.get(i))\n}\n\ninline fun IntArray.sortWith(cmp: (Int, Int) -> Int) { _mergeSort(this, size, IntArray(size), IntArray::get, IntArray::set, cmp) }\ninline fun > IntArray.sortBy(func: (Int) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }\ninline fun > IntArray.sortByDescending(func: (Int) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }\nfun IntArray.sort() { sortBy { it } }\nfun IntArray.sortDescending() { sortByDescending { it } }\n\ninline fun LongArray.sortWith(cmp: (Long, Long) -> Int) { _mergeSort(this, size, LongArray(size), LongArray::get, LongArray::set, cmp) }\ninline fun > LongArray.sortBy(func: (Long) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }\ninline fun > LongArray.sortByDescending(func: (Long) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }\nfun LongArray.sort() { sortBy { it } }\nfun LongArray.sortDescending() { sortByDescending { it } }\n\ninline fun DoubleArray.sortWith(cmp: (Double, Double) -> Int) { _mergeSort(this, size, DoubleArray(size), DoubleArray::get, DoubleArray::set, cmp) }\ninline fun > DoubleArray.sortBy(func: (Double) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }\ninline fun > DoubleArray.sortByDescending(func: (Double) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }\nfun DoubleArray.sort() { sortBy { it } }\nfun DoubleArray.sortDescending() { sortByDescending { it } }\n\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\n// import preserving junk function\n@Suppress(\"NonAsciiCharacters\") fun \u96ea\u82b1\u98c4\u98c4\u5317\u98a8\u562f\u562f\u5929\u5730\u4e00\u7247\u84bc\u832b() { iprintln(max(1, 2)) }\n\nfun IntArray.sumLong() = sumOf { it.toLong() }\n\nfun IntArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun IntArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun LongArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun LongArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun DoubleArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun DoubleArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun > Array.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun > Array.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun > List.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun > List.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\n\n// max/min Kotlin 1.6 -> 1.4 shim\nfun IntArray.max() = maxOf { it }\nfun IntArray.min() = minOf { it }\nfun LongArray.max() = maxOf { it }\nfun LongArray.min() = minOf { it }\nfun CharArray.max() = maxOf { it }\nfun CharArray.min() = minOf { it }\nfun > Iterable.max() = maxOf { it }\nfun > Iterable.min() = minOf { it }\nfun > Sequence.max() = maxOf { it }\nfun > Sequence.min() = minOf { it }", "positive_code": [{"source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n@file:OptIn(ExperimentalStdlibApi::class)\n\nimport java.io.PrintWriter\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\n/** @author Spheniscine */\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n// val startTime = System.nanoTime()\n\n val numCases = 1//readInt()\n case@ for(case in 1..numCases) {\n //print(\"Case #$case: \")\n\n val k = 59\n\n var nPrimes = 0\n val masks = IntArray(k+1)\n for(i in 2..k) if(masks[i] == 0) {\n val bit = 1 shl nPrimes\n nPrimes++\n\n for(j in i..k step i) masks[j] += bit\n }\n\n val m = 1 shl nPrimes\n\n val n = readInt()\n val A = readIntArray(n)\n\n val V = Array(n) { IntArray(m) }\n var D = IntArray(m) { inf }\n D[0] = 0\n\n for(i in 0 until n) {\n val a = A[i]\n val Di = IntArray(m) { inf }\n for(b in 1..a+a-1) {\n val mask = masks[b]\n val antiMask = mask xor m-1\n var s = antiMask\n while(true) {\n val d = D[s]\n if(Di.setMin(s or mask, d + abs(b - a))) {\n V[i][s or mask] = b\n }\n if(s == 0) break\n s = s-1 and antiMask\n }\n }\n\n D = Di\n }\n\n val ans = IntArray(n)\n\n var cur = (0 until m).minByOrNull { D[it] }!!\n\n for(i in n-1 downTo 0) {\n ans[i] = V[i][cur]\n cur -= masks[ans[i]]\n }\n\n println(ans.joinToString(\" \"))\n }\n\n// iprintln(\"Time: ${(System.nanoTime() - startTime) / 1000000} ms\")\n}\n\nconst val inf = Int.MAX_VALUE / 2\n\nfun IntArray.setMax(i: Int, v: Int) = if(v > get(i)) { set(i, v); true } else false\nfun IntArray.setMin(i: Int, v: Int) = if(v < get(i)) { set(i, v); true } else false\n\n/** IO */\n//@JvmField val ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n//const val PATH = \"src/main/resources/\"\n//@JvmField val INPUT = File(PATH + \"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(PATH + \"output.txt\").outputStream()\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() else c\n }\n}\n\n/** @param skipNext Whether to skip the next character (usually whitespace), defaults to true */\nfun readCharArray(n: Int, skipNext: Boolean = true): CharArray {\n val res = CharArray(n) { readChar() }\n if(skipNext) readChar()\n return res\n}\n\nfun readLine(): String? {\n var c = readChar()\n return if(c == Char.MIN_VALUE) null\n else buildString {\n while(c != '\\n' && c != Char.MIN_VALUE) {\n append(c)\n c = readChar()\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\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** sort overrides to avoid quicksort attacks */\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\ninline fun _mergeSort(a0: A, n: Int, tmp0: A, get: A.(Int) -> T, set: A.(Int, T) -> Unit, cmp: (T, T) -> Int) {\n var a = a0\n var tmp = tmp0\n var len = 1\n while(len < n) {\n var l = 0\n while(true) {\n val m = l + len\n if(m >= n) break\n val r = min(n, m + len)\n var i = l\n var j = m\n for(k in l until r) {\n if(i != m && (j == r || cmp(a.get(i), a.get(j)) <= 0)) {\n tmp.set(k, a.get(i++))\n } else tmp.set(k, a.get(j++))\n }\n l = r\n }\n for(i in l until n) tmp.set(i, a.get(i))\n val t = a; a = tmp; tmp = t\n len += len\n }\n if(a !== a0) for(i in 0 until n) a0.set(i, tmp0.get(i))\n}\n\ninline fun IntArray.sortWith(cmp: (Int, Int) -> Int) { _mergeSort(this, size, IntArray(size), IntArray::get, IntArray::set, cmp) }\ninline fun > IntArray.sortBy(func: (Int) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }\ninline fun > IntArray.sortByDescending(func: (Int) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }\nfun IntArray.sort() { sortBy { it } }\nfun IntArray.sortDescending() { sortByDescending { it } }\n\ninline fun LongArray.sortWith(cmp: (Long, Long) -> Int) { _mergeSort(this, size, LongArray(size), LongArray::get, LongArray::set, cmp) }\ninline fun > LongArray.sortBy(func: (Long) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }\ninline fun > LongArray.sortByDescending(func: (Long) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }\nfun LongArray.sort() { sortBy { it } }\nfun LongArray.sortDescending() { sortByDescending { it } }\n\ninline fun DoubleArray.sortWith(cmp: (Double, Double) -> Int) { _mergeSort(this, size, DoubleArray(size), DoubleArray::get, DoubleArray::set, cmp) }\ninline fun > DoubleArray.sortBy(func: (Double) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }\ninline fun > DoubleArray.sortByDescending(func: (Double) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }\nfun DoubleArray.sort() { sortBy { it } }\nfun DoubleArray.sortDescending() { sortByDescending { it } }\n\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\n// import preserving junk function\n@Suppress(\"NonAsciiCharacters\") fun \u96ea\u82b1\u98c4\u98c4\u5317\u98a8\u562f\u562f\u5929\u5730\u4e00\u7247\u84bc\u832b() { iprintln(max(1, 2)) }\n\nfun IntArray.sumLong() = sumOf { it.toLong() }\n\nfun IntArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun IntArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun LongArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun LongArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun DoubleArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun DoubleArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun > Array.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun > Array.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun > List.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun > List.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\n\n// max/min Kotlin 1.6 -> 1.4 shim\nfun IntArray.max() = maxOf { it }\nfun IntArray.min() = minOf { it }\nfun LongArray.max() = maxOf { it }\nfun LongArray.min() = minOf { it }\nfun CharArray.max() = maxOf { it }\nfun CharArray.min() = minOf { it }\nfun > Iterable.max() = maxOf { it }\nfun > Iterable.min() = minOf { it }\nfun > Sequence.max() = maxOf { it }\nfun > Sequence.min() = minOf { it }"}, {"source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n@file:OptIn(ExperimentalStdlibApi::class)\n\nimport java.io.PrintWriter\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\n/** @author Spheniscine */\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n// val startTime = System.nanoTime()\n\n val numCases = 1//readInt()\n case@ for(case in 1..numCases) {\n //print(\"Case #$case: \")\n\n val k = 59\n\n var nPrimes = 0\n val masks = IntArray(k+1)\n for(i in 2..k) if(masks[i] == 0) {\n val bit = 1 shl nPrimes\n nPrimes++\n\n for(j in i..k step i) masks[j] += bit\n }\n\n val m = 1 shl nPrimes\n\n val n = readInt()\n val A = readIntArray(n)\n\n val V = Array(n) { IntArray(m) }\n var D = IntArray(m) { inf }\n D[0] = 0\n\n for(i in 0 until n) {\n val a = A[i]\n val Di = IntArray(m) { inf }\n for(b in 1..a+a-1) {\n val mask = masks[b]\n val antiMask = mask xor m-1\n var s = antiMask\n while(true) {\n val d = D[s]\n if(d != inf && Di.setMin(s or mask, d + abs(b - a))) {\n V[i][s or mask] = b\n }\n if(s == 0) break\n s = s-1 and antiMask\n }\n }\n\n for(mask in 0 until m) if(D[mask] != inf) {\n\n }\n D = Di\n }\n\n val ans = IntArray(n)\n\n var cur = (0 until m).minByOrNull { D[it] }!!\n\n for(i in n-1 downTo 0) {\n ans[i] = V[i][cur]\n cur -= masks[ans[i]]\n }\n\n println(ans.joinToString(\" \"))\n }\n\n// iprintln(\"Time: ${(System.nanoTime() - startTime) / 1000000} ms\")\n}\n\nconst val inf = Int.MAX_VALUE\n\nfun IntArray.setMax(i: Int, v: Int) = if(v > get(i)) { set(i, v); true } else false\nfun IntArray.setMin(i: Int, v: Int) = if(v < get(i)) { set(i, v); true } else false\n\n/** IO */\n//@JvmField val ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n//const val PATH = \"src/main/resources/\"\n//@JvmField val INPUT = File(PATH + \"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(PATH + \"output.txt\").outputStream()\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() else c\n }\n}\n\n/** @param skipNext Whether to skip the next character (usually whitespace), defaults to true */\nfun readCharArray(n: Int, skipNext: Boolean = true): CharArray {\n val res = CharArray(n) { readChar() }\n if(skipNext) readChar()\n return res\n}\n\nfun readLine(): String? {\n var c = readChar()\n return if(c == Char.MIN_VALUE) null\n else buildString {\n while(c != '\\n' && c != Char.MIN_VALUE) {\n append(c)\n c = readChar()\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\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** sort overrides to avoid quicksort attacks */\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\ninline fun _mergeSort(a0: A, n: Int, tmp0: A, get: A.(Int) -> T, set: A.(Int, T) -> Unit, cmp: (T, T) -> Int) {\n var a = a0\n var tmp = tmp0\n var len = 1\n while(len < n) {\n var l = 0\n while(true) {\n val m = l + len\n if(m >= n) break\n val r = min(n, m + len)\n var i = l\n var j = m\n for(k in l until r) {\n if(i != m && (j == r || cmp(a.get(i), a.get(j)) <= 0)) {\n tmp.set(k, a.get(i++))\n } else tmp.set(k, a.get(j++))\n }\n l = r\n }\n for(i in l until n) tmp.set(i, a.get(i))\n val t = a; a = tmp; tmp = t\n len += len\n }\n if(a !== a0) for(i in 0 until n) a0.set(i, tmp0.get(i))\n}\n\ninline fun IntArray.sortWith(cmp: (Int, Int) -> Int) { _mergeSort(this, size, IntArray(size), IntArray::get, IntArray::set, cmp) }\ninline fun > IntArray.sortBy(func: (Int) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }\ninline fun > IntArray.sortByDescending(func: (Int) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }\nfun IntArray.sort() { sortBy { it } }\nfun IntArray.sortDescending() { sortByDescending { it } }\n\ninline fun LongArray.sortWith(cmp: (Long, Long) -> Int) { _mergeSort(this, size, LongArray(size), LongArray::get, LongArray::set, cmp) }\ninline fun > LongArray.sortBy(func: (Long) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }\ninline fun > LongArray.sortByDescending(func: (Long) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }\nfun LongArray.sort() { sortBy { it } }\nfun LongArray.sortDescending() { sortByDescending { it } }\n\ninline fun DoubleArray.sortWith(cmp: (Double, Double) -> Int) { _mergeSort(this, size, DoubleArray(size), DoubleArray::get, DoubleArray::set, cmp) }\ninline fun > DoubleArray.sortBy(func: (Double) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }\ninline fun > DoubleArray.sortByDescending(func: (Double) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }\nfun DoubleArray.sort() { sortBy { it } }\nfun DoubleArray.sortDescending() { sortByDescending { it } }\n\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\n// import preserving junk function\n@Suppress(\"NonAsciiCharacters\") fun \u96ea\u82b1\u98c4\u98c4\u5317\u98a8\u562f\u562f\u5929\u5730\u4e00\u7247\u84bc\u832b() { iprintln(max(1, 2)) }\n\nfun IntArray.sumLong() = sumOf { it.toLong() }\n\nfun IntArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun IntArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun LongArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun LongArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun DoubleArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun DoubleArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun > Array.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun > Array.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun > List.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun > List.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\n\n// max/min Kotlin 1.6 -> 1.4 shim\nfun IntArray.max() = maxOf { it }\nfun IntArray.min() = minOf { it }\nfun LongArray.max() = maxOf { it }\nfun LongArray.min() = minOf { it }\nfun CharArray.max() = maxOf { it }\nfun CharArray.min() = minOf { it }\nfun > Iterable.max() = maxOf { it }\nfun > Iterable.min() = minOf { it }\nfun > Sequence.max() = maxOf { it }\nfun > Sequence.min() = minOf { it }"}, {"source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n@file:OptIn(ExperimentalStdlibApi::class)\n\nimport java.io.PrintWriter\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\n/** @author Spheniscine */\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n// val startTime = System.nanoTime()\n\n val numCases = 1//readInt()\n case@ for(case in 1..numCases) {\n //print(\"Case #$case: \")\n\n val k = 59\n\n var nPrimes = 0\n val masks = IntArray(k+1)\n for(i in 2..k) if(masks[i] == 0) {\n val bit = 1 shl nPrimes\n nPrimes++\n\n for(j in i..k step i) masks[j] += bit\n }\n\n val m = 1 shl nPrimes\n\n val n = readInt()\n val A = readIntArray(n)\n\n\n val V = Array(n) { IntArray(m) }\n var D = IntArray(m) { inf }\n D[0] = 0\n\n for(i in 0 until n) {\n val a = A[i]\n val Di = IntArray(m) { inf }\n for(mask in 0 until m) if(D[mask] != inf) {\n for(b in 1..a+a-1) if(mask and masks[b] == 0) {\n val newMask = mask or masks[b]\n if(Di.setMin(newMask, D[mask] + abs(b - a))) V[i][newMask] = b\n }\n }\n D = Di\n }\n\n val ans = IntArray(n)\n\n var cur = (0 until m).minByOrNull { D[it] }!!\n\n for(i in n-1 downTo 0) {\n ans[i] = V[i][cur]\n cur -= masks[ans[i]]\n }\n\n println(ans.joinToString(\" \"))\n }\n\n// iprintln(\"Time: ${(System.nanoTime() - startTime) / 1000000} ms\")\n}\n\nconst val inf = Int.MAX_VALUE\n\nfun IntArray.setMax(i: Int, v: Int) = if(v > get(i)) { set(i, v); true } else false\nfun IntArray.setMin(i: Int, v: Int) = if(v < get(i)) { set(i, v); true } else false\n\n/** IO */\n//@JvmField val ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n//const val PATH = \"src/main/resources/\"\n//@JvmField val INPUT = File(PATH + \"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(PATH + \"output.txt\").outputStream()\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() else c\n }\n}\n\n/** @param skipNext Whether to skip the next character (usually whitespace), defaults to true */\nfun readCharArray(n: Int, skipNext: Boolean = true): CharArray {\n val res = CharArray(n) { readChar() }\n if(skipNext) readChar()\n return res\n}\n\nfun readLine(): String? {\n var c = readChar()\n return if(c == Char.MIN_VALUE) null\n else buildString {\n while(c != '\\n' && c != Char.MIN_VALUE) {\n append(c)\n c = readChar()\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\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** sort overrides to avoid quicksort attacks */\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\ninline fun _mergeSort(a0: A, n: Int, tmp0: A, get: A.(Int) -> T, set: A.(Int, T) -> Unit, cmp: (T, T) -> Int) {\n var a = a0\n var tmp = tmp0\n var len = 1\n while(len < n) {\n var l = 0\n while(true) {\n val m = l + len\n if(m >= n) break\n val r = min(n, m + len)\n var i = l\n var j = m\n for(k in l until r) {\n if(i != m && (j == r || cmp(a.get(i), a.get(j)) <= 0)) {\n tmp.set(k, a.get(i++))\n } else tmp.set(k, a.get(j++))\n }\n l = r\n }\n for(i in l until n) tmp.set(i, a.get(i))\n val t = a; a = tmp; tmp = t\n len += len\n }\n if(a !== a0) for(i in 0 until n) a0.set(i, tmp0.get(i))\n}\n\ninline fun IntArray.sortWith(cmp: (Int, Int) -> Int) { _mergeSort(this, size, IntArray(size), IntArray::get, IntArray::set, cmp) }\ninline fun > IntArray.sortBy(func: (Int) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }\ninline fun > IntArray.sortByDescending(func: (Int) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }\nfun IntArray.sort() { sortBy { it } }\nfun IntArray.sortDescending() { sortByDescending { it } }\n\ninline fun LongArray.sortWith(cmp: (Long, Long) -> Int) { _mergeSort(this, size, LongArray(size), LongArray::get, LongArray::set, cmp) }\ninline fun > LongArray.sortBy(func: (Long) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }\ninline fun > LongArray.sortByDescending(func: (Long) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }\nfun LongArray.sort() { sortBy { it } }\nfun LongArray.sortDescending() { sortByDescending { it } }\n\ninline fun DoubleArray.sortWith(cmp: (Double, Double) -> Int) { _mergeSort(this, size, DoubleArray(size), DoubleArray::get, DoubleArray::set, cmp) }\ninline fun > DoubleArray.sortBy(func: (Double) -> T) { sortWith { a, b -> func(a).compareTo(func(b)) } }\ninline fun > DoubleArray.sortByDescending(func: (Double) -> T) { sortWith { a, b -> func(b).compareTo(func(a)) } }\nfun DoubleArray.sort() { sortBy { it } }\nfun DoubleArray.sortDescending() { sortByDescending { it } }\n\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\n// import preserving junk function\n@Suppress(\"NonAsciiCharacters\") fun \u96ea\u82b1\u98c4\u98c4\u5317\u98a8\u562f\u562f\u5929\u5730\u4e00\u7247\u84bc\u832b() { iprintln(max(1, 2)) }\n\nfun IntArray.sumLong() = sumOf { it.toLong() }\n\nfun IntArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun IntArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun LongArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun LongArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun DoubleArray.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun DoubleArray.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun > Array.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun > Array.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\nfun > List.sortedIndices() = IntArray(size) { it }.also { it.sortBy(::get) }\nfun > List.sortedIndicesDescending() = IntArray(size) { it }.also { it.sortByDescending(::get) }\n\n// max/min Kotlin 1.6 -> 1.4 shim\nfun IntArray.max() = maxOf { it }\nfun IntArray.min() = minOf { it }\nfun LongArray.max() = maxOf { it }\nfun LongArray.min() = minOf { it }\nfun CharArray.max() = maxOf { it }\nfun CharArray.min() = minOf { it }\nfun > Iterable.max() = maxOf { it }\nfun > Iterable.min() = minOf { it }\nfun > Sequence.max() = maxOf { it }\nfun > Sequence.min() = minOf { it }"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\n\nval PRIMES = mutableListOf(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53)\nval IMPORTANT = (1..30) + listOf(31, 32, 37, 41, 43, 47, 49, 53)\n\nfun main() {\n val jin = BufferedReader(InputStreamReader(System.`in`))\n val n = jin.readLine().toInt()\n val masks = IntArray(54)\n for (k in 1..53) {\n for (e in 0..15) {\n if (k % PRIMES[e] == 0) {\n masks[k] += 1 shl e\n }\n }\n }\n val dp = Array(n + 1) { IntArray(1 shl 16) { 115115 } }\n dp[0][0] = 0\n val used = Array(n + 1) { IntArray(1 shl 16) }\n val tokenizer = StringTokenizer(jin.readLine())\n for (j in 1..n) {\n val a = tokenizer.nextToken().toInt()\n for (k in IMPORTANT) {\n for (mask in 0 until (1 shl 16)) {\n if (mask and masks[k] == 0 && dp[j - 1][mask] + abs(k - a) < dp[j][mask or masks[k]]) {\n dp[j][mask or masks[k]] = dp[j - 1][mask] + abs(k - a)\n used[j][mask or masks[k]] = k\n }\n }\n }\n }\n val optimal = dp[n].min()!!\n for (mask in 0 until (1 shl 16)) {\n if (dp[n][mask] == optimal) {\n val answer = mutableListOf()\n var mask = mask\n for (j in n downTo 1) {\n answer.add(used[j][mask])\n mask -= masks[used[j][mask]]\n }\n println(answer.reversed().joinToString(\" \"))\n return\n }\n }\n}"}], "negative_code": [], "src_uid": "f26c74f27bbc723efd69c38ad0e523c6"} {"source_code": "fun main(args: Array) {\n val s = readLine()!!\n val n = s.length\n for (i in 1..n - 2 ) {\n val ss = setOf(s[i - 1], s[i], s[i + 1])\n if (!ss.contains('.') && ss.size == 3) {\n println(\"Yes\")\n return\n }\n }\n println(\"No\")\n}", "positive_code": [{"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()\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 s = reader.next()\n for (i in 1 until s.length - 1) {\n if (s[i - 1] == '.' || s[i] == '.' || s[i + 1] == '.') {\n continue\n }\n\n if (s[i - 1] != s[i] && s[i - 1] != s[i + 1] && s[i] != s[i + 1]) {\n writer.println(\"yes\")\n return\n }\n }\n writer.println(\"no\")\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}"}, {"source_code": "fun main(args: Array){\n val opa = readLine()!!\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 && opa.get(i-1) != opa.get(i+1)){\n result = true\n }\n }\n if (result){\n println(\"Yes\")\n } else {\n println(\"No\")\n }\n\n}"}, {"source_code": "fun main() {\n val valids = setOf(\"ABC\", \"ACB\", \"BAC\", \"BCA\", \"CAB\", \"CBA\")\n val s = readLine()!!\n for (start in 0..s.length - 3)\n if (s.substring(start..start + 2) in valids) return print(\"Yes\")\n print(\"No\")\n}"}, {"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 val str = scanner.next()\n val arr = IntArray(102)\n for (i in 0 until str.length) {\n if (str[i] == 'A') {\n for (j in i .. i + 2) {\n arr[j] += 1\n if (arr[j] == 7) {\n print(\"Yes\")\n return\n }\n }\n }\n if (str[i] == 'B') {\n for (j in i .. i + 2) {\n arr[j] += 2\n if (arr[j] == 7) {\n print(\"Yes\")\n return\n }\n }\n }\n if (str[i] == 'C') {\n for (j in i .. i + 2) {\n arr[j] += 4\n if (arr[j] == 7) {\n print(\"Yes\")\n return\n }\n }\n }\n }\n println(\"No\")\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 b - a - other.b + other.a\n }\n}"}], "negative_code": [{"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}"}], "src_uid": "ba6ff507384570152118e2ab322dd11f"} {"source_code": "fun main(args: Array) {\n\nprintln(\"No\")\n}", "positive_code": [{"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 stringBuilder.append(\"no\")\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\""}, {"source_code": "import java.util.StringTokenizer\nimport java.io.PrintWriter\n\nfun main() {\n for(t in 1..1) {\n wr(\"NO\")\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 charToDecimalEquiv(num: Char) = num.toInt() - '0'.toInt()\n\nfun wr(a: T) = println(a)\nfun wr(a: Array, separator: String = \" \") = println(a.joinToString(separator))\nfun wr(a: IntArray, separator: String = \" \") = println(a.joinToString(separator))\nfun wr(a: LongArray, separator: String = \" \") = println(a.joinToString(separator))\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\ninline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }"}, {"source_code": "fun main() {\n println(\"No\")\n}\n"}, {"source_code": "// 2020-10-01 19:10:29.678950 \nfun main() = println(\"no\")"}, {"source_code": "fun main() {\n\tprintln(\"No\")\n}\n"}, {"source_code": "\n\nfun main() {\n println(\"No\")\n}"}, {"source_code": "fun main() {\n println(\"NO\")\n}"}, {"source_code": "fun main() {\n println(\"no\")\n}"}, {"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 println(\"NO\")\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}"}, {"source_code": "fun main() {\n println(\"NO\")\n}"}, {"source_code": "fun main(args:Array) {\n println(\"No\")\n}\n"}, {"source_code": "fun main() {\n println(\"No\")\n}"}, {"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 println(\"No\")\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"}, {"source_code": "fun main() {\n println(\"nO\")\n}"}, {"source_code": "fun main() {\n print(\"no\")\n}"}, {"source_code": "fun main() {\n\tprintln(\"No\")\n}"}, {"source_code": "fun main() {\n print(\"No\")\n}"}, {"source_code": "fun main(){\n println(\"No\")\n}"}, {"source_code": "fun main(args: Array) {\n println(\"NO\"); \n}\n"}, {"source_code": "fun main(){\n println(\"NO\")\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.log2\n\nfun main(args : Array) {\n \n println(\"No\")\n\n}\n"}, {"source_code": "import java.util.*\n\nfun main() {\n// val sc = Scanner(File(\"input-a.txt\"))\n// SolutionSample().doSolve(sc)\n println(\"No\")\n}\n\nclass SolutionA {\n fun doSolve(sc: Scanner) {\n val line: String = sc.nextLine()\n println(line)\n }\n}"}, {"source_code": "fun main(args: Array) {\n println(\"No\")\n}"}, {"source_code": "fun main(){\n print(\"NO\")\n}"}, {"source_code": "fun main(args: Array) {\n print(\"NO\")\n}"}, {"source_code": "import java.io.PrintWriter\nimport kotlin.math.*\n\nfun main() {\n io.apply {\n\n cout .. \"NO\" .. 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 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"}], "negative_code": [{"source_code": "fun main(args: Array) {\n val input = readLine()!!\n print(input)\n}"}, {"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 println(\"Unrated\")\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"}, {"source_code": "fun main() {\n \n}"}, {"source_code": "fun main() {\n println(1)\n}"}, {"source_code": "fun main(){}"}], "src_uid": "b6a30a725754a4b4daeb6e87986e28a4"} {"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 0..4) {\n if (i != j) {\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 }else{\n sum = list[5] + list[i]\n }\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}", "positive_code": [{"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\n\n/** @author Om Kumar */\nfun main() { _writer.solve(); _writer.flush() }\n\nfun solve(a: IntArray): Boolean{\n val sum = a.reduce { acc, i -> acc + i}\n if((sum and 1) == 0) {\n for (i in 0..5) {\n for (j in i + 1..5) {\n for (k in j + 1..5) {\n if (a[i] + a[j] + a[k] == sum / 2){\n return true\n }\n }\n }\n }\n }\n return false\n}\n\nfun PrintWriter.solve() {\n val a = readIntArray(6)\n println(if(solve(a)) \"YES\" else \"NO\")\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(0x58359625447 * 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()"}, {"source_code": "fun main(args: Array) {\n val mass = readLine()!!.split(\" \").map { it.toInt() }\n val f = mass.sum()\n if (f % 2 != 0) {\n print(\"NO\")\n } else {\n var stop = false\n for (i in 0..5) {\n for (j in 0..5) {\n for (k in 0..5) {\n if (i != j && i != k && j != k && (mass[i] + mass[j] + mass[k])* 2 == f) {\n print(\"YES\")\n stop = true\n break\n }\n }\n if (stop) {\n break\n }\n }\n if (stop) {\n break\n }\n }\n if (!stop) {\n print(\"NO\")\n }\n }\n}"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val scores = readInts()\n if (scores.sum() and 1 == 1) return print(\"NO\")\n val goal = scores.sum() / 2\n for (first in 0..3)\n for (second in first + 1..4)\n for (third in second + 1..5)\n if (scores[first] + scores[second] + scores[third] == goal) return print(\"YES\")\n print(\"NO\")\n}"}, {"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 val a = Array(6) { sc.nextInt() }\n val total = a.sum()\n\n for (i in 0..5) {\n for (j in i + 1..5) {\n for (k in j + 1..5) {\n val s = a[i] + a[j] + a[k]\n if(s == total - s) {\n println(\"YES\")\n return\n }\n }\n }\n }\n\n println(\"NO\")\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"}], "negative_code": [{"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}"}, {"source_code": "fun main() {\n var list = readLine()!!.split(' ').map { it.toInt() }.sorted()\n var flag = true\n if (list.sum() % 2 == 0) {\n if (list[0] + list[1] + list[5] != list.sum() / 2) {\n flag = false\n }\n if (list[2] + list[3] + list[4] != list.sum() / 2){\n flag = false\n }\n }else{\n println(\"NO\")\n return\n }\n println(if (flag) \"YES\" else \"NO\")\n\n\n}"}], "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11"} {"source_code": "import kotlin.math.max\n\nfun main(args: Array) {\n val b = Array(2) { readLine()!!.toCharArray() }\n val n = b[0].size\n val d = Array(n) { IntArray(3 ) }\n for (i in 1 until n) {\n val best = d[i - 1].max()!!\n for (p in 0..2) d[i][p] = best\n if (b[0][i - 1] == '0' && b[1][i - 1] == '0') {\n for (p in 0..2) {\n for (j in 0..1) if (b[j][i] == '0' && (p and (1 shl j) == 0)) {\n d[i][p] = max(d[i][p], (if (i > 1) d[i - 2][0] else 0) + 1)\n }\n }\n }\n if (b[0][i] == '0' && b[1][i] == '0') {\n for (j in 0..1) {\n if (b[j][i - 1] == '0')\n d[i][0] = max(d[i][0], d[i - 1][1 shl j] + 1)\n }\n }\n }\n println(d[n - 1][0])\n}", "positive_code": [{"source_code": "//package codeForces.c491_2\n\nfun main(args: Array) {\n val s1 = (readLine()!! + 'X').toCharArray()\n val s2 = (readLine()!! + 'X').toCharArray()\n\n val lenght = minOf(s1.size, s2.size)\n\n var count = 0\n var i = -1\n while (i < lenght - 1) {\n i++\n if (s1[i] == '0' && s2[i] == '0') {\n if (s1[i + 1] == '0') {\n s1[i + 1] = 'X'\n count++\n continue\n } else if (s2[i + 1] == '0') {\n s2[i + 1] = 'X'\n count++\n continue\n }\n }\n\n if (\n (s1[i] == '0' || s2[i] == '0') &&\n s1[i + 1] == '0' &&\n s2[i + 1] == '0'\n ) {\n count++\n i++\n continue\n }\n }\n\n print(count)\n}"}, {"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) { scanner.next().toCharArray() }\n var res = 0\n for (i in 0..Q[0].size - 2) {\n if (Q[0][i] == '0' && Q[1][i] == '0' && Q[0][i + 1] == '0') {\n Q[0][i] = 'X'\n Q[1][i] = 'X'\n Q[0][i + 1] = 'X'\n res++\n }\n if (Q[0][i] == '0' && Q[1][i] == '0' && Q[1][i + 1] == '0') {\n Q[0][i] = 'X'\n Q[1][i] = 'X'\n Q[1][i + 1] = 'X'\n res++\n }\n if (Q[0][i] == '0' && Q[0][i + 1] == '0' && Q[1][i + 1] == '0') {\n Q[0][i] = 'X'\n Q[0][i + 1] = 'X'\n Q[1][i + 1] = 'X'\n res++\n }\n if (Q[1][i] == '0' && Q[1][i + 1] == '0' && Q[0][i + 1] == '0') {\n Q[1][i] = 'X'\n Q[1][i + 1] = 'X'\n Q[0][i + 1] = 'X'\n res++\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//}"}], "negative_code": [{"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//}"}], "src_uid": "e6b3e787919e96fc893a034eae233fc6"} {"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 }\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 readInt() = readToken().toInt()\n fun readLong() = readToken().toLong()\n fun readLine() : String {\n tok = StringTokenizer(\"\")\n return rd.readLine()\n }\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 = IntArray(2, { io.readInt() })\n val k = IntArray(2, { io.readInt() })\n val res = when {\n n[0] <= n[1] -> \"Second\"\n else -> \"First\"\n }\n io.println(res)\n}\n", "positive_code": [{"source_code": "fun main(args: Array) {\n val (f,s) = readLine()!!.split(\" \").map { it.toInt() }\n println(if (f > s) \"First\" else \"Second\")\n}"}, {"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 println(if (v[0]-v[1]>0) \"First\" else \"Second\")\n}"}, {"source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n println(if (sc.nextInt() > sc.nextInt()) \"First\" else \"Second\")\n}\n\n"}, {"source_code": "import javafx.util.Pair\n\nimport java.util.ArrayList\nimport java.util.Scanner\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val n1 = scanner.nextInt()\n val n2 = scanner.nextInt()\n println(if (n1 > n2) \"First\" else \"Second\")\n\n}\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n var scan = Scanner(System.`in`)\n var p1 = scan.nextInt()\n var p2 = scan.nextInt()\n if (p1 > p2) {\n println(\"First\")\n } else {\n println(\"Second\")\n }\n}"}, {"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 (n, m, k, l) = readInts()\n if (n > m) print(\"First\") else print(\"Second\")\n}"}, {"source_code": "import org.omg.PortableInterceptor.INACTIVE\nimport java.util.*\n\nfun main(args: Array) {\n val s = Scanner(System.`in`)\n val a = IntArray(2, { s.nextInt() })\n val b = IntArray(2, { s.nextInt() })\n val res = when {a[0] > a[1] -> \"First\" else -> \"Second\"}\n print(res)\n}"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (n1, n2, k1, k2) = readInts()\n print(if (n1 > n2) \"First\" else \"Second\")\n}"}], "negative_code": [], "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b"} {"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')) && !(str[i - 1] in charArrayOf('a', 'o', 'u', 'i', 'e', 'n'))) {\n println(\"NO\")\n return\n }\n }\n if (str.last() in charArrayOf('a', 'o', 'u', 'i', 'e', 'n'))\n println(\"YES\")\n else\n println(\"NO\")\n\n\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}", "positive_code": [{"source_code": "fun main(args: Array) {\n val str1 = readLine()!!\n val exc = setOf(\"a\", \"o\", \"u\", \"i\", \"e\")\n var prev = \"\"\n\n for (it in str1.split(\"\")) {\n if (prev.isEmpty() || exc.contains(prev) || prev == \"n\") {\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"}, {"source_code": "fun main() {\n val vowel = listOf('a', 'o', 'u', 'i', 'e')\n val str = readLine()!!\n var ans = mutableListOf()\n for (i in str) {\n if (vowel.contains(i)) {\n ans.add(1)\n } else if (i == 'n') {\n ans.add(2)\n } else {\n ans.add(0)\n }\n }\n for (i in 1 until ans.size) {\n if (ans[i] == 0) {\n if (ans[i - 1] != 1 && ans[i - 1] != 2) {\n println(\"NO\")\n return\n }\n } else if (ans[i] == 1) {\n if (ans[i - 1] != 1 && ans[i - 1] != 2 && ans[i - 1] != 0) {\n println(\"NO\")\n return\n }\n } else {\n if (ans[i - 1] == 0) {\n println(\"NO\")\n return\n }\n }\n }\n\n if (ans[ans.size - 1] != 1 && ans[ans.size - 1] != 2) {\n println(\"NO\")\n } else {\n println(\"YES\")\n }\n\n}"}, {"source_code": "fun main() {\n val s = readLine()!!\n val notConsonant = setOf('a', 'e', 'i', 'o', 'u', 'n')\n val vowel = setOf('a', 'e', 'i', 'o', 'u')\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 vowel) return print(\"NO\")\n }\n print(\"YES\")\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.HashSet\n\npublic class programkt {\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}"}, {"source_code": "import java.util.*\nimport kotlin.collections.HashSet\n\nclass ProgramKT {\n\n 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 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}"}, {"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}"}, {"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 {\n !isVowel(s[it]) &&\n s[it] != 'n' &&\n ((it + 1 < s.length &&\n !isVowel(s[it + 1]) || it + 1 == s.length))\n }\n\n if (good) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}"}, {"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[s.length-1] !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"}], "negative_code": [{"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}"}, {"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}"}, {"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"}, {"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 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"}, {"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"}, {"source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun main() {\n var sc = Scanner(System.`in`)\n var str = sc.next()\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('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 flag = false\n if (str.length == 2 && !list.contains(str[0]) && str[0]!='n') {\n flag = true\n } else {\n var j = 0\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 }\n if (!array[array.size - 3]) {\n flag = true\n }\n if (flag) {\n println(\"NO\")\n } else {\n println(\"YES\")\n }\n}\n\n\n\n"}, {"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"}, {"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 flag = false\n if (str.length == 2 && !list.contains(str[0]) && str[0]!='n') {\n flag = true\n } else {\n var j = 0\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 }\n if (!array[array.size - 3]) {\n flag = true\n }\n if (!list.contains(str[str.length-2]) && str[str.length-1]!='n'){\n flag = true\n }\n if (flag) {\n println(\"NO\")\n } else {\n println(\"YES\")\n }\n}\n\n\n\n"}, {"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}"}, {"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}"}, {"source_code": "fun main(arg: Array){\n\tval string = readLine().toString()\n\tvar glas = setOf('a','e','i','o','u','n')\n\tif (string.last() in glas){\n\t\tvar prev = 'a'\n\t\tstring.reversed().forEach(){\n\t\t\tif (!(prev in glas)){\n\t\t\t\tif (!(it in glas)){\n\t\t\t\t\tprintln(\"NO\")\n\t\t\t\t\treturn\n\t\t\t\t}\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}"}, {"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 glas){\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}"}], "src_uid": "a83144ba7d4906b7692456f27b0ef7d4"} {"source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.lang.Exception\nimport java.util.*\n\nfun PrintWriter.solve(sc: FastScanner) {\n val el = \"Ac Ag Al Am Ar As At Au B Ba Be Bh Bi Bk Br C Ca Cd Ce Cf Cl Cm Cn Co Cr Cs Cu Db Ds Dy Er Es Eu F Fe Fl Fm Fr Ga Gd Ge H He Hf Hg Ho Hs I In Ir K Kr La Li Lr Lu Lv Mc Md Mg Mn Mo Mt N Na Nb Nd Ne Nh Ni No Np O Og Os P Pa Pb Pd Pm Po Pr Pt Pu Ra Rb Re Rf Rg Rh Rn Ru S Sb Sc Se Sg Si Sm Sn Sr Ta Tb Tc Te Th Ti Tl Tm Ts U V W Xe Y Yb Zn Zr\".toUpperCase().split(' ')\n val s = sc.nextLine()\n val n = s.length\n val D = BooleanArray(n + 1)\n D[0] = true\n\n for(i in s.indices) {\n if(!D[i]) continue\n if(s.substring(i, i+1) in el) D[i+1] = true\n if(i + 2 <= n && s.substring(i, i+2) in el) D[i+2] = true\n }\n\n println(if(D.last()) \"YES\" else \"NO\")\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", "positive_code": [{"source_code": "fun main() {\n val a = listOf(\"AC\",\"AG\",\"AL\",\"AM\",\"AR\",\"AS\",\"AT\",\"AU\",\"B\",\"BA\",\"BE\",\"BH\",\"BI\",\"BK\",\"BR\",\"C\",\"CA\",\"CD\",\"CE\",\"CF\",\"CL\",\"CM\",\"CN\",\"CO\",\"CR\",\"CS\",\"CU\",\"DB\",\"DS\",\"DY\",\"ER\",\"ES\",\"EU\",\"F\",\"FE\",\"FL\",\"FM\",\"FR\",\"GA\",\"GD\",\"GE\",\"H\",\"HE\",\"HF\",\"HG\",\"HO\",\"HS\",\"I\",\"IN\",\"IR\",\"K\",\"KR\",\"LA\",\"LI\",\"LR\",\"LU\",\"LV\",\"MC\",\"MD\",\"MG\",\"MN\",\"MO\",\"MT\",\"N\",\"NA\",\"NB\",\"ND\",\"NE\",\"NH\",\"NI\",\"NO\",\"NP\",\"O\",\"OG\",\"OS\",\"P\",\"PA\",\"PB\",\"PD\",\"PM\",\"PO\",\"PR\",\"PT\",\"PU\",\"RA\",\"RB\",\"RE\",\"RF\",\"RG\",\"RH\",\"RN\",\"RU\",\"S\",\"SB\",\"SC\",\"SE\",\"SG\",\"SI\",\"SM\",\"SN\",\"SR\",\"TA\",\"TB\",\"TC\",\"TE\",\"TH\",\"TI\",\"TL\",\"TM\",\"TS\",\"U\",\"V\",\"W\",\"XE\",\"Y\",\"YB\",\"ZN\",\"ZR\")\n val s = readLine()!!\n val n = s.length\n val b = BooleanArray(n+1)\n b[0] = true\n for (i in 1..n) {\n for (e in a) {\n if (i >= e.length && b[i - e.length] && s.substring(i - e.length, i) == e) {\n b[i] = true\n break\n }\n }\n }\n println(if (b[n]) \"YES\" else \"NO\")\n}\n"}, {"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 el = \"Ac Ag Al Am Ar As At Au B Ba Be Bh Bi Bk Br C Ca Cd Ce Cf Cl Cm Cn Co Cr Cs Cu Db Ds Dy Er Es Eu F Fe Fl Fm Fr Ga Gd Ge H He Hf Hg Ho Hs I In Ir K Kr La Li Lr Lu Lv Mc Md Mg Mn Mo Mt N Na Nb Nd Ne Nh Ni No Np O Og Os P Pa Pb Pd Pm Po Pr Pt Pu Ra Rb Re Rf Rg Rh Rn Ru S Sb Sc Se Sg Si Sm Sn Sr Ta Tb Tc Te Th Ti Tl Tm Ts U V W Xe Y Yb Zn Zr\".toUpperCase().split(' ')\n\n val s = readLn()\n val n = s.length\n var D = BooleanArray(n + 1)\n D[0] = true\n\n for(i in s.indices) {\n if(!D[i]) continue\n if(s.substring(i, i+1) in el) D[i+1] = true\n if(i + 2 <= n && s.substring(i, i+2) in el) D[i+2] = true\n }\n\n println(if(D.last()) \"YES\" else \"NO\")\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}"}, {"source_code": "fun main() {\n val periodic = HashSet()\n fun setUp() {\n periodic += \"H\"\n periodic += \"HE\"\n periodic += \"LI\"\n periodic += \"BE\"\n periodic += \"B\"\n periodic += \"C\"\n periodic += \"N\"\n periodic += \"O\"\n periodic += \"F\"\n periodic += \"NE\"\n periodic += \"NA\"\n periodic += \"MG\"\n periodic += \"AL\"\n periodic += \"SI\"\n periodic += \"P\"\n periodic += \"S\"\n periodic += \"CL\"\n periodic += \"AR\"\n periodic += \"K\"\n periodic += \"CA\"\n periodic += \"SC\"\n periodic += \"TI\"\n periodic += \"V\"\n periodic += \"CR\"\n periodic += \"MN\"\n periodic += \"FE\"\n periodic += \"CO\"\n periodic += \"NI\"\n periodic += \"CU\"\n periodic += \"ZN\"\n periodic += \"GA\"\n periodic += \"GE\"\n periodic += \"AS\"\n periodic += \"SE\"\n periodic += \"BR\"\n periodic += \"KR\"\n periodic += \"RB\"\n periodic += \"SR\"\n periodic += \"Y\"\n periodic += \"ZR\"\n periodic += \"NB\"\n periodic += \"MO\"\n periodic += \"TC\"\n periodic += \"RU\"\n periodic += \"RH\"\n periodic += \"PD\"\n periodic += \"AG\"\n periodic += \"CD\"\n periodic += \"IN\"\n periodic += \"SN\"\n periodic += \"SB\"\n periodic += \"TE\"\n periodic += \"I\"\n periodic += \"XE\"\n periodic += \"CS\"\n periodic += \"BA\"\n periodic += \"LA\"\n periodic += \"CE\"\n periodic += \"PR\"\n periodic += \"ND\"\n periodic += \"PM\"\n periodic += \"SM\"\n periodic += \"EU\"\n periodic += \"GD\"\n periodic += \"TB\"\n periodic += \"DY\"\n periodic += \"HO\"\n periodic += \"ER\"\n periodic += \"TM\"\n periodic += \"YB\"\n periodic += \"LU\"\n periodic += \"HF\"\n periodic += \"TA\"\n periodic += \"W\"\n periodic += \"RE\"\n periodic += \"OS\"\n periodic += \"IR\"\n periodic += \"PT\"\n periodic += \"AU\"\n periodic += \"HG\"\n periodic += \"TL\"\n periodic += \"PB\"\n periodic += \"BI\"\n periodic += \"PO\"\n periodic += \"AT\"\n periodic += \"RN\"\n periodic += \"FR\"\n periodic += \"RA\"\n periodic += \"AC\"\n periodic += \"TH\"\n periodic += \"PA\"\n periodic += \"U\"\n periodic += \"NP\"\n periodic += \"PU\"\n periodic += \"AM\"\n periodic += \"CM\"\n periodic += \"BK\"\n periodic += \"CF\"\n periodic += \"ES\"\n periodic += \"FM\"\n periodic += \"MD\"\n periodic += \"NO\"\n periodic += \"LR\"\n periodic += \"RF\"\n periodic += \"DB\"\n periodic += \"SG\"\n periodic += \"BH\"\n periodic += \"HS\"\n periodic += \"MT\"\n periodic += \"DS\"\n periodic += \"RG\"\n periodic += \"CN\"\n periodic += \"NH\"\n periodic += \"FL\"\n periodic += \"MC\"\n periodic += \"LV\"\n periodic += \"TS\"\n periodic += \"OG\"\n }\n setUp()\n val input = System.`in`.bufferedReader().readLine()\n\n // val calced = BooleanArray(input.length)\n// val valid = BooleanArray(input.length)\n fun solve(id: Int): Boolean {\n if (id == input.length) {\n return true\n }\n// if (!calced[id]) {\n var isValid = false\n if (input[id].toString() in periodic) {\n isValid = isValid || solve(id + 1)\n }\n if (id < input.lastIndex && (input[id].toString() + input[id + 1]) in periodic) {\n isValid = isValid || solve(id + 2)\n }\n// valid[id] = isValid\n// }\n// return valid[id]\n return isValid\n }\n print(if (solve(0)) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main() {\n val periodic = HashSet()\n fun setUp() {\n periodic += \"H\"\n periodic += \"HE\"\n periodic += \"LI\"\n periodic += \"BE\"\n periodic += \"B\"\n periodic += \"C\"\n periodic += \"N\"\n periodic += \"O\"\n periodic += \"F\"\n periodic += \"NE\"\n periodic += \"NA\"\n periodic += \"MG\"\n periodic += \"AL\"\n periodic += \"P\"\n periodic += \"S\"\n periodic += \"CL\"\n periodic += \"AR\"\n periodic += \"K\"\n periodic += \"CA\"\n periodic += \"TI\"\n periodic += \"V\"\n periodic += \"CR\"\n periodic += \"MN\"\n periodic += \"FE\"\n periodic += \"ZN\"\n periodic += \"GA\"\n periodic += \"GE\"\n periodic += \"AS\"\n periodic += \"SE\"\n periodic += \"BR\"\n periodic += \"KR\"\n periodic += \"RB\"\n periodic += \"SR\"\n periodic += \"Y\"\n periodic += \"ZR\"\n periodic += \"MO\"\n periodic += \"TC\"\n periodic += \"RU\"\n periodic += \"RH\"\n periodic += \"PD\"\n periodic += \"AG\"\n periodic += \"CD\"\n periodic += \"TE\"\n periodic += \"I\"\n periodic += \"XE\"\n periodic += \"BA\"\n periodic += \"LA\"\n periodic += \"CE\"\n periodic += \"PR\"\n periodic += \"ND\"\n periodic += \"PM\"\n periodic += \"SM\"\n periodic += \"EU\"\n periodic += \"GD\"\n periodic += \"TB\"\n periodic += \"DY\"\n periodic += \"ER\"\n periodic += \"TM\"\n periodic += \"LU\"\n periodic += \"TA\"\n periodic += \"W\"\n periodic += \"RE\"\n periodic += \"IR\"\n periodic += \"PT\"\n periodic += \"AU\"\n periodic += \"HG\"\n periodic += \"TL\"\n periodic += \"AT\"\n periodic += \"RN\"\n periodic += \"FR\"\n periodic += \"RA\"\n periodic += \"AC\"\n periodic += \"TH\"\n periodic += \"PA\"\n periodic += \"U\"\n periodic += \"AM\"\n periodic += \"CM\"\n periodic += \"ES\"\n periodic += \"FM\"\n periodic += \"MD\"\n periodic += \"LR\"\n periodic += \"RF\"\n periodic += \"DB\"\n periodic += \"SG\"\n periodic += \"MT\"\n periodic += \"DS\"\n periodic += \"RG\"\n periodic += \"FL\"\n periodic += \"MC\"\n periodic += \"LV\"\n periodic += \"TS\"\n periodic += \"OG\"\n }\n setUp()\n val input = System.`in`.bufferedReader().readLine()\n\n // val calced = BooleanArray(input.length)\n// val valid = BooleanArray(input.length)\n fun solve(id: Int): Boolean {\n if (id == input.length) {\n return true\n }\n// if (!calced[id]) {\n var isValid = false\n if (input[id].toString() in periodic) {\n isValid = isValid || solve(id + 1)\n }\n if (id < input.lastIndex && (input[id].toString() + input[id + 1]) in periodic) {\n isValid = isValid || solve(id + 2)\n }\n// valid[id] = isValid\n// }\n// return valid[id]\n return isValid\n }\n print(if (solve(0)) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main() {\n val periodic = HashSet()\n fun setUp() {\n periodic += \"H\"\n periodic += \"HE\"\n periodic += \"LI\"\n periodic += \"BE\"\n periodic += \"B\"\n periodic += \"C\"\n periodic += \"N\"\n periodic += \"O\"\n periodic += \"F\"\n periodic += \"NE\"\n periodic += \"NA\"\n periodic += \"MG\"\n periodic += \"AL\"\n periodic += \"SI\"\n periodic += \"P\"\n periodic += \"S\"\n periodic += \"CL\"\n periodic += \"AR\"\n periodic += \"K\"\n periodic += \"CA\"\n periodic += \"SC\"\n periodic += \"TI\"\n periodic += \"V\"\n periodic += \"CR\"\n periodic += \"MN\"\n periodic += \"FE\"\n periodic += \"CO\"\n periodic += \"NI\"\n periodic += \"CU\"\n periodic += \"ZN\"\n periodic += \"GA\"\n periodic += \"GE\"\n periodic += \"AS\"\n periodic += \"SE\"\n periodic += \"BR\"\n periodic += \"KR\"\n periodic += \"RB\"\n periodic += \"SR\"\n periodic += \"Y\"\n periodic += \"ZR\"\n periodic += \"NB\"\n periodic += \"MO\"\n periodic += \"TC\"\n periodic += \"RU\"\n periodic += \"RH\"\n periodic += \"PD\"\n periodic += \"AG\"\n periodic += \"CD\"\n periodic += \"IN\"\n periodic += \"SN\"\n periodic += \"SB\"\n periodic += \"TE\"\n periodic += \"I\"\n periodic += \"XE\"\n periodic += \"CS\"\n periodic += \"BA\"\n periodic += \"LA\"\n periodic += \"CE\"\n periodic += \"PR\"\n periodic += \"ND\"\n periodic += \"PM\"\n periodic += \"SM\"\n periodic += \"EU\"\n periodic += \"GD\"\n periodic += \"TB\"\n periodic += \"DY\"\n periodic += \"HO\"\n periodic += \"ER\"\n periodic += \"TM\"\n periodic += \"YB\"\n periodic += \"LU\"\n periodic += \"HF\"\n periodic += \"TA\"\n periodic += \"W\"\n periodic += \"RE\"\n periodic += \"OS\"\n periodic += \"IR\"\n periodic += \"PT\"\n periodic += \"AU\"\n periodic += \"HG\"\n periodic += \"TL\"\n periodic += \"PB\"\n periodic += \"BI\"\n periodic += \"PO\"\n periodic += \"AT\"\n periodic += \"RN\"\n periodic += \"FR\"\n periodic += \"RA\"\n periodic += \"AC\"\n periodic += \"TH\"\n periodic += \"PA\"\n periodic += \"U\"\n periodic += \"NP\"\n periodic += \"PU\"\n periodic += \"AM\"\n periodic += \"CM\"\n periodic += \"BK\"\n periodic += \"CF\"\n periodic += \"ES\"\n periodic += \"FM\"\n periodic += \"MD\"\n periodic += \"NO\"\n periodic += \"LR\"\n periodic += \"RF\"\n periodic += \"DB\"\n periodic += \"SG\"\n periodic += \"BH\"\n periodic += \"HS\"\n periodic += \"MT\"\n periodic += \"DS\"\n periodic += \"RG\"\n periodic += \"CN\"\n periodic += \"NH\"\n periodic += \"FL\"\n periodic += \"MC\"\n periodic += \"LV\"\n periodic += \"TS\"\n periodic += \"OG\"\n }\n setUp()\n val input = System.`in`.bufferedReader().readLine()\n val calced = BooleanArray(input.length)\n val valid = BooleanArray(input.length)\n fun solve(id: Int): Boolean {\n if (id == input.length) {\n return true\n }\n if (!calced[id]) {\n var isValid = false\n if (input[id].toString() in periodic) {\n isValid = isValid || solve(id + 1)\n }\n if (id < input.lastIndex && (input[id].toString() + input[id + 1]) in periodic) {\n isValid = isValid || solve(id + 2)\n }\n valid[id] = isValid\n }\n return valid[id]\n }\n print(if (solve(0)) \"YES\" else \"NO\")\n}"}], "negative_code": [{"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 s = sc.nextLine()\n val a = arrayOf(\"GENIUS\", \"IRENE\", \"REVOLVER\", \"WATSON\")\n val b = arrayOf(\"DOCTOR\", \"MARY\", \"SMARTPHONE\", \"HOLMES\")\n if (a.contains(s)) {\n println(\"YES\")\n } else if (b.contains(s)) {\n println(\"NO\")\n } else {\n println(\"YES\")\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}\n"}], "src_uid": "d0ad35798119f98320967127c43ae88d"} {"source_code": "fun main() {\n val month = readLine()!!\n val nextMonthNumber = readLine()!!\n\n val monthNumber = months.indexOf(month)\n val result = (monthNumber + nextMonthNumber.toInt() % 12) % 12\n println(months[result])\n}\n\nval months = arrayOf(\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n)", "positive_code": [{"source_code": "import java.util.Scanner\n\nfun main(args : Array) {\n\n val reader = Scanner(System.`in`)\n val m = readLine()!!\n var n: Int = reader.nextInt()\n val list = arrayOf(\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\")\n\n var a = 0\n\n for(i in 0..11){\n if(m==list[i]){\n a = i\n break\n }\n }\n\n n = n%12\n\n println(list[(a + n)%12])\n\n}"}, {"source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n\n val nameToNumber = mapOf(\"January\" to 0, \"February\" to 1, \"March\" to 2, \"April\" to 3, \"May\" to 4, \"June\" to 5,\n \"July\" to 6, \"August\" to 7, \"September\" to 8, \"October\" to 9, \"November\" to 10, \"December\" to 11)\n val numberToName = arrayOf(\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\",\n \"September\", \"October\", \"November\", \"December\")\n println(numberToName[(nameToNumber[readLine()!!]!! + readInt()) % 12])\n}\n"}, {"source_code": "fun main(args: Array) {\n val month = readLine()\n val cnt = readLine()!!.toInt()\n\n val allMonths = listOf(\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\")\n var currMonthIndex = allMonths.indexOf(month)\n\n for (i in 1 .. cnt)\n {\n if (++currMonthIndex > 11)\n currMonthIndex -= 12\n }\n\n print(allMonths[currMonthIndex])\n}\n"}], "negative_code": [], "src_uid": "a307b402b20554ce177a73db07170691"} {"source_code": "fun main(args: Array){\n val reg = Regex(\" \")\n var s = readLine()!!.split(reg)\n var n = s[0].toInt()\n val k = s[1].toInt()\n s = readLine()!!.split(reg)\n var sum = s.sumBy { it.toInt() }\n val need = (k - 1).toDouble() + 0.5\n var ans = 0\n while (sum.toDouble() / n.toDouble() < need){\n sum += k\n ++n\n ++ans\n }\n print(ans)\n}", "positive_code": [{"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 // [A] [B]\n\n var cntOther : Int = n - cntK\n if (cntK >= cntOther) println(0)\n else if (need == 0) println(cntOther - cntK)\n else println(need + n + need)\n}"}, {"source_code": "\nfun main(args: Array) {\n val (n, k) = readLine()!!.split(\" \").map { it.toInt() }\n val list = readLine()!!.split(\" \").map { it.toInt() }\n var sum = 0\n var count = list.size\n list.forEach { it -> sum += it }\n while (true) {\n if (Math.round(sum.toFloat()/count) == k) {\n break\n }\n sum += k\n count++\n }\n print(count - list.size)\n}"}, {"source_code": "fun main(args: Array) {\n val x = readLine()!!.split(\" \")\n var courses = x[0].toInt()\n val mark = x[1].toInt()\n\n var sum = readLine()!!.split(\" \").map { it.toInt() }.sum().toDouble()\n\n var ans = 0\n var curMark = sum / courses\n while ((curMark + .5).toInt() < mark){\n sum += mark\n courses++\n curMark = sum / courses\n ans++\n }\n println(ans)\n}"}, {"source_code": "import java.util.*\n\n/**\n * Created by apple on 2017/5/22.\n */\nfun main(args:Array) {\n var scanner:Scanner = Scanner(System.`in`)\n\n var n = scanner.nextInt()\n var k = scanner.nextInt()\n\n var sum = 0\n\n for (i in 0..n-1) {\n var a = scanner.nextInt()\n sum += a\n }\n\n var ans = 0\n\n while (!accept(sum, k, n + ans)) {\n sum += k\n ans++\n }\n println(ans)\n}\n\nfun accept(sum:Int, k:Int, count:Int) : Boolean{\n if (Math.round(1.0 * sum / count) >= k) {\n return true\n }\n return false\n}"}, {"source_code": "import kotlin.math.max\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (numMarks, k) = readInts()\n val arr = readInts()\n print(max(0, ((arr.sum() - numMarks * (k - 0.5)) / -0.5).toInt()))\n}"}, {"source_code": "import java.io.InputStream\nimport java.math.BigDecimal\nimport java.math.BigInteger\n\nfun main(args: Array) = input.run {\n var n = nextInt()\n var k = nextInt()\n var a = nextInts(n)\n var sum = a.sum()\n var ans = 0\n while (2 * sum < 2 * k * n - n) {\n ++ans\n ++n\n sum += k\n }\n println(ans)\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}"}, {"source_code": "\nfun main(args: Array) {\n\n var x= readLine()?.split(\" \")\n var n:Int = Integer.parseInt(x!![0])\n var k:Int = Integer.parseInt(x!![1])\n x= readLine()?.split(\" \")\n var sum:Double=0.0\n for(i in 1..n){\n sum+=Integer.parseInt(x!![i-1])\n }\n var avg:Double=sum/n\n if(avg+.5>=k){\n println(0)\n return\n }\n var c=0\n while (true){\n sum+=k\n n++\n c++\n avg=sum/n\n if(avg+.5>=k)break\n }\n println(c)\n\n}\n"}, {"source_code": "fun main(args: Array) {\n var (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 // print(\"$n $total\\n\")\n if (total / n >= k)\n break\n else if (total / n >= k - 1 && total % n >= (n+1) / 2)\n break\n ans++\n n++\n total += k\n }\n print(\"$ans\\n\")\n}\n"}], "negative_code": [{"source_code": "/**\n * Created by seydazimovnurbol on 5/23/17.\n */\n\nimport java.util.*\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 for (i in 1 .. n) {\n var x = scanner.nextInt()\n a.add(x)\n }\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\n}"}, {"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}"}, {"source_code": "/**\n * Created by seydazimovnurbol on 5/23/17.\n */\n\nimport java.util.*\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 for (i in 1 .. n) {\n var x = scanner.nextInt()\n a.add(x)\n }\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 (need == 0) println(0);\n else println(n + 2 * need)\n\n}"}, {"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}"}], "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900"} {"source_code": "fun main() {\n fun sieve(limit: Int): List {\n val notPrimes = mutableSetOf()\n val primes = ArrayList()\n for (num in 2..limit) {\n if (num !in notPrimes) {\n primes.add(num)\n var notPrime = num + num\n while (notPrime <= limit) {\n notPrimes.add(notPrime)\n notPrime += num\n }\n }\n }\n return primes\n }\n\n val primes = sieve(10000).toSet()\n val n = readLine()!!.toInt()\n for (c in 1..10)\n if (n * c + 1 !in primes) {\n print(c)\n return\n }\n}", "positive_code": [{"source_code": "import kotlin.math.sqrt\n\nfun checkprime(n:Int):Boolean\n{\n if(n<=1)\n {\n return false\n }\n val root = sqrt(n.toDouble())\n for(i in 2 until root.toInt()+1)\n {\n if(n%i==0)\n {\n return false\n }\n }\n return true\n}\n\nfun main(args:Array)\n{\n val n : Int = readLine()!!.toInt()\n for(i in 1 until 1001) {\n if(!checkprime(n*i+1))\n {\n print(i)\n break\n }\n }\n}"}, {"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 String.words() = split(\" \")\n\nprivate fun String.toInts() = split(\" \").map(String::toInt)\nprivate fun String.toLongs() = split(\" \").map(String::toLong)\n\nfun isPrime(p: Int): Boolean {\n val upb = Math.sqrt(p.toDouble()).toInt()\n for (i in 2..upb) {\n if (p % i == 0)\n return false\n }\n return true\n}\n\nprivate fun solve(input: BufferedReader, output: PrintWriter) {\n val n = input.readLine().toInt()\n for (m in 1..1000) {\n val p = n * m + 1\n if (!isPrime(p)) {\n output.println(m)\n return\n }\n }\n}"}, {"source_code": "import kotlin.math.sqrt\n\nfun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n fun prime(i: Int) = (2..sqrt(i.toDouble()).toInt()).none { i % it == 0 }\n val n = r.readLine()!!.toInt()\n //val v = r.readLine()!!.split(\" \").map { it.toInt() }.toSet().toList().sorted()\n var m = 1\n while (prime(m*n+1)){\n m++\n }\n println(m)\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n\n var m = 1\n while (m <= 1000) {\n\n if (!isPrime(n * m + 1)) {\n println(m)\n return\n }\n m++\n }\n\n}\n\nfun isPrime(n: Int): Boolean {\n var i = 2\n\n while (i * i <= n) {\n\n if (n % i == 0)\n return false\n\n i++\n }\n\n return true\n}"}, {"source_code": "import java.io.*\nimport java.util.*\n\nfun main(args : Array) {\n //====== Input preparations ========================================================\n// val fin = BufferedReader(FileReader(\"a.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 fun gcd (a: Int, b: Int) : Int = if (a == 0) b else gcd(b%a, a)\n fun isprime(a: Int) = (2..a-1).none { a % it == 0 }\n val n = nextInt()\n// for (n in 1..1000) {\n for (i in 2..1000) {\n if (gcd(i, n) == 1 && !isprime(i)) {\n for (j in 1..i - 1) {\n if (j * n % i == i - 1) {\n fout.println(j)\n break\n }\n }\n break\n }\n }\n// }\n\n\n fout.close()\n fin.close()\n}\n\n"}, {"source_code": "import java.lang.String.format\nimport java.util.*\nimport kotlin.math.*\nimport kotlin.system.exitProcess\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\nfun main(){\n val reader=Scanner(System.`in`)\n var a=readInt();\n for(i in 1..1000){\n var b=a*i+1\n for(j in 2..b-1){\n if(b%j==0){\n print(i)\n return\n }\n }\n }\n}"}, {"source_code": "import kotlin.math.*\n\nfun main(args: Array) {\n val n = readLine()!!.toInt()\n\n for (i in 1..1000) {\n val num = n * i + 1\n var flag = false\n for (j in 2..num / 2) {\n if (num % j == 0) {\n flag = true\n break\n }\n }\n if (flag) {\n println(i)\n return\n }\n }\n}"}, {"source_code": "import java.lang.StringBuilder\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.max\n\nfun main() {\n var sc = Scanner(System.`in`)\n var n = sc.nextInt()\n var list = ArrayList()\n\n for (i in 1..10_000) {\n var flag = true\n\n for (j in 2..i - 1) {\n if (i % j == 0) {\n flag = false\n break\n }\n }\n if (flag) {\n list.add(false)\n } else {\n list.add(true)\n }\n }\n list[0] = true\n list[1] = false\n list.add(true)\n for (i in 1..1000) {\n if (list[n * i]) {\n println(i)\n break\n }\n }\n\n}"}], "negative_code": [{"source_code": "import kotlin.math.sqrt\n\nfun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n fun prime(i: Int) = (2..sqrt(i.toDouble()).toInt()).none { it % i == 0 }\n val n = r.readLine()!!.toInt()\n //val v = r.readLine()!!.split(\" \").map { it.toInt() }.toSet().toList().sorted()\n var m = 1\n while (!prime(m*n+1)){\n m++\n }\n println(m)\n}"}, {"source_code": "import kotlin.math.*\n\nfun main(args: Array) {\n val n = readLine()!!.toInt()\n\n for (i in 1..1000) {\n val num = n * i + 1\n var flag = false\n for (j in 2..num / 2) {\n if (num % i == 0) {\n flag = true\n break\n }\n }\n if (!flag) {\n println(i)\n return\n }\n }\n}"}, {"source_code": "import java.lang.StringBuilder\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.max\n\nfun main() {\n var sc = Scanner(System.`in`)\n var n = sc.nextInt()\n var list = ArrayList()\n\n for (i in 1..1000) {\n var flag = true\n\n for (j in 2..i - 1) {\n if (i % j == 0) {\n flag = false\n break\n }\n }\n if (flag) {\n list.add(false)\n } else {\n list.add(true)\n }\n }\n list[0] = true\n list[1] = true\n list.add(true)\n for (i in 1..1000) {\n if (list[n * i]) {\n println(i)\n break\n }\n }\n\n}"}, {"source_code": "import java.util.*\n\nfun main(){\n val sc = Scanner(System.`in`)\n val n:Int = sc.nextInt()\n if (n%2==0){\n println(1)\n }else if (n==1){\n println(3)\n }else{\n println(2)\n }\n}"}, {"source_code": "import java.util.*\n\nfun main(){\n val sc = Scanner(System.`in`)\n val n:Int = sc.nextInt()\n if (n%2==0){\n println(2)\n }else{\n println(1)\n }\n}"}, {"source_code": "import java.util.*\n\nfun main(){\n val sc = Scanner(System.`in`)\n val n:Int = sc.nextInt()\n if (n%2==0){\n println(2)\n }else if (n==1){\n println(3)\n }else{\n println(1)\n }\n}"}], "src_uid": "5c68e20ac6ecb7c289601ce8351f4e97"} {"source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.lang.StringBuilder\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.max\n\nfun main() {\n val sc = Scanner.sysIn\n\n val n = sc.nextInt()\n val m = sc.nextInt()\n\n var ans = 1L\n for (i in 1..(n + m)) {\n ans = (ans * 2) % 998244353\n }\n println(ans)\n\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n val br: BufferedReader = BufferedReader(InputStreamReader(s))\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n fun nextLine(): String {\n return br.readLine()\n }\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n companion object {\n val sysIn = Scanner(System.`in`)\n }\n\n}\nfun IntArray.print() {\n println(Arrays.toString(this))\n}\nfun Array.print() {\n for (i in this)\n i.print()\n}\n\nfun BooleanArray.print() {\n println(Arrays.toString(this))\n}\n\n", "positive_code": [{"source_code": "import java.math.BigInteger\n\n// Unable to solve it by myself. The tutorial is here: https://codeforces.com/blog/entry/68534\nfun main() {\n val (w, h) = readLine()!!.split(\" \").map(String::toLong)\n print(BigInteger.valueOf(2L).modPow(BigInteger.valueOf(w + h), BigInteger.valueOf(998244353L)))\n}"}, {"source_code": "private 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 main() {\n val (w, h) = readInts()\n\n val mod = 998244353\n var res = 1L\n repeat(w + h) {\n res *= 2\n res %= mod\n }\n println(res)\n}\n"}, {"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%mod\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}"}, {"source_code": "import java.lang.Integer.min\nimport java.util.*\n\nfun main() {\n var ab = readLine()!!.split(' ').map { it.toInt() }.let { it[0] + it[1] }\n var k = 1\n while (ab > 0) {\n val z = Integer.numberOfLeadingZeros(k)\n val bit = min(ab, z - 1)\n ab -= bit\n k = k.shl(bit).rem(998244353)\n }\n println(k)\n return\n\n\n\n\n val s = \"\"//readLine()!!\n val l = s.length\n var lv = -1\n var os = 0\n val mark = LinkedList()\n for (i in 0 until l) {\n when (s[i]) {\n 'v' -> ++lv\n 'o' -> {\n if (lv > 0) {\n mark.add(lv)\n }\n lv = -1\n mark.add(0)\n ++os\n }\n else -> {\n throw Error()\n }\n }\n }\n if (lv > 0) {\n mark.add(lv)\n }\n\n var w = 0\n val left = IntArray(os)\n val right = IntArray(os)\n var fi = 0\n var ss = 0\n if (os > 0 ) {\n\n mark.iterator().forEach {\n if (it == 0) {\n left[fi++] = w\n } else {\n w += it\n }\n }\n w = 0\n mark.descendingIterator().forEach {\n if (it == 0) {\n right[--fi] = w\n } else {\n w += it\n }\n }\n\n }\n for (i in 0 until os) {\n ss += left[i] * right[i]\n }\n println(ss)\n}\n"}, {"source_code": "fun main() {\n\n val (w, h) = readInts()\n\n val prime = 998244353L\n val dp = mutableListOf>()\n\n for (i in 0 until h) {\n dp.add(mutableListOf())\n for (j in 0 until w) {\n dp[i].add(0)\n }\n }\n\n dp[0][0] = 4L\n for (i in 0 until h) {\n for (j in 0 until w) {\n if (i > 0 && j > 0) dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % prime\n else if (i > 0) dp[i][j] = (dp[i - 1][j] * 2) % prime\n else if (j > 0) dp[i][j] = (dp[i][j - 1] * 2) % prime\n }\n }\n\n println(dp[h - 1][w - 1])\n}\n\n// Input Reader\nprivate fun readLn() = readLine()!!\n\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n"}, {"source_code": "fun main() {\n val (w, h) = readInts()\n val ans = ModInt(2).pow(w + h)\n\n println(ans)\n}\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\n/** modint inline class, requires hardcoded mod base **/\nconst val MODBASE = 998244353\n\ninline fun Int.toModInt() = ModInt(this umod MODBASE)\ninline fun Long.toModInt() = ModInt((this umod MODBASE).toInt())\n\n/** note: Only use constructor for int within modulo range, otherwise use toModInt **/\ninline class ModInt(val int: Int) {\n operator fun plus(other: ModInt) = plus(other.int) // MODBASE < 2^30\n operator fun plus(other: Int) = (int + other).toModInt() // careful of possible overflow\n operator fun inc() = plus(1)\n\n operator fun minus(other: ModInt) = minus(other.int)\n operator fun minus(other: Int) = (int - other).toModInt()\n operator fun dec() = minus(1)\n\n operator fun times(other: ModInt) = times(other.int)\n operator fun times(other: Int) = (int.toLong() * other).toModInt()\n\n fun pow(exponent: Int): ModInt {\n var res = ModInt(1)\n var e = exponent\n var b = this\n\n if(e < 0) e = e.umod(MODBASE - 1) // assumes MODBASE is prime\n\n while(e > 0) {\n if(e and 1 == 1) {\n res *= b\n }\n e = e shr 1\n b *= b\n }\n return res\n }\n\n fun inv() = pow(MODBASE - 2) // assumes MODBASE is prime\n\n operator fun div(other: ModInt) = times(other.inv())\n 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 operator fun get(i: Int) = ModInt(intArray[i])\n operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }\n\n override val size: Int get() = intArray.size\n\n override fun contains(element: ModInt): Boolean = indices.any { get(it) == element }\n\n override fun containsAll(elements: Collection): Boolean = elements.all { contains(it) }\n\n override fun isEmpty(): Boolean = size == 0\n\n override fun iterator(): Iterator = object: AbstractIterator() {\n var index = 0\n override fun computeNext() {\n if(index >= size) done()\n else setNext(get(index++))\n }\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 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"}, {"source_code": "import java.util.*\n\nfun main() {\n val jin = Scanner(System.`in`)\n val w = jin.nextInt()\n val h = jin.nextInt()\n println(M2 pow (w + h))\n}\n\nval M0 = Mint(0)\nval M1 = Mint(1)\nval M2 = Mint(2)\n\nval MOD: Long = 998244353\nval MOD_TOTIENT = (MOD - 1).toInt()\n\nfun mint(num: Long) = Mint(num % MOD)\nfun mint(num: Int) = Mint(num % MOD)\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 + MOD - 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(MOD - num)\n operator fun inc() = this + M1\n operator fun dec() = this - M1\n\n infix fun pow(power: Int): Mint {\n var e = power\n e %= MOD_TOTIENT\n if (e < 0) {\n e += MOD_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}"}, {"source_code": "import java.util.*\n\nfun main() {\n val input = Scanner(System.`in`)\n val mod = 998244353L\n val n = input.nextInt() + input.nextInt()\n var result = 1L\n for (i in 1..n) {\n result = (result * 2) % mod\n }\n println(result)\n}\n"}], "negative_code": [{"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}"}], "src_uid": "8b2a9ae21740c89079a6011a30cd6aee"} {"source_code": "import java.io.*\nimport java.util.*\nimport java.util.Arrays\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 when (ir.nextInt() % 4) {\n 0 -> pw.print(\"1 A\")\n 2 -> pw.print(\"1 B\")\n 3 -> pw.print(\"2 A\")\n else -> pw.print(\"0 A\")\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}", "positive_code": [{"source_code": "fun main(){\n\tvar x = readLine()!!.toInt()\n\tvar m = x % 4\n\tprintln( when(m) {\n\t\t1 -> \"0 A\"\n\t\t2 -> \"1 B\"\n\t\t3 -> \"2 A\"\n\t\telse -> \"1 A\" \n\t\t\n\t})\n}"}, {"source_code": "fun main() {\n val (a, b) = when (readInt() % 4) {\n 0 -> 1 to \"A\"\n 1 -> 0 to \"A\"\n 2 -> 1 to \"B\"\n 3 -> 2 to \"A\"\n else -> error(\"\")\n }\n println(\"$a $b\")\n}\n\nprivate fun readInt() = readLine()!!.toInt()"}, {"source_code": "private fun readString() = readLine()!!\nprivate fun readInt() = readString().toInt()\nprivate fun readStrings() = readString().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n\nfun isBetter(current: Int, next: Int): Boolean = when(current) {\n 1 -> false\n 3 -> next == 1\n 2 -> next in setOf(1,3)\n 0 -> next != 4\n else -> throw IllegalArgumentException(\"Should never be more than 4, was $current\")\n}\n\n\nfun main() {\n val hp = readInt()\n var best = hp % 4\n var howMuch = 0\n for (i in 1..2) {\n val current = (hp + i) % 4\n if (isBetter(best, current)) {\n howMuch = i\n best = current\n }\n }\n print(howMuch)\n print(' ')\n println(\n when (best) {\n 0 -> 'D'\n 1 -> 'A'\n 2 -> 'C'\n 3 -> 'B'\n else -> throw IllegalArgumentException(\"Should never be more than 4, was $best\")\n }\n )\n}"}, {"source_code": "private fun readLn() = readLine()!!\nprivate fun readString() = readLn().trim()\nprivate fun readInt() = readLn().toInt()\nprivate val regSpace = \"\\\\s+\".toRegex()\nprivate fun readSomeInts(): List {\n return readLn().trim().split(regSpace).map { it.toInt() }\n}\nprivate fun readLong() = readLn().toLong()\nprivate fun readSomeLongs(): List {\n return readLn().trim().split(regSpace).map { it.toLong() }\n}\n\nfun main() {\n\n val x = readInt()\n\n when (x % 4) {\n 1 -> println(\"0 A\")\n 3 -> println(\"2 A\")\n 2 -> println(\"1 B\")\n else -> println(\"1 A\")\n }\n \n}\n\n"}, {"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 ) {\n println(\"1 A\")\n } else if (num % 4 == 2) {\n println(\"1 B\")\n }else if(num % 4 == 3){\n println(\"2 A\")\n }\n }\n\n\n}"}, {"source_code": "\nfun solve(n: Int):Int{\n if(n%4==1)\n return 'A'.toInt()\n else if(n%4==2)\n return 'C'.toInt()\n else if(n%4==3)\n return 'B'.toInt()\n else\n return 'D'.toInt()\n}\nfun main(){\n var n: Int\n n = readLine()!!.toInt()\n var a:Int=0\n var res:Int=solve(n)\n for(i in 1..2){\n var tmp:Int = solve(n+i)\n if(tmpprint(\"1 A\")\n 1->print(\"0 A\")\n 2->print(\"1 B\")\n 3->print(\"2 A\")\n }\n}"}, {"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(\"1 A\")\n 1 -> println(\"0 A\")\n 2 -> println(\"1 B\")\n 3 -> println(\"2 A\")\n }\n}"}, {"source_code": "fun main() {\n val hp = readLine()!!.toInt()\n when(hp%4) {\n 0 -> println(\"1 A\")\n 1 -> println(\"0 A\")\n 2 -> println(\"1 B\")\n else -> println(\"2 A\")\n }\n}"}, {"source_code": "import java.io.*\nimport java.util.*\nimport java.util.Arrays\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 line: String = when (ir.nextInt() % 4) {\n 0 -> \"1 A\"\n 2 -> \"1 B\"\n 3 -> \"2 A\"\n else -> \"0 A\"\n }\n \n pw.print(line)\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}"}, {"source_code": "fun main(args: Array) {\n val x = readLine()!!.toInt()\n\n val r = x % 4\n when (r) {\n // D increment by 1 to have A\n 0 -> {\n println(\"1 A\")\n }\n // A already the best\n 1 -> {\n println(\"0 A\")\n }\n // C increment by 1 to have B\n 2 -> {\n println(\"1 B\")\n }\n // B increment by 2 to have A\n 3 -> println(\"2 A\")\n }\n}\n\n"}, {"source_code": "fun main() {\n val x = readLine()!!.toInt()\n var out = Array(2){ (it).toString() }\n var div = x % 4\n when(div){\n 0 -> { out[0] = \"1\" ; out[1] = \"A\" }\n 1 -> { out[0] = \"0\" ; out[1] = \"A\" }\n 2 -> { out[0] = \"1\" ; out[1] = \"B\" }\n 3 -> { out[0] = \"2\" ; out[1] = \"A\" }\n }\n out.forEach { print(\"$it \") }\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val ost = n % 4\n\n if (ost == 0) println(\"1 A\")\n if (ost == 1) println(\"0 A\")\n if (ost == 2) println(\"1 B\")\n if (ost == 3) println(\"2 A\")\n}"}, {"source_code": "fun main() {\n val x = readInt()\n val ans = when(x % 4) {\n 0 -> \"1 A\"\n 1 -> \"0 A\"\n 2 -> \"1 B\"\n else -> \"2 A\"\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"}, {"source_code": "fun main() {\n\n var hp = readInt()\n var c = when {\n hp % 4 == 1 -> 'A'\n hp % 4 == 3 -> 'B'\n hp % 4 == 2 -> 'C'\n hp % 4 == 0 -> 'D'\n else -> 'X'\n }\n\n when(c) {\n 'A' -> println(\"0 A\")\n 'B' -> println(\"2 A\")\n 'C' -> println(\"1 B\")\n 'D' -> println(\"1 A\")\n }\n\n\n\n}\n\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() }"}, {"source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n\n val x = readInt()\n print(\n when (x % 4) {\n 1 -> \"0 A\"\n 2 -> \"1 B\"\n 3 -> \"2 A\"\n else -> \"1 A\"\n }\n )\n}"}, {"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 val n = readInt()\n fun cat(i : Int) : Char {\n return when {\n i % 4 == 0 -> 'D'\n i % 4 == 1 -> 'A'\n i % 4 == 2 -> 'C'\n else -> 'B'\n }\n }\n val a = (0..2).maxBy { 'D' - cat(n+it) }!!\n println(\"$a ${cat(n+a)}\")\n}"}, {"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 hp = readInt()\n when (hp % 4) {\n 0 -> println(\"1 A\")\n 1 -> println(\"0 A\")\n 2 -> println(\"1 B\")\n 3 -> println(\"2 A\")\n }\n}"}], "negative_code": [{"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}"}, {"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}"}, {"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}"}], "src_uid": "488e809bd0c55531b0b47f577996627e"} {"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 0-> println(\"zero\")\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", "positive_code": [{"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\", \"fifteen\", \"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"}], "negative_code": [{"source_code": "\n\nfun main() {\n var n = readLine()!!\n var one = 0\n var toCheck = Integer.parseInt(n)\n if (toCheck == 11) {\n println(\"eleven\")\n return\n } else if (toCheck == 10) {\n println(\"ten\")\n } else if (toCheck == 12) {\n println(\"twelve\")\n return\n } else if (toCheck == 13) {\n println(\"thirteen\")\n return\n } else if (toCheck == 14) {\n println(\"fourteen\")\n return\n } else if (toCheck == 15) {\n println(\"fifteen\")\n return\n } else if (toCheck == 16) {\n println(\"sixteen\")\n return\n } else if (toCheck == 17) {\n println(\"seventeen\")\n return\n } else if (toCheck == 18) {\n println(\"eighteen\")\n return\n } else if (toCheck == 19) {\n println(\"nineteen\")\n return\n }\n when(toCheck){\n 1 -> print(\"one\")\n 2 -> print(\"two\")\n 3 -> print(\"three\")\n 4 -> print(\"four\")\n 5 -> print(\"five\")\n 6 -> print(\"six\")\n 7 -> print(\"seven\")\n 8 -> print(\"eight\")\n 9 -> print(\"nine\")\n }\n\n\n if (n.length > 1) {\n\n when (Integer.parseInt(n[0].toString())) {\n 2 -> print(\"twenty-\")\n 3 -> print(\"thirty-\")\n 4 -> print(\"forty-\")\n 5 -> print(\"fifty-\")\n 6 -> print(\"sixty-\")\n 7 -> print(\"seventy-\")\n 8 -> print(\"eighty-\")\n 9 -> print(\"ninety-\")\n }\n when (Integer.parseInt(n[1].toString())) {\n 1 -> print(\"one\")\n 2 -> print(\"two\")\n 3 -> print(\"three\")\n 4 -> print(\"four\")\n 5 -> print(\"five\")\n 6 -> print(\"six\")\n 7 -> print(\"seven\")\n 8 -> print(\"eight\")\n 9 -> print(\"nine\")\n }\n\n }\n}"}, {"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 1 -> println(\"ten\")\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"}, {"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"}, {"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"}], "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7"} {"source_code": "import java.util.*\n\n/**\n * Created by thuanle on 7/16/17.\n */\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n sc.nextLine()\n sc.nextLine().split(\"0\").forEach{print(it.length)}\n}", "positive_code": [{"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 if(chars[chars.size-1] == '0')\n result+=\"0\"\n println(result)\n\n}\n"}, {"source_code": "import 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 n = sc.nextInt()\n sc.nextLine()\n val s = sc.nextLine()\n s.split(\"0\")\n .forEach{print(it.length)}\n\n}"}, {"source_code": "import java.io.*\nimport java.util.*\n\n\nfun solve() {\n nextInt()\n val s = next()\n var add = 0\n s.forEach {\n when(it) {\n '0' -> {\n pw.print(add)\n add = 0\n } else -> add++\n }\n }\n pw.println(add)\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}"}, {"source_code": "import java.util.*\n\nfun main(args: Array ) {\n val sc = Scanner( System.`in` )\n sc.nextLine()\n println( sc.nextLine().split( \"0\" ).map { it.length }.joinToString( \"\" ) )\n}"}, {"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 sol.append(sum)\n print(sol)\n}\n"}, {"source_code": "import java.util.Scanner\n\nfun main(args : Array) {\n val scanner = Scanner(System.`in`)\n var n = scanner.next().toInt()\n var s = scanner.next().toString()\n var digit: Int = 0\n s.forEach {\n when(it) {\n '1' -> digit++\n '0' -> {\n print(digit)\n digit = 0\n }\n }\n }\n print(digit)\n}"}], "negative_code": [{"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"}, {"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"}], "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa"} {"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(\"\").toLong())\n}", "positive_code": [{"source_code": "import java.util.*\n\nfun main(args: Array) {\n val NStr = readLine()!!\n val digits = NStr.length\n val results = ArrayList(digits)\n\n for (i in 0..digits-1) {\n val beginning = NStr.take(i)\n val ending = NStr.takeLast(digits-i).toLong()\n val newEnding = (ending / Math.pow(10.0, digits-i - 1.0).toLong() - 1) * Math.pow(10.0, digits-i - 1.0).toLong() +\n (digits-i.toLong() - 2 downTo 0).sumByLong { 9 * Math.pow(10.0, it.toDouble()).toLong() }\n if (newEnding<0) continue\n results.add(\"$beginning$newEnding\".toLong())\n }\n\n results.add(NStr.toLong())\n val maxSum = results.maxBy(Long::getSum)!!.getSum()\n val output = results.filter { it.getSum() == maxSum}.max()\n\n println(output)\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}\n"}, {"source_code": "//package qqq2\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\n\n//fun Long.maxSum(): Long = (this downTo 1).maxBy(Long::sum) ?: 0\n\nfun Long.maxSumFast(): Long {\n val digits = digits()\n var nines = digits().mapIndexed { index, l -> if (index == digits.size - 1) l else 9 }\n if (nines.toLong() == this) return this\n for (i in 0..nines.size - 2) {\n if (nines.toLong().setDigit(8, i) <= this) {\n nines = nines.toLong().setDigit(8, i).digits()\n break\n }\n }\n if (nines.toLong() > this) nines = nines.mapIndexed { index, l -> if (index == digits.size - 1) l - 1 else l }\n return nines.toLong()\n}\n\nfun Long.setDigit(digit: Long, pos: Int) = digits().mapIndexed { index, l -> if (index == pos) digit else l }.toLong()\n\n//fun Long.sum(): Long = digits().sum()\n\nfun Long.digits(): MutableList {\n val r = mutableListOf()\n var t = this\n while (t > 0) {\n r.add(t % 10)\n t /= 10\n }\n return r\n}\n\nfun List.toLong() = if (isEmpty()) 0 else this.reversed().reduce { acc, l -> acc * 10 + l }\n\nfun main(args: Array) {\n println(BufferedReader(InputStreamReader(System.`in`)).readLine().toLong().maxSumFast())\n\n// val filter = (1L..4444)\n// .onEach { println(\"$it\\t${it.maxSum()}\\t${it.maxSumFast()}\") }\n// .filter { it.maxSum() != it.maxSumFast() }\n// println(\"errors == \" + filter)\n\n}"}, {"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 : Long) : Long {\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.toLong()\n head --\n if (head > 0) {\n cur = (head.toString() + tail).toLong()\n } else {\n cur = tail.toLong()\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()!!.toLong()\n println(solve(x))\n}"}], "negative_code": [{"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"}, {"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}"}, {"source_code": "fun main(args: Array) {\n val N = readLine()!!.toInt()\n val digits = Math.abs(N).toString().length.toDouble()\n val N2 = (N / Math.pow(10.0, digits-1).toInt() - 1) * Math.pow(10.0, digits-1).toInt() +\n (digits.toInt()-2 downTo 0).sumBy { 9*Math.pow(10.0, it.toDouble()).toInt() }\n\n val Nsum = N.getSum()\n val N2sum = N2.getSum()\n if (Nsum>N2sum)\n println(N)\n else if (Nsum) {\n val NStr = readLine()!!\n var nines = 0\n while (NStr.length>nines && 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 if (nines>0)\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}"}], "src_uid": "e55b0debbf33c266091e6634494356b8"} {"source_code": "import java.util.*\n \nfun main() {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n val Z = LongArray(20)\n Z[1] = 1\n for (i in 2 until Z.size) {\n Z[i] = Z[i - 1] * 10 + 1\n }\n var res = Long.MAX_VALUE\n for (len in 1..17) {\n for (m in 0..(1 shl len)) {\n var cur = 0L\n var cnt = 0L\n for (i in len downTo 1) {\n val overflow = (m and (1 shl i)) != 0\n if (cur < n) {\n val am = (n - cur) / Z[i]\n cur += Z[i] * am\n cnt += i * am\n if (overflow && cur < n) {\n cur += Z[i]\n cnt += i\n }\n } else if (cur > n) {\n val am = (cur - n) / Z[i]\n cur -= Z[i] * am\n cnt += i * am\n if (overflow && cur > n) {\n cur -= Z[i]\n cnt += i\n }\n }\n }\n if (cur == n)\n res = minOf(res, cnt)\n }\n }\n println(res)\n}", "positive_code": [{"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 val memo = mutableMapOf()\n fun dfs(x: Long, isAlt: Boolean = false): Int {\n debug{\"x:$x\"}\n if (x == 0L) return 0\n if (memo.containsKey(x)) return memo[x]!!\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 memo[x] = res\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}"}, {"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\nval memo = HashMap()\n\nfun rec(n: Long): Long{\n if(n in memo)\n return memo[n]!!\n val bs = lowerBound(n)\n if(ones[bs + 1] == n){\n memo[n] = (bs + 2).toLong()\n return (bs + 2).toLong()\n }\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 memo[n] = ans\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 memo[0L] = 0L\n for(i in 1L..6L)\n memo[i] = i\n for(i in 7L..11L)\n memo[i] = 13-i\n println(rec(n))\n}"}, {"source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\n\nfun main() {\n val n0 = readLong()\n\n val M = LongArray(17)\n for(i in 1 until M.size) M[i] = M[i-1] * 10 + 1\n\n var D = hashMapOf(n0 to 0)\n\n for(k in M.size-2 downTo 1) {\n if(M[k] > n0) continue\n\n val Dk = HashMap()\n\n for((n, c) in D) {\n Dk.checkMin(n % M[k], c + (n / M[k] * k).toInt())\n val n1 = M[k+1] - n\n Dk.checkMin(n1 % M[k], c + k + 1 + (n1 / M[k] * k).toInt())\n }\n\n D = Dk\n }\n\n val ans = D[0]\n\n println(ans)\n}\n\nfun HashMap.checkMin(k: K, v: Int) { if(v < getOrDefault(k, Int.MAX_VALUE)) put(k, v) }\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"}, {"source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\n\nfun main() {\n val n0 = readLong()\n\n val M = LongArray(17)\n for(i in 1 until M.size) M[i] = M[i-1] * 10 + 1\n\n var D = hashMapOf(n0 to 0)\n\n for(k in M.size-2 downTo 1) {\n if(M[k] > n0) continue\n\n val Dk = HashMap()\n\n for((n, c) in D) {\n Dk.checkMin(n % M[k], c + (n / M[k] * k).toInt())\n val n1 = M[k+1] - n\n Dk.checkMin(n1 % M[k], c + k + 1 + (n1 / M[k] * k).toInt())\n }\n\n D = Dk\n }\n\n val ans = D[0]\n\n println(ans)\n}\n\nfun HashMap.checkMin(k: K, v: Int) { if(!containsKey(k) || v < get(k)!!) put(k, v) }\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"}, {"source_code": "import java.util.*\n \nfun main() {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n val Z = LongArray(20)\n Z[1] = 1\n for (i in 2 until Z.size) {\n Z[i] = Z[i - 1] * 10 + 1\n }\n var res = Long.MAX_VALUE\n for (len in 1..17) {\n for (m in 0..(1 shl len)) {\n var cur = 0L\n var cnt = 0L\n for (i in len downTo 1) {\n val overflow = (m and (1 shl i)) != 0\n if (cur < n) {\n val am = (n - cur) / Z[i]\n cur += Z[i] * am\n cnt += i * am\n if (overflow && cur < n) {\n cur += Z[i]\n cnt += i\n }\n } else if (cur > n) {\n val am = (cur - n) / Z[i]\n cur -= Z[i] * am\n cnt += i * am\n if (overflow && cur > n) {\n cur -= Z[i]\n cnt += i\n }\n }\n }\n if (cur == n)\n res = minOf(res, cnt)\n }\n }\n println(res)\n}"}, {"source_code": "import java.util.*\n \nfun main() {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n val Z = LongArray(20)\n Z[1] = 1\n for (i in 2 until Z.size) {\n Z[i] = Z[i - 1] * 10 + 1\n }\n var res = Long.MAX_VALUE\n for (len in 1..17) {\n for (m in 0..(1 shl len)) {\n var cur = 0L\n var cnt = 0L\n for (i in len downTo 1) {\n val overflow = (m and (1 shl i)) != 0\n if (cur < n) {\n val am = (n - cur) / Z[i]\n cur += Z[i] * am\n cnt += i * am\n if (overflow && cur < n) {\n cur += Z[i]\n cnt += i\n }\n } else if (cur > n) {\n val am = (cur - n) / Z[i]\n cur -= Z[i] * am\n cnt += i * am\n if (overflow && cur > n) {\n cur -= Z[i]\n cnt += i\n }\n }\n }\n if (cur == n)\n res = minOf(res, cnt)\n }\n }\n println(res)\n}"}, {"source_code": "fun answer(n: Long, position: Int, ones: Array): Long {\n var local_n: Long = n\n var lower_bound: Long = local_n / ones[position]\n local_n %= ones[position]\n if (local_n == 0L) {\n return lower_bound * position;\n }\n return lower_bound * position + \n minOf(position + answer(ones[position] - local_n, position - 1, ones),\n answer(local_n, position - 1, ones));\n}\n\nfun main() {\n var n: Long = readLine()!!.toLong()\n var ones: Array = arrayOf(0L, 1L, 11L, 111L, 1111L, 11111L, 111111L, 1111111L, 11111111L, 111111111L, \n 1111111111L, 11111111111L, 111111111111L, 1111111111111L, 11111111111111L, 111111111111111L, \n 1111111111111111L, 11111111111111111L, 111111111111111111L, 1111111111111111111L)\n println(\"${answer(n, 19, ones)}\")\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.min\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val n = scan.nextLong()\n ones[0] = 0\n for (i in 1..16) {\n ones[i] = ones[i - 1] * 10 + 1\n }\n println(result(n, 16))\n}\n\nvar ones = LongArray(17)\nfun result(n1: Long, i: Int): Long {\n var n = n1\n val k = (n / ones[i]).toInt()\n n %= ones[i]\n val count = (k * i).toLong()\n return if (n == 0L)\n count\n else\n count + min(i + result(ones[i] - n, i - 1), result(n, i - 1))\n}"}, {"source_code": "import java.io.*\nimport java.util.*\nimport kotlin.collections.*\nimport kotlin.math.*\n\nfun findMv(v: Long): Pair {\n var bs = 1L\n var cnt = 1\n while (10*bs < v) {\n bs = 10*bs + 1\n cnt++\n }\n return Pair(bs, cnt)\n}\n\nfun solve() {\n val n = kin.long()\n val q = PriorityQueue>(compareBy{it.first})\n val dst = HashMap()\n var ans = -1\n fun tryAdd(v: Long, cnt: Int) {\n if (!dst.containsKey(v) || dst.getValue(v) > cnt) {\n dst[v] = cnt\n q.add(Pair(cnt, v))\n if (v == 0L) {\n ans = cnt\n }\n }\n }\n tryAdd(n, 0)\n while (ans == -1) {\n val cur = q.poll()\n val v = cur.second\n val cnt = cur.first\n if (dst.getValue(v) != cur.first) {\n continue\n }\n val mv = findMv(v)\n tryAdd(v - mv.first, cnt + mv.second)\n tryAdd(10*mv.first+1-v, cnt + mv.second+1)\n }\n kout.println(ans)\n}\n\nvar kin = InputReader(getInput())\nval kout = PrintWriter(System.out)\n\nfun main() {\n kout.use { solve() }\n}\n\nclass InputReader(stream: InputStream) {\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n fun str(): String {\n while (tokenizer?.hasMoreTokens() != true) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n fun list(n: Int, parse: (String) -> R): List {\n return (1..n).map { parse.invoke(str()) }\n }\n\n fun int() = str().toInt()\n fun listInt(n: Int) = list(n) { it.toInt() }\n fun long() = str().toLong()\n fun listLong(n: Int) = list(n) { it.toLong() }\n}\n\nfun getInput(): InputStream {\n val inputFile = try {\n System.getProperty(\"compet.input\")\n } catch (ex: Exception) {\n null\n } ?: return System.`in`\n\n return FileInputStream({}::class.java.classLoader.getResource(inputFile).file)\n}\n\n"}, {"source_code": "import kotlin.math.min\nimport kotlin.math.pow\n\nfun a(n: Int): Long {\n return ((10.toDouble().pow(n) - 1) / 9).toLong()\n}\n\nfun solve(n: Long): Long {\n if (n <= 6) return n.toLong()\n if (n <= 11) return 13 - n.toLong()\n var level = 1\n while (a(level) < n) level ++\n level --\n val p1 = a(level)\n val p2 = a(level + 1)\n var res1 = n / p1 * level.toLong()\n res1 += solve(n % p1)\n var res2 = (level + 1).toLong()\n var x = p2 - n\n res2 += x / p1 * level.toLong()\n res2 += solve(x % p1)\n return min(res1, res2)\n}\n\nfun main(){\n val n = readLine()!!.toLong()\n println(solve(n))\n}"}, {"source_code": "import kotlin.math.*\nvar ones = LongArray(18, { 0L })\nfun main() {\n \n\n for (i in 1..17)\n {\n ones[i] = ones[i - 1] * 10 + 1\n }\n var n = readLine()!!.toLong()\n println(dfs(n, 16))\n\n}\n\nfun dfs(n:Long, i:Int):Long\n{\n var n1 = n\n var k = n1 / ones[i]\n n1 %= ones[i]\n if(n1 == 0L)\n {\n return k * i\n }\n else\n {\n return k*i+min(i+dfs(ones[i]-n1, i-1), dfs(n1, i-1))\n }\n\n}\n\n\n\n\n\n\n"}, {"source_code": "import java.util.*\n\ninternal var ones = LongArray(17)\ninternal fun dfs(n: Long, i: Int): Long {\n var n = n\n val k = (n / ones[i]).toInt()\n n %= ones[i]\n val count = (k * i).toLong()\n return if (n == 0L)\n count\n else\n count + Math.min(i + dfs(ones[i] - n, i - 1), dfs(n, i - 1))\n}\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val n = scan.nextLong()\n ones[0] = 0\n for (i in 1..16) {\n ones[i] = ones[i - 1] * 10 + 1\n }\n println(dfs(n, 16))\n}\n"}, {"source_code": "import kotlin.math.min\n\nvar memo = mutableListOf()\nfun calculate(number: Long): Long {\n val res: Long\n var i = 18\n if (number <= 11) return min(number, 2 + 11 - number)\n\n while (memo[i - 1] >= number) i--\n\n res = ((number / memo[i - 1]) * (i - 1)) + calculate(number % memo[i - 1])\n if (number < memo[i] - number) return res\n return min(res, i + calculate(memo[i] - number))\n}\n\nfun main(args: Array) {\n val n = readLine()!!.toLong()\n memo.add(0)\n memo.add(1)\n for (i in 2 until 18) memo.add(10 * memo[i - 1] + 1)\n memo.add(0)\n memo.add(0)\n print(calculate(n))\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashMap\nimport kotlin.math.min\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\n\nfun getOnes(sz: Int) : Long {\n var r = 0L\n for (unused in 0 until sz) {\n r = r * 10 + 1\n }\n return r\n}\nclass State(val node: Long, val dist: Int): Comparable {\n override fun compareTo(other: State): Int {\n return dist.compareTo(other.dist)\n }\n\n}\nfun bfs(): IntArray {\n val queue = PriorityQueue()\n queue.add(State(0, 0))\n val D = IntArray(20000) { 1000000000 }\n D[0] = 0\n while (queue.isNotEmpty()) {\n val t = queue.poll()!!\n if (D[t.node.toInt()] < t.dist) continue\n for (s in intArrayOf(-1, 1)) {\n for (i in 1..6) {\n val ns = State(t.node + s * getOnes(i), t.dist + i)\n if (ns.node < D.size && ns.node >= 0 && D[ns.node.toInt()] > ns.dist) {\n D[ns.node.toInt()] = ns.dist\n queue.add(ns)\n }\n }\n }\n }\n return D\n}\n\nval ref = Array(18) { i -> getOnes(i) }\nfun BF(v: Long): Int {\n val queue = PriorityQueue()\n queue.add(State(v, 0))\n val D = HashMap()\n D[v] = 0\n while (queue.isNotEmpty()) {\n val t = queue.poll()!!\n if (D[t.node]!! < t.dist) continue\n if (t.node == 0L) return t.dist\n var states = ArrayList()\n for (i in 0 until ref.size) {\n if (ref[i] == t.node) {\n states.add(State(t.node - ref[i], t.dist + i))\n break\n } else if (ref[i] > t.node) {\n states.add(State(ref[i] - t.node, t.dist + i))\n states.add(State(t.node - ref[i-1], t.dist + i - 1))\n break\n }\n }\n for (ns in states) {\n if (D.getOrDefault(ns.node, 1000000000) > ns.dist) {\n D.compute(ns.node) { _, _ -> ns.dist }\n queue.add(ns)\n }\n }\n// for (s in intArrayOf(-1, 1)) {\n// for (i in 1..6) {\n// val ns = State(t.node + s * getOnes(i), t.dist + i)\n// if (ns.node >= 0 && D.getOrDefault(ns.node, 1000000000) > ns.dist) {\n// D.compute(ns.node) { _, _ -> ns.dist }\n// queue.add(ns)\n// }\n// }\n// }\n }\n return D[0]!!\n}\n\nfun main() {\n\n val N = readLong()\n println(BF(N))\n// println(BF(1763283723286323L))\n// for ((k, v) in bfs().withIndex().take(1000)) {\n// println(\"${k} ${v == BF(k.toLong())}\")\n// }\n\n}"}, {"source_code": "import kotlin.math.abs\nimport kotlin.math.min\n\nfun solve(num: Long): Int {\n if (num == 0L) {\n return 0\n }\n val len = num.toString().length\n val a = \"1\".repeat(len).toLong()\n val b = \"1\".repeat(len +1).toLong()\n val diffA = abs(a - num)\n val diffB = abs(b - num)\n return if (diffA > diffB) {\n min(\n solve(abs(num - a)) + a.toString().length,\n solve(abs(num - b)) + b.toString().length)\n } else {\n solve(abs(num - a)) + a.toString().length\n }\n\n}\n\nfun readNumsLine(): List {\n return readLine()!!.split(\"\\\\s\".toRegex()).map { it.toLong() }\n}\n\nfun main() {\n val (num) = readNumsLine()\n\n println(solve(num))\n}\n"}, {"source_code": "import kotlin.math.min\n \nfun main() {\n \n fun calculate(n: Long, s: Long, l: Long): Long {\n if (n < 0) return calculate(-n, s, l)\n if (n == 0L) return 0L\n if (s == 0L) return n\n val q = n / s\n return min(calculate(n - q * s, s / 10, l - 1) + l * q, calculate(n - (q + 1) * s, s / 10, l - 1) + l * (q + 1))\n }\n \n readLine()?.let {\n val n = it.toLong()\n println(calculate(n, 1111111111111111, 16))\n }\n}"}, {"source_code": "// kotlin tips b/c I'm bad\n\n/** useful links\n * https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html\n * https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-array-list/index.html\n * https://kotlinlang.org/docs/reference/ranges.html\n */\n\n/** valid ways to sort (don't use quicksort ...)\n * 1\n * val a = nextLongs().sorted() // a is mutable list\n * 2\n * val a = arrayListOf()\n * a.addAll(nextLongs())\n * a.sort()\n */\n\n/** declare 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\n/** printing variables:\n * println(\"${l+1} and $r\")\n * evidently print has high constant factor\n * print stringbuilder instead?\n */\n\n// ArrayList to Array: toArray\n\n// IntArray with size:\n// val arr = IntArray(1 shl 20, { 1 })\n\n// lower bound: use binary search\n// https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/binary-search.html\n\n// if/switch\n// https://kotlinlang.org/docs/reference/control-flow.html\n\n// swap:\n// https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/also.html\n// a = b.also { b = a }\n\n/** comparing pairs\n * val ed = ArrayList>>()\n ed.sortBy {it.first}\n * class CustomComparator : Comparator>> {\n override fun compare(o1: Pair>, o2: Pair>): Int {\n return o1.first.compareTo(o2.first)\n }\n }\n val v = ed.sortedWith(CustomComparator())\n *\n val v = ArrayList>()\n for (t in a) v.add(Pair(cat(t),t))\n val z = v.sortedWith(compareBy({ -it.first }, { it.second }))\n */\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\nimport java.util.*\n\nval MX = 1000005\nval MOD = 998244353\nval SZ = 1 shl 19\nval INF = (1e18).toLong()\n\nfun add(a: Int, b: Int) = (a + b) % MOD\nfun sub(a: Int, b: Int) = (a - b + MOD) % MOD\nfun mul(a: Int, b: Int) = ((a.toLong() * b) % MOD).toInt()\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 ad(res: HashMap, key: Long, value: Long) {\n if (!(key in res)) res.put(key,1e18.toLong())\n res.put(key,minOf(res.get(key)!!,value))\n}\n\nfun adjust(cur: HashMap, len: Int) : HashMap {\n var prod: Long = 1\n for (t in 1..len) prod *= 10\n prod = (prod-1)/9\n\n val res = HashMap()\n for ((key,value) in cur) {\n assert(key >= 0)\n val quo = key/prod\n ad(res,key-quo*prod,value+quo*len)\n ad(res,(quo+1)*prod-key,value+(quo+1)*len)\n }\n return res\n}\n\nfun solve() {\n val n = nextLong()\n var cur = HashMap()\n cur.put(n,0)\n for (i in 16 downTo 1) {\n cur = adjust(cur,i)\n // println(prod)\n }\n print(cur.get(0))\n}\n\nfun main(args: Array) {\n val T = 1\n for (i in 1..T) solve()\n}"}, {"source_code": "import java.util.*\n\n\nvar long_array = LongArray(18)\nvar res:Long = 100000000000000000L\nfun func(n_now: Long, index: Int, total: Long) {\n if (index == 0) {\n if (res > total) res = total\n return\n }\n if (n_now >= 0) {\n func(n_now - n_now / long_array[index] * long_array[index], index - 1, total + n_now / long_array[index] * index)\n func(n_now - (n_now / long_array[index] + 1) * long_array[index], index - 1, total + (n_now / long_array[index] + 1) * index)\n } else {\n func(n_now + -n_now / long_array[index] * long_array[index], index - 1, total + -n_now / long_array[index] * index)\n func(n_now + (-n_now / long_array[index] + 1) * long_array[index], index - 1, total + (-n_now / long_array[index] + 1) * index)\n }\n}\n\nfun main(args: Array) {\n long_array[1] = 1\n for (i in 2..16)\n long_array[i] = long_array[i - 1] * 10 + 1\n val input = Scanner(System.`in`)\n var n = input.nextLong()\n func(n, 16, 0)\n System.out.print(res)\n input.close();\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.*\nimport kotlin.math.*\n\nprivate fun readLn() = readLine()!! // string\nprivate fun readInt() = readLn().toInt() // int\nprivate fun readStrings() = readLn().split(\" \") // string string\nprivate fun readInts() = readStrings().map { it.toInt() } // int int\n\n// tut\n\nvar a1 = Array(17){0L}\n\nfun dfs(n: Long, p: Int) : Long{\n var t = n / a1[p]\n return t * p + if (n%a1[p] != 0L) min(p + dfs(a1[p] - n%a1[p], p - 1), dfs(n%a1[p], p - 1)) else 0\n}\n\nfun main() {\n for (i in 1..16)\n a1[i] = a1[i - 1] * 10 + 1\n var n = readLn().toLong()\n System.out.print(dfs(n, 16))\n}\n"}, {"source_code": "import kotlin.math.abs\nimport kotlin.math.min\n\nfun sol(n: Long, index: Int, ones: MutableList) : Long {\n if(index == 0)\n return n\n\n val division = n / ones[index]\n val debug = division + 1\n\n return min(division * (index + 1) + sol(abs(n - division * ones[index]), index - 1, ones),\n debug * (index + 1) + sol(abs(n - debug * ones[index]), index - 1, ones))\n}\n\nfun main() {\n val n = readLine()!!.toLong()\n\n val ones = mutableListOf(1)\n for(i in 1 until 16)\n ones.add(ones[i-1] * 10 + 1)\n\n println(sol(n, 15, ones))\n\n}"}, {"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 ints\n\nfun dfs(x : Long, d : Long, len : Int):Int {\n if (d==1L) return maxOf(x,-x).toInt()\n if (x==0L) return 0\n if (x>0) {\n var c=(x/d).toInt()\n var xx=x-c*d\n return minOf(dfs(xx,d/10,len-1)+c*len,dfs(xx-d,d/10,len-1)+(c+1)*len)\n } else {\n var c=((-x)/d).toInt()\n var xx=x+c*d\n return minOf(dfs(xx,d/10,len-1)+c*len,dfs(xx+d,d/10,len-1)+(c+1)*len)\n }\n}\n\nfun main() {\n var x=readLn().toLong()\n println(dfs(x,1111111111111111L,16));\n}"}, {"source_code": "\nimport java.lang.Math.min\nimport java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextLong()\n println(solve(n))\n}\n\nfun solve(x:Long):Int\n{\n if(x==0L)return 0\n var n=0\n var num=0L\n while(true)\n {\n if(num*10+1>x)break\n n+=1\n num*=10\n num+=1\n }\n var x2=x\n var tmp=0\n while(x2>=num)\n {\n x2-=num\n tmp+=n\n }\n var ans=solve(x2)+tmp\n x2=(num*10+1)-x\n tmp=n+1\n while(x2>=num)\n {\n x2-=num\n tmp+=n\n }\n ans=min(ans,solve(x2)+tmp)\n return ans\n}\n"}, {"source_code": "import java.util.*\nimport kotlin.math.*\n\nprivate fun readString() = readLine()!! // string line\nprivate fun readInt() = readString().toInt() // single int\nprivate fun readLong() = readString().toLong()\nprivate fun readStrings() = readString().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\nvar p = arrayOf()\nvar F = HashMap()\n\nfun solve(n: Long) : Long\n{\n if (n == 0L) return 0\n if (F.containsKey(n)) return F.get(n)!!\n \n var len = 0\n var x = n\n while (x > 0)\n {\n x /= 10\n len ++\n }\n \n var ret = n\n if (abs(n-p[len-1]) < n) ret = minOf(ret, len+solve(abs(n-p[len-1])))\n if (abs(n-p[len]) < n) ret = minOf(ret, len+1+solve(abs(n-p[len])))\n \n F.put(n, ret)\n return ret\n}\n\nfun main(args: Array)\n{\n var cur = 0L\n for (i in 0..16)\n {\n cur = cur*10+1\n p += cur\n }\n var n = readLong()\n var ret = solve(n)\n println(ret)\n}"}, {"source_code": "import kotlin.math.min\n\nprivate fun readInt() = readLine()!!.toInt()\nprivate fun readLong() = readLine()!!.toLong()\nprivate fun readIntList() = readLine()!!.split(\" \").map { it.toInt() }\nprivate fun readLongList() = readLine()!!.split(\" \").map { it.toLong() }\nprivate fun readString() = readLine()!!\n\nconst val maxl = 16\nconst val NEG = 1\nconst val ZERO = 0\nconst val POS = 2\n\nval mask = IntArray(maxl)\nvar bestAns = Long.MAX_VALUE\nval ONES = (0..maxl).map { createOnes(it) }\n\nfun createMask(pos: Int, initialN:Long, prevNonZeroId:Int = -1, initialAns:Long = 0) {\n if (pos == maxl) {\n if (initialN == 0L) {\n bestAns = min(bestAns, initialAns)\n }\n } else if (initialAns < bestAns) {\n val curTerm = ONES[maxl - pos]\n\n for (maskValue in 0..2) {\n var ok = true\n var curN = initialN\n var curAns = initialAns\n mask[pos] = maskValue\n\n var nextNonZeroId = prevNonZeroId\n\n when (mask[pos]) {\n POS -> {\n if (prevNonZeroId != -1 && curN < 0 && mask[prevNonZeroId] == NEG) {\n curN += ONES[maxl - prevNonZeroId]\n curAns += maxl - prevNonZeroId\n } else if (curN < 0) {\n ok = false\n }\n val toAdd = curN / curTerm\n curAns += (maxl - pos) * toAdd\n curN -= curTerm * toAdd\n nextNonZeroId = pos\n }\n NEG -> {\n if (prevNonZeroId != -1 && curN > 0 && mask[prevNonZeroId] == POS) {\n curN -= ONES[maxl - prevNonZeroId]\n curAns += maxl - prevNonZeroId\n } else if (curN > 0) {\n ok = false\n }\n val toAdd = curN / curTerm\n if (toAdd < 0) {\n curAns += (maxl - pos) * (-toAdd)\n curN += curTerm * (-toAdd)\n }\n nextNonZeroId = pos\n }\n }\n\n if (ok) {\n createMask(pos + 1, initialAns = curAns, initialN = curN, prevNonZeroId = nextNonZeroId)\n }\n }\n }\n}\n\nfun createOnes(n:Int): Long {\n var ans = 0L\n repeat(n) {\n ans = ans * 10 + 1\n }\n return ans\n}\n\nfun main() {\n val n = readLong()\n\n createMask(0, n)\n println(bestAns)\n}"}, {"source_code": "import java.io.*\nimport java.util.*\nimport java.lang.Math.*\nimport kotlin.collections.ArrayList\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 var n = nextLong()\n val ps = LongArray(16)\n ps[0] = 1\n for (i in 1 until ps.size) {\n ps[i] = ps[i - 1] * 10 + 1\n }\n\n var ans = 1e9.toInt()\n\n fun go(i: Int, s: Long, ca: Int, n: Long) {\n if (s == n) {\n ans = min(ans, ca)\n }\n if (i == -1 || s - 9 * ps[i] > n || s + 9 * ps[i] < n) {\n return\n }\n\n for (j in -9 .. 9) {\n go(i - 1, s + ps[i] * j, ca + abs(j) * (i + 1), n)\n }\n }\n\n go(15, 0, 0, n)\n\n print(ans)\n}"}, {"source_code": "import kotlin.math.min\n\nprivate fun next(r: Long): Long {\n return r * 10L + 1\n}\n\nprivate fun solve(value: Long): Int {\n if (value == 0L) return 0\n var count = 1\n var r = 1L\n if (r == value) return count\n while (next(r) < value) {\n r = next(r)\n ++count\n }\n var mult = 1\n while ((mult + 1L) * r <= value) ++mult\n\n var result = solve(value - mult * r) + count * mult\n if (next(r) - value < value) {\n // try 111..11 - ab..f\n result = min(result, solve(next(r) - value) + count + 1)\n }\n return result\n}\n\nfun main() {\n val n = readLine()!!.trim().toLong()\n println(solve(n))\n}\n"}, {"source_code": "import kotlin.math.sign\n\nfun main() {\n val n = readLine()!!\n println(oneBasedArithmetic(n, 0))\n}\n\nfun oneBasedArithmetic(string: String, count: Int): Int {\n val length = if (string[0] == '-') string.length - 1 else string.length\n val count1 = withNOnes(string, count, length)\n val count2 = withNPlus1Ones(string, count)\n return if (count1 < count2) count1 else count2\n}\n\nfun withNOnes(string: String, count: Int, length: Int): Int {\n val n = if (string[0] == '-') string.length - 1 else string.length\n val num = string.toLong()\n val nOnes = \"1\".repeat(n).toLong()\n return when {\n n < length -> oneBasedArithmetic(string, count)\n n > length -> Int.MAX_VALUE\n num == 0L -> count\n num == -1L -> count + 1\n num == 1L -> count + 1\n num < 0L -> {\n val rem = (num % nOnes).toString()\n val quotient = num / nOnes\n if (quotient == 0L && rem.length == n+1){\n withNOnes((num + nOnes).toString(), count + n, n)\n }else\n oneBasedArithmetic(rem, count + (n * quotient.unaryMinus()).toInt())\n }\n else -> {\n val rem = (num % nOnes).toString()\n val quotient = num / nOnes\n if (quotient == 0L && rem.length == n){\n withNOnes((num - nOnes).toString(), count + n, n)\n }else\n oneBasedArithmetic(rem, count + (n * quotient).toInt())\n }\n }\n}\n\n\nfun withNPlus1Ones(string: String, count: Int): Int {\n val n = if (string[0] == '-') string.length - 1 else string.length\n val num = string.toLong()\n val nOnes = \"1\".repeat(n + 1).toLong()\n return when {\n num < 0L -> withNOnes((num + nOnes).toString(), count + n + 1, n)\n else -> withNOnes((nOnes - num).toString(), count + n + 1, n)\n }\n}"}, {"source_code": "import kotlin.math.sign\n\nfun main() {\n val n = readLine()!!\n println(oneBasedArithmetic(n, 0))\n}\n\nfun oneBasedArithmetic(string: String, count: Int): Int {\n if (count == -1) return -1\n val length = if (string[0] == '-') string.length - 1 else string.length\n val count1 = withNOnes(string, count, length)\n val count2 = withNPlus1Ones(string, count)\n return if (count1 < count2) count1 else count2\n}\n\nfun withNOnes(string: String, count: Int, length: Int): Int {\n// val n = string.replace(\"-\",\"\").length\n// var count1 = count\n// var num = string.toInt()\n// val nOnes = \"1\".repeat(n).toInt()\n// var length = n\n// while (length == n) {\n// when {\n// num < 0 -> {\n// num += nOnes\n// count1 += n\n// length = num.toString().replace(\"-\", \"\").length\n// }\n// num == 0 -> return count1\n// num > 0 -> {\n// count1 += n\n// num -= nOnes\n// length = num.toString().replace(\"-\", \"\").length\n// }\n// }\n// }\n// return if (length < n)\n// oneBasedArithmetic(num.toString(), count1)\n// else -1\n val n = if (string[0] == '-') string.length - 1 else string.length\n val num = string.toLong()\n val nOnes = \"1\".repeat(n).toLong()\n return when {\n n < length -> oneBasedArithmetic(string,count)\n n > length -> Int.MAX_VALUE\n num == 0L -> count\n num == -1L -> count + 1\n num == 1L -> count + 1\n num < 0L -> withNOnes((num + nOnes).toString(), count + n, length)\n else -> withNOnes((num - nOnes).toString(), count + n, length)\n }\n}\n\nfun withNPlus1Ones(string: String, count: Int): Int {\n// val n = string.replace(\"-\",\"\").length\n// var count1 = count\n// var num = string.toInt()\n// val nOnesPlusOne = \"1\".repeat(n + 1).toInt()\n// var length = n\n// while (length == n) {\n// when {\n// num < 0 -> {\n// num += nOnesPlusOne\n// count1 += n\n// length = num.toString().replace(\"-\", \"\").length\n// }\n// num == 0 -> return count\n// num > 0 -> {\n// count1 += n\n// num = nOnesPlusOne - num\n// length = num.toString().replace(\"-\", \"\").length\n// }\n// }\n// }\n// return if (length < n)\n// oneBasedArithmetic(num.toString(), count1)\n// else -1\n val n = if (string[0] == '-') string.length - 1 else string.length\n val num = string.toLong()\n val nOnes = \"1\".repeat(n + 1).toLong()\n return when {\n num < 0L -> withNOnes((num + nOnes).toString(), count + n + 1, n)\n else -> withNOnes((nOnes - num).toString(), count + n + 1, n)\n }\n}"}, {"source_code": "import kotlin.math.min\n\nfun main() {\n val i = readLine()!!\n val count = 0L\n println(min(findEqualDigits(i, count), findGreaterDigits(i, count)))\n}\n\nfun findEqualDigits(\n Number: String,\n count: Long\n): Long {\n when {\n (Number.toLong() == -1L) -> return count + 1L\n (Number.toLong() == 1L) -> return count + 1L\n (Number.toLong() == 0L) -> return count\n }\n val num = if (Number.startsWith(\"-\")) Number.drop(1) else Number\n val digits = num.length\n val number = \"1\".repeat(digits).toLong()\n val quotient = num.toLong() / number\n val updatedNumber = num.toLong() % number\n val onesCount = count.plus(quotient * digits)\n// val updatedNumber=num.toLong()- number\n if (quotient == 0L && updatedNumber.toString().length == digits) {\n val number1 = updatedNumber - number\n val subCount = onesCount + digits\n return min(findEqualDigits(number1.toString(), subCount),\n findGreaterDigits(number1.toString(),subCount))\n }\n else\n {\n return when {\n (updatedNumber == -1L) -> onesCount + 1L\n (updatedNumber == 1L) -> onesCount + 1L\n (updatedNumber == 0L) -> onesCount\n else ->\n min(\n findEqualDigits(updatedNumber.toString(), onesCount)\n , findGreaterDigits(updatedNumber.toString(), onesCount)\n )\n }\n }\n}\n\nfun findGreaterDigits(\n Number: String,\n count: Long\n): Long {\n val num = if (Number.startsWith(\"-\")) Number.drop(1) else Number\n val digits = num.length\n val number = \"1\".repeat(digits + 1)\n val updatedNumber = number.toLong() - num.toLong()\n return if (digits < updatedNumber.toString().length)\n Long.MAX_VALUE\n else\n findEqualDigits(updatedNumber.toString(), count.plus(digits + 1))\n\n}\n"}, {"source_code": "import java.util.*\n\nfun main() {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n val Z = LongArray(20)\n Z[1] = 1\n for (i in 2 until Z.size) {\n Z[i] = Z[i - 1] * 10 + 1\n }\n var res = Long.MAX_VALUE\n for (len in 1..17) {\n for (m in 0..(1 shl len)) {\n var cur = 0L\n var cnt = 0L\n for (i in len downTo 1) {\n val overflow = (m and (1 shl i)) != 0\n if (cur < n) {\n val am = (n - cur) / Z[i]\n cur += Z[i] * am\n cnt += i * am\n if (overflow && cur < n) {\n cur += Z[i]\n cnt += i\n }\n } else if (cur > n) {\n val am = (cur - n) / Z[i]\n cur -= Z[i] * am\n cnt += i * am\n if (overflow && cur > n) {\n cur -= Z[i]\n cnt += i\n }\n }\n }\n if (cur == n)\n res = minOf(res, cnt)\n }\n }\n println(res)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\n\nval inf = BufferedReader(InputStreamReader(System.`in`))\nval ouf = PrintWriter(System.out)\n\nfun BufferedReader.readInts() = readLine()!!.split(' ').map(String::toInt)\nfun BufferedReader.readLongs() = readLine()!!.split(' ').map(String::toLong)\nfun Any?.println() = ouf.println(this)\n\nfun main() {\n val (n) = inf.readLongs()\n var q = 1L\n var qq = 1\n while (q <= n) {\n q = q * 10 + 1\n qq++\n }\n\n fun f(n: Long, q: Long, qq: Int): Int {\n if (n % q == 0L) return (n / q).toInt() * qq\n val d = (n / q).toInt()\n return minOf(qq * d + f(n - q * d, q / 10, qq - 1), qq * (d + 1) + f(q * (d + 1) - n, q / 10, qq - 1))\n }\n\n ouf.println(minOf(f(n, q / 10, qq - 1), f(q - n, q / 10, qq - 1) + qq))\n ouf.close()\n}\n"}, {"source_code": "import java.util.*\n\n\nvar a = LongArray(18)\nvar res = 1000000000000000000L\nfun dfs(n_now: Long, pre: Int, total: Long) {\n if (pre == 0) {\n if (res > total) res = total\n return\n }\n if (n_now >= 0) {\n dfs(n_now - n_now / a[pre] * a[pre], pre - 1, total + n_now / a[pre] * pre)\n dfs(n_now - (n_now / a[pre] + 1) * a[pre], pre - 1, total + (n_now / a[pre] + 1) * pre)\n } else {\n dfs(n_now + -n_now / a[pre] * a[pre], pre - 1, total + -n_now / a[pre] * pre)\n dfs(n_now + (-n_now / a[pre] + 1) * a[pre], pre - 1, total + (-n_now / a[pre] + 1) * pre)\n }\n}\n\nfun main(args: Array) {\n a[1] = 1\n for (i in 2..16)\n a[i] = a[i - 1] * 10 + 1\n val cin = Scanner(System.`in`)\n var n = cin.nextLong()\n dfs(n, 16, 0)\n System.out.print(res)\n}"}, {"source_code": "import java.util.*\n\n\nvar a = LongArray(18)\nvar MIN = 100000000000000000L\nfun dfs(n: Long, now: Int, tot: Long) {\n if (now == 0) {\n if (MIN > tot) MIN = tot\n return\n }\n if (n >= 0) {\n val temp = n / a[now]\n dfs(n - temp * a[now], now - 1, tot + temp * now)\n dfs(n - (temp + 1) * a[now], now - 1, tot + (temp + 1) * now)\n } else {\n val temp = -n / a[now]\n dfs(n + temp * a[now], now - 1, tot + temp * now)\n dfs(n + (temp + 1) * a[now], now - 1, tot + (temp + 1) * now)\n }\n}\n\nfun main(args: Array) {\n a[1] = 1\n for (i in 2..16) a[i] = a[i - 1] * 10 + 1\n val cin = Scanner(System.`in`)\n val n = cin.nextLong()\n dfs(n, 16, 0)\n println(MIN)\n cin.close()\n}"}, {"source_code": "//package com.company\n\nimport java.util.*\nimport kotlin.math.min\n\nvar vec : MutableList < Long > = mutableListOf()\n\nfun main() {\n vec.add(0);\n\n for(i in 1..16)\n vec.add(vec.elementAt(i - 1) * 10 + 1)\n var sc = Scanner(System.`in`)\n var n = sc.nextLong()\n\n var res = func(n , vec.size - 1)\n println(res)\n}\n\nfun func(n : Long, i : Int): Long {\n var ret = n / vec.elementAt(i)\n var N = n % vec.elementAt(i)\n\n when {\n n.toString() == \"0\" || N.toString() == \"0\" -> return ret * i\n else -> return ret * i + min(i + func(vec.elementAt(i) - N , i - 1) , func(N , i - 1))\n }\n}"}, {"source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\n\nfun main() {\n val n0 = readLong()\n\n val M = LongArray(17)\n for(i in 1 until M.size) M[i] = M[i-1] * 10 + 1\n\n var D = hashMapOf(n0 to 0)\n\n for(k in M.size-2 downTo 1) {\n if(M[k] > n0) continue\n\n val Dk = HashMap()\n\n for((n, c) in D) {\n Dk.checkMin(n % M[k], c + (n / M[k] * k).toInt())\n val n1 = M[k+1] - n\n Dk.checkMin(n1 % M[k], c + k + 1 + (n1 / M[k] * k).toInt())\n }\n\n D = Dk\n }\n\n val ans = D[0]\n\n println(ans)\n}\n\nfun HashMap.checkMin(k: K, v: Int) { if(!containsKey(k) || v < get(k)!!) put(k, v) }\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"}, {"source_code": "import java.util.*\n\nfun main() {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n val Z = LongArray(20)\n Z[1] = 1\n for (i in 2 until Z.size) {\n Z[i] = Z[i - 1] * 10 + 1\n }\n var res = Long.MAX_VALUE\n for (len in 1..17) {\n for (m in 0..(1 shl len)) {\n var cur = 0L\n var cnt = 0L\n for (i in len downTo 1) {\n val overflow = (m and (1 shl i)) != 0\n if (cur < n) {\n val am = (n - cur) / Z[i]\n cur += Z[i] * am\n cnt += i * am\n if (overflow && cur < n) {\n cur += Z[i]\n cnt += i\n }\n } else if (cur > n) {\n val am = (cur - n) / Z[i]\n cur -= Z[i] * am\n cnt += i * am\n if (overflow && cur > n) {\n cur -= Z[i]\n cnt += i\n }\n }\n }\n if (cur == n)\n res = minOf(res, cnt)\n }\n }\n println(res)\n}"}, {"source_code": "private fun spar() = readLine()!! // string line\nprivate fun ipar() = spar().toInt() // single int\nprivate fun lpar() = spar().toLong() // single long\nprivate fun sapar() = spar().split(\" \") // list of strings\nprivate fun iapar() = sapar().map { it.toInt() } // list of ints\nprivate fun lapar() = sapar().map { it.toLong() } // list of longs\n\nfun main()\n{\n val n = lpar()\n println(brute(n))\n}\n\nprivate fun brute(n: Long): Int\n{\n if (n <= 6)\n {\n return n.toInt()\n }\n if (n >= 7 && n <= 11)\n {\n return 13-n.toInt()\n }\n var l = 1\n while (ones(l) < n)\n {\n l++\n }\n l--\n val a = n % ones(l)\n val res1 = (n / ones(l)) * l + brute(a)\n val b = (ones(l+1) - n) % ones(l)\n val res2 = l+1 + ((ones(l+1) - n) / ones(l)) * l + brute(b)\n // println(arrayOf(n, a, b, Math.min(res1, res2)).joinToString(\", \"))\n return Math.min(res1, res2).toInt()\n}\n\nprivate fun ones(l: Int): Long\n{\n return Math.pow(10.0, l.toDouble()).toLong() / 9\n}"}, {"source_code": "import java.lang.Integer.parseInt\nimport java.lang.Long.parseLong\nimport java.lang.Math.abs\nimport java.lang.Math.min\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 F {\n\n internal val ones = LongArray(17)\n internal val total = LongArray(17)\n\n internal var `in`: BufferedReader? = null\n internal var out: PrintWriter? = null\n internal var tok: StringTokenizer? = null\n\n init {\n for (i in 1 until ones.size) {\n ones[i] = 10 * ones[i - 1] + 1\n total[i] = total[i - 1] + 6 * ones[i]\n }\n }\n\n internal fun solve(n: Long, i: Int): Int {\n if (n > total[i] || n < -total[i]) {\n return -1\n }\n if (i == 0) {\n return 0\n }\n var ans = Integer.MAX_VALUE\n for (j in -6..6) {\n val cans = solve(n + j * ones[i], i - 1)\n if (cans >= 0) {\n ans = min(ans, cans + abs(j) * i)\n }\n }\n return if (ans == Integer.MAX_VALUE) -1 else ans\n }\n\n @Throws(Exception::class)\n internal fun solve() {\n val n = scanLong()\n out!!.print(solve(n, 16))\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}\n\nfun main(args: Array) {\n F.main(args)\n}"}, {"source_code": "import java.util.*\n\nvar a = Array(17, {i -> 0L})\nfun ans(n: Long): Long\n{\n if (n == 0L)\n return 0L;\n var k = 1\n while (k < 16)\n {\n if (a[k] <= n && n <= a[k + 1])\n {\n var x = k * (n / a[k]) + ans(n - a[k] * (n / a[k]))\n var y = k + 1 + (a[k + 1] - n) / a[k] * k + ans(a[k + 1] - n - (a[k + 1] - n) / a[k] * a[k])\n return if (x < y) x else y\n }\n ++k;\n }\n return 1000000000\n}\n\nfun main()\n{\n for (i in 1..16)\n a[i] = a[i - 1] * 10L + 1L\n var n = readLine()!!.toLong()\n print(ans(n))\n}"}, {"source_code": "import kotlin.math.*\n \nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n \nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n \nfun get1(_l:Int):Long{\n var n = _l\n if (n == 0)\n return 1\n var ret = 1L\n while(n > 1)\n {\n ret=1 + ret * 10\n n--\n }\n return ret\n}\n \n \nfun main() {\n val n =readLong()\n val res = getCount(n, getLength(n) + 1 )\n // println(res)\n println(get1Count(res))\n}\n \nfun get1Count(lst:List):Int\n{\n var ret = 0\n for(i in 0 until lst.size)\n { \n val item = lst[i]\n ret+=(i+1)*item.absoluteValue\n }\n return ret\n}\n \nfun getCount(_n:Long, _l:Int):MutableList\n{ \n if (_n ==0L && _l ==0)\n return mutableListOf()\n \n var n =if (_n> 0) _n else -_n\n \n val l = _l\n \n if (l == 1)\n { \n return mutableListOf(n.toInt()) \n }\n \n \n val l1 = get1(l)\n \n val bDigit = (n / l1).toInt() \n val tDigit = bDigit + 1\n \n val solb = getCount(n - l1 * bDigit, l - 1)\n val vb = get1Count(solb) + bDigit * l\n \n val solt = getCount(l1 * tDigit - n, l - 1) \n for (i in 0 until solt.size) {\n solt[i] = -solt[i]\n }\n val vt = get1Count(solt) + tDigit * l\n\n if (vb < vt)\n {\n solb.add(0)\n solb[l-1] = bDigit\n return solb\n }\n else\n {\n solt.add(0)\n solt[l-1] = tDigit\n return solt \n }\n\n \n}\n"}, {"source_code": "import java.util.*\n\n\nvar array__ = LongArray(18)\nvar res = 100000000000000000L\nfun fffffffffffffffffffff(n_now: Long, pre: Int, total: Long) {\n if (pre == 0) {\n if (res > total) res = total\n return\n }\n if (n_now >= 0) {\n fffffffffffffffffffff(n_now - n_now / array__[pre] * array__[pre], pre - 1, total + n_now / array__[pre] * pre)\n fffffffffffffffffffff(n_now - (n_now / array__[pre] + 1) * array__[pre], pre - 1, total + (n_now / array__[pre] + 1) * pre)\n } else {\n fffffffffffffffffffff(n_now + -n_now / array__[pre] * array__[pre], pre - 1, total + -n_now / array__[pre] * pre)\n fffffffffffffffffffff(n_now + (-n_now / array__[pre] + 1) * array__[pre], pre - 1, total + (-n_now / array__[pre] + 1) * pre)\n }\n}\n\nfun main(args: Array) {\n array__[1] = 1\n for (i in 2..16)\n array__[i] = array__[i - 1] * 10 + 1\n val cin = Scanner(System.`in`)\n var n = cin.nextLong()\n fffffffffffffffffffff(n, 16, 0)\n System.out.print(res)\n}"}, {"source_code": "// https://kotlinlang.org/docs/tutorials/competitive-programming.html\n// https://stackoverflow.com/questions/41283393/reading-console-input-in-kotlin\n\nimport java.io.*\nimport java.lang.Math.*\nimport java.util.*\n\nprivate fun readln() = readLine()!!\nprivate fun readlnByte() = readln().toByte()\nprivate fun readlnShort() = readln().toShort()\nprivate fun readlnInt() = readln().toInt()\nprivate fun readlnLong() = readln().toLong()\nprivate fun readlnFloat() = readln().toFloat()\nprivate fun readlnDouble() = readln().toDouble()\nprivate fun readlnBigInt(radix: Int = 10) = readln().toBigInteger(radix)\nprivate fun readlnBigDecimal() = readln().toBigDecimal()\n\nprivate fun lineSequence(limit: Int = Int.MAX_VALUE) = generateSequence { readLine() }.constrainOnce().take(limit)\nprivate fun readlnStrings() = readln().split(' ')\nprivate fun readlnBytes() = readlnStrings().map { it.toByte() }\nprivate fun readlnShorts() = readlnStrings().map { it.toShort() }\nprivate fun readlnInts() = readlnStrings().map { it.toInt() }\nprivate fun readlnLongs() = readlnStrings().map { it.toLong() }\nprivate fun readlnFloats() = readlnStrings().map { it.toFloat() }\nprivate fun readlnDoubles() = readlnStrings().map { it.toDouble() }\n\nprivate fun readByteArray() = readlnStrings().run { ByteArray(size) { get(it).toByte() } }\nprivate fun readShortArray() = readlnStrings().run { ShortArray(size) { get(it).toShort() } }\nprivate fun readIntArray() = readlnStrings().run { IntArray(size) { get(it).toInt() } }\nprivate fun readLongArray() = readlnStrings().run { LongArray(size) { get(it).toLong() } }\nprivate fun readFloatArray() = readlnStrings().run { FloatArray(size) { get(it).toFloat() } }\nprivate fun readDoubleArray() = readlnStrings().run { DoubleArray(size) { get(it).toDouble() } }\n\nprivate fun readlnByteArray(n: Int) = ByteArray(n) { readlnByte() }\nprivate fun readlnShortArray(n: Int) = ShortArray(n) { readlnShort() }\nprivate fun readlnIntArray(n: Int) = IntArray(n) { readlnInt() }\nprivate fun readlnLongArray(n: Int) = LongArray(n) { readlnLong() }\nprivate fun readlnFloatArray(n: Int) = FloatArray(n) { readlnFloat() }\nprivate fun readlnDoubleArray(n: Int) = DoubleArray(n) { readlnDouble() }\n\nprivate fun readByteArray2d(rows: Int, cols: Int) = Array(rows) { readByteArray().also { require(it.size == cols) } }\nprivate fun readShortArray2d(rows: Int, cols: Int) = Array(rows) { readShortArray().also { require(it.size == cols) } }\nprivate fun readLongArray2d(rows: Int, cols: Int) = Array(rows) { readLongArray().also { require(it.size == cols) } }\nprivate fun readIntArray2d(rows: Int, cols: Int) = Array(rows) { readIntArray().also { require(it.size == cols) } }\nprivate fun readFloatArray2d(rows: Int, cols: Int) = Array(rows) { readFloatArray().also { require(it.size == cols) } }\nprivate fun readDoubleArray2d(rows: Int, cols: Int) =\n Array(rows) { readDoubleArray().also { require(it.size == cols) } }\n\n\nprivate fun isWhiteSpace(c: Char) = c in \" \\r\\n\\t\"\n\n// JVM-only targeting code follows next\n\n// readString() via sequence is still slightly faster than Scanner\nprivate fun readString() = generateSequence { System.`in`.read().toChar() }\n .dropWhile { isWhiteSpace(it) }.takeWhile { !isWhiteSpace(it) }.joinToString(\"\")\n\nprivate fun readByte() = readString().toByte()\nprivate fun readShort() = readString().toShort()\nprivate fun readInt() = readString().toInt()\nprivate fun readLong() = readString().toLong()\nprivate fun readFloat() = readString().toFloat()\nprivate fun readDouble() = readString().toDouble()\nprivate fun readBigInt(radix: Int = 10) = readString().toBigInteger(radix)\nprivate fun readBigDecimal() = readString().toBigDecimal()\n\nprivate fun readBytes(n: Int) = generateSequence { readByte() }.take(n)\nprivate fun readShorts(n: Int) = generateSequence { readShort() }.take(n)\nprivate fun readInts(n: Int) = generateSequence { readInt() }.take(n)\nprivate fun readLongs(n: Int) = generateSequence { readLong() }.take(n)\nprivate fun readFloats(n: Int) = generateSequence { readFloat() }.take(n)\nprivate fun readDoubles(n: Int) = generateSequence { readDouble() }.take(n)\n\nprivate fun printIntArray(a: IntArray) {\n println(a.joinToString(\", \"))\n}\n\nprivate fun printLongArray(a: LongArray) {\n println(a.joinToString(\", \"))\n}\n\nprivate fun printDoubleArray(a: DoubleArray) {\n println(a.joinToString(\", \"))\n}\n\nprivate fun printFloatArray(a: FloatArray) {\n println(a.joinToString(\", \"))\n}\n\nprivate fun printStringArray(a: Array) {\n println(a.joinToString(\", \"))\n}\n\nprivate fun main() {\n// test()\n// benchMark()\n val n = readlnLong()\n var ans = solve(n)\n println(ans)\n}\n\nprivate fun test() {\n var l=10000000L\n for (i in l*l*10-100..l*l*10) {\n// for (i in 1L..100L) {\n println(i)\n val b = dfs(i, getDigitCount(i) + 1, 0)\n val a = dfs1(i, getDigitCount(i) + 1, 0)\n if(a!=b){\n println(\"$i: $a $b\")\n }\n\n }\n}\n\nprivate fun benchMark() {\n var l=10000000L\n for (i in l*l*10-100..l*l*10) {\n cnt = 0\n println(\"$i: ${solve(i)} $cnt\")\n }\n}\nvar cnt:Int = 0\nprivate fun solve(n: Long): Int {\n var d = getDigitCount(n)\n return dfs1(n, d + 1, 0)\n}\n\nconst val MAX = 100000\nfun dfs(n: Long, d: Int, c: Int): Int {\n if (d == 0) {\n return if (n == 0L) c else MAX\n }\n var minC = Int.MAX_VALUE\n for (i in 0..9) {\n val addend = gen(i, d)\n minC = minC.coerceAtMost(dfs(n + addend, d - 1, c + d * i))\n minC = minC.coerceAtMost(dfs(n - addend, d - 1, c + d * i))\n }\n return minC\n}\n\nfun dfs1(n: Long, d: Int, c: Int): Int {\n cnt++\n if (d == 0) {\n return if (n == 0L) c else MAX\n }\n val hd = getHighestDigit(n)\n var minC = Int.MAX_VALUE\n val maxDiff = gen(1, d)\n for (i in 0..9) {\n val addend = gen(i, d)\n// if(addend <= n && n - addend < maxDiff){\n// minC = minC.coerceAtMost(dfs1(n - addend, d - 1, c + d * i))\n// }\n// else if(addend >= n && addend - n < maxDiff){\n// minC = minC.coerceAtMost(dfs1(addend - n, d - 1, c + d * i))\n// }\n if (kotlin.math.abs(n - addend) < maxDiff) {\n\n minC = minC.coerceAtMost(dfs1(kotlin.math.abs(n - addend), d - 1, c + d * i))\n }\n }\n return minC\n}\n\nprivate fun solve(n: String, c: Int): Int {\n val nn = n.toLong()\n if (nn == 0L) {\n return c\n }\n val d = n.length\n val lb = n.substring(0, 1).repeat(d).toLong()\n val ub = \"1\".repeat(d + 1).toLong()\n var minC = Int.MAX_VALUE\n val ex = solveIdenticalDigit(lb.toString())\n// println(\"${lb.toString()}: $ex\")\n if (lb > nn) {\n minC = minC.coerceAtMost(solve((lb - nn).toString(), c) + ex)\n } else {\n minC = minC.coerceAtMost(solve((lb - nn).toString(), c) + ex)\n }\n if (nn > ub / 2) {\n minC = minC.coerceAtMost(solve((ub - nn).toString(), c + d + 1))\n }\n// println(\"$n: $minC\")\n return minC\n}\n\nfun solveIdenticalDigit(n: String): Int {\n\n val nn = n.toLong()\n val d = n.length\n val digit = n.substring(0, 1).toInt()\n if (digit == 1) {\n return d\n }\n val ub = \"1\".repeat(d + 1).toLong()\n return if (nn > ub / 2) {\n (d * digit).coerceAtMost(d + 1 + solve((ub - nn).toString(), 0))\n } else {\n (d * digit)\n }\n\n}\n\nprivate fun gen(n: Int, k: Int): Long {\n var ret = 0L\n var i = 0\n while (i < k) {\n ret *= 10\n ret += n\n i++\n }\n return ret\n}\n\nprivate fun getDigitCount(n: Long): Int {\n var x = n\n var i = 0\n while (x != 0L) {\n x /= 10\n i++\n }\n return i\n}\n\nprivate fun getHighestDigit(n: Long): Int {\n var x = n\n while (x / 10 != 0L) {\n x /= 10\n }\n return x.toInt()\n}"}, {"source_code": "import java.util.*;\nimport java.lang.*;\n\nfun main(args:Array){\n\n\n var read = Scanner(System.`in`)\n println(min_ones(read.nextLong()));\n} \n\nfun min_ones(n:Long):Long{\n // println(n)\n if(n==0L){\n return 0;\n }\n var digits = 0*1L\n var temp = n;\n while(temp>0){\n temp/=10; digits++;\n }\n var p = 0L;\n for( i in 0 until digits){\n p *= 10\n p++\n }\n if(p<=n){\n var p2 = p*10 +1;\n var k = 0L\n var count = 0L\n while(k+p<=n){\n k += p;\n count += digits\n }\n var ans = min_ones(n-k)+count\n\n k = p2;\n count = digits+1;\n while(k-p>=n){\n k -= p;\n count += digits\n }\n ans = Math.min(ans , min_ones(k-n) + count);\n return ans\n }\n else{\n return min_ones(p-n)+digits;\n }\n}"}, {"source_code": " import java.util.*\n \n var a = arrayOf(0L, 1L, 11L, 111L, 1111L, 11111L, 111111L, 1111111L, 11111111L, 111111111L, 1111111111L, 11111111111L, 111111111111L, \n 1111111111111L, 11111111111111L, 111111111111111L,1111111111111111L)\n fun ans(n: Long): Long\n {\n if (n == 0L)\n return 0L;\n var k = 1\n while (k < 17)\n {\n if (a[k] <= n && n <= a[k + 1])\n {\n var x = k * (n / a[k]) + ans(n - a[k] * (n / a[k]))\n var y = k + 1 + (a[k + 1] - n) / a[k] * k + ans(a[k + 1] - n - (a[k + 1] - n) / a[k] * a[k])\n return if (x < y) x else y\n }\n ++k;\n }\n return 10000000000\n }\n \n fun main()\n {\n var n = readLine()!!.toLong()\n print(ans(n))\n }"}, {"source_code": "import kotlin.math.min\n\nfun main(args: Array) {\n val n = readLine()!!.toLong()\n println(f(n))\n}\n\nval ones = LongArray(16) { \"1\".repeat(it + 1).toLong() }\n\nprivate fun f(n: Long): Long {\n if (n == 0L) return 0\n val len = n.toString().length\n val number = ones[len - 1]\n val lower = n / number\n val n1 = n - lower * number\n val n2 = (lower + 1) * number - n\n val n3 = number * 10 + 1 - n\n var res = Long.MAX_VALUE\n if (n1 < n) {\n res = min(res, f(n1) + lower * len)\n }\n if (n3 < n) {\n res = min(res, f(n3) + len + 1)\n }\n if (n2 < n && (lower + 1) * len < res) {\n res = min(res, f(n2) + (lower + 1) * len)\n }\n return res\n}"}, {"source_code": "import kotlin.math.min\n\nfun foo(s : String) : Long {\n if (s == \"0\")\n return 0L;\n var p = true\n for (i in s)\n if(i != '1'){\n p = false\n break\n }\n if (p)\n return 1L * s.length\n var d = 0L\n for (i in s.indices)\n d = d * 10 + 1\n if (s.toLong() < d)\n d /= 10\n var q1 = foo((s.toLong() % d).toString()) + s.toLong() / d * s.length\n d = d * 10 + 1;\n var q2 = q1;\n if (s.toLong() > d / 2)\n q2 = foo(d.toString()) + foo((d - s.toLong()).toString())\n return min(q1, q2)\n}\nfun main(){\n var n = readLine().toString()\n println(foo(n))\n\n}\n"}, {"source_code": "import java.util.*\n \nfun main() {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n val Z = LongArray(20)\n Z[1] = 1\n for (i in 2 until Z.size) {\n Z[i] = Z[i - 1] * 10 + 1\n }\n var res = Long.MAX_VALUE\n for (len in 1..17) {\n for (m in 0..(1 shl len)) {\n var cur = 0L\n var cnt = 0L\n for (i in len downTo 1) {\n val overflow = (m and (1 shl i)) != 0\n if (cur < n) {\n val am = (n - cur) / Z[i]\n cur += Z[i] * am\n cnt += i * am\n if (overflow && cur < n) {\n cur += Z[i]\n cnt += i\n }\n } else if (cur > n) {\n val am = (cur - n) / Z[i]\n cur -= Z[i] * am\n cnt += i * am\n if (overflow && cur > n) {\n cur -= Z[i]\n cnt += i\n }\n }\n }\n if (cur == n)\n res = minOf(res, cnt)\n }\n }\n println(res)\n}"}, {"source_code": "import kotlin.math.absoluteValue\nimport kotlin.random.Random\n\n\nfun power(base: Long, exp: Int): Long {\n return when(exp){\n 0 -> 1L\n 1 -> base\n else -> power(base * base, exp / 2) * power(base, exp % 2)\n }\n}\nfun calMin(value: Long, digit: Int, base: Long): Long {\n return when(digit){\n 1 -> value.absoluteValue\n else -> {\n if (value >= 0) {\n val b = value / base\n (b..b + 1).map { calMin(value - it * base, digit - 1, base / 10) + digit * it.absoluteValue }.min()!!\n }else {\n val b = value / base\n (b - 1 .. b).map{calMin(value - it * base, digit - 1, base / 10) + digit * it.absoluteValue}.min()!!\n }\n }\n }\n}\nfun calMin2(value: Long, digit: Int, base: Long): Long {\n return when(digit){\n 1 -> value.absoluteValue\n else -> {\n (-10 .. 10).map{calMin(value - it * base, digit - 1, base / 10) + digit * it.absoluteValue}.min()!!\n }\n }\n}\nconst val digit = 15\nfun calMin(value: Long): Long = calMin(value, digit + 1, power(10L, digit + 1) / 9)\nfun calMin2(value: Long): Long = calMin2(value, digit + 1, power(10L, digit + 1) / 9)\nfun main(args: Array?): Unit {\n println(calMin(readLine()!!.trim().toLong()))\n}"}, {"source_code": "import java.util.*\n \n \nvar kkkkkkkkkkkkkkk = LongArray(18)\nvar aaaaaaaaaaaaa = 100000000000000000L\nfun mmmmmmmmmmm(tttttttttttttttttt: Long, now: Int, bbbbbbbbbbbb: Long) {\n if (now == 0) {\n if (aaaaaaaaaaaaa > bbbbbbbbbbbb) aaaaaaaaaaaaa = bbbbbbbbbbbb\n return\n }\n if (tttttttttttttttttt >= 0) {\n val zzzzzzzzzzzzzzzzz = tttttttttttttttttt / kkkkkkkkkkkkkkk[now]\n mmmmmmmmmmm(tttttttttttttttttt - zzzzzzzzzzzzzzzzz * kkkkkkkkkkkkkkk[now], now - 1, bbbbbbbbbbbb + zzzzzzzzzzzzzzzzz * now)\n mmmmmmmmmmm(tttttttttttttttttt - (zzzzzzzzzzzzzzzzz + 1) * kkkkkkkkkkkkkkk[now], now - 1, bbbbbbbbbbbb + (zzzzzzzzzzzzzzzzz + 1) * now)\n } else {\n val zzzzzzzzzzzzzzzzz = -tttttttttttttttttt / kkkkkkkkkkkkkkk[now]\n mmmmmmmmmmm(tttttttttttttttttt + zzzzzzzzzzzzzzzzz * kkkkkkkkkkkkkkk[now], now - 1, bbbbbbbbbbbb + zzzzzzzzzzzzzzzzz * now)\n mmmmmmmmmmm(tttttttttttttttttt + (zzzzzzzzzzzzzzzzz + 1) * kkkkkkkkkkkkkkk[now], now - 1, bbbbbbbbbbbb + (zzzzzzzzzzzzzzzzz + 1) * now)\n }\n}\n \nfun main(args: Array) {\n kkkkkkkkkkkkkkk[1] = 1\n for (ooooooooooooooo in 2..16) kkkkkkkkkkkkkkk[ooooooooooooooo] = kkkkkkkkkkkkkkk[ooooooooooooooo - 1] * 10 + 1\n val input = Scanner(System.`in`)\n val tttttttttttttttttt = input.nextLong()\n mmmmmmmmmmm(tttttttttttttttttt, 16, 0)\n println(aaaaaaaaaaaaa)\n input.close()\n}"}, {"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 size = IntArray(402){0}\n// var dp = Array(402, {IntArray(402)})\n// var adj = MutableList>(402) {_ -> mutableListOf()}\n// println(Arrays.toString(array))\n// println(Arrays.deepToString(array))\n// Pair\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(17, {Array(46, {Array(46, {Array(32, {1000000})})})})\nvar S = \"\"\n\nfun DP(at: Int, pos: Int, neg: Int, bc: Int): Int {\n if (at == 16) {\n if (bc == 0) return 0\n return 1000000\n }\n if (dp[at][pos][neg][bc + 16] != 1000000) {\n return dp[at][pos][neg][bc + 16]\n }\n dp[at][pos][neg][bc + 16] = 999999\n if (pos > 0) {\n var cur = DP(at, pos - 1, neg, bc)\n if (cur < dp[at][pos][neg][bc + 16]) dp[at][pos][neg][bc + 16] = cur\n }\n if (neg > 0) {\n var cur = DP(at, pos, neg - 1, bc)\n if (cur < dp[at][pos][neg][bc + 16]) dp[at][pos][neg][bc + 16] = cur\n }\n val now = bc + pos - neg\n var new_carry = 0\n if (now >= 0) new_carry = now / 10\n var new_borrow = 0\n if (now < 0) new_borrow = -((-now + 9) / 10)\n var last_degit = 0\n if (now >= 0) last_degit=now % 10\n else last_degit = (10 - (-now % 10)) % 10\n var expected = 0\n if (at < S.length) expected = (S[at] - '0').toInt()\n if (last_degit != expected) {\n return dp[at][pos][neg][bc + 16]\n }\n var cur = DP(at + 1, pos, neg, new_carry + new_borrow) + pos + neg\n if (cur < dp[at][pos][neg][bc + 16]) dp[at][pos][neg][bc + 16] = cur\n return dp[at][pos][neg][bc + 16]\n}\n\nfun main(args: Array) {\n S = readLn()\n S = S.reversed()\n var ans = 30000\n for (pos in 0..45) for (neg in 0..45) {\n val cur = DP(0, pos, neg, 0)\n if (cur < ans) ans = cur\n //if (cur == 224) println(\"$pos $neg\")\n }\n println(ans)\n}\n"}, {"source_code": "import java.io.*\nimport java.lang.Math.abs\nimport java.lang.Math.min\nimport java.util.*\nimport java.util.Arrays.sort\nimport kotlin.collections.HashMap\n\nval mem = HashMap()\nfun go(x: Long, pr: Long = Long.MAX_VALUE): Int{\n if (abs(pr) < abs(x)) return 1000000\n if (x == 0.toLong()) return 0\n if (mem.contains(x)) return mem[x]!!\n val n = abs(x).toString().length\n var s1 = \"\"\n var s2 = \"\"\n for (i in 1..n){\n s1 += \"1\"\n s2 += \"1\"\n }\n s2 += \"1\"\n var x1 = s1.toLong()\n var x2 = s2.toLong()\n if (x < 0){\n x1 *= -1\n x2 *= -1\n }\n val ans = min(go(x - x2, x) + n + 1, n + min(go(x - x1, x), go(x + x1, x)))\n mem[x] = ans\n return ans\n}\n\nfun main(args: Array){\n val x = readLine()!!.toLong()\n println(go(x))\n}"}, {"source_code": "import java.util.*\n \ninternal var ones = LongArray(17)\ninternal fun dfs(n: Long, i: Int): Long {\n var n = n\n val k = (n / ones[i]).toInt()\n n %= ones[i]\n val count = (k * i).toLong()\n return if (n == 0L)\n count\n else\n count + Math.min(i + dfs(ones[i] - n, i - 1), dfs(n, i - 1))\n}\n \nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val n = scan.nextLong()\n ones[0] = 0\n for (i in 1..16) {\n ones[i] = ones[i - 1] * 10 + 1\n }\n println(dfs(n, 16))\n}"}, {"source_code": "fun pow(a : Long, r : Int) : Long = if(r == 0) 1L else pow(a, r - 1) * a\nvar p = Array(17){i -> (pow(10L, i + 1) - 1) / 9}\nfun solve(n : Long, i : Int) : Int{\n var res = (n / p[i] * (i + 1)).toInt()\n var m = n % p[i]\n if(m == 0L) return res\n return res + minOf(i + 1 + solve(p[i] - m, i - 1), solve(m, i - 1))\n}\nfun main() {\n print(solve(readLine()!!.toLong(), 16))\n}"}, {"source_code": "\nfun pow(a : Long, r : Int) : Long = if(r == 0) 1L else pow(a, r - 1) * a\nvar p = Array(16){i -> (pow(10L, i + 1) - 1) / 9}\nfun solve(n : Long, i : Int) : Int{\n var res = (n / p[i] * (i + 1)).toInt()\n var m = n % p[i]\n if(m == 0L) return res\n return res + minOf(i + 1 + solve(p[i] - m, i - 1), solve(m, i - 1))\n}\nfun main() {\n print(solve(readLine()!!.toLong(), 15))\n}\n"}, {"source_code": "import java.io.*\nimport kotlin.math.*\nimport kotlin.collections.*\n\nfun main() = bufferOut { readSolveWrite() }\n\nprivate fun PrintWriter.readSolveWrite() {\n val n = readLine()!!.toLong()\n var degs = arrayListOf()\n degs.add(0L)\n degs.add(1L)\n for (i in 1..18)\n degs.add(degs[i] * 10L + 1L)\n\n fun rec(x: Long, d: Int): Long\n {\n val cur = abs(x)\n if (cur % degs[d] == 0L)\n return cur / degs[d] * d\n val k = cur / degs[d]\n val temp1 = (k * d + rec(cur - k * degs[d], d - 1))\n val temp2 = ((k + 1) * d + rec((k + 1) * degs[d] - cur, d - 1))\n return min(temp1, temp2)\n }\n println(rec(n, 18))\n}\n\nprivate fun ok(x: Boolean) = if (x) 1 else 0// {{{\n\nprivate fun getIntArray() = readLine()!!.splitToIntArray()\n\nprivate fun bufferOut(block: PrintWriter.() -> Unit) = PrintWriter(System.out).use { block(it) }\n\ndata class Pt(val x: Int, val y: Int, val i: Int, var ans: Int)\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 in 0..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"}, {"source_code": "import java.lang.Math.abs\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(args: Array) {\n var s = readLn().reversed() + \"000\"\n var len = s.length\n val MAX = 200\n var dp = Array(len + 1, { Array(2 * MAX, { IntArray(2 * MAX, { 12345 }) }) })\n dp[0][MAX][MAX] = 0\n for (i in 0..len - 1) {\n for (cur in -MAX..MAX-1) {\n for (carry in -MAX..MAX-1) {\n var ft = dp[i][cur + MAX][carry + MAX]\n if (ft == 12345) {\n continue\n }\n for (delta in -100..100) {\n var newCur = cur + delta\n var here = newCur + carry\n var value = (here % 10 + 10) % 10\n if (value != s[i] - '0') {\n continue\n }\n var newCarry = (here - value) / 10\n var newFt = ft + abs(delta) * i\n if (newCur >= -MAX && newCur < MAX && newCarry >= -MAX && newCarry < MAX && newFt < dp[i + 1][newCur + MAX][newCarry + MAX]) {\n dp[i + 1][newCur + MAX][newCarry + MAX] = newFt\n }\n }\n }\n }\n }\n println(dp[len][MAX][MAX])\n}"}, {"source_code": "import java.io.OutputStream\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.PrintWriter\nimport java.util.Scanner\nimport kotlin.math.min\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 solve(1, `in`, out)\n out.close()\n}\n\nfun lower(x: Long): Long {\n var ret: Long = 1\n while (x >= ret) {\n ret = ret * 10 + 1\n }\n ret = (ret - 1) / 10\n return ret\n}\n\nfun f(x: Long, y: Long): Long {\n if (x == 0L) return 0\n val l = lower(x)\n val u = l * 10 + 1\n var a = l.toString().length * 1L\n val b = a + 1\n a = x / l * a + f(x % l, l)\n if (u <= y) a = min(a, b + f(u - x, u - 1))\n return a\n}\n\nfun solve(testNumber: Int, `in`: Scanner, out: PrintWriter) {\n val n = `in`.nextLong()\n out.println(f(n, 1111111111111111L))\n}\n\n\n"}, {"source_code": "import kotlin.math.min\n \nfun f(n: Long, s: Long, l: Int): Long {\n if (s == 0L) return if (n == 0L) 0L else Long.MAX_VALUE / 2\n val q = n / s\n return min(f(n - q * s, s / 10, l - 1) + l * q, f((q + 1) * s - n, s / 10, l - 1) + l * (q + 1))\n}\n \nfun main() = println(f(readLine()!!.toLong(), 1111_1111_1111_1111L, 16))"}, {"source_code": "fun readLn(): String = readLine()!!\nfun readInt(): Int = readLn().toInt()\nfun readInts(): MutableList = readLn().split(\" \").map { it.toInt() }.toMutableList()\nfun readLong(): Long = readLn().toLong()\n\nval results = mutableMapOf(0L to 0L)\n\nfun preprocess() {\n val MAX = 1e17\n var x = 1L\n var ones = 1L\n while (x < MAX) {\n results[x] = ones\n x = 10 * x + 1\n ones++\n }\n}\n\nfun firstSmallerOnes(number: Long): Pair {\n var x = 1L\n var ones = 1L\n while (x < number) {\n x = 10 * x + 1\n ones++\n }\n x /= 10\n ones--\n return Pair(x, ones)\n}\n\nfun solve(number: Long): Long {\n if (number in results) return results[number]!!\n val (smallerOnes, ones) = firstSmallerOnes(number)\n\n val quotient = number / smallerOnes\n val remainder = number % smallerOnes\n var result = ones * quotient + solve(remainder)\n // println(\"$number $quotient $smallerOnes $remainder $result\")\n\n val largerOnes = smallerOnes * 10 + 1\n val ones1 = ones + 1\n val remainder2 = largerOnes - number\n if (remainder2 < number) {\n result = Math.min(ones1 + solve(remainder2), result)\n }\n\n results[number] = result\n return result\n}\n\nfun main(args: Array) {\n preprocess()\n val number = readLong()\n println(solve(number))\n}\n\n"}, {"source_code": "import kotlin.math.min\n\n//https://codeforces.com/contest/1212/problem/F\n\nfun main() {\n\n fun calculate(n: Long, s: Long, l: Long): Long {\n if (n < 0) return calculate(-n, s, l)\n if (n == 0L) return 0L\n if (s == 0L) return n\n val q = n / s\n return min(calculate(n - q * s, s / 10, l - 1) + l * q, calculate(n - (q + 1) * s, s / 10, l - 1) + l * (q + 1))\n }\n\n readLine()?.let {\n val n = it.toLong()\n println(calculate(n, 1111111111111111, 16))\n }\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.min\n\nvar oneList = mutableListOf(0)\nvar problemResult = Int.MAX_VALUE\n\nfun main() {\n val read = Scanner(System.`in`)\n var start = 0L\n for (i in 1..16) {\n start = start * 10 + 1\n oneList.add(start)\n }\n val n = read.nextLong()\n dfs(getLength(n) + 1, n, 0)\n println(problemResult)\n}\n\n\n\nfun dfs(length : Int, num : Long, ans : Int) {\n if (length == 0) {\n problemResult = min(problemResult, ans)\n return\n }\n if (ans > problemResult) {\n return\n }\n if (num == oneList[length]) {\n val times = num.div(oneList[length])\n val ansNow = ans + length * times.toInt()\n dfs(0, 0, ansNow)\n } else {\n val times = num.div(oneList[length])\n val numNow = num - times * oneList[length]\n val ansNow = ans + length * times.toInt()\n dfs(length - 1, numNow, ansNow)\n dfs(length - 1, oneList[length] - numNow, ansNow + length)\n }\n}\nfun getLength(num: Long) : Int {\n var a = num\n var result = 0\n while (a > 0) {\n a /= 10\n result++\n }\n return result\n}\n"}, {"source_code": "/* f */\n\nval f = Array(17) { 0L }\n\nfun dp(n: Long, w: Int): Long {\n val y = (n / f[w]) * w\n val nn = n % f[w]\n if (nn == 0L) return y\n return y + Math.min(dp(nn, w - 1), dp(f[w] - nn, w - 1) + w)\n}\n\nfun main(args: Array) {\n val n = readLine().toString().toLong()\n for (i in 1..16) {\n f[i] = f[i - 1] * 10L + 1L\n }\n print(dp(n, 16))\n}\n\n"}, {"source_code": "fun readLong() = readLine()!!.toLong()\n\nfun main() {\n val number = readLong()\n println(countOfOnesCached(number))\n// (1..10000).forEach {\n// println(\"$it->${countOfOnesCached(it.toLong())}\")\n// }\n}\n\nval cache = mutableMapOf()\nfun countOfOnesCached(number: Long): Int {\n return cache.computeIfAbsent(number, ::countOfOnes)\n}\n\nfun countOfOnes(number: Long): Int {\n val digitCount = number.toString().count()\n val firstDigit = number.toString().first().toString().toInt()\n return when {\n number == 0L -> 0\n number == generateNumber(1, digitCount) -> digitCount\n else -> {\n val results = mutableListOf()\n val a = generateNumber(firstDigit, digitCount)\n when {\n number == a -> {\n results += digitCount * firstDigit\n }\n number > a -> {\n results += digitCount * firstDigit + countOfOnesCached(number - a)\n if (firstDigit != 9) {\n val b = generateNumber(firstDigit + 1, digitCount)\n results += digitCount * (firstDigit + 1) + countOfOnesCached(b - number)\n }\n }\n number < a -> {\n results += digitCount * firstDigit + countOfOnesCached(a - number)\n if (firstDigit != 1) {\n val b = generateNumber(firstDigit - 1, digitCount)\n results += digitCount * (firstDigit - 1) + countOfOnesCached(number - b)\n }\n }\n }\n val c = generateNumber(1, digitCount + 1)\n val delta = c - number\n if (delta < number) {\n results += countOfOnesCached(c) + countOfOnesCached(delta)\n }\n results.min()!!\n }\n }\n}\n\nfun generateNumber(digit: Int, count: Int) = generateSequence(digit.toLong()) { it * 10 + digit }.take(count).last()"}, {"source_code": "fun rec(n: Long) : Int {\n if (n == 0L) {\n return 0\n }\n var ones = 1L\n var cnt = 1\n while (ones * 10 + 1 < n) {\n ones = ones * 10 + 1\n ++cnt\n }\n val cand1 = rec(n % ones) + cnt * (n / ones).toInt()\n ones = ones * 10 + 1\n ++cnt\n if (ones - n < n) {\n return minOf(rec(ones - n) + cnt, cand1)\n }\n return cand1\n}\nfun main() {\n val n = readLine()!!.toLong()\n println(rec(n))\n}"}, {"source_code": "import kotlin.math.min\n \nfun f(n: Long, a: Long, l: Int): Long {\n if (a == 0L) return if (n == 0L) 0L else Long.MAX_VALUE / 2\n val q = n / a\n return min(f(n - q * a, a / 10, l - 1) + l * q, f((q + 1) * a - n, a / 10, l - 1) + l * (q + 1))\n}\n \nfun main() = println(f(readLine()!!.toLong(), 1111_1111_1111_1111L, 16))"}, {"source_code": "import java.util.*\n \n var a = arrayOf(0L, 1L, 11L, 111L, 1111L, 11111L, 111111L, 1111111L, 11111111L, 111111111L, 1111111111L, 11111111111L, 111111111111L, \n 1111111111111L, 11111111111111L, 111111111111111L,1111111111111111L)\n fun ans(n: Long): Long\n {\n if (n == 0L)\n return 0L;\n var k = 1\n while (k < 17)\n {\n if (a[k] <= n && n <= a[k + 1])\n {\n var x = k * (n / a[k]) + ans(n - a[k] * (n / a[k]))\n var y = k + 1 + (a[k + 1] - n) / a[k] * k + ans(a[k + 1] - n - (a[k + 1] - n) / a[k] * a[k])\n return if (x < y) x else y\n }\n ++k;\n }\n return 10000000000\n }\n \n fun main()\n {\n var n = readLine()!!.toLong()\n print(ans(n))\n }\n"}, {"source_code": "import java.util.*\n\nval maxn = 200010\n\nfun next() = readLine()!!\nfun nextInt() = next().toInt()\nfun nextInts() = next().split(\" \").map { it.toInt() }\nfun nextLongs() = next().split(\" \").map { it.toLong() }\n\nval v = ArrayList()\nvar mk : MutableMap = mutableMapOf()\n\nfun init(){\n var t : Long = 0\n for(i in 1..17){\n t *= 10\n t++\n v.add(t)\n }\n}\n\nfun solve(x : Long) : Long{\n\n if(x == 0.toLong())return 0\n\n if(mk[x] != null){\n return mk[x]!!\n }\n\n var pos : Int = -1\n var ans : Long = x\n for(i in 0..16){\n if(v[i] > x){\n break\n }\n pos = i\n }\n\n ans = minOf(ans,solve(x-v[pos]) + pos + 1)\n\n if((v[pos+1] - x) < (x-v[pos])){\n ans = minOf(ans,solve(v[pos+1]-x) + pos + 2)\n }\n mk[x] = ans\n return ans\n}\nfun main(argumento: Array){\n\n init()\n\n var n = readLine()!!.toLong()\n\n println(solve(n))\n\n}\n\n"}, {"source_code": "import java.io.PrintWriter\nimport java.lang.Math.abs\nimport java.lang.Math.min\n\nval pw = PrintWriter(System.out)\nfun main(args: Array) {\n var INF = 1000000000000000L\n var n = nextLong()\n var vs = mutableListOf(1L)\n repeat(16){\n vs.add(vs.get(it)*10+1)\n }\n var dp = mapOf(Pair(n,0L))\n var re = n;\n for(i in 16 downTo 0){\n// dp.forEach { t, u -> print(\"${t} ${u}\\n\")}\n// println(\"\")\n var nxt = mutableMapOf()\n var upd = { key:Long, value:Long ->\n var cur = nxt.getOrDefault(key, INF)\n nxt.put(key, min(cur, value))\n }\n dp.forEach { n_, c ->\n var n = abs(n_)\n if(n==0L){\n re= min(re, c)\n return@forEach\n }\n var t=n/vs[i]\n upd(n-t*vs[i], c+(i+1)*t)\n upd((t+1)*vs[i]-n, c+(i+1)*(t+1))\n }\n dp=nxt\n }\n print(min(re, dp.getOrDefault(0, INF)))\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"}, {"source_code": "import java.util.*\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readLong() = readInt().toLong()\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\n\ninternal var list = ArrayList()\ninternal var map = HashMap()\ninternal var oo = 100000000000000000L\n\nfun main(args : Array) {\n val s = Scanner(System.`in`)\n var cur = \"1\"\n while(cur.length < 18) {\n list.add(cur.toLong())\n cur += \"1\"\n }\n var n = s.nextLong()\n var res = solve(n)\n println(res)\n}\n\ninternal fun solve(n: Long): Long {\n if(map.containsKey(n)) return map[n]!!.toLong()\n if(n == 0L) return 0L\n var largest = 1L\n var mult = 1L\n for(i in 0..list.size-1) {\n if(list[i] <= n) {\n largest = list[i].toLong()\n mult = (i+1).toLong()\n }\n }\n var res1 = n/largest * mult\n //println(res1)\n var left1 = n % largest\n res1 += solve(left1)\n\n var res2 = (n/largest+1) * mult\n var left2 = n - ((n/largest+1)*largest)\n //println(\" \" + n.toString() + \" , \" + (-left2).toString())\n if(-left2 < n) {\n res2 += solve(-left2)\n }\n else {\n res2 = oo\n }\n\n largest = 10*largest + 1\n var res3 = mult+1\n var left3 = largest-n\n if(left3 < n) {\n res3 += solve(left3);\n }\n else {\n res3 = oo\n }\n\n //println(res1.toString() + \" \" + res2)\n\n map[n] = minOf(res1, minOf(res3, res2))\n //println(n.toString() + \" \" + map[n]!!.toString())\n return map[n]!!.toLong()\n}\n"}, {"source_code": "import java.io.*\nimport java.util.*\n\nfun GetGraph(n: Int): Array> {\n return Array(n) { ArrayList() }\n}\n\nvar min = 9999999999L\n\nfun solve() {\n var n = readLongs()[0]\n var arr = ArrayList()\n var p = 0\n while (n > 0) {\n arr.add((n % 10).toInt())\n n /= 10\n p++\n }\n arr.add(0)\n dfs(arr, p, 0L, 0, 0)\n println(min)\n}\n\nfun dfs(arr: ArrayList, p: Int, n: Long, under: Int, cost: Long) {\n if (cost >= min) return\n if (p == -1) {\n if (n == 0L) {\n min = cost\n }\n return\n }\n var nxt = n * 10 + arr[p] + under\n for (i in -22..22) {\n if (nxt + i <= -50L || nxt + i >= 50L) continue\n dfs(arr, p - 1, nxt + i, under + i, cost + Math.abs(i) * (p + 1))\n }\n}\n\nvar reader = BufferedReader(InputStreamReader(System.`in`))\nvar writer = PrintWriter(System.out)\n\nfun readInt() = reader.readLine()!!.toInt()\nfun readStrings() = reader.readLine()!!.split(\" \")\nfun readInts() = readStrings().map { it.toInt() }\nfun readLongs() = readStrings().map { it.toLong() }\nfun main() {\n solve()\n writer.close()\n}\n"}, {"source_code": "import kotlin.math.min\n\nfun f(n: Long, s: Long, l: Int): Long {\n if (s == 0L) return if (n == 0L) 0L else Long.MAX_VALUE / 2\n val q = n / s\n return min(f(n - q * s, s / 10, l - 1) + l * q, f((q + 1) * s - n, s / 10, l - 1) + l * (q + 1))\n}\n\nfun main() = println(f(readLine()!!.toLong(), 1111_1111_1111_1111L, 16))\n"}, {"source_code": "fun f(n: Long, s: Long, l: Int): Long {\n if (n < 0) return f(-n, s, l)\n if (n == 0L) return 0L\n if (s == 0L) return n\n val q = n / s\n return Math.min(f(n - q * s, s / 10, l - 1) + l * q, f(n - (q + 1) * s, s / 10, l - 1) + l * (q + 1))\n}\n\nfun main() {\n val n = readLine()!!.toLong()\n var s = 0L\n val limit = 16\n repeat(limit) {\n s = 10 * s + 1\n }\n println(f(n, s, limit))\n}"}, {"source_code": "fun f(n: Long, s: Long, l: Int): Long {\n if (n == 0L) return 0L\n if (s == 0L) return Long.MAX_VALUE / 2\n val q = n / s\n return Math.min(f(n - q * s, s / 10, l - 1) + l * q, f((q + 1) * s - n, s / 10, l - 1) + l * (q + 1))\n}\n\nfun main() {\n val n = readLine()!!.toLong()\n println(f(n, 1111_1111_1111_1111L, 16))\n}"}, {"source_code": "import kotlin.math.min\n\nval addends = listOf(\n 0,\n 1L,\n 11L,\n 111L,\n 1_111L,\n 11_111L,\n 111_111L,\n 1_111_111L,\n 11_111_111L,\n 111_111_111L,\n 1_111_111_111L,\n 11_111_111_111L,\n 111_111_111_111L,\n 1_111_111_111_111L,\n 11_111_111_111_111L,\n 111_111_111_111_111L,\n 1_111_111_111_111_111L\n)\n\nfun main() {\n val number = readLine()!!.toLong()\n println(findMinimumDigits(number))\n}\n\nfun findMinimumDigits(number: Long): Int {\n if (number <= 11) return min(number, 13 - number).toInt()\n var i = addends.size - 1\n while (addends[i] >= number) i--\n\n if (i + 1 < addends.size && number == addends[i + 1]) return i + 1\n\n val addendA = addends[i]\n val timesA = number / addendA\n val remainderA = number % addendA\n\n val numberOfDigitsA = if (timesA < 10) (i * timesA + findMinimumDigits(remainderA)).toInt() else Int.MAX_VALUE\n if (i + 1 == addends.size) return numberOfDigitsA\n\n val addendB = if (timesA >= 9L) addends[i + 1] else addends[i]\n val timesB = if (timesA >= 9L) 1L else timesA + 1\n val remainderB = addendB * timesB - number\n\n val numberOfDigitsB = (addendB.toString().length * timesB + findMinimumDigits(remainderB)).toInt()\n\n val numberOfDigitsC = if (timesA >= 9L) {\n Int.MAX_VALUE\n } else {\n val addendC = addends[i + 1]\n val timesC = 1\n val remainderC = addendC * timesC - number\n if (remainderC > number) Int.MAX_VALUE else (i + 1) * timesC + findMinimumDigits(remainderC)\n }\n\n return min(min(numberOfDigitsA, numberOfDigitsB), numberOfDigitsC)\n}\n"}, {"source_code": "import java.lang.Long.min\n\nfun main() {\n val n = readLine()!!.toLong()\n val map = mutableMapOf()\n println(minUnits(n, map))\n}\n\nfun units(len: Long): Long {\n var x = 1L\n for (i in 1 until len) {\n x = x * 10 + 1\n }\n return x\n}\n\nfun minUnits(n: Long, map: MutableMap): Long {\n val x = map[n]\n if (x != null) return x\n val l = n.toString().length.toLong()\n val u = units(l)\n if (n == u) {\n map[n] = l\n return l\n }\n if (n < u) {\n val v = l + minUnits(u - n, map)\n map[n] = v\n return v\n } else {\n val v1 = l + minUnits(n - u, map)\n val n2 = units(l + 1) - n\n return if (n2 > n) {\n map[n] = v1\n v1\n } else {\n val v2 = l + 1 + minUnits(n2, map)\n val v = min(v1, v2);\n map[n] = v\n v\n }\n }\n}"}, {"source_code": "import java.lang.StringBuilder\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.*\n\nprivate fun readLn(): String = readLine()!!\nprivate fun readInt(): Int = readLn().toInt()\nprivate fun readLong(): Long = readLn().toLong()\nprivate fun readDouble(): Double = readLn().toDouble()\n\nprivate fun readStrings(): List = readLn().split(\" \")\nprivate fun readInts(): List = readStrings().map { it.toInt() }\nprivate fun readLongs(): List = readStrings().map { it.toLong() }\nprivate fun readDoubles(): List = readStrings().map { it.toDouble() }\n\nprivate const val INF: Int = 1_000_000_017\nprivate const val LLINF: Long = 1_000_000_000_000_000_017L\nprivate const val MOD: Int = 1_000_000_007\n\nprivate class TaskF {\n val nums = Array(17) { 0L }\n\n fun gen(x: Long, y: Int) : Long {\n if (y == 0) {\n return 0\n }\n var cur = 0L\n var st = 0\n while (cur + nums[y] <= x) {\n cur += nums[y]\n ++st\n }\n return min(st * y + gen(x - cur, y - 1), (st + 1) * y + gen(cur + nums[y] - x, y - 1))\n }\n\n fun solve() {\n nums[1] = 1L\n for (i in 2 until 17) {\n nums[i] = nums[i - 1] * 10L + 1L\n }\n\n val x = readLong()\n println(gen(x, 16))\n }\n}\n\nfun main() {\n val t = TaskF()\n t.solve()\n}"}, {"source_code": "import kotlin.math.absoluteValue\n\nfun main(){\n var n : Long = readLine()!!.toLong()\n var res: Long = 0;\n\n res = calculate(16, n)\n\n println(res)\n}\n\nfun calculate(x: Int, n: Long) : Long{\n var sum : Long = 0\n var divisionNumber : Long = 1\n var div: Long = 0\n if (x != 1) {\n for (i in 1 until x) {\n divisionNumber = divisionNumber * 10 + 1\n }\n div = n/divisionNumber\n sum = if(div == 0.toLong() && n/(divisionNumber/10) == 0.toLong()) {\n 0 + calculate(x-1, n)\n }else {\n var posSum: Long = calculate(x - 1, n - (div * divisionNumber))\n var negSum: Long = calculate(x - 1, (n - ((div + 1) * divisionNumber)).absoluteValue)\n if (posSum <= negSum + x) {\n (div) * (x) + posSum\n } else {\n (div + 1) * (x) + negSum\n }\n }\n }else{\n sum = n.absoluteValue\n }\n return sum\n}"}, {"source_code": "import java.util.*\n\nprivate fun readLn(): String = readLine()!!\nprivate fun readInt(): Int = readLn().toInt()\nprivate fun readLong(): Long = readLn().toLong()\nprivate fun readStrings(): List = readLn().split(\" \")\nprivate fun readInts(): List = readStrings().map {it.toInt()}\nprivate fun readLongs(): List = readStrings().map {it.toLong()}\nprivate fun , S: Comparable> pairComparator() = \n compareBy(Pair::first, Pair::second)\nprivate fun , S: Comparable, T: Comparable> tripleComparator() = \n compareBy(Triple::first, Triple::second, Triple::third)\n\n\nfun repUnit(numOnes: Int): Long {\n return (Math.pow(10.0, numOnes.toDouble()).toLong() - 1) / 9;\n}\n\nvar n: Long = 0\n\nfun go(cur: Long, ones: Int): Long {\n if (ones == 0 || cur == n) {\n return 0\n } else if (ones == 1) {\n return Math.abs(n - cur)\n } else {\n val power = repUnit(ones)\n val diff: Long = Math.abs(n - cur)\n val sgn = if (n - cur < 0) -1 else 1\n val hi_mult = (power + diff - 1) / power\n val lo_mult = hi_mult - 1\n return Math.min(\n go(cur + sgn * lo_mult * power, ones - 1) + lo_mult * ones,\n go(cur + sgn * hi_mult * power, ones - 1) + hi_mult * ones\n )\n }\n}\n\nfun main(args: Array) {\n n = readLong()\n var p = 1\n while (repUnit(p + 1) <= n) {\n p++\n }\n var power = repUnit(p)\n var ans = go((n / power) * power, p - 1) + p * (n / power)\n ans = Math.min(ans, go((n / power + 1) * power, p - 1) + p * (n / power + 1))\n power = repUnit(p + 1)\n ans = Math.min(ans, go(power, p) + p + 1)\n println(ans)\n}"}, {"source_code": "import java.util.*\nimport java.math.*\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readInts() = readLn().split(\" \").map{it.toInt()}\n\nvar pw = LongArray(17)\nvar ones = LongArray(17)\n\nfun solve(m:Long, pos:Int): Int {\n\tif(m==0L) return 0\n\tif(pos==0) return 0\n\t\n\tval m1 = ones[pos+1]-m\n\treturn minOf(solve(m%ones[pos], pos-1)+m/ones[pos]*pos,\n\t\tsolve(m1%ones[pos], pos-1)+m1/ones[pos]*pos+pos+1).toInt()\n}\n\nfun main(args: Array) {\n\tpw[0]=1\n\tones[0]=0\n\tfor(i in 1..16) {\n\t\tpw[i] = pw[i-1]*10\n\t\tones[i] = ones[i-1]+pw[i-1]\n\t}\n\t\n\tvar m = readLn().toLong()\n\tprintln(solve(m,15))\n}"}, {"source_code": "import java.lang.Math.abs\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(args: Array) {\n var s = readLn().reversed() + \"000\"\n var len = s.length\n val MAX = 200\n var dp = Array(len + 1, { Array(2 * MAX, { IntArray(2 * MAX, { 12345 }) }) })\n dp[0][MAX][MAX] = 0\n for (i in 0..len - 1) {\n for (cur in -MAX..MAX-1) {\n for (carry in -MAX..MAX-1) {\n var ft = dp[i][cur + MAX][carry + MAX]\n if (ft == 12345) {\n continue\n }\n for (delta in -100..100) {\n var newCur = cur + delta\n var here = newCur + carry\n var value = (here % 10 + 10) % 10\n if (value != s[i] - '0') {\n continue\n }\n var newCarry = (here - value) / 10\n var newFt = ft + abs(delta) * i\n if (newCur >= -MAX && newCur < MAX && newCarry >= -MAX && newCarry < MAX && newFt < dp[i + 1][newCur + MAX][newCarry + MAX]) {\n dp[i + 1][newCur + MAX][newCarry + MAX] = newFt\n }\n }\n }\n }\n }\n println(dp[len][MAX][MAX])\n}"}, {"source_code": "var ans = (1e18).toLong()\nvar dig = Array(18) {0L}\nfun solve(num : Long, pos : Int, tans : Long){\n if(pos == 0){\n if(num == 0L){\n ans = minOf(ans, tans)\n }\n return\n }\n var low = num / dig[pos]\n var high = (num + dig[pos] - 1) / dig[pos]\n solve(num - low * dig[pos], pos - 1, tans + low * pos)\n solve(high * dig[pos] - num, pos - 1, tans + high * pos)\n}\nfun main(args: Array) {\n var n = readLine()!!.toLong()\n for(i in 1..17){\n dig[i] = dig[i - 1] * 10L + 1L\n }\n solve(n, 17, 0)\n print(ans)\n}\n"}, {"source_code": "import java.util.*;\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n\tvar n = nextLong()\n\tvar ans = n;\n\tvar q = LinkedList();\n\tvar hm = HashMap();\n\tq.add(0L);\n\tq.add(0L);\n\twhile (!q.isEmpty()) {\n\t\tvar curVal = q.pop();\n\t\tvar curSteps = q.pop();\n\t\tif (hm.containsKey(curVal)) {\n\t\t\tvar x = hm.get(curVal) as Long;\n\t\t\tif (x <= curSteps) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\thm.put(curVal, curSteps);\n\t\tif (curVal < n) {\n\t\t\tvar add = 1L;\n\t\t\tvar sum = 1L;\n\t\t\twhile (curVal + add * 10 + 1 <= n) {\n\t\t\t\tadd = add * 10 + 1;\n\t\t\t\tsum++;\n\t\t\t}\n\t\t\tq.add(curVal + add);\n\t\t\tq.add(curSteps + sum);\n\t\t\tq.add(curVal + add * 10 + 1);\n\t\t\tq.add(curSteps + sum + 1);\n\t\t}\n\t\telse if (curVal > n) {\n\t\t\tvar sub = 1L;\n\t\t\tvar sum = 1L;\n\t\t\twhile (curVal - (sub * 10 + 1) >= n) {\n\t\t\t\tsub = sub * 10 + 1;\n\t\t\t\tsum++;\n\t\t\t}\n\t\t\tq.add(curVal - sub);\n\t\t\tq.add(curSteps + sum);\n\t\t\tq.add(curVal - (sub * 10 + 1));\n\t\t\tq.add(curSteps + sum + 1);\n\t\t}\n\t}\n\tif (hm.containsKey(n)) {\n\t\tans = Math.min(ans, hm.get(n) as Long);\n\t}\n\tprint(ans);\n\tprintln();\n}"}, {"source_code": "import kotlin.math.absoluteValue\nimport kotlin.math.sign\n\nfun Long.toOneBasedArithmetic(): String {\n\n fun findAddends(n: Long, forbidden: Int? = null): List {\n val addends = mutableListOf()\n val digits = n.toString().length\n val base = ones(digits)\n if (base == n)\n return listOf(digits)\n val ms = if (base > n) digits - 1 else digits\n val m = ones(ms)\n val bs = ms + 1\n val b = ones(bs)\n val fits = n % m == 0L\n if (fits) {\n val count = n / m\n val a = count * ms\n if (bs == forbidden) {\n repeat(count.toInt()) { addends += ms }\n } else {\n val remaining = findAddends(b - n, bs)\n val b = bs + remaining.sumBy { it.absoluteValue }\n if (a < b) {\n repeat(count.toInt()) { addends += ms }\n } else {\n addends += bs\n addends += remaining.map { -it }\n }\n }\n return addends\n }\n\n val options = mutableListOf>()\n // stay below, add enough\n val below = n / m\n val remaining = n - below * m\n val x = mutableListOf()\n repeat(below.toInt()) { x += ms }\n x += findAddends(remaining, ms)\n options += x.toList()\n\n // above\n val above = below + 1\n val toomuch = -n + above * m\n x.clear()\n repeat(above.toInt()) { x += ms }\n x += findAddends(toomuch, ms).map { -it }\n options += x.toList()\n\n // above with next larger step\n if (forbidden != bs) {\n val waytoomuch = -n + b\n x.clear()\n x += bs\n x += findAddends(waytoomuch, bs).map { -it }\n options += x.toList()\n }\n return options.minBy { it.sumBy { it.absoluteValue } }!!\n }\n\n val addends = findAddends(this)\n\n return addends.map {\n it.sign * ones(it)\n }.joinToString(separator = \"+\")\n}\n\nfun ones(n: Int) = \"1\".repeat(n.absoluteValue).toLong()\n\nval String.countOnes\n get() = count { it == '1' }\n\nfun main() {\n /* (1..1_000_000_000_000_000).forEach { i ->\n val toOneBasedArithmetic = i.toOneBasedArithmetic()\n println(\"$i => (${toOneBasedArithmetic.countOnes}) $toOneBasedArithmetic\")\n }*/\n val n = readLine()!!.toLong()\n println(n.toOneBasedArithmetic().countOnes)\n}"}, {"source_code": "import kotlin.math.min\n\nfun Long.digitsCount() = toString().length\n\nfun Long.repeat(n: Int) = toString().repeat(n).toLong()\n\n\nfun main() {\n val n = readLine()!!.toLong()\n val digits = n.digitsCount()\n print(dfs(n, digits+1))\n}\n\nfun dfs(dividend: Long, i: Int): Long {\n val divisor = 1L.repeat(i)\n val quo = dividend/divisor\n val rem = dividend%divisor\n if (rem == 0L) return quo*i\n return quo*i + min(dfs(rem, i-1), i + dfs(divisor - rem, i-1))\n}\n"}, {"source_code": "import java.io.*\nimport java.util.*\nimport javax.xml.stream.events.Characters\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashMap\nimport kotlin.collections.HashSet\n\nvar a = LongArray(20);\n\nfun dfs(n : Long, t : Long): Long {\n var m = n;\n var k = t;\n var num : Long = n / a[t.toInt()];\n m %= a[t.toInt()];\n if (m == 0L){\n return num * t;\n }\n return num * t + Math.min(t + dfs(a[t.toInt()] - m, k - 1), dfs (m, t - 1));\n}\n\nfun main(args: Array) {\n\n val cin = FastReader(System.`in`);\n val out = PrintWriter(BufferedOutputStream(System.out));\n\n var n : Long = cin.nextLong();\n\n for (i in 1 until 17){\n a[i] = a[i - 1] * 10 + 1;\n }\n out.print(dfs(n, 16L));\n// var arr = p.sortedWith(compareBy({it.first}, {it.second}));\n\n\n out.close()\n}\n\n\nprivate class FastReader(input: InputStream) {\n private val br = BufferedReader(InputStreamReader(input))\n private var st = StringTokenizer(\"\")\n\n fun next(): String {\n while (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt(): Int {\n return next().toInt()\n }\n\n fun nextDouble(): Double {\n return next().toDouble()\n }\n\n fun nextLong(): Long {\n return next().toLong()\n }\n\n /**\n * Warning! Use carefully!\n */\n fun nextLine(): String {\n return br.readLine()\n }\n}"}, {"source_code": "import java.util.*\n \nfun main() {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n val Z = LongArray(20)\n Z[1] = 1\n for (i in 2 until Z.size) {\n Z[i] = Z[i - 1] * 10 + 1\n }\n var res = Long.MAX_VALUE\n for (len in 1..17) {\n for (m in 0..(1 shl len)) {\n var cur = 0L\n var cnt = 0L\n for (i in len downTo 1) {\n val overflow = (m and (1 shl i)) != 0\n if (cur < n) {\n val am = (n - cur) / Z[i]\n cur += Z[i] * am\n cnt += i * am\n if (overflow && cur < n) {\n cur += Z[i]\n cnt += i\n }\n } else if (cur > n) {\n val am = (cur - n) / Z[i]\n cur -= Z[i] * am\n cnt += i * am\n if (overflow && cur > n) {\n cur -= Z[i]\n cnt += i\n }\n }\n }\n if (cur == n)\n res = minOf(res, cnt)\n }\n }\n println(res)\n}"}, {"source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\n \nfun main() {\n val n0 = readLong()\n \n val M = LongArray(17)\n for(i in 1 until M.size) M[i] = M[i-1] * 10 + 1\n \n var D = hashMapOf(n0 to 0)\n \n for(k in M.size-2 downTo 1) {\n if(M[k] > n0) continue\n \n val Dk = HashMap()\n \n for((n, c) in D) {\n Dk.checkMin(n % M[k], c + (n / M[k] * k).toInt())\n val n1 = M[k+1] - n\n Dk.checkMin(n1 % M[k], c + k + 1 + (n1 / M[k] * k).toInt())\n }\n \n D = Dk\n }\n \n val ans = D[0]\n \n println(ans)\n}\n \nfun HashMap.checkMin(k: K, v: Int) { if(!containsKey(k) || v < get(k)!!) put(k, v) }\n \n\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) }"}], "negative_code": [{"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}"}, {"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}"}, {"source_code": "import kotlin.math.*\n \nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n \n fun get1(_l:Int):Long{\n var n = _l\n if (n == 0)\n return 1\n var ret = 1L\n while(n > 1)\n {\n ret=1 + ret * 10\n n--\n }\n return ret\n}\n\nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n \nfun pow10(pow:Int):Long{\n var ret = 1L\n for(i in 1..pow)\n ret = ret*10\n return ret\n}\n\nfun getCount(n: Long):Long\n{\n val l = getLength(n)\n \n \n val plus = mutableMapOf()\n var tmp:Long = n\n for(i in l-1 downTo 0)\n {\n var v = get1(i+1)\n val mult = tmp / v \n \n plus.set(i, mult.toInt()) \n \n tmp = tmp%v\n }\n plus.set(l, 0)\n //println(plus)\n var changed = true\n while(changed)\n {\n changed = false\n for (i in 0..l-1) {\n var itm = plus[i]!!\n val li = i+1\n if ( itm > 0)\n { \n println(1)\n\n val diff = (if (i != 0) (li+1) * plus[i+1]!!.absoluteValue + li * itm + plus[0]!!.absoluteValue - \n (li+1) *(plus[i+1]!! + 1).absoluteValue - li*(itm - 10).absoluteValue - (plus[0]!! -1).absoluteValue\n else\n plus[i+1]!!.absoluteValue + plus[0]!!.absoluteValue -\n (li+1) *(plus[i+1]!! + 1).absoluteValue - (plus[0]!! - 11).absoluteValue\n )\n \n if (diff > 0)\n {\n \n // println(i)\n // println(plus)\n plus[i+1] = plus[i+1]!! + 1 \n plus[0] = plus[0]!! - 1\n plus[i] = plus[i]!! - 10\n changed = true\n \n \n // println(plus)\n }\n \n //println(plus)\n \n }\n else if ( itm <0 )\n {\n val diff = (if (i != 0) (li+1) * plus[i+1]!!.absoluteValue + li * itm.absoluteValue + plus[0]!!.absoluteValue - \n (li+1) *(plus[i+1]!! - 1).absoluteValue - li*(itm + 10).absoluteValue - (plus[0]!! + 1).absoluteValue\n else\n plus[i+1]!!.absoluteValue + plus[0]!!.absoluteValue -\n (li+1) *(plus[i+1]!! - 1).absoluteValue - (plus[0]!! + 11).absoluteValue\n )\n if (diff > 0)\n { \n // println(2) \n // println(i) \n // println(plus)\n plus[i+1] = plus[i+1]!! -1 \n plus[0] = plus[0]!! + 1\n plus[i] = plus[i]!! + 10\n changed = true\n \n \n // println(plus)\n }\n \n }\n }\n }\n\n var ret = 0L\n for ((key, value) in plus) {\n ret+=(key + 1) * value.absoluteValue\n }\n // print(plus)\n return ret\n}\n \nfun main() {\n var n = readLong()\n \n println(getCount(n) )\n //println(plus)\n //println(minus)\n}"}, {"source_code": "import kotlin.math.*\n \nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n \n fun get1(_l:Int):Long{\n var n = _l\n if (n == 0)\n return 1\n var ret = 1L\n while(n > 1)\n {\n ret=1 + ret * 10\n n--\n }\n return ret\n}\n\nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n \nfun pow10(pow:Int):Long{\n var ret = 1L\n for(i in 1..pow)\n ret = ret*10\n return ret\n}\n\nfun getCount(n: Long):Long\n{\n val l = getLength(n)\n \n \n val plus = mutableMapOf()\n var tmp:Long = n\n for(i in l-1 downTo 0)\n {\n var v = get1(i+1)\n val mult = tmp / v \n \n plus.set(i, mult.toInt()) \n \n tmp = tmp%v\n }\n plus.set(l, 0)\n \n var changed = true\n while(changed)\n {\n changed = false\n for (i in 0..l-1) {\n var itm = plus[i]!!\n val li = i+1\n if ( itm >= 7 || itm == 6 && li >=2 )\n {\n \n plus[i+1] = plus[i+1]!! + 1 \n plus[0] = plus[0]!! - 1\n plus[i] = itm - 10\n changed = true\n }\n else if ( itm <= -7 || itm == -6 && li >=2 )\n {\n \n plus[i+1] = plus[i+1]!! -1 \n plus[0] = plus[0]!! + 1\n plus[i] = itm + 10\n changed = true\n }\n }\n }\n\n var ret = 0L\n for ((key, value) in plus) {\n ret+=(key + 1) * value.absoluteValue\n }\n // print(plus)\n return ret\n}\n \nfun main() {\n var n = readLong()\n \n println(getLength(n) )\n //println(plus)\n //println(minus)\n}"}, {"source_code": "import kotlin.math.*\n\nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n\nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n\nfun get1(_l:Int):Long{\n var n = _l\n if (n == 0)\n return 1\n var ret = 1L\n while(n > 1)\n {\n ret=1 + ret * 10\n n--\n }\n return ret\n}\n\nfun pow10(pow:Int):Long{\n var ret = 1L\n for(i in 1..pow)\n ret = ret*10\n return ret\n}\n\nfun main() {\n \n println(getCount(readLong()))\n}\n\nfun getCount(_n:Long):Long\n{\n // println(\"-------------\")\n // println(_n)\n if (_n ==0L)\n return 0\n\n var n =if (_n> 0) _n else -_n\n \n val l = getLength(n)\n val l1 = get1(l)\n\n if (l == 1)\n return min(n, 13 - n)\n\n // println(l1)\n if(n <= l1)\n return l + getCount(l1 - n)\n \n val l11 = l1 + pow10(l)\n // println(l+1)\n // println(pow10(l))\n // println(l11)\n val rem1 = n / pow10(l-1)\n\n val n2 = l11 - n\n val rem2 = n2 / pow10(l-1)\n\n \n \n val value1 = l * rem1 + getCount( n - rem1 * l1 )\n val value2 = (l+1) + l * rem2 + getCount( n2 - rem2 * l1 ) \n // println(\"++++++++++\")\n return if (value1 > value2) value2 else value1\n}\n"}, {"source_code": "import kotlin.math.*\n\nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n\nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n\nfun get1(_l:Int):Long{\n var n = _l\n if (n == 0)\n return 1\n var ret = 1L\n while(n > 1)\n {\n ret=1 + ret * 10\n n--\n }\n return ret\n}\n\nfun pow10(pow:Int):Long{\n var ret = 1L\n for(i in 1..pow)\n ret = ret*10\n return ret\n}\n\nfun main() {\n \n println(getCount(readLong()))\n}\n\nfun getCount(_n:Long):Long\n{\n if (_n ==0L)\n return 0\n\n var n =if (_n> 0) _n else -_n\n \n val l = getLength(n)\n val l1 = get1(l)\n\n if (l == 1)\n return min(n, 13 - n)\n\n // println(l1)\n if(n <= l1)\n return l + getCount(l1 - n)\n \n val l11 = l1 + pow10(l)\n // println(l+1)\n // println(pow10(l))\n // println(l11)\n val rem1 = n / pow10(l-1)\n\n val n2 = l11 - n\n val rem2 = n2 / pow10(l-1)\n\n // println(rem1)\n // println(rem2)\n \n val value1 = l * rem1 + getCount( n - rem1 * l1 )\n val value2 = l * rem2 + getCount( n2 - rem2 * l1 ) \n return if (value1 > value2) value2 else value1\n}\n"}, {"source_code": "import kotlin.math.*\n\nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n\nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n\nfun get1(_l:Int):Long{\n var n = _l\n if (n == 0)\n return 1\n var ret = 1L\n while(n > 1)\n {\n ret=1 + ret * 10\n n--\n }\n return ret\n}\n\nfun pow10(pow:Int):Long{\n var ret = 1L\n for(i in 1..pow)\n ret = ret*10\n return ret\n}\n\nfun main() {\n \n println(getCount(readLong()))\n}\n\n\nfun getCount(_n:Long):Long\n{ \n if (_n ==0L)\n return 0\n\n var n =if (_n> 0) _n else -_n\n \n val l = getLength(n)\n val l1 = get1(l)\n\n if (l == 1)\n return min(n, 13 - n)\n \n val digit = n / l1\n var bdigit = digit + 1\n var nbottom = digit * l1\n var ntop = (bdigit) * l1\n if (n % l1 ==0L)\n {\n ntop = nbottom \n bdigit = digit \n }\n \n \n val ntopadd = getCount(ntop - n)\n \n val v1 = bdigit * l + ntopadd\n val v2 = l + 2 + l * (10 - bdigit) + ntopadd\n\n var ret = min(v1, v2)\n if (ntop != nbottom && nbottom > 0)\n {\n val ntopadd2 = getCount(n - nbottom)\n \n val v3 = digit * l + ntopadd2\n val v4 = l + 2 + l * (10 - digit) + ntopadd2\n ret = min(ret, v3)\n ret = min(ret, v4)\n }\n return ret\n}"}, {"source_code": "import kotlin.math.*\n \nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n \n fun get1(_l:Int):Long{\n var n = _l\n if (n == 0)\n return 1\n var ret = 1L\n while(n > 1)\n {\n ret=1 + ret * 10\n n--\n }\n return ret\n}\n\nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n \nfun pow10(pow:Int):Long{\n var ret = 1L\n for(i in 1..pow)\n ret = ret*10\n return ret\n}\n\n \nfun main() {\n var n = readLong()\n val l = getLength(n)\n \n \n val plus = mutableMapOf()\n var tmp:Long = n\n for(i in l-1 downTo 0)\n {\n var v = get1(i+1)\n val mult = tmp / v \n \n plus.set(i, mult.toInt()) \n \n tmp = tmp%v\n }\n plus.set(l, 0)\n \n var changed = true\n while(changed)\n {\n changed = false\n for (i in 0..l-1) {\n var itm = plus[i]!!\n val li = i+1\n if ( itm >= 7 || itm == 6 && li >=2 )\n {\n \n plus[i+1] = plus[i+1]!! + 1 \n plus[0] = plus[0]!! - 1\n plus[i] = plus[i]!! - 10\n changed = true\n }\n else if ( itm <= -7 || itm == -6 && li >=2 )\n {\n \n plus[i+1] = plus[i+1]!! -1 \n plus[0] = plus[0]!! + 1\n plus[i] = plus[i]!! + 10\n changed = true\n }\n }\n }\n\n var ret = 0L\n for ((key, value) in plus) {\n ret+=(key + 1) * value.absoluteValue\n }\n\n println(ret)\n //println(plus)\n //println(minus)\n}\n "}, {"source_code": "import kotlin.math.*\n\nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n\nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n\nfun pow10(pow:Int):Long{\n var ret = 1L\n for(i in 1..pow)\n ret = ret*10\n return ret\n}\n\nfun main() {\n var n = readLong()\n val l = getLength(n)\n \n \n var prev = 0\n\n val minus = mutableMapOf()\n val plus = mutableMapOf()\n\n for(i in l-1 downTo 0)\n {\n \n val cur = ((n / pow10(i)) % 10).toInt()\n plus.set(i, 0)\n minus.set(i, 0)\n if (cur >= prev)\n {\n plus[i] =plus[i]!! + cur - prev\n }\n else\n {\n minus[i] =minus[i]!! + prev - cur\n }\n prev = cur\n }\n plus.set(l, 0)\n minus.set(l, 0)\n\n \n var i = l -1\n\n while(i >= 0)\n {\n //println(\"i = %d\".format(i))\n //println(\"----\")\n //println(plus)\n //println(minus)\n if (plus[i]!! > 0 && minus[i]!! > 0)\n {\n val minv = min(plus[i]!!, minus[i]!!)\n plus[i] = plus[i]!! - minv\n minus[i] = minus[i]!! - minv\n }\n if (plus[i]!! >= 10)\n {\n val tc = plus[i]!! / 10\n plus[i] = plus[i]!! % 10\n //println(\"Set %d to %d\".format(i+1, plus[i+1]!! + 1))\n plus[i+1] = plus[i+1]!! + tc\n minus[0] = minus[0]!!+1\n i = i+1\n continue\n }\n else if (minus[i]!! >= 10)\n {\n val tc = minus[i]!! / 10\n minus[i] = minus[i]!! % 10\n minus[i+1] = minus[i+1]!! + tc\n plus[0] =plus[0]!!+1\n i = i+1\n continue\n }\n \n if (plus[i]!! > 0 && i != l)\n {\n val curcnt = plus[i]!! * (i+1) \n \n var possible = (i + 2) + 1 + (i+1) + ( 9 - plus[i]!!) * (i+1)\n \n if (minus[i+1]!! > 0)\n {\n possible -= 2 * (i+2)\n }\n if (plus[0]!! > 0 && i > 0)\n {\n possible -= 2 \n }\n if (possible <= curcnt)\n {\n println(possible)\n \n plus[i+1]= plus[i+1]!! + 1 \n minus[i] = 10 - plus[i]!!\n minus[0] = minus[0]!!+1\n plus[i] = 0\n i = i + 1 \n continue\n }\n } \n if (minus[i]!! > 0 && i != l)\n {\n val curcnt = minus[i]!! * (i+1)\n var possible = (i + 2) + 1 + (i+1) + ( 9 - minus[i]!!) * (i+1)\n\n if (plus[i+1]!! > 0)\n {\n possible -= 2 * (i+2)\n }\n if (minus[0]!! > 0 && i > 0)\n {\n possible -= 2 \n }\n if (possible <= curcnt)\n {\n minus[i+1]= minus[i+1]!! + 1 \n plus[i] = 10 - minus[i]!!\n plus[0] = plus[0]!!+1\n minus[i] = 0\n i = i + 1 \n continue\n }\n } \n // println(\"decrement\")\n i = i -1 \n }\n var ret =0\n for(j in 0..l)\n {\n ret+=plus[j]!! *(j + 1)\n ret+=minus[j]!! *(j + 1)\n \n }\n println(ret)\n //println(plus)\n //println(minus)\n}"}, {"source_code": "import kotlin.math.*\n\nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n\nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n\nfun pow10(pow:Int):Long{\n var ret = 1L\n for(i in 1..pow)\n ret = ret*10\n return ret\n}\n\nfun main() {\n var n = readLong()\n val l = getLength(n)\n \n \n var prev = 0\n\n val minus = mutableMapOf()\n val plus = mutableMapOf()\n\n for(i in l-1 downTo 0)\n {\n \n val cur = ((n / pow10(i)) % 10).toInt()\n plus.set(i, 0)\n minus.set(i, 0)\n if (cur >= prev)\n {\n plus[i] =plus[i]!! + cur - prev\n }\n else\n {\n minus[i] =minus[i]!! + prev - cur\n }\n prev = cur\n }\n plus.set(l, 0)\n minus.set(l, 0)\n\n \n var i = l -1\n\n while(i >= 0)\n {\n //println(\"i = %d\".format(i))\n //println(\"----\")\n //println(plus)\n //println(minus)\n if (plus[i]!! > 0 && minus[i]!! > 0)\n {\n val minv = min(plus[i]!!, minus[i]!!)\n plus[i] = plus[i]!! - minv\n minus[i] = minus[i]!! - minv\n }\n if (plus[i]!! >= 10)\n {\n val tc = plus[i]!! / 10\n plus[i] = plus[i]!! % 10\n //println(\"Set %d to %d\".format(i+1, plus[i+1]!! + 1))\n plus[i+1] = plus[i+1]!! + tc\n minus[0] = minus[0]!!+1\n i = i+1\n continue\n }\n else if (minus[i]!! >= 10)\n {\n val tc = minus[i]!! / 10\n minus[i] = minus[i]!! % 10\n minus[i+1] = minus[i+1]!! + tc\n plus[0] =plus[0]!!+1\n i = i+1\n continue\n }\n \n if (plus[i]!! > 0 && i != l)\n {\n val curcnt = plus[i]!! * (i+1) \n \n var possible = (i + 2) + 1 + (i+1) + ( 9 - plus[i]!!) * (i+1)\n \n if (minus[i+1]!! > 0)\n {\n possible -= 2 * (i+2)\n }\n if (plus[0]!! > 0 && i > 0)\n {\n possible -= 2 \n }\n if (possible < curcnt)\n {\n // println(possible)\n \n plus[i+1]= plus[i+1]!! + 1 \n minus[i] = 10 - plus[i]!!\n minus[0] = minus[0]!!+1\n plus[i] = 0\n i = i + 1 \n continue\n }\n } \n if (minus[i]!! > 0 && i != l)\n {\n val curcnt = minus[i]!! * (i+1)\n var possible = (i + 2) + 1 + (i+1) + ( 9 - minus[i]!!) * (i+1)\n\n if (plus[i+1]!! > 0)\n {\n possible -= 2 * (i+2)\n }\n if (minus[0]!! > 0 && i > 0)\n {\n possible -= 2 \n }\n if (possible <= curcnt)\n {\n minus[i+1]= minus[i+1]!! + 1 \n plus[i] = 10 - minus[i]!!\n plus[0] = plus[0]!!+1\n minus[i] = 0\n i = i + 1 \n continue\n }\n } \n // println(\"decrement\")\n i = i -1 \n }\n var ret =0\n for(j in 0..l)\n {\n ret+=plus[j]!! *(j + 1)\n ret+=minus[j]!! *(j + 1)\n \n }\n println(ret)\n //println(plus)\n //println(minus)\n}\n"}, {"source_code": "import kotlin.math.*\n \nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n \n fun get1(_l:Int):Long{\n var n = _l\n if (n == 0)\n return 1\n var ret = 1L\n while(n > 1)\n {\n ret=1 + ret * 10\n n--\n }\n return ret\n}\n\nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n \nfun pow10(pow:Int):Long{\n var ret = 1L\n for(i in 1..pow)\n ret = ret*10\n return ret\n}\n\nfun getCount(n: Long):Long\n{\n val l = getLength(n)\n \n \n val plus = mutableMapOf()\n var tmp:Long = n\n for(i in l-1 downTo 0)\n {\n var v = get1(i+1)\n val mult = tmp / v \n \n plus.set(i, mult.toInt()) \n \n tmp = tmp%v\n }\n plus.set(l, 0)\n //println(plus)\n var changed = true\n while(changed)\n {\n changed = false\n for (i in 0..l-1) {\n var itm = plus[i]!!\n val li = i+1\n if ( itm > 0)\n { \n // println(1)\n\n val diff = (if (i != 0) (li+1) * plus[i+1]!!.absoluteValue + li * itm + plus[0]!!.absoluteValue - \n (li+1) *(plus[i+1]!! + 1).absoluteValue - li*(itm - 10).absoluteValue - (plus[0]!! -1).absoluteValue\n else\n plus[i+1]!!.absoluteValue + plus[0]!!.absoluteValue -\n (li+1) *(plus[i+1]!! + 1).absoluteValue - (plus[0]!! - 11).absoluteValue\n )\n \n if (diff > 0)\n {\n \n // println(i)\n // println(plus)\n plus[i+1] = plus[i+1]!! + 1 \n plus[0] = plus[0]!! - 1\n plus[i] = plus[i]!! - 10\n changed = true\n \n \n // println(plus)\n }\n \n //println(plus)\n \n }\n else if ( itm <0 )\n {\n val diff = (if (i != 0) (li+1) * plus[i+1]!!.absoluteValue + li * itm.absoluteValue + plus[0]!!.absoluteValue - \n (li+1) *(plus[i+1]!! - 1).absoluteValue - li*(itm + 10).absoluteValue - (plus[0]!! + 1).absoluteValue\n else\n plus[i+1]!!.absoluteValue + plus[0]!!.absoluteValue -\n (li+1) *(plus[i+1]!! - 1).absoluteValue - (plus[0]!! + 11).absoluteValue\n )\n if (diff > 0)\n { \n // println(2) \n // println(i) \n // println(plus)\n plus[i+1] = plus[i+1]!! -1 \n plus[0] = plus[0]!! + 1\n plus[i] = plus[i]!! + 10\n changed = true\n \n \n // println(plus)\n }\n \n }\n }\n }\n\n var ret = 0L\n for ((key, value) in plus) {\n ret+=(key + 1) * value.absoluteValue\n }\n // print(plus)\n return ret\n}\n \nfun main() {\n var n = readLong()\n \n println(getCount(n) )\n //println(plus)\n //println(minus)\n}\n"}, {"source_code": "import kotlin.math.*\n \nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n \nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n \nfun get1(_l:Int):Long{\n var n = _l\n if (n == 0)\n return 1\n var ret = 1L\n while(n > 1)\n {\n ret=1 + ret * 10\n n--\n }\n return ret\n}\n \n \nfun main() {\n val res = getCount(readLong())\n // println(res)\n println(get1Count(res))\n}\n \nfun get1Count(lst:List):Int\n{\n var ret = 0\n for(i in 0 until lst.size)\n { \n val item = lst[i]\n ret+=(i+1)*item.absoluteValue\n }\n return ret\n}\n \nfun getCount(_n:Long):MutableList\n{ \n if (_n ==0L)\n return mutableListOf()\n \n var n =if (_n> 0) _n else -_n\n \n val l = getLength(n).toInt()\n \n if (l == 1)\n {\n if ( n > 6)\n {\n return mutableListOf( n.toInt() - 11, 1 )\n }\n else \n {\n return mutableListOf(n.toInt())\n } \n }\n \n \n val l1 = get1(l)\n \n val digit = (n / l1).toInt()\n var bdigit = digit + 1\n var nbottom = digit * l1\n var ntop = (bdigit) * l1\n if (n % l1 ==0L)\n {\n ntop = nbottom \n bdigit = digit \n }\n \n \n val soltop = getCount(ntop - n)\n // println(ntop - n)\n // println(soltop)\n for(i in soltop.size..l)\n {\n soltop.add(0)\n }\n for(i in 0 until soltop.size)\n {\n soltop[i] = -soltop[i]\n }\n \n var ntopadd = get1Count(soltop)\n val v1 = ( (soltop[l-1] + bdigit).absoluteValue * l \n + ntopadd \n - soltop[l-1].absoluteValue * l)\n \n\n val v2 = ( (l + 1) * (soltop[l] + 1).absoluteValue \n + (soltop[0] - 1).absoluteValue \n + l * (soltop[l-1] - 10 + bdigit).absoluteValue \n + ntopadd \n - soltop[l].absoluteValue - soltop[l-1].absoluteValue- soltop[0].absoluteValue)\n \n \n if (ntop != nbottom && nbottom > 0)\n {\n // println(n - nbottom)\n val soltop2 = getCount(n - nbottom)\n // println(soltop2)\n val ntopadd2 = get1Count(soltop2)\n for(i in soltop2.size..l)\n {\n soltop2.add(0)\n }\n val v3 = ( (soltop2[l-1] + digit).absoluteValue * l \n + ntopadd2 \n - soltop2[l-1].absoluteValue * l)\n \n // println(\"calc v4\")\n //println(soltop2)\n //println(ntopadd2)\n //println(digit)\n val v4 = ( (l + 1) * (soltop2[l] + 1).absoluteValue \n + (soltop2[0] - 1).absoluteValue \n + l * (soltop2[l-1] - 10 + digit).absoluteValue \n + ntopadd2 \n - soltop2[l].absoluteValue - soltop2[l-1].absoluteValue- soltop2[0].absoluteValue)\n //println(v4)\n\n if (v1 <= v2 && v1 <= v3 && v1 <= v4)\n {\n // println(1) \n // println(soltop) \n soltop[l-1] =soltop[ l-1] + bdigit\n // println(soltop)\n return soltop\n }\n else if (v2 <= v1 && v2 <= v3 && v2 <= v4)\n {\n // println(2) \n // println(v1) \n // println(v2) \n // println(soltop) \n // println(l)\n // println(bdigit) \n soltop[l-1] =soltop[ l-1] - 10 + bdigit\n soltop[l] =soltop[ l] +1\n soltop[0] =soltop[ 0] -1\n // println(soltop)\n return soltop\n }\n else if (v3 <= v1 && v3 <= v2 && v3 <= v4)\n {\n // println(3) \n // println(soltop2) \n soltop2[l-1] =soltop2[ l-1] + digit \n // println(soltop2) \n return soltop2\n }\n else\n {\n // println(4) \n // println(soltop2) \n soltop2[l-1] =soltop2[ l-1] - 10 + digit\n soltop2[l] =soltop2[ l] +1\n soltop2[0] =soltop2[ 0] -1\n // println(soltop2) \n return soltop2\n }\n }\n else\n {\n if (v1 <= v2)\n {\n // println(5) \n // println(soltop) \n soltop[l-1] =soltop[ l-1] + bdigit\n // println(soltop) \n return soltop\n }\n else\n {\n // println(6) \n // println(soltop) \n soltop[l-1] =soltop[ l-1] - 10 + bdigit\n soltop[l] =soltop[ l] +1\n soltop[0] =soltop[ 0] -1\n // println(soltop) \n return soltop\n }\n }\n\n \n}"}, {"source_code": "import kotlin.math.*\n\nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n\nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n\nfun pow10(pow:Int):Long{\n var ret = 1L\n for(i in 1..pow)\n ret = ret*10\n return ret\n}\n\nfun main() {\n var n = readLong()\n val l = getLength(n)\n \n \n var prev = 0\n\n val minus = mutableMapOf()\n val plus = mutableMapOf()\n\n for(i in l-1 downTo 0)\n {\n \n val cur = ((n / pow10(i)) % 10).toInt()\n plus.set(i, 0)\n minus.set(i, 0)\n if (cur >= prev)\n {\n plus[i] =plus[i]!! + cur - prev\n }\n else\n {\n minus[i] =minus[i]!! + prev - cur\n }\n prev = cur\n }\n plus.set(l, 0)\n minus.set(l, 0)\n\n \n var i = l -1\n\n while(i >= 0)\n {\n //println(\"i = %d\".format(i))\n //println(\"----\")\n //println(plus)\n //println(minus)\n if (plus[i]!! > 0 && minus[i]!! > 0)\n {\n val minv = min(plus[i]!!, minus[i]!!)\n plus[i] = plus[i]!! - minv\n minus[i] = minus[i]!! - minv\n }\n if (plus[i]!! >= 10)\n {\n val tc = plus[i]!! / 10\n plus[i] = plus[i]!! % 10\n //println(\"Set %d to %d\".format(i+1, plus[i+1]!! + 1))\n plus[i+1] = plus[i+1]!! + tc\n minus[0] = minus[0]!!+1\n i = i+1\n continue\n }\n else if (minus[i]!! >= 10)\n {\n val tc = minus[i]!! / 10\n minus[i] = minus[i]!! % 10\n minus[i+1] = minus[i+1]!! + tc\n plus[0] =plus[0]!!+1\n i = i+1\n continue\n }\n \n if (plus[i]!! > 0 && i != l)\n {\n val curcnt = plus[i]!! * (i+1) \n \n var possible = (i + 2) + 1 + (i+1) + ( 9 - plus[i]!!) * (i+1)\n \n if (minus[i+1]!! > 0)\n {\n possible -= 2 * (i+2)\n }\n if (plus[0]!! > 0 && i > 0)\n {\n possible -= 2 \n }\n if (possible < curcnt)\n {\n // println(possible)\n \n plus[i+1]= plus[i+1]!! + 1 \n minus[i] = 10 - plus[i]!!\n minus[0] = minus[0]!!+1\n plus[i] = 0\n i = i + 1 \n continue\n }\n } \n if (minus[i]!! > 0 && i != l)\n {\n val curcnt = minus[i]!! * (i+1)\n var possible = (i + 2) + 1 + (i+1) + ( 9 - minus[i]!!) * (i+1)\n\n if (plus[i+1]!! > 0)\n {\n possible -= 2 * (i+2)\n }\n if (minus[0]!! > 0 && i > 0)\n {\n possible -= 2 \n }\n if (possible < curcnt)\n {\n minus[i+1]= minus[i+1]!! + 1 \n plus[i] = 10 - minus[i]!!\n plus[0] = plus[0]!!+1\n minus[i] = 0\n i = i + 1 \n continue\n }\n } \n // println(\"decrement\")\n i = i -1 \n }\n var ret =0\n for(j in 0..l)\n {\n ret+=plus[j]!! *(j + 1)\n ret+=minus[j]!! *(j + 1)\n \n }\n println(ret)\n //println(plus)\n //println(minus)\n}\n\n// main()\n//println(-2 % 10)\n"}, {"source_code": "import kotlin.math.*\n\nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n\nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n\nfun pow10(pow:Int):Long{\n var ret = 1L\n for(i in 1..pow)\n ret = ret*10\n return ret\n}\n\nfun main() {\n var n = readLong()\n val l = getLength(n)\n \n \n var prev = 0\n\n val minus = mutableMapOf()\n val plus = mutableMapOf()\n\n for(i in l-1 downTo 0)\n {\n \n val cur = ((n / pow10(i)) % 10).toInt()\n plus.set(i, 0)\n minus.set(i, 0)\n if (cur >= prev)\n {\n plus[i] =plus[i]!! + cur - prev\n }\n else\n {\n minus[i] =minus[i]!! + prev - cur\n }\n prev = cur\n }\n plus.set(l, 0)\n minus.set(l, 0)\n\n \n var i = l -1\n\n while(i >= 0)\n {\n //println(\"i = %d\".format(i))\n //println(\"----\")\n //println(plus)\n //println(minus)\n if (plus[i]!! > 0 && minus[i]!! > 0)\n {\n val minv = min(plus[i]!!, minus[i]!!)\n plus[i] = plus[i]!! - minv\n minus[i] = minus[i]!! - minv\n }\n if (plus[i]!! >= 10)\n {\n val tc = plus[i]!! / 10\n plus[i] = plus[i]!! % 10\n //println(\"Set %d to %d\".format(i+1, plus[i+1]!! + 1))\n plus[i+1] = plus[i+1]!! + tc\n minus[0] = minus[0]!!+1\n i = i+1\n continue\n }\n else if (minus[i]!! >= 10)\n {\n val tc = minus[i]!! / 10\n minus[i] = minus[i]!! % 10\n minus[i+1] = minus[i+1]!! + tc\n plus[0] =plus[0]!!+1\n i = i+1\n continue\n }\n \n if (plus[i]!! > 0 && i != l)\n {\n val curcnt = plus[i]!! * (i+1) \n \n var possible = (i + 2) + 1 + (i+1) + ( 9 - plus[i]!!) * (i+1)\n \n if (minus[i+1]!! > 0)\n {\n possible -= 2 * (i+2)\n }\n if (plus[0]!! > 0 && i > 0)\n {\n possible -= 2 \n }\n if (possible <= curcnt)\n {\n println(possible)\n \n plus[i+1]= plus[i+1]!! + 1 \n minus[i] = 10 - plus[i]!!\n minus[0] = minus[0]!!+1\n plus[i] = 0\n i = i + 1 \n continue\n }\n } \n if (minus[i]!! > 0 && i != l)\n {\n val curcnt = minus[i]!! * (i+1)\n var possible = (i + 2) + 1 + (i+1) + ( 9 - minus[i]!!) * (i+1)\n\n if (plus[i+1]!! > 0)\n {\n possible -= 2 * (i+2)\n }\n if (minus[0]!! > 0 && i > 0)\n {\n possible -= 2 \n }\n if (possible <= curcnt)\n {\n minus[i+1]= minus[i+1]!! + 1 \n plus[i] = 10 - minus[i]!!\n plus[0] = plus[0]!!+1\n minus[i] = 0\n i = i + 1 \n continue\n }\n } \n println(\"decrement\")\n i = i -1 \n }\n var ret =0\n for(j in 0..l)\n {\n ret+=plus[j]!! *(j + 1)\n ret+=minus[j]!! *(j + 1)\n \n }\n println(ret)\n println(plus)\n println(minus)\n}"}, {"source_code": "import kotlin.math.min\n\nfun main(args: Array) {\n val n = readLine()!!.toLong()\n println(f(n))\n}\n\nprivate fun f(n: Long): Long {\n if (n == 0L) return 0\n val len = n.toString().length\n val number = \"1\".repeat(len).toLong()\n val lower = n / number\n val n1 = n - lower * number\n val n2 = (lower + 1) * number - n\n val n3 = number * 10 + 1 - n\n var res = Long.MAX_VALUE\n if (n1 < n) {\n res = min(res, f(n1) + lower * len)\n }\n if (n3 < n) {\n res = min(res, f(n3) + lower + 1)\n }\n if (n2 < n && (lower + 1) * len < res) {\n res = min(res, f(n2) + (lower + 1) * len)\n }\n return res\n}"}, {"source_code": "import java.util.*\n\n\nvar a = LongArray(18)\nvar res = 100000000000000000L\nfun dfs(n_now: Long, pre: Int, total: Long) {\n if (pre == 0) {\n if (res > total) res = total\n return\n }\n if (n_now >= 0) {\n dfs(n_now - n_now / a[pre] * a[pre], pre - 1, total + n_now / a[pre] * pre)\n dfs(n_now - (n_now / a[pre] + 1) * a[pre], pre - 1, total + (n_now / a[pre] + 1) * pre)\n } else {\n val temp = -n_now / a[pre]\n dfs(n_now + n_now / a[pre] * a[pre], pre - 1, total + n_now / a[pre] * pre)\n dfs(n_now + (n_now / a[pre] + 1) * a[pre], pre - 1, total + (n_now / a[pre] + 1) * pre)\n }\n}\n\nfun main(args: Array) {\n a[1] = 1\n for (i in 2..16)\n a[i] = a[i - 1] * 10 + 1\n val cin = Scanner(System.`in`)\n var n = cin.nextLong()\n dfs(n, 16, 0)\n System.out.print(res)\n}"}, {"source_code": "import kotlin.math.absoluteValue\n\n\nfun power(base: Long, exp: Int): Long {\n return when(exp){\n 0 -> 1L\n 1 -> base\n else -> power(base * base, exp / 2) * power(base, exp % 2)\n }\n}\nfun calMin(value: Long, digit: Int, base: Long): Long {\n return when(digit){\n 1 -> value.absoluteValue\n else -> {\n val b = value / base\n (b .. b + 1).map{calMin(value - it * base, digit - 1, base / 10) + digit * it.absoluteValue}.min()!!\n }\n }\n}\nfun main(args: Array?): Unit {\n println(calMin(readLine()!!.trim().toLong(), 15, power(10L, 15) / 9))\n}"}, {"source_code": "import kotlin.math.absoluteValue\n\n\nfun power(base: Long, exp: Int): Long {\n return when(exp){\n 0 -> 1L\n 1 -> base\n else -> power(base * base, exp / 2) * power(base, exp % 2)\n }\n}\nfun calMin(value: Long, digit: Int): Long {\n return when(digit){\n 1 -> value.absoluteValue\n else -> {\n val base = value / power(10L, digit - 1)\n (-1 .. 0).map{calMin(value - power(10L, digit) / 9 * (base + it), digit - 1) + (base + it).absoluteValue * digit}.min()!!\n }\n }\n}\nfun main(args: Array?): Unit {\n println(calMin(readLine()!!.trim().toLong(), 15))\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.absoluteValue\n\nfun Long.digit(): Int {\n return when(this) {\n 0L -> 0\n else -> 1 + (this / 10).digit()\n }\n}\nfun ones(digit: Int): Long {\n return when(digit){\n 1 -> 1L\n else -> ones(digit - 1) * 10 + 1\n }\n}\n\nfun main(args: Array?): Unit {\n var n = readLine()!!.trim().toLong()\n var sumDigit = 0\n while (n != 0L) {\n if (n > 0) {\n val d = n.digit()\n n -= ones(d)\n sumDigit += d\n }else {\n val d = n.absoluteValue.digit()\n n += ones(d)\n sumDigit += d\n }\n }\n println(sumDigit)\n}"}, {"source_code": "import kotlin.math.absoluteValue\nimport kotlin.random.Random\n\n\nfun power(base: Long, exp: Int): Long {\n return when(exp){\n 0 -> 1L\n 1 -> base\n else -> power(base * base, exp / 2) * power(base, exp % 2)\n }\n}\nfun calMin(value: Long, digit: Int, base: Long): Long {\n return when(digit){\n 1 -> value.absoluteValue\n else -> {\n val b = value / base\n (b .. b + 1).map{calMin(value - it * base, digit - 1, base / 10) + digit * it.absoluteValue}.min()!!\n }\n }\n}\nfun calMin2(value: Long, digit: Int, base: Long): Long {\n return when(digit){\n 1 -> value.absoluteValue\n else -> {\n (-10 .. 10).map{calMin(value - it * base, digit - 1, base / 10) + digit * it.absoluteValue}.min()!!\n }\n }\n}\nconst val digit = 15\nfun calMin(value: Long): Long = calMin(value, digit + 1, power(10L, digit + 1) / 9)\nfun calMin2(value: Long): Long = calMin2(value, digit + 1, power(10L, digit + 1) / 9)\nfun main(args: Array?): Unit {\n println(calMin(readLine()!!.trim().toLong()))\n}"}, {"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 size = IntArray(402){0}\n// var dp = Array(402, {IntArray(402)})\n// var adj = MutableList>(402) {_ -> mutableListOf()}\n// println(Arrays.toString(array))\n// println(Arrays.deepToString(array))\n// Pair\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(17, {Array(36, {Array(36, {Array(32, {1000000})})})})\nvar S = \"\"\n\nfun DP(at: Int, pos: Int, neg: Int, bc: Int): Int {\n if (at == 16) {\n if (bc == 0) return 0\n return 1000000\n }\n if (dp[at][pos][neg][bc + 16] != 1000000) {\n return dp[at][pos][neg][bc + 16]\n }\n dp[at][pos][neg][bc + 16] = 999999\n if (pos > 0) {\n var cur = DP(at, pos - 1, neg, bc)\n if (cur < dp[at][pos][neg][bc + 16]) dp[at][pos][neg][bc + 16] = cur\n }\n if (neg > 0) {\n var cur = DP(at, pos, neg - 1, bc)\n if (cur < dp[at][pos][neg][bc + 16]) dp[at][pos][neg][bc + 16] = cur\n }\n val now = bc + pos - neg\n var new_carry = 0\n if (now >= 0) new_carry = now / 10\n var new_borrow = 0\n if (now < 0) new_borrow = -((-now + 9) / 10)\n var last_degit = 0\n if (now >= 0) last_degit=now % 10\n else last_degit = (10 - (-now % 10)) % 10\n var expected = 0\n if (at < S.length) expected = (S[at] - '0').toInt()\n if (last_degit != expected) {\n return dp[at][pos][neg][bc + 16]\n }\n var cur = DP(at + 1, pos, neg, new_carry + new_borrow) + pos + neg\n if (cur < dp[at][pos][neg][bc + 16]) dp[at][pos][neg][bc + 16] = cur\n return dp[at][pos][neg][bc + 16]\n}\n\nfun main(args: Array) {\n S = readLn()\n S = S.reversed()\n var ans = 30000\n for (pos in 0..35) for (neg in 0..35) {\n if (pos == 1)\n ans = max(ans, 0)\n val cur = DP(0, pos, neg, 0)\n if (cur < ans) ans = cur\n //if (cur == 224) println(\"$pos $neg\")\n }\n println(ans)\n}\n"}, {"source_code": "import java.io.*\nimport java.lang.Math.abs\nimport java.util.*\nimport java.util.Arrays.sort\n\nfun main(args: Array){\n val s = readLine()\n val n = s!!.length\n val a = IntArray(n)\n for (i in 0..n - 1) a[i] = (s[i] - '0')\n var ans = 0\n for (i in 0..n - 1){\n val d = a[i]\n for (j in i..n - 1){\n a[j] -= d\n ans += abs(d)\n }\n }\n println(ans)\n}"}, {"source_code": "import java.io.*\nimport kotlin.math.*\nimport kotlin.collections.*\n\nfun main() = bufferOut { readSolveWrite() }\n\nprivate fun PrintWriter.readSolveWrite() {\n val s = readLine()!!.map{it.toInt() - 48}.toIntArray()\n val n = s.size\n var ans = 0\n for (i in 0..n - 1)\n if (s[i] != 0) {\n ans += (n - i) * abs(s[i])\n for (j in i + 1..n - 1)\n s[j] -= s[i]\n }\n println(ans)\n}\n\nprivate fun ok(x: Boolean) = if (x) 1 else 0// {{{\n\nprivate fun getIntArray() = readLine()!!.splitToIntArray()\n\nprivate fun bufferOut(block: PrintWriter.() -> Unit) = PrintWriter(System.out).use { block(it) }\n\ndata class Pt(val x: Int, val y: Int, val i: Int, var ans: Int)\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 in 0..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"}, {"source_code": "import java.io.OutputStream\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.PrintWriter\nimport java.util.Scanner\nimport kotlin.math.min\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 solve(1, `in`, out)\n out.close()\n}\n\nfun lower(x: Long): Long {\n var ret: Long = 1\n while (x >= ret) {\n ret = ret * 10 + 1\n }\n ret = (ret - 1) / 10\n return ret\n}\n\nfun f(x: Long, y: Long): Long {\n if (x == 0L) return 0\n val l = lower(x)\n val u = l * 10 + 1\n var a = l.toString().length * 1L\n val b = a + 1\n a = x / l * a + f(x % l, l)\n if (u < y) a = min(a, b + f(u - x, u))\n return a\n}\n\nfun solve(testNumber: Int, `in`: Scanner, out: PrintWriter) {\n val n = `in`.nextLong()\n out.println(f(n, 1111111111111111L))\n}\n\n\n"}, {"source_code": "import kotlin.math.*\nfun main(args: Array) {\n var x = \"0\".plus(readLine()!!).toCharArray()\n var xx: Array = x.map{it.toInt()-'0'.toInt()}.toTypedArray() \n val n = x.size\n var sum =0\nfor(i in n-1 downTo 1 ) {xx[i]-=xx[i-1];sum+=abs(xx[i]*(n-i));}\n//for(d in xx)print(\"$d \")\n//println(\"$sum\")\nfor(i in n-1 downTo 1 ) if((xx[0]>6)||(i>0&&xx[i]>=6)){xx[i-1]++;xx[i]=xx[i]-10;xx[n-1]--;}\nfor(i in n-1 downTo 1 ) if((xx[0]<-6)||(i>0&&xx[i]<=-6)){xx[i-1]--;xx[i]=xx[i]+10;xx[n-1]++;}\nsum=0\nfor(i in n-1 downTo 0 ) {sum+=abs(xx[i]*(n-i));}\nvar xxx=1L\nvar xxxx=0L\nfor(i in n-1 downTo 0 ){xxxx+=xx[i]*xxx;xxx=xxx*10+1;} \n//println(\"$xxxx\")\n//for(d in xx)print(\"$d \")\nprintln(\"$sum\")\n}"}, {"source_code": "import kotlin.math.*\nfun main(args: Array) {\n var x = \"0\".plus(readLine()!!).toCharArray()\n var xx: Array = x.map{it.toInt()-'0'.toInt()}.toTypedArray() \n val n = x.size\n var sum = 0\n var sum1 =0\nfor(i in n-1 downTo 1 ) {xx[i]-=xx[i-1];sum1+=abs(xx[i]*(n-i));}\nwhile (sum!=sum1) {\nsum1=sum\n//for(d in xx)print(\"$d \")\n//println(\"$sum\")\nfor(i in n-1 downTo 1 ) if((xx[n-1]>6)||(i=6)){xx[i-1]++;xx[i]=xx[i]-10;xx[n-1]--;}\nfor(i in n-1 downTo 1 ) if((xx[n-1]<-6)||(i) {\n var x = \"0\".plus(readLine()!!).toCharArray()\n var xx: Array = x.map{it.toInt()-'0'.toInt()}.toTypedArray() \n val n = x.size\n var sum =0\nfor(i in n-1 downTo 1 ) {xx[i]-=xx[i-1];sum+=abs(xx[i]*(n-i));}\nfor(i in n-1 downTo 1 ) if(xx[i]>=6){xx[i-1]++;xx[i]=xx[i]-10;xx[n-1]--;}\nfor(i in n-1 downTo 1 ) if(xx[i]<=-6){xx[i-1]--;xx[i]=xx[i]+10;xx[n-1]++;}\nsum=0\nfor(i in n-1 downTo 0 ) {sum+=abs(xx[i]*(n-i));}\nvar xxx=1L\nvar xxxx=0L\nfor(i in n-1 downTo 0 ){xxxx+=xx[i]*xxx;xxx=xxx*10+1;} \n//println(\"$xxxx\")\n//for(d in xx)print(\"$d \")\nprintln(\"$sum\")\n}"}, {"source_code": "import kotlin.math.*\nfun main(args: Array) {\n var x = \"0\".plus(readLine()!!).toCharArray()\n var xx: Array = x.map{it.toInt()-'0'.toInt()}.toTypedArray() \n val n = x.size\n var sum =0\nfor(i in n-1 downTo 1 ) {xx[i]-=xx[i-1];sum+=abs(xx[i]*(n-i));}\nfor(i in n-1 downTo 1 ) if(xx[i]>=6){xx[i-1]++;xx[i]=xx[i]-10;xx[n-1]--;}\nfor(i in n-1 downTo 1 ) if(xx[i]<=-6){xx[i-1]--;xx[i]=xx[i]+10;xx[n-1]++;}\nfor(i in n-1 downTo 1 ) if(xx[i]>=6){xx[i-1]++;xx[i]=xx[i]-10;xx[n-1]--;}\nfor(i in n-1 downTo 1 ) if(xx[i]<=-6){xx[i-1]--;xx[i]=xx[i]+10;xx[n-1]++;}\nsum=0\nfor(i in n-1 downTo 0 ) {sum+=abs(xx[i]*(n-i));}\nvar xxx=1L\nvar xxxx=0L\n//for(i in n-1 downTo 0 ){xxxx+=xx[i]*xxx;xxx=xxx*10+1;}\n//for(d in xx)print(\"$d \")\nprintln(\"$sum\")\n}"}, {"source_code": "import kotlin.math.*\nfun main(args: Array) {\n var x = \"0\".plus(readLine()!!).toCharArray()\n var xx: Array = x.map{it.toInt()-'0'.toInt()}.toTypedArray() \n val n = x.size\n var sum =0\nfor(i in n-1 downTo 1 ) {xx[i]-=xx[i-1];sum+=abs(xx[i]*(n-i));}\n//for(d in xx)print(\"$d \")\n//println(\"$sum\")\nfor(i in n-1 downTo 1 ) if((xx[n-1]>6)||(i=6)){xx[i-1]++;xx[i]=xx[i]-10;xx[n-1]--;}\nfor(i in n-1 downTo 1 ) if((xx[n-1]<-6)||(i) {\n var x = \"0\".plus(readLine()!!).toCharArray()\n var xx: Array = x.map{it.toInt()-'0'.toInt()}.toTypedArray() \n val n = x.size\n var sum =0\n// println(x)\nfor(i in n-1 downTo 1 ) {xx[i]-=xx[i-1];sum+=abs(xx[i]*(n-i));}\n//for(d in xx)print(\"$d \")\n//println(\"sum=$sum \")\nfor(i in n-1 downTo 1 ) if(xx[i]>=6){xx[i-1]++;xx[i]=xx[i]-10;xx[n-1]--;}\nsum=0\nfor(i in n-1 downTo 0 ) {sum+=abs(xx[i]*(n-i));}\n//for(d in xx)print(\"$d \")\nprintln(\"$sum \")\n}"}, {"source_code": "fun readLn(): String = readLine()!!\nfun readInt(): Int = readLn().toInt()\nfun readInts(): MutableList = readLn().split(\" \").map { it.toInt() }.toMutableList()\nfun readLong(): Long = readLn().toLong()\n\nval results = mutableMapOf(0L to 0)\n\nfun preprocess() {\n val MAX = 1e16\n var x = 1L\n var ones = 1\n while (x < MAX) {\n results[x] = ones\n x = 10 * x + 1\n ones++\n }\n}\n\nfun firstSmallerOnes(number: Long): Pair {\n var x = 1L\n var ones = 1\n while (x < number) {\n x = 10 * x + 1\n ones++\n }\n x /= 10\n ones--\n return Pair(x, ones)\n}\n\nfun solve(number: Long): Int {\n if (number in results) return results[number]!!\n val (smallerOnes, ones) = firstSmallerOnes(number)\n\n val quotient = (number / smallerOnes).toInt()\n val remainder = number % smallerOnes\n var result = ones * quotient + solve(remainder)\n // println(\"$number $quotient $smallerOnes $remainder $result\")\n // results[number] = result\n\n val largerOnes = smallerOnes * 10 + 1\n val ones1 = ones + 1\n val quotient2 = (largerOnes / number).toInt()\n val remainder2 = largerOnes % number\n if (remainder2 < number) {\n result = Math.min(ones1 * quotient2 + solve(remainder2), result)\n results[number] = result\n }\n\n results[number] = result\n return result\n}\n\nfun main(args: Array) {\n preprocess()\n val number = readLong()\n println(solve(number))\n}\n\n"}, {"source_code": "fun readLn(): String = readLine()!!\nfun readInt(): Int = readLn().toInt()\nfun readInts(): MutableList = readLn().split(\" \").map { it.toInt() }.toMutableList()\nfun readLong(): Long = readLn().toLong()\n\nval results = mutableMapOf(0L to 0L)\n\nfun preprocess() {\n val MAX = 1e17\n var x = 1L\n var ones = 1L\n while (x < MAX) {\n results[x] = ones\n x = 10 * x + 1\n ones++\n }\n}\n\nfun firstSmallerOnes(number: Long): Pair {\n var x = 1L\n var ones = 1L\n while (x < number) {\n x = 10 * x + 1\n ones++\n }\n x /= 10\n ones--\n return Pair(x, ones)\n}\n\nfun solve(number: Long): Long {\n if (number in results) return results[number]!!\n val (smallerOnes, ones) = firstSmallerOnes(number)\n\n val quotient = number / smallerOnes\n val remainder = number % smallerOnes\n var result = ones * quotient + solve(remainder)\n // println(\"$number $quotient $smallerOnes $remainder $result\")\n // results[number] = result\n\n val largerOnes = smallerOnes * 10 + 1\n val ones1 = ones + 1\n val quotient2 = largerOnes / number\n val remainder2 = largerOnes % number\n if (remainder2 < number) {\n result = Math.min(ones1 * quotient2 + solve(remainder2), result)\n }\n\n results[number] = result\n return result\n}\n\nfun main(args: Array) {\n preprocess()\n val number = readLong()\n println(solve(number))\n}\n\n"}, {"source_code": "import java.util.*\nimport kotlin.math.min\n\nvar oneList = mutableListOf(0)\nvar problemResult = Int.MAX_VALUE\n\nfun main() {\n val read = Scanner(System.`in`)\n var start = 0L\n for (i in 1..16) {\n start = start * 10 + 1\n oneList.add(start)\n }\n val n = read.nextLong()\n dfs(getLength(n), n, 0)\n println(problemResult)\n}\n\n\n\nfun dfs(length : Int, num : Long, ans : Int) {\n if (length == 0) {\n problemResult = min(problemResult, ans)\n return\n }\n if (ans > problemResult) {\n return\n }\n if (num == oneList[length]) {\n val times = num.div(oneList[length])\n val ansNow = ans + length * times.toInt()\n dfs(0, 0, ansNow)\n } else {\n val times = num.div(oneList[length])\n val numNow = num - times * oneList[length]\n val ansNow = ans + length * times.toInt()\n dfs(length - 1, numNow, ansNow)\n dfs(length - 1, oneList[length] - numNow, ansNow + length)\n }\n}\nfun getLength(num: Long) : Int {\n var a = num\n var result = 0\n while (a > 0) {\n a /= 10\n result++\n }\n return result\n}\n"}, {"source_code": "import java.util.*\nimport kotlin.math.min\n\nvar oneList = mutableListOf(0)\nvar problemResult = Int.MAX_VALUE\n\nfun main() {\n val read = Scanner(System.`in`)\n var start = 0L\n for (i in 1..16) {\n start = start * 10 + 1\n oneList.add(start)\n }\n val n = read.nextLong()\n dfs(getLength(n), n, 0)\n println(problemResult)\n}\n\n\n\nfun dfs(length : Int, num : Long, ans : Int) {\n if (length == 0) {\n problemResult = min(problemResult, ans)\n return\n }\n if (ans > problemResult) {\n return\n }\n if (num % oneList[length] == 0L) {\n val times = num.div(oneList[length])\n val ansNow = ans + length * times.toInt()\n dfs(0, 0, ansNow)\n } else {\n val times = num.div(oneList[length])\n val numNow = num - times * oneList[length]\n val ansNow = ans + length * times.toInt()\n dfs(length - 1, numNow, ansNow)\n dfs(length - 1, oneList[length] - numNow, ansNow + length)\n }\n}\nfun getLength(num: Long) : Int {\n var a = num\n var result = 0\n while (a > 0) {\n a /= 10\n result++\n }\n return result\n}\n"}, {"source_code": "import java.util.*\nimport kotlin.math.min\n\nvar oneList = mutableListOf(0)\nvar problemResult = Int.MAX_VALUE\n\nfun main() {\n val read = Scanner(System.`in`)\n var start = 0L\n for (i in 1..15) {\n start = start * 10 + 1\n oneList.add(start)\n }\n val n = read.nextLong()\n dfs(getLength(n), n, 0)\n println(problemResult)\n}\n\n\n\nfun dfs(length : Int, num : Long, ans : Int) {\n if (length == 0) {\n problemResult = min(problemResult, ans)\n return\n }\n if (ans > problemResult) {\n return\n }\n if (num % oneList[length] == 0L) {\n val times = num.div(oneList[length])\n val ansNow = ans + length * times.toInt()\n dfs(0, 0, ansNow)\n } else {\n val times = num.div(oneList[length])\n val numNow = num - times * oneList[length]\n val ansNow = ans + length * times.toInt()\n dfs(length - 1, numNow, ansNow)\n dfs(length - 1, oneList[length] - numNow, ansNow + length)\n }\n}\nfun getLength(num: Long) : Int {\n var a = num\n var result = 0\n while (a > 0) {\n a /= 10\n result++\n }\n return result\n}\n"}, {"source_code": "import java.util.*\n\nval maxn = 200010\n\nfun next() = readLine()!!\nfun nextInt() = next().toInt()\nfun nextInts() = next().split(\" \").map { it.toInt() }\nfun nextLongs() = next().split(\" \").map { it.toLong() }\n\nval v = ArrayList()\n\n\nfun init(){\n var t : Long = 0\n for(i in 1..17){\n t *= 10\n t++\n v.add(t)\n }\n}\n\nfun solve(x : Long) : Long{\n\n if(x == 0.toLong())return 0\n\n var pos : Int = -1\n var ans : Long = x\n for(i in 0..16){\n if(v[i] > x){\n break\n }\n pos = i\n }\n\n\n\n if((v[pos+1] - x) < (x-v[pos])){\n ans = minOf(ans,solve(v[pos+1]-x) + pos + 2)\n }\n else {\n ans = minOf(ans,solve(x-v[pos]) + pos + 1)\n }\n return ans\n}\nfun main(argumento: Array){\n\n init()\n\n var n = readLine()!!.toLong()\n\n print(solve(n))\n\n\n}\n"}, {"source_code": "import java.io.PrintWriter\nimport java.lang.Math.abs\nimport java.lang.Math.min\n\nval pw = PrintWriter(System.out)\nfun main(args: Array) {\n var INF = 1000000000000000L\n var n = nextLong()\n var vs = mutableListOf(1L)\n repeat(15){\n vs.add(vs.get(it)*10+1)\n }\n var dp = mapOf(Pair(n,0L))\n var re = n;\n repeat(100){\n// dp.forEach { t, u -> print(\"${t} ${u}\\n\")}\n// println(\"\")\n var nxt = mutableMapOf()\n var upd = { key:Long, value:Long ->\n var cur = nxt.getOrDefault(key, INF)\n nxt.put(key, min(cur, value))\n }\n dp.forEach { n_, c ->\n var n = abs(n_)\n if(n==0L){\n re= min(re, c)\n return@forEach\n }\n var i = n.toString().length-1\n var t=n/vs[i]\n upd(n-t*vs[i], c+(i+1)*t)\n if(n%vs[i]>0) upd((t+1)*vs[i]-n, c+(i+1)*(t+1))\n }\n dp=nxt\n }\n print(re)\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"}, {"source_code": "fun main() {\n val n = readLine()!!\n var balance = 0\n var res = 0\n var cnt = 0\n for (c in n) {\n val g = c.toInt() - '0'.toInt()\n cnt += Math.abs(g - balance)\n res += cnt\n balance = g\n }\n println(res)\n}"}, {"source_code": "fun main() {\n val n = readLine()!!\n var balance = 0\n var res = 0L\n var cnt = 0L\n for (c in n) {\n val g = c.toInt() - '0'.toInt()\n cnt += Math.abs(g - balance)\n res += cnt\n balance = g\n }\n println(res)\n}"}, {"source_code": "import kotlin.math.min\n\nval addends = listOf(\n 0,\n 1L,\n 11L,\n 111L,\n 1_111L,\n 11_111L,\n 111_111L,\n 1_111_111L,\n 11_111_111L,\n 111_111_111L,\n 1_111_111_111L,\n 11_111_111_111L,\n 111_111_111_111L,\n 1_111_111_111_111L,\n 11_111_111_111_111L,\n 111_111_111_111_111L,\n 1_111_111_111_111_111L\n)\n\nfun main() {\n val number = readLine()!!.toLong()\n println(findMinimumDigits(number))\n}\n\nfun findMinimumDigits(number: Long): Int {\n if (number <= 11) return min(number, 13 - number).toInt()\n var i = addends.size - 1\n while (addends[i] >= number) i--\n\n if (i + 1 < addends.size && number == addends[i + 1]) return i + 1\n\n val addendA = addends[i]\n val timesA = number / addendA\n val remainderA = number % addendA\n\n val numberOfDigitsA = if (timesA < 10) (i * timesA + findMinimumDigits(remainderA)).toInt() else Int.MAX_VALUE\n if (i + 1 == addends.size) return numberOfDigitsA\n\n val addendB = if (timesA >= 9L) addends[i + 1] else addends[i]\n val timesB = if (timesA >= 9L) 1L else timesA + 1\n val remainderB = addendB * timesB - number\n\n val numberOfDigitsB = (addendB.toString().length * timesB + findMinimumDigits(remainderB)).toInt()\n\n return min(numberOfDigitsA, numberOfDigitsB)\n}\n"}, {"source_code": "import kotlin.math.min\n\nval addends = listOf(\n 0,\n 1L,\n 11L,\n 111L,\n 1_111L,\n 11_111L,\n 111_111L,\n 1_111_111L,\n 11_111_111L,\n 111_111_111L,\n 1_111_111_111L,\n 11_111_111_111L,\n 111_111_111_111L,\n 1_111_111_111_111L,\n 11_111_111_111_111L,\n 111_111_111_111_111L,\n 1_111_111_111_111_111L\n)\n\nfun main() {\n val number = readLine()!!.toLong()\n println(findMinimumDigits(number))\n}\n\nfun findMinimumDigits(number: Long): Int {\n if (number <= 11) return min(number, 13 - number).toInt()\n var i = addends.size - 1\n while (addends[i] >= number) i--\n\n if (i + 1 < addends.size && number == addends[i + 1]) return i + 1\n\n val addendA = addends[i]\n val timesA = number / addendA\n val remainderA = number % addendA\n\n val numberOfDigitsA = (i * timesA + findMinimumDigits(remainderA)).toInt()\n if (i + 1 == addends.size) return numberOfDigitsA\n\n val addendB = if (timesA == 9L) addends[i + 1] else addends[i]\n val timesB = if (timesA == 9L) 1L else timesA + 1\n val remainderB = addendB * timesB - number\n\n val numberOfDigitsB = (i * timesB + findMinimumDigits(remainderB)).toInt()\n\n return min(numberOfDigitsA, numberOfDigitsB)\n}\n"}, {"source_code": "import kotlin.math.min\n\nval addends = listOf(\n 0,\n 1L,\n 11L,\n 111L,\n 1_111L,\n 11_111L,\n 111_111L,\n 1_111_111L,\n 11_111_111L,\n 111_111_111L,\n 1_111_111_111L,\n 11_111_111_111L,\n 111_111_111_111L,\n 1_111_111_111_111L,\n 11_111_111_111_111L,\n 111_111_111_111_111L,\n 1_111_111_111_111_111L\n)\n\nfun main() {\n val number = readLine()!!.toLong()\n println(findMinimumDigits(number))\n}\n\nfun findMinimumDigits(number: Long): Int {\n println(\"findMinimumDigits($number)\")\n if (number <= 11) return min(number, 13 - number).toInt()\n var i = addends.size - 1\n while (addends[i] >= number) i--\n\n if (i + 1 < addends.size && number == addends[i + 1]) return i + 1\n\n val addendA = addends[i]\n val timesA = number / addendA\n val remainderA = number % addendA\n\n val numberOfDigitsA = if (timesA < 10) (i * timesA + findMinimumDigits(remainderA)).toInt() else Int.MAX_VALUE\n if (i + 1 == addends.size) return numberOfDigitsA\n\n val addendB = if (timesA >= 9L) addends[i + 1] else addends[i]\n val timesB = if (timesA >= 9L) 1L else timesA + 1\n val remainderB = addendB * timesB - number\n\n val numberOfDigitsB = (addendB.toString().length * timesB + findMinimumDigits(remainderB)).toInt()\n\n val numberOfDigitsC = if (timesA >= 9L) {\n Int.MAX_VALUE\n } else {\n val addendC = addends[i + 1]\n val timesC = 1\n val remainderC = addendC * timesC - number\n if (remainderC > number) Int.MAX_VALUE else (i + 1) * timesC + findMinimumDigits(remainderC)\n }\n\n return min(min(numberOfDigitsA, numberOfDigitsB), numberOfDigitsC)\n}"}, {"source_code": "import kotlin.math.absoluteValue\n\nfun main(){\n var n : Long = readLine()!!.toLong()\n var res: Long = 0;\n\n res = calculate(15, n)\n\n println(res)\n}\n\nfun calculate(x: Int, n: Long) : Long{\n var sum : Long = 0\n var divisionNumber : Long = 1\n var div: Long = 0\n if (x != 1) {\n for (i in 1 until x) {\n divisionNumber = divisionNumber * 10 + 1\n }\n div = n/divisionNumber\n sum = if(div == 0.toLong() && n/(divisionNumber/10) == 0.toLong()) {\n 0 + calculate(x-1, n)\n }else {\n var posSum: Long = calculate(x - 1, n - (div * divisionNumber))\n var negSum: Long = calculate(x - 1, (n - ((div + 1) * divisionNumber)).absoluteValue)\n if (posSum <= negSum + x) {\n (div) * (x) + posSum\n } else {\n (div + 1) * (x) + negSum\n }\n }\n }else{\n sum = n.absoluteValue\n }\n println(\"n: $n, x: $x, div: $divisionNumber, n/div: $div, sum: $sum \")\n return sum\n}"}, {"source_code": "import kotlin.math.absoluteValue\n\nfun main(){\n var n : Long = readLine()!!.toLong()\n var res: Long = 0;\n\n res = calculate(14, n)\n\n println(res)\n}\n\nfun calculate(x: Int, n: Long) : Long{\n var sum : Long = 0\n var divisionNumber : Long = 1\n var div: Long = 0\n if (x != 1) {\n for (i in 1 until x) {\n divisionNumber = divisionNumber * 10 + 1\n }\n div = n/divisionNumber\n sum = if(div == 0.toLong() && n/(divisionNumber/10) == 0.toLong()) {\n 0 + calculate(x-1, n)\n }else {\n var posSum: Long = calculate(x - 1, n - (div * divisionNumber))\n var negSum: Long = calculate(x - 1, (n - ((div + 1) * divisionNumber)).absoluteValue)\n if (posSum <= negSum + x) {\n (div) * (x) + posSum\n } else {\n (div + 1) * (x) + negSum\n }\n }\n }else{\n sum = n.absoluteValue\n }\n return sum\n}"}, {"source_code": "import kotlin.math.absoluteValue\n\nfun main(){\n var n : Long = readLine()!!.toLong()\n var res: Long = 0;\n\n res = calculate(15, n)\n\n println(res)\n}\n\nfun calculate(x: Int, n: Long) : Long{\n var sum : Long = 0\n var divisionNumber : Long = 1\n var div: Long = 0\n if (x != 1) {\n for (i in 1 until x) {\n divisionNumber = divisionNumber * 10 + 1\n }\n div = n/divisionNumber\n sum = if(div == 0.toLong() && n/(divisionNumber/10) == 0.toLong()) {\n 0 + calculate(x-1, n)\n }else {\n var posSum: Long = calculate(x - 1, n - (div * divisionNumber))\n var negSum: Long = calculate(x - 1, (n - ((div + 1) * divisionNumber)).absoluteValue)\n if (posSum <= negSum + x) {\n (div) * (x) + posSum\n } else {\n (div + 1) * (x) + negSum\n }\n }\n }else{\n sum = n.absoluteValue\n }\n return sum\n}"}, {"source_code": "import java.util.*\n\nprivate fun readLn(): String = readLine()!!\nprivate fun readInt(): Int = readLn().toInt()\nprivate fun readLong(): Long = readLn().toLong()\nprivate fun readStrings(): List = readLn().split(\" \")\nprivate fun readInts(): List = readStrings().map {it.toInt()}\nprivate fun readLongs(): List = readStrings().map {it.toLong()}\nprivate fun , S: Comparable> pairComparator() = \n compareBy(Pair::first, Pair::second)\nprivate fun , S: Comparable, T: Comparable> tripleComparator() = \n compareBy(Triple::first, Triple::second, Triple::third)\n\n\nfun repUnit(numOnes: Int): Long {\n return (Math.pow(10.0, numOnes.toDouble()).toLong() - 1) / 9;\n}\n\nvar n: Long = 0\n\nfun go(cur: Long, ones: Int): Long {\n if (ones == 0 || cur == n) {\n return 0\n } else if (ones == 1) {\n return Math.abs(n - cur)\n } else {\n val power = repUnit(ones)\n val diff: Long = Math.abs(n - cur)\n val sgn = if (n - cur < 0) -1 else 1\n val hi_mult = (power + diff - 1) / power\n val lo_mult = hi_mult - 1\n return Math.min(\n go(cur + sgn * lo_mult * power, ones - 1) + lo_mult * ones,\n go(cur + sgn * hi_mult * power, ones - 1) + hi_mult * ones\n )\n }\n}\n\nfun main(args: Array) {\n n = readLong()\n var p = 1\n while (repUnit(p + 1) <= n) {\n p++\n }\n var power = repUnit(p)\n var ans = go((n / power) * power, p - 1) + p * (n / power)\n power = repUnit(p + 1)\n ans = Math.min(ans, go(power, p) + p + 1)\n println(ans)\n}"}, {"source_code": "fun main(args: Array) {\n val s = readLine()!!\n var mx = 0\n var ans = 0\n \n var sz = s.length\n \n for(i in 0 until sz){\n ans += Math.abs(mx - (s[i] - '0')) * (sz - i)\n mx = s[i] - '0'\n }\n println(ans)\n}\n"}, {"source_code": "import java.util.*;\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n\tsolve(next());\n//\tfor (i in 1..100) {\n//\t\tprint(i.toString() + \" \");\n//\t\tsolve(i.toString());\n//\t}\n}\n\nfun solve(c: String) {\n\t//var c = next();\n\tvar ans = 0L;\n\tvar a = ArrayList();\n\tfor (i in 0..c.length-1) {\n\t\ta.add(0);\n\t}\n\tfor (i in 0..c.length-1) {\n\t\tvar cur = c[i] - '0';\n\t\tif (cur == a[i]) continue;\n\t\tif (cur < a[i]) {\n\t\t\tfor (j in i..c.length-1) {\n\t\t\t\tans += a[j] - cur;\n\t\t\t\ta[j] = cur;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tfor (j in i..c.length-1) {\n\t\t\t\tans += cur - a[j];\n\t\t\t\ta[j] = cur;\n\t\t\t}\n\t\t}\n\t}\n\tvar cur = 0L;\n\tvar ans2 = 0L;\n\tvar add = 1L;\n\tvar sum = 1L;\n\tvar n = c.toLong();\n\twhile (add * 10 + 1 <= n) {\n\t\tadd = add * 10 + 1;\n\t\tsum++;\n\t}\n\tadd = add * 10 + 1;\n\tsum++;\n\tcur += n / add * add;\n\tans2 += n / add * sum;\n\tif (cur < n) {\n\t\tcur += add;\n\t\tans2+=sum;\n\t}\n\tvar sub = 1L;\n\tvar sum1 = 1L;\n\twhile (cur > n) {\n\t\tvar dif = cur - n;\n\t\twhile (sub * 10 + 1 <= dif) {\n\t\t\tsub = sub * 10 + 1;\n\t\t\tsum1++;\n\t\t}\n\t\twhile (sub > dif) {\n\t\t\tsub = (sub - 1) / 10;\n\t\t\tsum1--;\n\t\t}\n\t\tvar tim = dif / sub;\n\t\tcur -= sub * tim;\n\t\tans2 += sum1 * tim;\n\t}\n\tprint(Math.min(ans, ans2));\n\tprintln();\n}\n"}, {"source_code": "import java.util.*;\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n\tvar n = nextLong();\n\tvar ans = n;\n\tvar sum = 0L;\n\tvar cur = 0L;\n\tvar cnt = 1L;\n\tvar add = 1L;\n\twhile (cur < ans) {\n\t\twhile (cur + add * 10 + 1 > ans) {\n\t\t\tadd = (add - 1) / 10;\n\t\t\tcnt--;\n\t\t}\n\t\twhile (cur + add * 10 + 1 <= ans) {\n\t\t\tadd = add * 10 + 1;\n\t\t\tcnt++;\n\t\t}\n\t\tsum += cnt;\n\t\tcur += add;\n\t}\n\tans = Math.min(ans, sum);\n\tvar ad2 = 1L;\n\tvar cnt2 = 1L;\n\tvar ad3 = 1L;\n\tvar cnt3 = 1L;\n\twhile (ad2 * 10 + 1<= n) {\n\t\tad2 = ad2 * 10 + 1;\n\t\tcnt2++;\n\t\tad3 = ad3 * 10 + 1;\n\t\tcnt3++;\n\t}\n\tif (ad2 > 1) {\n\t\tad3 = (ad3 - 1) / 10;\n\t\tcnt3--;\n\t}\n\tsum = cnt2 + cnt3;\n\tcur = ad2 + ad3;\n\twhile (cur > n) {\n\t\tvar nn = cur - n;\n\t\tvar sub = 1L;\n\t\tvar cnt4 = 1L;\n\t\twhile (nn - (sub * 10 + 1) >= 0) {\n\t\t\tcnt4++;\n\t\t\tsub = sub * 10 + 1;\n\t\t}\n\t\tcur -= sub;\n\t\tsum += cnt4;\n\t}\n\tans = Math.min(ans, sum);\n\tprint(ans);\n}"}, {"source_code": "import java.util.*;\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n\tvar c = next();\n\tvar ans = 0L;\n\tvar a = ArrayList();\n\tfor (i in 0..c.length-1) {\n\t\ta.add(0);\n\t}\n\tfor (i in 0..c.length-1) {\n\t\tvar cur = c[i] - '0';\n\t\tif (cur == a[i]) continue;\n\t\tif (cur < a[i]) {\n\t\t\tfor (j in i..c.length-1) {\n\t\t\t\tans += a[j] - cur;\n\t\t\t\ta[j] = cur;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tfor (j in i..c.length-1) {\n\t\t\t\tans += cur - a[j];\n\t\t\t\ta[j] = cur;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprint(ans);\n}\n\nfun solve(n: Long) {\n\tvar ans = n;\n\tvar sum = 0L;\n\tvar cur = 0L;\n\tvar cnt = 1L;\n\tvar add = 1L;\n\twhile (cur < n) {\n\t\twhile (cur + add * 10 + 1 > n) {\n\t\t\tadd = (add - 1) / 10;\n\t\t\tcnt--;\n\t\t}\n\t\twhile (cur + add * 10 + 1 <= n) {\n\t\t\tadd = add * 10 + 1;\n\t\t\tcnt++;\n\t\t}\n\t\tvar tim = (n - cur) / add;\n\t\tsum += cnt * tim;\n\t\tcur += add * tim;\n\t}\n\tans = Math.min(ans, sum);\n\t\n\tvar ad2 = 1L;\n\tvar cnt2 = 1L;\n\tvar ad3 = 1L;\n\tvar cnt3 = 1L;\n\twhile (ad2 * 10 + 1 <= n) {\n\t\tad2 = ad2 * 10 + 1;\n\t\tcnt2++;\n\t\tad3 = ad3 * 10 + 1;\n\t\tcnt3++;\n\t}\n\tad2 = ad2 * 10 + 1;\n\tcnt2++;\n\tad3 = ad3 * 10 + 1;\n\tcnt3++;\n\tif (ad2 > 1) {\n\t\tad3 = (ad3 - 1) / 10;\n\t\tcnt3--;\n\t}\n\tsum = 0L;\n\tcur = 0L;\n\twhile (cur < n) {\n\t\tcur += ad2;\n\t\tsum += cnt2;\n\t}\n\tif (cur != n) {\n\t\tcur += ad3;\n\t\tsum += cnt3;\n\t}\n\t//print(cnt2);\n\twhile (cur > n) {\n\t\tvar nn = cur - n;\n\t\tvar sub = 1L;\n\t\tvar cnt4 = 1L;\n\t\twhile (nn - (sub * 10 + 1) >= 0) {\n\t\t\tcnt4++;\n\t\t\tsub = sub * 10 + 1;\n\t\t}\n\n\t\tvar tim = (cur - n) / add;\n\t\t\n\t\tcur -= sub * tim;\n\t\tsum += cnt4 * tim;\n\t}\n\tans = Math.min(ans, sum);\n\tprint(ans);\n}"}, {"source_code": "fun Int.digitsCount() = toString().length\n\nfun Int.repeat(n: Int) = toString().repeat(n).toInt()\n\nfun main() {\n val n = readLine()!!.toInt()\n var number = n\n var ones = 0\n// var count = 0\n while (true) {\n// count++\n val digits = number.digitsCount()\n val onesNumber = 1.repeat(digits)\n val rem = number%onesNumber\n val quo = number/onesNumber\n// print(number, onesNumber, rem, quo, ones)\n if (rem.digitsCount() == digits) {\n number = onesNumber - rem\n ones += quo*digits + digits\n } else {\n number = rem\n ones += quo*digits\n }\n if (number.digitsCount() == 1) {\n ones += number\n break\n }\n// if (count == 50) break\n }\n println(ones)\n// println(count)\n}"}, {"source_code": "import kotlin.math.*\n \nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n \nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n \nfun get1(_l:Int):Long{\n var n = _l\n if (n == 0)\n return 1\n var ret = 1L\n while(n > 1)\n {\n ret=1 + ret * 10\n n--\n }\n return ret\n}\n \n \nfun main() {\n val n =readLong()\n val res = getCount(n, getLength(n) + 1 )\n println(res)\n println(get1Count(res))\n}\n \nfun get1Count(lst:List):Int\n{\n var ret = 0\n for(i in 0 until lst.size)\n { \n val item = lst[i]\n ret+=(i+1)*item.absoluteValue\n }\n return ret\n}\n \nfun getCount(_n:Long, _l:Int):MutableList\n{ \n if (_n ==0L && _l ==0)\n return mutableListOf()\n \n var n =if (_n> 0) _n else -_n\n \n val l = _l\n \n if (l == 1)\n { \n return mutableListOf(n.toInt()) \n }\n \n \n val l1 = get1(l)\n \n val bDigit = (n / l1).toInt() \n val tDigit = bDigit + 1\n \n val solb = getCount(n - l1 * bDigit, l - 1)\n val vb = get1Count(solb) + bDigit * l\n \n val solt = getCount(l1 * tDigit - n, l - 1) \n for (i in 0 until solt.size) {\n solt[i] = -solt[i]\n }\n val vt = get1Count(solt) + tDigit * l\n\n if (vb < vt)\n {\n solb.add(0)\n solb[l-1] = bDigit\n return solb\n }\n else\n {\n solt.add(0)\n solt[l-1] = tDigit\n return solt \n }\n\n \n}\n"}, {"source_code": "import kotlin.math.*\n\nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\nfun readLongs() = readStrings().map { it.toLong() } // list of ints\nfun readLong() = readLn().toLong() // list of strings\n\nfun getLength(_n:Long):Int{\n var n = _n\n if (n == 0L)\n return 0\n var ret = 0\n while(n > 0L)\n {\n ret++\n n = n / 10\n }\n return ret\n}\n\nfun get1(_l:Int):Long{\n var n = _l\n if (n == 0)\n return 1\n var ret = 1L\n while(n > 1)\n {\n ret=1 + ret * 10\n n--\n }\n return ret\n}\n\n\nfun main() {\n \n println(getCount(readLong()))\n}\n\n\nfun getCount(_n:Long):Long\n{ \n if (_n ==0L)\n return 0\n\n var n =if (_n> 0) _n else -_n\n \n val l = getLength(n)\n \n if (l == 1)\n return min(n, 13 - n)\n\n val l1 = get1(l)\n \n val digit = n / l1\n var bdigit = digit + 1\n var nbottom = digit * l1\n var ntop = (bdigit) * l1\n if (n % l1 ==0L)\n {\n ntop = nbottom \n bdigit = digit \n }\n \n \n val ntopadd = getCount(ntop - n)\n \n val v1 = bdigit * l + ntopadd\n val v2 = l + 2 + l * (10 - bdigit) + ntopadd\n\n var ret = min(v1, v2)\n if (ntop != nbottom && nbottom > 0)\n {\n val ntopadd2 = getCount(n - nbottom)\n \n val v3 = digit * l + ntopadd2\n val v4 = l + 2 + l * (10 - digit) + ntopadd2\n ret = min(ret, v3)\n ret = min(ret, v4)\n }\n return ret\n}"}, {"source_code": "fun absoluteValue(n: Long): Long {\n if (n < 0) {\n return -n;\n } else {\n return n;\n }\n}\n\nfun answer(n: Long, position: Int, ones: Array): Long {\n if (position == 0) {\n return absoluteValue(n)\n }\n var local_n: Long = n\n var lower_bound: Long = local_n / ones[position]\n local_n %= ones[position]\n if (n == 0L) {\n return lower_bound * position;\n }\n return lower_bound * position + \n minOf(position + answer(ones[position] - local_n, position - 1, ones),\n answer(local_n, position - 1, ones));\n}\n\nfun main() {\n var n: Long = readLine()!!.toLong()\n var ones: Array = arrayOf(0L, 1L, 11L, 111L, 1111L, 11111L, 111111L, 1111111L, 11111111L, 111111111L, \n 1111111111L, 11111111111L, 111111111111L, 1111111111111L, 11111111111111L, 111111111111111L, \n 111111111111111L, 1111111111111111L, 11111111111111111L, 111111111111111111L, 1111111111111111111L)\n println(\"${answer(n, 16, ones)}\")\n}"}, {"source_code": "fun answer(n: Long, position: Int, ones: Array): Long {\n var local_n: Long = n\n var lower_bound: Long = local_n / ones[position]\n local_n %= ones[position]\n if (local_n == 0L) {\n return lower_bound * position;\n }\n return lower_bound * position + \n minOf(position + answer(ones[position] - local_n, position - 1, ones),\n answer(local_n, position - 1, ones));\n}\n\nfun main() {\n var n: Long = readLine()!!.toLong()\n var ones: Array = arrayOf(0L, 1L, 11L, 111L, 1111L, 11111L, 111111L, 1111111L, 11111111L, 111111111L, \n 1111111111L, 11111111111L, 111111111111L, 1111111111111L, 11111111111111L, 111111111111111L, \n 111111111111111L, 1111111111111111L, 11111111111111111L, 111111111111111111L, 1111111111111111111L)\n println(\"${answer(n, 16, ones)}\")\n}"}, {"source_code": "import kotlin.math.min\n\nvar memo = mutableListOf()\nfun calculate(number: Long): Long {\n val res: Long\n var i = 16\n if (number <= 11) return min(number, 2 + 11 - number)\n\n while (memo[i - 1] >= number) i--\n\n res = ((number / memo[i - 1]) * (i - 1)) + calculate(number % memo[i - 1])\n if (number < memo[i] - number) return res\n return min(res, i + calculate(memo[i] - number))\n}\n\nfun main(args: Array) {\n val n = readLine()!!.toLong()\n memo.add(0)\n memo.add(1)\n for (i in 2 until 16) memo.add(10 * memo[i - 1] + 1)\n memo.add(0)\n memo.add(0)\n print(calculate(n))\n}"}, {"source_code": "import kotlin.math.abs\n\nfun closest11(num: Long): Long {\n val len = num.toString().length\n val a = \"1\".repeat(len).toLong()\n val b = \"1\".repeat(len +1).toLong()\n val diffA = abs(a - num)\n val diffB = abs(b - num)\n return if (diffA > diffB) b else a\n}\n\nfun solve(num: Long): Int {\n if (num == 0L) {\n return 0\n }\n val closest = closest11(num)\n return solve(abs(num - closest)) + closest.toString().length\n}\n\nfun readNumsLine(): List {\n return readLine()!!.split(\"\\\\s\".toRegex()).map { it.toLong() }\n}\n\nfun main() {\n val (num) = readNumsLine()\n\n println(solve(num))\n}\n"}, {"source_code": "import kotlin.math.abs\n\nfun closest11(num: Long): Long {\n val len = num.toString().length\n val a = \"1\".repeat(len).toLong()\n val b = \"1\".repeat(len +1).toLong()\n val diffA = abs(a - num)\n val diffB = abs(b - num)\n return if (diffA > diffB) b else a\n}\n\nfun solve(num: Long): Int {\n if (num == 1L) {\n return 1\n }\n val closest = closest11(num)\n return solve(abs(num - closest)) + closest.toString().length\n}\n\nfun readNumsLine(): List {\n return readLine()!!.split(\"\\\\s\".toRegex()).map { it.toLong() }\n}\n\nfun main() {\n val (num) = readNumsLine()\n\n println(solve(num))\n}\n"}, {"source_code": "fun method(array: IntArray, left: Int, right: Int, value: Int): Int {\n if(left >= right)\n return 0\n else if(left == right - 1)\n if(array[left] == value)\n return 1\n else\n return 0\n else {\n val middle = (left + right) / 2;\n\n return method(array, left, middle, value) + method(array, middle, right, value);\n }\n}\n\nfun main() {\n\n println(method(intArrayOf(1, 1, 1, 2, 2), 1, 3, 1))\n\n}"}, {"source_code": "import kotlin.math.min\n\nprivate fun readInt() = readLine()!!.toInt()\nprivate fun readLong() = readLine()!!.toLong()\nprivate fun readIntList() = readLine()!!.split(\" \").map { it.toInt() }\nprivate fun readLongList() = readLine()!!.split(\" \").map { it.toLong() }\nprivate fun readString() = readLine()!!\n\nconst val maxl = 15\nconst val NEG = 1\nconst val ZERO = 0\nconst val POS = 2\n\nval mask = IntArray(maxl).toMutableList()\nvar bestAns = Long.MAX_VALUE\nval ONES = (0..maxl).map { createOnes(it) }\n\nfun createMask(pos: Int, initialN:Long, prevNonZeroId:Int = -1, initialAns:Long = 0) {\n if (pos == maxl) {\n if (initialN == 0L) {\n bestAns = min(bestAns, initialAns)\n }\n } else {\n val curTerm = ONES[maxl - pos]\n\n for (maskValue in 0..2) {\n var ok = true\n var curN = initialN\n var curAns = initialAns\n mask[pos] = maskValue\n\n var nextNonZeroId = prevNonZeroId\n\n when (mask[pos]) {\n POS -> {\n if (prevNonZeroId != -1 && curN < 0 && mask[prevNonZeroId] == NEG) {\n curN += ONES[maxl - prevNonZeroId]\n curAns += maxl - prevNonZeroId\n } else if (curN < 0) {\n ok = false\n }\n val toAdd = curN / curTerm\n curAns += (maxl - pos) * toAdd\n curN -= curTerm * toAdd\n nextNonZeroId = pos\n }\n NEG -> {\n if (prevNonZeroId != -1 && curN > 0 && mask[prevNonZeroId] == POS) {\n curN -= ONES[maxl - prevNonZeroId]\n curAns += maxl - prevNonZeroId\n } else if (curN > 0) {\n ok = false\n }\n val toAdd = curN / curTerm\n if (toAdd < 0) {\n curAns += (maxl - pos) * (-toAdd)\n curN += curTerm * (-toAdd)\n }\n nextNonZeroId = pos\n }\n }\n\n if (ok) {\n createMask(pos + 1, initialAns = curAns, initialN = curN, prevNonZeroId = nextNonZeroId)\n }\n }\n }\n}\n\nfun useMask(initialN: Long): Long {\n var ans = 0L\n var curN = initialN\n var prevNonZeroId = -1\n for (i in 0 until mask.size) {\n\n\n }\n return if (curN == 0L) ans else -1\n}\n\nfun createOnes(n:Int): Long {\n var ans = 0L\n repeat(n) {\n ans = ans * 10 + 1\n }\n return ans\n}\n\nfun test(n:Long) {\n mask[mask.size - 1] = NEG\n mask[mask.size - 2] = POS\n mask[mask.size - 3] = POS\n assert(useMask(n) == 6L)\n}\n\nfun main() {\n val n = readLong()\n\n //test(n)\n\n createMask(0, n)\n println(bestAns)\n}"}, {"source_code": "import java.lang.Math.pow\n\nprivate fun readInt() = readLine()!!.toInt()\nprivate fun readLong() = readLine()!!.toLong()\nprivate fun readIntList() = readLine()!!.split(\" \").map { it.toInt() }\nprivate fun readLongList() = readLine()!!.split(\" \").map { it.toLong() }\nprivate fun readString() = readLine()!!\n\nconst val maxl = 10\nconst val NEG = 1\nconst val ZERO = 0\nconst val POS = 2\n\nfun createMask(n: Int, mask: MutableList) {\n var curN = n\n for (i in 0 until maxl) {\n mask[i] = curN % 3\n curN /= 3\n }\n}\n\nfun useMask(mask: List, n: Long): Long {\n var ans = 0L\n var curN = n\n var nextMaskId = 1\n var curTerm = createOnes(maxl)\n for (i in 0 until mask.size) {\n if (nextMaskId == i) {\n nextMaskId++\n }\n while (nextMaskId < mask.size && mask[nextMaskId] == 0) {\n nextMaskId++\n }\n val nextMask = if (nextMaskId < mask.size) mask[nextMaskId] else null\n when (mask[i]) {\n POS -> {\n val toAdd = curN / curTerm\n ans += (maxl - i) * toAdd\n curN -= curTerm * toAdd\n if (nextMask == NEG) {\n curN -= curTerm\n ans += maxl - i\n }\n }\n NEG -> {\n val toAdd = curN / curTerm\n if (toAdd < 0) {\n ans += (maxl - i) * (-toAdd)\n curN += curTerm * (-toAdd)\n }\n if (nextMask == POS) {\n curN += curTerm\n ans += maxl - i\n }\n }\n }\n curTerm /= 10\n }\n return if (curN == 0L) ans else -1\n}\n\n//fun decompose(n: Long, tryNeg: Boolean = false): Int {\n// if (n == 0L) {\n// return 0\n// }\n// var curN = n\n// var curOnes = 17\n// var curTerm = createOnes(curOnes)\n// while (curTerm > curN) {\n// curTerm = createOnes(--curOnes)\n// }\n// var ans = curOnes + decompose(curN - curTerm, true)\n// if (tryNeg) {\n// ans = min(ans, curOnes + 1 + decompose(createOnes(curOnes + 1) - n))\n// }\n// return ans\n//}\n//\nfun createOnes(n:Int): Long {\n var ans = 0L\n repeat(n) {\n ans = ans * 10 + 1\n }\n return ans\n}\n\n//fun restore(n:Long, prev: IntArray): List {\n// val ans = mutableListOf()\n// var curN = n\n// while (curN > 0) {\n// val curTerm = createOnes(prev[curN])\n// curN -= curTerm\n// ans.add(curTerm)\n// }\n// return ans\n//}\n\nfun tempDp() {\n val maxn = 1000\n val dp = IntArray(maxn) {Int.MAX_VALUE}\n val prev = IntArray(maxn) {-1}\n dp[0] = 0\n for (i in 1 until maxn) {\n var add = 1\n var cntOnes = 1\n while (add <= i) {\n if (cntOnes + dp[i - add] < dp[i]) {\n dp[i] = cntOnes + dp[i - add]\n prev[i] = cntOnes\n }\n add = add * 10 + 1\n cntOnes++\n }\n }\n//\n// for (i in 1..1000) {\n// println(restore(i, prev).joinToString())\n// }\n}\n\nfun test(n:Long) {\n val mask = IntArray(maxl).toMutableList()\n mask[mask.size - 1] = NEG\n mask[mask.size - 2] = POS\n mask[mask.size - 3] = POS\n assert(useMask(mask, n) == 6L)\n}\n\nfun main() {\n val n = readLong()\n\n val mask = IntArray(maxl).toMutableList()\n\n val ans = (0 until pow(3.0, maxl.toDouble()).toInt()).map { m ->\n createMask(m, mask)\n useMask(mask, n)\n }.filter { it != -1L }.min()\n println(ans)\n}"}, {"source_code": "import java.io.*\nimport java.util.*\nimport java.lang.Math.*\nimport kotlin.collections.ArrayList\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 var n = nextLong()\n val used = TreeSet()\n fun get(n: Long, can: Boolean): Int {\n if (n == 0L) {\n return 0\n }\n if (n < 0) {\n return get(abs(n), can)\n }\n if (used.contains(n)) {\n return 1e9.toInt()\n }\n used.add(n)\n val ds = ArrayList()\n var x = n\n while (x > 0) {\n ds.add((x % 10).toInt())\n x /= 10\n }\n ds.reverse()\n\n x = 0\n for (i in ds) {\n x = x * 10 + 1\n }\n\n x *= ds[0]\n\n var a1 = get(n - x, true) + ds.size * ds[0]\n var a2 = 1e9.toInt()\n if (can) {\n x = 1\n for (i in ds) {\n x = x * 10 + 1\n }\n a2 = get(n - x, false) + ds.size + 1\n }\n\n return min(a1, a2)\n }\n\n println(get(n, true))\n}"}, {"source_code": "import java.io.*\nimport java.util.*\nimport java.lang.Math.*\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 var s = nextToken()!!\n var ans = 0\n var c = 0\n for (i in 0 until s.length) {\n val x = abs(s[i].toInt() - '0'.toInt() - c)\n ans += (s.length - i) * x\n c = s[i].toInt() - '0'.toInt();\n }\n print(ans)\n}"}, {"source_code": "import java.io.*\nimport java.util.*\nimport java.lang.Math.*\nimport kotlin.collections.ArrayList\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 var n = nextLong()\n fun get(n: Long, mx: Int): Int {\n if (n == 0L) {\n return 0\n }\n if (n < 0) {\n return get(abs(n), mx)\n }\n val ds = ArrayList()\n var x = n\n while (x > 0) {\n ds.add((x % 10).toInt())\n x /= 10\n }\n ds.reverse()\n\n var a1 = 1e9.toInt()\n if (ds.size + 1 <= mx) {\n x = 1\n for (i in ds) {\n x = x * 10 + 1\n }\n a1 = ds.size + 1 + get(n - x, ds.size)\n }\n\n var a2 = 1e9.toInt()\n if (ds.size <= mx) {\n x = 0\n for (i in ds) {\n x = x * 10 + 1\n }\n x *= ds[0]\n a2 = get(n - x, ds.size - 1) + ds.size * ds[0]\n }\n\n return min(a1, a2)\n }\n\n println(get(n, 100))\n}"}, {"source_code": "import java.io.*\nimport java.util.*\nimport java.lang.Math.*\nimport kotlin.collections.ArrayList\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 var n = nextLong()\n val used = TreeSet()\n fun get(n: Long, can: Boolean): Int {\n if (n == 0L) {\n return 0\n }\n if (n < 0) {\n return get(abs(n), can)\n }\n if (used.contains(n)) {\n return 1e9.toInt()\n }\n used.add(n)\n val ds = ArrayList()\n var x = n\n while (x > 0) {\n ds.add((x % 10).toInt())\n x /= 10\n }\n ds.reverse()\n\n x = 0\n for (i in ds) {\n x = x * 10 + 1\n }\n\n x *= ds[0]\n\n var a1 = get(n - x, true) + ds.size * ds[0]\n var a2 = 1e9.toInt()\n if (true || can) {\n x = 1\n for (i in ds) {\n x = x * 10 + 1\n }\n a2 = get(n - x, false) + ds.size + 1\n }\n\n return min(a1, a2)\n }\n\n println(get(n, true))\n}"}, {"source_code": "import java.io.*\nimport java.util.*\nimport java.lang.Math.*\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 var n = nextLong()\n fun get(n: Long, mx: Int): Int {\n if (n == 0L) {\n return 0\n }\n if (n < 0) {\n return get(abs(n), mx)\n }\n var a: Long = 0\n var x = 0\n while (a <= n) {\n a = a * 10 + 1\n x++\n }\n var a1 = 1e9.toInt()\n if (x <= mx) {\n a1 = x + get(n - a, x - 1)\n }\n a = 1\n x = 1\n var p = 1L\n while (a * 10 + 1 <= n && x < mx) {\n a = a * 10 + 1\n x++\n p *= 10\n }\n var y = x\n var b = a\n var bp = p\n while (bp + p <= n) {\n b += a\n y += x\n bp += p\n }\n var a2 = y + get(n - b, x - 1)\n return min(a1, a2)\n }\n\n println(get(n, 100))\n}"}, {"source_code": "import java.io.*\nimport java.util.*\nimport java.lang.Math.*\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 var n = nextLong()\n fun get(n: Long): Int {\n var ans = 0\n var c = 0\n var s = n.toString()\n for (i in 0 until s.length) {\n val x = abs(s[i].toInt() - '0'.toInt() - c)\n ans += (s.length - i) * x\n c = s[i].toInt() - '0'.toInt();\n }\n return ans\n }\n\n var a: Long = 0\n var x = 0\n while (a < n) {\n a = a * 10 + 1\n x++\n }\n if (a == n) {\n print(get(n))\n } else {\n print(min(get(n), get(a - n) + x))\n }\n}"}, {"source_code": "\n\nfun main() {\n val n = readLine()!!\n println(oneBasedArithmetic(n, 0))\n}\n\nfun oneBasedArithmetic(string: String, count: Int): Int {\n val length = if (string[0] == '-') string.length - 1 else string.length\n val count1 = withNOnes(string, count, length)\n val count2 = withNPlus1Ones(string, count)\n return if (count1 < count2) count1 else count2\n}\n\nfun withNOnes(string: String, count: Int, length: Int): Int {\n val n = if (string[0] == '-') string.length - 1 else string.length\n val num = string.toLong()\n val nOnes = \"1\".repeat(n).toLong()\n return when {\n// n < length -> oneBasedArithmetic(string, count)\n n > length -> Int.MAX_VALUE\n num == 0L -> count\n num == -1L -> count + 1\n num == 1L -> count + 1\n num < 0L -> {\n val rem = (num % nOnes).toString()\n val quotient = num / nOnes\n if (quotient == 0L && rem.length == n+1){\n withNOnes((num + nOnes).toString(), count + n, n)\n }else\n oneBasedArithmetic(rem, count + (n * quotient.unaryMinus()).toInt())\n }\n else -> {\n val rem = (num % nOnes).toString()\n val quotient = num / nOnes\n if (quotient == 0L && rem.length == n){\n withNOnes((num - nOnes).toString(), count + n, n)\n }else\n oneBasedArithmetic(rem, count + (n * quotient).toInt())\n }\n }\n}\n\n\nfun withNPlus1Ones(string: String, count: Int): Int {\n val n = if (string[0] == '-') string.length - 1 else string.length\n val num = string.toLong()\n val nOnes = \"1\".repeat(n + 1).toLong()\n return when {\n num < 0L -> withNOnes((num + nOnes).toString(), count + n + 1, n)\n else -> withNOnes((nOnes - num).toString(), count + n + 1, n)\n }\n}"}, {"source_code": "import kotlin.math.sign\n\nfun main() {\n val n = readLine()!!\n println(oneBasedArithmetic(n, 0))\n}\n\nfun oneBasedArithmetic(string: String, count: Int): Int {\n if (count == -1) return -1\n val count1 = withNOnes(string, count)\n val count2 = withNPlus1Ones(string, count)\n return if (count1 < count2) count1 else count2\n}\n\nfun withNOnes(string: String, count: Int): Int {\n// val n = string.replace(\"-\",\"\").length\n// var count1 = count\n// var num = string.toInt()\n// val nOnes = \"1\".repeat(n).toInt()\n// var length = n\n// while (length == n) {\n// when {\n// num < 0 -> {\n// num += nOnes\n// count1 += n\n// length = num.toString().replace(\"-\", \"\").length\n// }\n// num == 0 -> return count1\n// num > 0 -> {\n// count1 += n\n// num -= nOnes\n// length = num.toString().replace(\"-\", \"\").length\n// }\n// }\n// }\n// return if (length < n)\n// oneBasedArithmetic(num.toString(), count1)\n// else -1\n val n = if (string[0] == '-') string.length - 1 else string.length\n val num = string.toLong()\n val nOnes = \"1\".repeat(n).toLong()\n return when {\n num == 0L -> count\n num == -1L -> count + 1\n num == 1L -> count + 1\n num < 0L -> withNOnes((num + nOnes).toString(), count + n)\n else -> withNOnes((num - nOnes).toString(), count + n)\n }\n}\n\nfun withNPlus1Ones(string: String, count: Int): Int {\n// val n = string.replace(\"-\",\"\").length\n// var count1 = count\n// var num = string.toInt()\n// val nOnesPlusOne = \"1\".repeat(n + 1).toInt()\n// var length = n\n// while (length == n) {\n// when {\n// num < 0 -> {\n// num += nOnesPlusOne\n// count1 += n\n// length = num.toString().replace(\"-\", \"\").length\n// }\n// num == 0 -> return count\n// num > 0 -> {\n// count1 += n\n// num = nOnesPlusOne - num\n// length = num.toString().replace(\"-\", \"\").length\n// }\n// }\n// }\n// return if (length < n)\n// oneBasedArithmetic(num.toString(), count1)\n// else -1\n val n = if (string[0] == '-') string.length - 1 else string.length\n val num = string.toLong()\n val nOnes = \"1\".repeat(n + 1).toLong()\n return when {\n num < 0L -> withNOnes((num + nOnes).toString(), count + n + 1)\n else -> withNOnes((nOnes - num).toString(), count + n + 1)\n }\n}"}, {"source_code": "import kotlin.math.sign\n\nfun main() {\n val n = readLine()!!\n println(oneBasedArithmetic(n, 0))\n}\n\nfun oneBasedArithmetic(string: String, count: Int): Int {\n if (count == -1) return -1\n val count1 = withNOnes(string, count)\n val count2 = withNPlus1Ones(string, count)\n return if (count1 < count2) count1 else count2\n}\n\nfun withNOnes(string: String, count: Int): Int {\n// val n = string.replace(\"-\",\"\").length\n// var count1 = count\n// var num = string.toInt()\n// val nOnes = \"1\".repeat(n).toInt()\n// var length = n\n// while (length == n) {\n// when {\n// num < 0 -> {\n// num += nOnes\n// count1 += n\n// length = num.toString().replace(\"-\", \"\").length\n// }\n// num == 0 -> return count1\n// num > 0 -> {\n// count1 += n\n// num -= nOnes\n// length = num.toString().replace(\"-\", \"\").length\n// }\n// }\n// }\n// return if (length < n)\n// oneBasedArithmetic(num.toString(), count1)\n// else -1\n val n = if (string[0] == '-') string.length - 1 else string.length\n val num = string.toLong()\n val nOnes = \"1\".repeat(n).toLong()\n return when {\n num == 0L -> count\n num == -1L -> count + 1\n num == 1L -> count + 1\n num < 0L -> withNOnes((num + nOnes).toString(), count + n)\n else -> withNOnes((num - nOnes).toString(), count + n)\n }\n}\n\nfun withNPlus1Ones(string: String, count: Int): Int {\n// val n = string.replace(\"-\",\"\").length\n// var count1 = count\n// var num = string.toInt()\n// val nOnesPlusOne = \"1\".repeat(n + 1).toInt()\n// var length = n\n// while (length == n) {\n// when {\n// num < 0 -> {\n// num += nOnesPlusOne\n// count1 += n\n// length = num.toString().replace(\"-\", \"\").length\n// }\n// num == 0 -> return count\n// num > 0 -> {\n// count1 += n\n// num = nOnesPlusOne - num\n// length = num.toString().replace(\"-\", \"\").length\n// }\n// }\n// }\n// return if (length < n)\n// oneBasedArithmetic(num.toString(), count1)\n// else -1\n val n = if (string[0] == '-') string.length - 1 else string.length\n val num = string.toLong()\n val nOnes = \"1\".repeat(n + 1).toLong()\n return when {\n num == 0L -> count\n num == -1L -> count + 1\n num == 1L -> count + 1\n num < 0L -> withNOnes((num + nOnes).toString(), count + n)\n else -> withNOnes((nOnes - num).toString(), count + n)\n }\n}"}, {"source_code": "import kotlin.math.min\n\nfun main()\n{\n val i= readLine()!!\n val count=0\n println(min(findDigits(i,count),findGreaterDigits(i,count)))\n}\n\ntailrec fun findDigits(\n Number:String,\n count:Int):Int\n{\n\n return when {\n (Number.length == 2 && Number.contains(\"-1\")) -> count + 1\n (Number.length == 1 && Number.contains(\"1\")) -> count + 1\n (Number.length == 1 && Number.contains(\"0\")) -> count\n else -> {\n val num= if (Number.startsWith(\"-\")) Number.drop(1) else Number\n val digits = num.length\n val number = \"1\".repeat(digits)\n val updatedNumber=num.toLong()-number.toLong()\n findDigits(updatedNumber.toString(), count.plus(digits))\n\n }\n }\n}\n\nfun findGreaterDigits(\n Number:String,\n count:Int):Int\n{\n val digits = Number.length\n val number = \"1\".repeat(digits+1)\n val updatedNumber=Number.toLong()-number.toLong()\n return findDigits(updatedNumber.toString(), count.plus(digits+1))\n\n}"}, {"source_code": "fun main()\n{\n val i= readLine()!!\n val count=0\n println(findDigits(i,count))\n}\n\nfun findDigits(\n Number:String,\n count:Int):Int\n{\n\n return when {\n (Number.length == 2 && listOf(\"-1\").contains(Number)) -> count + 1\n (Number.length == 1 && listOf(\"1\").contains(Number)) -> count + 1\n (Number.length == 1 && listOf(\"0\").contains(Number)) -> count\n else -> {\n val digits = Number.length\n val number = \"1\".repeat(digits)\n val updatedNumber=Number.toInt()-number.toInt()\n findDigits(updatedNumber.toString(), count.plus(digits))\n\n }\n }\n}"}, {"source_code": "\nfun main()\n{\n val i= readLine()!!\n val count=0\n println(listOf(findEqualDigits(i,count),findGreaterDigits(i,count)).min())\n\n}\n\ntailrec fun findEqualDigits(\n Number:String,\n count:Int):Int\n{\n\n return when {\n (Number.length == 2 && Number.contains(\"-1\")) -> count + 1\n (Number.length == 1 && Number.contains(\"1\")) -> count + 1\n (Number.length == 1 && Number.contains(\"0\")) -> count\n else -> {\n val num= if (Number.startsWith(\"-\")) Number.drop(1) else Number\n val digits = num.length\n val number = \"1\".repeat(digits)\n val updatedNumber=num.toLong()-number.toLong()\n findEqualDigits(updatedNumber.toString(), count.plus(digits))\n\n }\n }\n}\n\nfun findGreaterDigits(\n Number:String,\n count:Int):Int\n{\n val digits = Number.length\n val number = \"1\".repeat(digits+1)\n val updatedNumber=Number.toLong()-number.toLong()\n return findEqualDigits(updatedNumber.toString(), count.plus(digits+1))\n\n}\n\n//fun findLesserDigits(\n// Number:String,\n// count:Int):Int\n//{\n// val digits = Number.length\n// val number = \"1\".repeat(digits-1)\n// val updatedNumber=Number.toLong()-number.toLong()\n// return findEqualDigits(updatedNumber.toString(), count.plus(digits-1))\n//\n//}"}, {"source_code": "fun main()\n{\n println(\"enter the number\")\n val i= readLine()!!\n val count=0\n println(findDigits(i,count))\n}\n\nfun findDigits(\n Number:String,\n count:Int):Int\n{\n\n return when {\n (Number.length == 2 && listOf(\"-1\").contains(Number)) -> count + 1\n (Number.length == 1 && listOf(\"1\").contains(Number)) -> count + 1\n (Number.length == 1 && listOf(\"0\").contains(Number)) -> count\n else -> {\n val digits = Number.length\n val number = \"1\".repeat(digits)\n val updatedNumber=Number.toInt()-number.toInt()\n findDigits(updatedNumber.toString(), count.plus(digits))\n\n }\n }\n}"}, {"source_code": "import kotlin.math.min\n\nfun main() {\n val i = readLine()!!\n val count = 0L\n println(min(findEqualDigits(i, count), findGreaterDigits(i, count)))\n}\n\nfun findEqualDigits(\n Number: String,\n count: Long\n): Long {\n when {\n (Number.toLong() == -1L) -> return count + 1L\n (Number.toLong() == 1L) -> return count + 1L\n (Number.toLong() == 0L) -> return count\n }\n val num = if (Number.startsWith(\"-\")) Number.drop(1) else Number\n val digits = num.length\n val number = \"1\".repeat(digits).toLong()\n val quotient = num.toLong() / number\n val updatedNumber = num.toLong() % number\n val onesCount = count.plus(quotient * digits)\n if (quotient == 0L && updatedNumber.toString().length == digits) {\n val number1 = updatedNumber - number\n val subCount = onesCount + digits\n return findEqualDigits(number1.toString(), subCount)\n }\n else\n {\n return when {\n (updatedNumber == -1L) -> onesCount + 1L\n (updatedNumber == 1L) -> onesCount + 1L\n (updatedNumber == 0L) -> onesCount\n else ->\n min(\n findEqualDigits(updatedNumber.toString(), onesCount)\n , findGreaterDigits(updatedNumber.toString(), onesCount)\n )\n }\n }\n}\n\nfun findGreaterDigits(\n Number: String,\n count: Long\n): Long {\n val num = if (Number.startsWith(\"-\")) Number.drop(1) else Number\n val digits = num.length\n val number = \"1\".repeat(digits + 1)\n val updatedNumber = number.toLong() - num.toLong()\n\n return findEqualDigits(updatedNumber.toString(), count.plus(digits + 1))\n\n}\n\n"}, {"source_code": "fun main()\n{\n val i= readLine()!!\n val count=0\n if (i.toInt() == 0){\n println(count)\n }\n else{\n println(findDigits(i,count))\n }\n}\n\nfun findDigits(\n Number:String,\n count:Int):Int\n{\n\n return when {\n (Number.length == 2 && listOf(\"-1\").contains(Number)) -> count + 1\n (Number.length == 1 && listOf(\"1\").contains(Number)) -> count + 1\n (Number.length == 1 && listOf(\"0\").contains(Number)) -> count\n else -> {\n val digits = Number.length\n val number = \"1\".repeat(digits)\n val updatedNumber=Number.toInt()-number.toInt()\n findDigits(updatedNumber.toString(), count.plus(digits))\n\n }\n }\n}"}, {"source_code": "import kotlin.math.min\n\nfun main()\n{\n val i= readLine()!!\n val count=0L\n println(min(findEqualDigits(i,count),findGreaterDigits(i,count)))\n}\n\n fun findEqualDigits(\n Number:String,\n count:Long):Long {\n when{\n (Number == \"-1\") -> return count + 1L\n (Number == \"1\") -> return count + 1L\n (Number == \"0\") -> return count\n }\n val num = if (Number.startsWith(\"-\")) Number.drop(1) else Number\n val digits = num.length\n val number = \"1\".repeat(digits)\n val quotient = num.toLong() / number.toLong()\n val updatedNumber = num.toLong() % number.toLong()\n val onesCount = count.plus(quotient * digits)\n if (quotient == 0L && updatedNumber.toString().length == digits) {\n val number1=updatedNumber-number.toLong()\n val subCount=onesCount+digits\n return findEqualDigits(number1.toString(), subCount)\n } else {\n return when {\n (updatedNumber == \"-1\".toLong()) -> onesCount + 1L\n (updatedNumber == \"1\".toLong()) -> onesCount + 1L\n (updatedNumber == \"0\".toLong()) -> onesCount\n else ->\n min(\n findEqualDigits(updatedNumber.toString(), onesCount)\n , findGreaterDigits(updatedNumber.toString(), onesCount)\n )\n\n\n }\n }\n }\n\n fun findGreaterDigits(\n Number: String,\n count: Long\n ): Long {\n val num = if (Number.startsWith(\"-\")) Number.drop(1) else Number\n val digits = num.length\n val number = \"1\".repeat(digits + 1)\n val updatedNumber = num.toLong() - number.toLong()\n\n return findEqualDigits(updatedNumber.toString(), count.plus(digits + 1))\n\n }\n\n"}, {"source_code": "import java.util.*\n\nvar a = LongArray(16)\nvar MIN = 10000000000000000L\nfun dfs(n: Long, now: Int, tot: Long) {\n if (now == 0) {\n if (MIN > tot) MIN = tot\n return\n }\n if (n >= 0) {\n val temp = n / a[now]\n dfs(n - temp * a[now], now - 1, tot + temp * now)\n dfs(n - (temp + 1) * a[now], now - 1, tot + (temp + 1) * now)\n } else {\n val temp = -n / a[now]\n dfs(n + temp * a[now], now - 1, tot + temp * now)\n dfs(n + (temp + 1) * a[now], now - 1, tot + (temp + 1) * now)\n }\n}\n\nfun main(args: Array) {\n a[1] = 1\n for (i in 2..15) a[i] = a[i - 1] * 10 + 1\n val cin = Scanner(System.`in`)\n val n = cin.nextLong()\n dfs(n, 15, 0)\n println(MIN)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.StringTokenizer\nimport kotlin.math.*\n\nfun main() {\n val M = generateSequence(0L) { it * 10 + 1 }.take(17).toList()\n\n val n0 = readLong()\n\n var n = n0\n var ans = 0\n\n while(n > 0) {\n val s = n.toString()\n val l = s.length\n val d0 = s[0] - '0'\n\n var cost = 0\n var next = n\n\n for(d in (d0-1).coerceAtLeast(0) .. (d0+1).coerceAtMost(9)) {\n val p = abs(n - M[l] * d)\n if(p < next) {\n next = p\n cost = l * d\n }\n }\n\n ans += cost\n n = next\n }\n\n println(ans)\n}\n\n/** IO code start */\nprivate val _reader = BufferedReader(InputStreamReader(System.`in`))\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\nprivate 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\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}\ninline fun output(block: Output.()->Unit) { val o = Output().apply(block); print(o.outputSb) }\nfun iprintln(o: Any?) { println(o) } // immediate println for interactive, bypasses output{} blocks"}, {"source_code": "private fun spar() = readLine()!! // string line\nprivate fun ipar() = spar().toInt() // single int\nprivate fun lpar() = spar().toLong() // single long\nprivate fun sapar() = spar().split(\" \") // list of strings\nprivate fun iapar() = sapar().map { it.toInt() } // list of ints\nprivate fun lapar() = sapar().map { it.toLong() } // list of longs\n\nfun main()\n{\n var n = spar().toCharArray();\n val arr = Array(n.size) { 0 }\n var count = 0\n for (i in 0..n.size-1)\n {\n while (n[i] - '0' > arr[i])\n {\n for (e in i..n.size-1)\n {\n count++\n arr[e]++\n }\n // println(arrayOf(arr.joinToString(\" \"), count).joinToString(\" \"))\n }\n while (n[i] - '0' < arr[i])\n {\n for (e in i..n.size-1)\n {\n count++\n arr[e]--\n }\n // println(arrayOf(arr.joinToString(\" \"), count).joinToString(\" \"))\n }\n }\n println(count)\n}"}, {"source_code": "private fun spar() = readLine()!! // string line\nprivate fun ipar() = spar().toInt() // single int\nprivate fun lpar() = spar().toLong() // single long\nprivate fun sapar() = spar().split(\" \") // list of strings\nprivate fun iapar() = sapar().map { it.toInt() } // list of ints\nprivate fun lapar() = sapar().map { it.toLong() } // list of longs\n\nfun main()\n{\n val n = lpar()\n println(brute(n, n.toString().length))\n}\n\nprivate fun brute(n: Long, len: Int): Int\n{\n if (n == 0L)\n {\n return 0\n }\n if (len == 0)\n {\n return 1000000\n }\n var ones = 0L\n for (i in 1..len)\n {\n ones *= 10\n ones++\n }\n \n return Math.min(brute(n - n/ones*ones, len-1) + (n/ones*len).toInt(), brute((n/ones+1)*ones - n, len-1) + (n/ones+1).toInt()*len)\n}"}, {"source_code": "import java.lang.Integer.parseInt\nimport java.lang.Long.parseLong\nimport java.lang.Math.abs\nimport java.lang.Math.min\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 F {\n\n internal val ones = LongArray(17)\n internal val total = LongArray(17)\n\n internal var `in`: BufferedReader? = null\n internal var out: PrintWriter? = null\n internal var tok: StringTokenizer? = null\n\n init {\n for (i in 1 until ones.size) {\n ones[i] = 10 * ones[i - 1] + 1\n total[i] = total[i - 1] + ones[i]\n }\n }\n\n internal fun solve(n: Long, i: Int): Int {\n if (n > total[i] || n < -total[i]) {\n return -1\n }\n if (i == 0) {\n return 0\n }\n var ans = Integer.MAX_VALUE\n for (j in -6..6) {\n val cans = solve(n + j * ones[i], i - 1)\n if (cans >= 0) {\n ans = min(ans, cans + abs(j) * i)\n }\n }\n return if (ans == Integer.MAX_VALUE) -1 else ans\n }\n\n @Throws(Exception::class)\n internal fun solve() {\n val n = scanLong()\n out!!.print(solve(n, 16))\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}\n\nfun main(args: Array) {\n F.main(args)\n}"}, {"source_code": "import java.util.*\n\nvar a = arrayOf(0L, 1L, 11L, 111L, 1111L, 11111L, 111111L, 1111111L, 11111111L, 111111111L, 1111111111L, 11111111111L, 111111111111L, \n1111111111111L, 11111111111111L, 111111111111111L)\nfun ans(n: Long): Long\n{\n if (n == 0L)\n return 0L;\n var k = 1\n while (k < 15)\n {\n if (a[k] <= n && n <= a[k + 1])\n {\n var x = k * (n / a[k]) + ans(n - a[k] * (n / a[k]))\n var y = k + 1 + (a[k + 1] - n) / a[k] * k + ans(a[k + 1] - n - (a[k + 1] - n) / a[k] * a[k])\n return if (x < y) x else y\n }\n ++k;\n }\n return 1000000000\n}\n\nfun main()\n{\n var n = readLine()!!.toLong()\n print(ans(n))\n}"}, {"source_code": " import java.util.*\n \n var a = arrayOf(1L, 11L, 111L, 1111L, 11111L, 111111L, 1111111L, 11111111L, 111111111L, 1111111111L, 11111111111L, 111111111111L, \n 1111111111111L, 11111111111111L, 111111111111111L,1111111111111111L)\n fun ans(n: Long): Long\n {\n if (n == 0L)\n return 0L;\n var k = 1\n while (k < 15)\n {\n if (a[k] <= n && n <= a[k + 1])\n {\n var x = k * (n / a[k]) + ans(n - a[k] * (n / a[k]))\n var y = k + 1 + (a[k + 1] - n) / a[k] * k + ans(a[k + 1] - n - (a[k + 1] - n) / a[k] * a[k])\n return if (x < y) x else y\n }\n ++k;\n }\n return 1000000000\n }\n \n fun main()\n {\n var n = readLine()!!.toLong()\n print(ans(n))\n }"}], "src_uid": "1b17a7b3b41077843ee1d6e0607720d6"} {"source_code": "import kotlin.math.min\n\nfun main() {\n val n = readLine()!!.toInt()\n val ys = IntArray((2 * n) + 1)\n val line = readLine()!!\n for (i in 0 until 2 * n) {\n ys[i + 1] = ys[i] + if (line[i % n] == '(') 1 else -1\n }\n if (ys[n] != 0) {\n println(0)\n println(\"1 1\")\n return\n }\n val low = ys.min()!!\n val sums = Array(3) { IntArray((2 * n) + 1) }\n //println(\"ys = ${ys.contentToString()}\")\n //println(\"low = $low\")\n for (i in 1..2 * n) {\n for (j in 0..2) {\n sums[j][i] = sums[j][i - 1]\n }\n if (ys[i] - low <= 2) {\n sums[ys[i] - low][i]++\n }\n }\n /*for (j in 0..2) {\n println(\"sums[$j] = ${sums[j].contentToString()}\")\n }*/\n val last = IntArray(2)\n val nearest = Array(2) { IntArray(n + 1) }\n for (i in 2 * n downTo 1) {\n if (ys[i] - low <= 1) {\n last[ys[i] - low] = i\n }\n if (i <= n) {\n for (j in 0..1) {\n nearest[j][i] = last[j]\n }\n }\n }\n /*for (j in 0..1) {\n println(\"nearest[$j] = ${nearest[j].contentToString()}\")\n }*/\n var answer = sums[0][n]\n var al = 1\n var ar = 1\n for (i in 1..n) {\n if (line[i - 1] == '(') {\n var j = min(nearest[0][i], nearest[1][i])\n var pos = sums[0][n] + sums[2][j - 1] - sums[2][i - 1]\n if (pos > answer) {\n answer = pos\n al = i\n ar = j\n }\n if (nearest[1][i] < nearest[0][i]) {\n j = nearest[0][i]\n pos = sums[1][j - 1] - sums[1][i - 1]\n if (pos > answer) {\n answer = pos\n al = i\n ar = j\n }\n }\n }\n }\n println(answer)\n println(\"$al ${((ar - 1) % n) + 1}\")\n}", "positive_code": [{"source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\")\n\nimport java.io.PrintWriter\nimport java.util.ArrayDeque\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 // immediate println for interactive\n\nfun main() {\n output {\n val n = readInt()\n val s = readLn().toCharArray()\n\n val ans = sequence {\n val init = Ans(s.beauty(), 0, 0)\n yield(init)\n if(init.b == 0) return@sequence\n\n for(i in 0 until n-1) {\n for(j in i+1 until n) {\n s.swap(i, j)\n yield(Ans(s.beauty(), i, j))\n s.swap(i, j)\n }\n }\n }.maxBy { it.b }!!\n\n println(ans)\n }\n}\n\nfun CharArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i]} }\n\nfun CharArray.beauty(): Int {\n var min = 0\n var count = 0\n var acc = 0\n\n for(c in this) {\n when(c) {\n '(' -> acc++\n ')' -> acc--\n }\n when {\n acc == min -> count++\n acc < min -> {\n min = acc\n count = 1\n }\n }\n }\n\n return if(acc == 0) count else 0\n}\n\ndata class Ans(val b: Int, val l: Int, val r: Int) {\n override fun toString(): String = \"$b\\n${l+1} ${r+1}\"\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 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()"}, {"source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\")\n\nimport java.io.PrintWriter\nimport java.util.ArrayDeque\nimport java.util.PriorityQueue\nimport java.util.StringTokenizer\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 s = readLn().toCharArray()\n\n val ans = sequence {\n val init = Ans(s.beauty(), 0, 0)\n yield(init)\n if(init.b == 0) return@sequence\n\n for(i in 0 until n-1) {\n for(j in i+1 until n) {\n if(s[i] == s[j]) continue\n s.swap(i, j)\n yield(Ans(s.beauty(), i, j))\n s.swap(i, j)\n }\n }\n }.maxBy { it.b }!!\n\n println(ans)\n }\n}\n\nfun CharArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i]} }\n\nfun CharArray.beauty(): Int {\n var min = 0\n var count = 0\n var acc = 0\n\n for(c in this) {\n when(c) {\n '(' -> acc++\n ')' -> acc--\n }\n when {\n acc == min -> count++\n acc < min -> {\n min = acc\n count = 1\n }\n }\n }\n\n return if(acc == 0) count else 0\n}\n\ndata class Ans(val b: Int, val l: Int, val r: Int) {\n override fun toString(): String = \"$b\\n${l+1} ${r+1}\"\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 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()"}], "negative_code": [], "src_uid": "2d10668fcc2d8e90e102b043f5e0578d"} {"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 0..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}", "positive_code": [{"source_code": "fun main(args: Array) {\n val k = readLine()!!.toInt()\n var a = \"\"\n var b = 1\n while (a.length < k) {\n a += b.toString()\n b++\n }\n println(a[k - 1])\n}"}, {"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.joinToString(\"\")[k!!.toInt()-1])\n\n}"}, {"source_code": "\nprivate fun readLn() = readLine()!!\nprivate fun readLong() = readLn().toLong()\n\nfun exp10(x: Long): Long {\n if (x == 0L) {\n return 1\n } else {\n return 10 * exp10(x - 1)\n }\n}\n\nfun kthDigit(k: Long): Char {\n val lev_lst: MutableList = mutableListOf(0L)\n for (lev in 1L..12L) {\n val step = exp10(lev - 1) * 9 * lev\n val nxt = step + lev_lst.last()\n lev_lst.add(nxt)\n }\n val arr = LongArray(lev_lst.size) { lev_lst[it] }\n\n fun binLevSearch(): Int {\n var lo = 0\n var hi = arr.lastIndex\n while (hi - lo > 1) {\n val m = (hi + lo) / 2\n //println(\"m=$m\")\n if (k > arr[m])\n lo = m\n else\n hi = m\n }\n\n return hi\n }\n\n val bound_idx = binLevSearch()\n val wid = bound_idx\n val base = arr[bound_idx - 1]\n val delta = k - base - 1\n val cnt = delta / wid\n val offs: Int = (delta % wid).toInt()\n val from = exp10(wid - 1L)\n val num = from + cnt\n val numstr = num.toString()\n val dgt: Char = numstr[offs]\n\n return dgt\n}\n\nfun main() {\n\n val k: Long = readLong()\n val c: Char = kthDigit(k)\n println(c)\n}\n"}, {"source_code": "import kotlin.math.pow\n\nfun main() {\n val k = readLong()\n\n val regimeSeq = sequence {\n var acc = 1L\n\n var digits = 1\n var numInts = 9L\n\n while(true) {\n yield(acc)\n\n acc += digits * numInts\n digits++\n numInts *= 10\n }\n }.zipWithNext().map { (a, b) -> a until b }\n\n val regime = regimeSeq.withIndex().first { k in it.value }\n\n val digits = regime.index + 1\n val range = regime.value\n\n val number = ((k - range.first) / digits) + 10.0.pow(digits-1).toLong()\n val charIndex = ((k - range.first) % digits).toInt()\n\n println(number.toString()[charIndex])\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) { Output().apply(block).nowPrint() }"}, {"source_code": "import kotlin.math.pow\n\nfun main() {\n val k = readLong()\n\n val regimeSeq = sequence {\n var acc = 1L\n\n var digits = 1\n var numInts = 9L\n\n while(true) {\n yield(acc)\n\n acc += digits * numInts\n digits++\n numInts *= 10\n }\n }\n\n val regime = regimeSeq.zipWithNext().withIndex().first {\n it.value.second > k\n }\n\n val digits = regime.index + 1\n val range = regime.value.let { (a, b) -> a until b}\n\n val number = ((k - range.first) / digits) + 10.0.pow(digits-1).toLong()\n val charIndex = ((k - range.first) % digits).toInt()\n\n println(number.toString()[charIndex])\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) { Output().apply(block).nowPrint() }"}, {"source_code": "fun readLn() = readLine()!!\n\nfun main() {\n\tvar k = readLn().toLong();\n\tvar (p, np, numD) = listOf(1L, 10L, 1);\n\tk--;\n\twhile (true) {\n\t\tval x = minOf(k/numD, np-p);\n\n\t\tk -= x*numD;\n\n\t\tif (x < np-p) {\n\t\t\tprintln((p+x).toString()[k.toInt()]);\n\t\t\tbreak;\n\t\t}\n\n\t\tnumD++;\n\t\tp = np;\n\t\tnp *= 10;\n\t}\n\n}\n"}, {"source_code": "\nprivate fun readLn() = readLine()!!\nprivate fun readLong() = readLn().toLong()\n\nfun exp10(x: Long): Long {\n if (x == 0L) {\n return 1\n } else {\n return 10 * exp10(x - 1)\n }\n}\n\nfun kthDigit(k: Long): Char {\n val lev_lst: MutableList = mutableListOf(0L)\n for (lev in 1L..12L) {\n val step = exp10(lev - 1) * 9 * lev\n val nxt = step + lev_lst.last()\n lev_lst.add(nxt)\n }\n val arr = LongArray(lev_lst.size) { lev_lst[it] }\n\n fun binLevSearch(): Int {\n var lo = 0\n var hi = arr.lastIndex\n while (hi - lo > 1) {\n val m = (hi + lo) / 2\n //println(\"m=$m\")\n if (k > arr[m])\n lo = m\n else\n hi = m\n }\n\n return hi\n }\n\n val bound_idx = binLevSearch()\n val wid = bound_idx\n val base = arr[bound_idx - 1]\n val delta = k - base - 1\n val cnt = delta / wid\n val offs: Int = (delta % wid).toInt()\n val from = exp10(wid - 1L)\n val num = from + cnt\n val numstr = num.toString()\n val dgt: Char = numstr[offs]\n\n return dgt\n}\n\nfun main() {\n\n val k: Long = readLong()\n val c: Char = kthDigit(k)\n println(c)\n}\n"}, {"source_code": "import java.util.*\n\nfun main() {\n solveSequenceProblem()\n}\n\nfun solveSequenceProblem(){\n val scan = Scanner(System.`in`)\n val sequenceIndex = scan.nextLine().toInt()\n scan.close()\n var sequenceStr = \"\"\n for(index in 1..10000){\n sequenceStr += index.toString()\n if(sequenceStr.length >= sequenceIndex){\n print(sequenceStr[sequenceIndex-1])\n return\n }\n\n }\n}\n"}, {"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 val line = StringBuilder()\n\n for (i in 0..2800)\n line.append(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}"}, {"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 val line: StringBuilder = StringBuilder(\"\")\n\n for (i in 0..2800)\n line.append(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}"}, {"source_code": "fun main() {\n\n var st = \"\"\n\n for(i in 1 .. 10000){\n st += i\n }\n\n val n = readLine()!!.toInt()\n\n println(st[n - 1])\n}"}, {"source_code": "fun main() {\n val k = readLine()!!.toInt()\n\n val seq = sequence {\n for(int in 1..Int.MAX_VALUE) {\n val digits = int.toString().map { it - '0' }\n yieldAll(digits)\n }\n }\n\n println(seq.elementAt(k - 1))\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\n\n/**\n * Created by cidgeedeng on 2019-09-23.\n */\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val inputReader = InputReader(inputStream)\n\n val k = inputReader.nextLong()\n var num = 0L\n var len = 0L\n\n while (len < k) {\n num++\n len += num.toString().length\n }\n\n val numStr = num.toString()\n print(numStr.subSequence(0, (numStr.length - (len - k)).toInt()).last())\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 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}"}, {"source_code": "fun readLn() = readLine()!!\n\nfun main() {\n\tvar k = readLn().toLong();\n\tvar (p, np, numD) = listOf(1L, 10L, 1);\n\tk--;\n\twhile (true) {\n\t\tval x = minOf(k/numD, np-p);\n\n\t\tk -= x*numD;\n\n\t\tif (x < np-p) {\n\t\t\tprintln((p+x).toString()[k.toInt()]);\n\t\t\tbreak;\n\t\t}\n\n\t\tnumD++;\n\t\tp = np;\n\t\tnp *= 10;\n\t}\n\n}\n"}, {"source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n\n val sb = StringBuilder()\n for (i in 1 until 2780) sb.append(i)\n print(sb[readInt() - 1])\n}"}, {"source_code": "fun main(){\n\n var k = readLine()!!.toInt()\n\n //9 \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b\n //90 \u0434\u0432\u0443\u0437\u043d\u0430\u0447\u043d\u044b\u0445\n //900 \u0442\u0440\u0435\u0445\u0437\u043d\u0430\u0447\u043d\u044b\u0445\n //9000 \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u0437\u043d\u0430\u0447\u043d\u044b\u0445\n //\u0447\u0438\u0441\u043b\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u0437\u043d\u0430\u0447\u043d\u044b\u0435\n var p = 1\n for (i in 1..4){\n val s=i*9*p\n if (k<=s){\n //\u0437\u043d\u0430\u0447\u0438\u0442 \u0447\u0438\u0441\u043b\u043e i \u0437\u043d\u0430\u0447\u043d\u043e\u0435\n //\u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u0430\u043a\u043e\u0435 \u043e\u043d\u043e \u043f\u043e \u0441\u0447\u0435\u0442\u0443 \u0441\u0440\u0435\u0434\u0438 i \u0437\u043d\u0430\u0447\u043d\u044b\u0445\n val pos = if(k%i==0){\n k/i\n }else{\n k/i+1\n }\n val num = p-1+pos//\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043f\u0430\u043b\u0438\n //\u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u0430\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0446\u0438\u0444\u0440\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430\n val n = (k-1)%i\n println(num.toString()[n])\n break\n }else{\n k-=s\n p*=10\n }\n }\n}"}], "negative_code": [{"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}"}, {"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}"}, {"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}"}, {"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()))\n\n}"}], "src_uid": "1503d761dd4e129fb7c423da390544ff"} {"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 = 1\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", "positive_code": [{"source_code": "import java.util.Queue\nimport java.util.LinkedList\nimport kotlin.collections.*\nimport java.io.PrintWriter\nimport kotlin.math.*\nimport java.util.Scanner\nimport java.lang.Math.floorMod\nimport java.lang.Math.floorDiv\nimport java.io.File\nimport kotlin.comparisons.compareBy\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() else c\n }\n}\n \n/** @param skipNext Whether to skip the next character (usually whitespace), defaults to true */\nfun readCharArray(n: Int, skipNext: Boolean = true): CharArray {\n val res = CharArray(n) { readChar() }\n if(skipNext) readChar()\n return res\n}\n \nfun readLine(): String? {\n var c = readChar()\n return if(c == Char.MIN_VALUE) null\n else buildString {\n while(c != '\\n' && c != Char.MIN_VALUE) {\n append(c)\n c = readChar()\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 \n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\nfun main() { _writer.solve(); _writer.flush() }\n\nval mxn=1000000\nval INF=1000000007\n// kotlinc test.kt -include-runtime -d test.jar && java -jar test.jar\n// var adj=MutableList (mxn) {mutableListOf> ()}\n// var vis=BooleanArray(mxn)\n// var a=IntArray(mxn)\n// var ok=true\n// val INF=1000000000+7\n\n\nfun testcase()\n{\n var(n,a,b) = readInts(3)\n var ans=0\n for(i in 1..n-1)\n {\n var first=a/i\n var second=b/(n-i)\n if(first==0||second==0) continue;\n ans=max(ans,min(first,second))\n }\n println(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n\n}\n\nfun PrintWriter.solve() {\n var t=1\n // t=readInt()\n while(t>0)\n {\n t--\n // var (a,b) = readLine()!!.trim().split(\"\\\\s+\".toRegex()).map (String::toInt)\n // var arr=readLine()!!.split(\" \").map {it.toInt()} (read array)\n // var(n,a) = readLine()!!.split(' ').map{it.toInt()}\n testcase()\n }\n}\n"}, {"source_code": "import java.lang.Integer.max\nimport java.lang.Integer.min\nimport java.util.*\n\nfun main (args: Array) = with(Scanner(System.`in`)) {\n val (n, a, b) = arrayOf(nextInt(), nextInt(), nextInt())\n var maximum = 0\n for (x in 1 until n)\n maximum = max(maximum, min(a / x, b / (n - x)))\n println(maximum)\n}"}, {"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 && numA / sol > 0 && numB / sol > 0) sol++\n print(sol - 1)\n}"}], "negative_code": [{"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"}, {"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}"}], "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e"} {"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 a: Int = ir.nextInt()\n val b: Int = ir.nextInt()\n val c: Int = ir.nextInt()\n val first: Int = (c / a) + 1\n val second: Int = (c / b) + 1\n\n for (i in 0 until first) {\n for (j in 0 until second) {\n if (a * i + b * j == c) {\n pw.print(\"Yes\")\n return\n }\n }\n }\n\n pw.print(\"No\")\n\n}\n\n\n\nprivate fun sort(array: IntArray, barray: IntArray, low: Int, high: Int) {\n\n var i = low\n var j = high\n val x = array[low + (high - low) / 2]\n\n do {\n while (array[i] < x) ++i\n while (array[j] > x) --j\n if (i <= j) {\n val tmp = array[i]\n array[i] = array[j]\n array[j] = tmp\n\n val pmt = barray[i]\n barray[i] = barray[j]\n barray[j] = pmt\n\n i++\n j--\n }\n } while (i <= j)\n\n if (low < j) sort(array, barray, low, j)\n if (i < high) sort(array, barray, i, high)\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}", "positive_code": [{"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 a: Int = ir.nextInt()\n val b: Int = ir.nextInt()\n val c: Int = ir.nextInt()\n\n for (i in 0 until (c / a) + 1) {\n for (j in 0 until (c / b) + 1) {\n if (a * i + b * j == c) {\n pw.print(\"Yes\")\n return\n }\n }\n }\n\n pw.print(\"No\")\n\n}\n\n\n\nprivate fun sort(array: IntArray, barray: IntArray, low: Int, high: Int) {\n\n var i = low\n var j = high\n val x = array[low + (high - low) / 2]\n\n do {\n while (array[i] < x) ++i\n while (array[j] > x) --j\n if (i <= j) {\n val tmp = array[i]\n array[i] = array[j]\n array[j] = tmp\n\n val pmt = barray[i]\n barray[i] = barray[j]\n barray[j] = pmt\n\n i++\n j--\n }\n } while (i <= j)\n\n if (low < j) sort(array, barray, low, j)\n if (i < high) sort(array, barray, i, high)\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}"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (a, b, c) = readInts()\n for (x in 0..c / a)\n if ((c - x * a) % b == 0) return print(\"Yes\")\n print(\"No\")\n}"}], "negative_code": [], "src_uid": "e66ecb0021a34042885442b336f3d911"} {"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==\"\"||x==\">\"||x==\"<\") {\n println(\"YES\")\n }\n else\n {\n println(\"NO\")}\n}\n\n", "positive_code": [{"source_code": "fun main() {\n var n = readLine()!!.toInt()\n var list = readLine()!!.split(' ').map { it.toInt() }.toList().toMutableList()\n list.add(0, 0)\n list.add(list.size, 0)\n var x = 1\n while (list[x] < list[x + 1] && x < n) x++\n while (list[x] == list[x + 1] && x < n) x++\n while (list[x] > list[x + 1] && x < n) x++\n if (x == n){\n println(\"YES\")\n }else println(\"NO\")\n}\n\n"}, {"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 println(\"YES\")\n}"}, {"source_code": "import java.io.*\nimport java.util.*\n\n\nfun DataReader.solve(out: PrintWriter) {\n val n = nextInt()\n\n val a = readIntArray(n).toList()\n\n for (i in a.indices) {\n for (j in i..a.lastIndex) {\n if (a.subList(i, j + 1).any { it != a[i] }) continue\n val q = a.subList(0, i)\n if (q.drop(1).zip(q).any { it.first <= it.second } || (q.isNotEmpty() && q.last() >= a[i])) continue\n\n val w = a.subList(j + 1, a.size)\n if (w.drop(1).zip(w).any { it.first >= it.second } || (w.isNotEmpty() && w[0] >= a[i])) continue\n\n out.print(\"YES\")\n\n return\n }\n }\n\n out.print(\"NO\")\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}"}, {"source_code": "enum class State {\n UP, FLAT, DOWN\n}\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n readLine()\n val arr = readInts()\n var state = State.UP\n for (pos in 1..arr.lastIndex) {\n when (state) {\n State.UP -> {\n when {\n arr[pos] == arr[pos - 1] -> state = State.FLAT\n arr[pos] < arr[pos - 1] -> state = State.DOWN\n }\n }\n State.FLAT -> {\n when {\n arr[pos] < arr[pos - 1] -> state = State.DOWN\n arr[pos] > arr[pos - 1] -> return print(\"NO\")\n }\n }\n else -> if (arr[pos] >= arr[pos - 1]) return print(\"NO\")\n }\n }\n print(\"YES\")\n}"}], "negative_code": [{"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}"}, {"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"}, {"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"}, {"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 arr = Array(n){\"\"}\n arr= line.split(\" \").toTypedArray()\n arr.to(Int)\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==\"=\") {\n println(\"YES\")\n }\n else\n {\n println(\"NO\")}\n}\n\n"}, {"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==\"=\") {\n println(\"YES\")\n }\n else\n {\n println(\"NO\")}\n}\n\n"}], "src_uid": "5482ed8ad02ac32d28c3888299bf3658"} {"source_code": "/**\n * https://codeforces.com/problemset/problem/394/A\n * \n * A. Counting Sticks\n */\n\n fun main() {\n val input = readLine();\n val arr = input.toString().split('=')\n val c = arr.get(1)\n val ab = arr.get(0).split('+')\n val a = ab.get(0)\n val b = ab.get(1)\n var lenA = a.length\n var lenB = b.length\n var lenC = c.length\n\n val minus = lenC - lenA - lenB\n\n if (minus == 0) {\n print(input)\n } else if (minus == 2) {\n lenA += 1\n lenC -= 1\n printOutput(lenA, lenB, lenC)\n } else if (minus == -2) {\n lenC += 1\n if (lenA > 1) {\n lenA -= 1\n } else {\n lenB -= 1\n }\n printOutput(lenA, lenB, lenC)\n } else {\n print(\"Impossible\")\n }\n }\n\n fun printOutput(a: Int, b: Int, c:Int) {\n var rs: String = \"\"\n for (i in 0 until a) {\n rs += \"|\"\n }\n rs += \"+\"\n for (i in 0 until b) {\n rs += \"|\"\n }\n rs += \"=\"\n for (i in 0 until c) {\n rs += \"|\"\n }\n print(rs)\n } ", "positive_code": [{"source_code": "\nfun main() {\n val expression= readLine()!!.split(\"[=+]\".toRegex())\n val expressionInt=expression.map { it.length }\n// println(expressionInt)\n val first=expressionInt[0]\n val second=expressionInt[1]\n val third=expressionInt[2]\n if (first+second==third)\n println(\"${expression[0]}+${expression[1]}=${expression[2]}\")\n else\n if ((first+1)+second==(third-1))\n println(\"${expression[0].plus(\"|\")}+${expression[1]}=${expression[2].drop(1)}\")\n else if (first+(second+1)==(third-1))\n println(\"${expression[0]}+${expression[1].plus(\"|\")}=${expression[2].drop(1)}\")\n else if (first+(second-1)==(third+1) && expression[1].length>1)\n println(\"${expression[0]}+${expression[1].drop(1)}=${expression[2].plus(\"|\")}\")\n else if ((first-1)+second==(third+1)&& expression[0].length>1)\n println(\"${expression[0].drop(1)}+${expression[1]}=${expression[2].plus(\"|\")}\")\n else\n println(\"Impossible\")\n}"}, {"source_code": "fun main() {\n val (a, b, c) = readLine()!!.split(\"+\", \"=\").map { it.length }\n\n fun printAns(a: Int, b: Int, c: Int) = println(\"${(1..a).joinToString(\"\") { \"|\" }}+${(1..b).joinToString(\"\") { \"|\" }}=${(1..c).joinToString(\"\") { \"|\" }}\")\n\n when {\n a + b == c -> printAns(a, b, c)\n a + b - 1 == c + 1 -> when {\n a > 1 -> printAns(a - 1, b, c + 1)\n b > 1 -> printAns(a, b - 1, c + 1)\n else -> println(\"Impossible\")\n }\n a + b + 1 == c - 1 -> printAns(a, b + 1, c - 1)\n else -> println(\"Impossible\")\n }\n}"}], "negative_code": [{"source_code": "fun main() {\n val (a, b, c) = readLine()!!.split(\"+\", \"=\").map { it.length }\n\n fun printAns(a: Int, b: Int, c: Int) = println(\"${(1..a).joinToString(\"\") { \"|\" }}+${(1..b).joinToString(\"\") { \"|\" }}=${(1..c).joinToString(\"\") { \"|\" }}\")\n\n when {\n a + b == c -> printAns(a, b, c)\n a + b - 1 == c + 1 -> when {\n a > 1 -> printAns(a - 1, b, c + 1)\n b > 1 -> printAns(a, b - 1, c + 1)\n else -> println(\"Impossible\")\n }\n else -> println(\"Impossible\")\n }\n}"}, {"source_code": "\nfun main() {\n val expression= readLine()!!.split(\"[=+]\".toRegex())\n val expressionInt=expression.map { it.length }\n val first=expressionInt[0]\n val second=expressionInt[1]\n val third=expressionInt[2]\n if (first+second==third)\n println(\"$expression\")\n if ((first+1)+second==(third-1))\n println(\"${expression[0].plus(\"|\")}+${expression[1]}=${expression[2].drop(1)}\")\n else if (first+(second+1)==(third-1))\n println(\"${expression[0]}+${expression[1].plus(\"|\")}=${expression[2].drop(1)}\")\n else\n println(\"IMPOSSIBLE\")\n}"}, {"source_code": "\nfun main() {\n val expression= readLine()!!.split(\"[=+]\".toRegex())\n val expressionInt=expression.map { it.length }\n val first=expressionInt[0]\n val second=expressionInt[1]\n val third=expressionInt[2]\n if (first+second==third)\n println(\"${expression[0]}+${expression[1]}=${expression[2]}\")\n else\n if ((first+1)+second==(third-1))\n println(\"${expression[0].plus(\"|\")}+${expression[1]}=${expression[2].drop(1)}\")\n else if (first+(second+1)==(third-1))\n println(\"${expression[0]}+${expression[1].plus(\"|\")}=${expression[2].drop(1)}\")\n else\n println(\"Impossible\")\n}"}, {"source_code": "\nfun main() {\n val expression= readLine()!!.split(\"[=+]\".toRegex())\n val expressionInt=expression.map { it.length }\n val first=expressionInt[0]\n val second=expressionInt[1]\n val third=expressionInt[2]\n if (first+second==third)\n println(\"${expression[0]}+${expression[1]}=${expression[2]}\")\n when {\n (first+1)+second==(third-1) -> println(\"${expression[0].plus(\"|\")}+${expression[1]}=${expression[2].drop(1)}\")\n first+(second+1)==(third-1) -> println(\"${expression[0]}+${expression[1].plus(\"|\")}=${expression[2].drop(1)}\")\n else -> println(\"Impossible\")\n }\n}"}, {"source_code": "\nfun main() {\n val expression= readLine()!!.split(\"[=+]\".toRegex())\n val expressionInt=expression.map { it.length }\n println(expressionInt)\n val first=expressionInt[0]\n val second=expressionInt[1]\n val third=expressionInt[2]\n if (first+second==third)\n println(\"${expression[0]}+${expression[1]}=${expression[2]}\")\n else\n if ((first+1)+second==(third-1))\n println(\"${expression[0].plus(\"|\")}+${expression[1]}=${expression[2].drop(1)}\")\n else if (first+(second+1)==(third-1))\n println(\"${expression[0]}+${expression[1].plus(\"|\")}=${expression[2].drop(1)}\")\n else if ((first-1)+second==(third+1))\n println(\"${expression[0].drop(1)}+${expression[1]}=${expression[2].plus(\"|\")}\")\n else if (first+(second-1)==(third+1))\n println(\"${expression[0]}+${expression[1].drop(1)}=${expression[2].plus(\"|\")}\")\n else\n println(\"Impossible\")\n}"}, {"source_code": "\nfun main() {\n val expression= readLine()!!.split(\"[=+]\".toRegex())\n val expressionInt=expression.map { it.length }\n// println(expressionInt)\n val first=expressionInt[0]\n val second=expressionInt[1]\n val third=expressionInt[2]\n if (first+second==third)\n println(\"${expression[0]}+${expression[1]}=${expression[2]}\")\n else\n if ((first+1)+second==(third-1))\n println(\"${expression[0].plus(\"|\")}+${expression[1]}=${expression[2].drop(1)}\")\n else if (first+(second+1)==(third-1))\n println(\"${expression[0]}+${expression[1].plus(\"|\")}=${expression[2].drop(1)}\")\n else if ((first-1)+second==(third+1))\n println(\"${expression[0].drop(1)}+${expression[1]}=${expression[2].plus(\"|\")}\")\n else if (first+(second-1)==(third+1))\n println(\"${expression[0]}+${expression[1].drop(1)}=${expression[2].plus(\"|\")}\")\n else\n println(\"Impossible\")\n}"}, {"source_code": "\nfun main() {\n val expression= readLine()!!.split(\"[=+]\".toRegex())\n val expressionInt=expression.map { it.length }\n val first=expressionInt[0]\n val second=expressionInt[1]\n val third=expressionInt[2]\n if (first+second==third)\n println(\"$expression\")\n if ((first+1)+second==(third-1))\n println(\"${expression[0].plus(\"|\")}+${expression[1]}=${expression[2].drop(1)}\")\n else if (first+(second+1)==(third-1))\n println(\"${expression[0]}+${expression[1].plus(\"|\")}=${expression[2].drop(1)}\")\n else\n println(\"Impossible\")\n}"}], "src_uid": "ee0aaa7acf127e9f3a9edafc58f4e2d6"} {"source_code": "fun main() {\n val pos = readLine()!!\n if (pos in setOf(\"a1\", \"h1\", \"a8\", \"h8\")) return print(3)\n if (pos[0] == 'a' || pos[0] == 'h' || pos[1] == '1' || pos[1] == '8') return print(5)\n print(8)\n}", "positive_code": [{"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 line = input.readLine()\n val c = line[0]\n val n = line[1]\n\n val top = when {\n n == '1' -> 0\n c == 'a' || c == 'h' -> 2\n else -> 3\n }\n\n val bottom = when {\n n == '8' -> 0\n c == 'a' || c == 'h' -> 2\n else -> 3\n }\n\n val leftRight = when {\n c == 'a' || c == 'h' -> 1\n else -> 2\n }\n\n output.println(top + bottom + leftRight)\n}"}, {"source_code": "import java.io.*\nimport java.util.*\n\nfun main(args : Array) {\n //====== Input preparations ========================================================\n// val fin = BufferedReader(FileReader(\"a.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 nextPairDec() = nextInt()-1 to nextInt()-1\n //====== Solution below ============================================================\n val s = next()\n fun mirror(a: Int) = if (a > 3) 7 - a else a\n val a = mirror(s[0] - 'a')\n val b = mirror(s[1] - '1')\n if (a > 0 && b > 0)\n fout.print(8)\n else if (a == 0 && b == 0)\n fout.print(3)\n else\n fout.print(5)\n\n\n fout.close()\n fin.close()\n}\n\n"}, {"source_code": "fun main() {\n var str = readLine()!!\n if (str[1] == '1' || str[1] == '8') {\n if (str[0] == 'a' || str[0] == 'h') {\n println(3)\n return\n } else {\n println(5)\n return\n }\n } else {\n if (str[0] == 'a' || str[0] == 'h'){\n println(5)\n }else{\n println(8)\n }\n }\n\n}"}, {"source_code": "fun main() {\n val input = readLine()!!.toCharArray()\n if ((input[0] == 'b' || input[0] == 'c' || input[0] == 'd' || input[0] == 'e' || input[0] == 'f' || input[0] == 'g') && (input[1] == '2' || input[1] == '3' || input[1] == '4' || input[1] == '5' || input[1] == '6' || input[1] == '7')) print(\"8\") else if (((input[0] == 'b' || input[0] == 'c' || input[0] == 'd' || input[0] == 'e' || input[0] == 'f' || input[0] == 'g') && (input[1] == '1' || input[1] == '8')) || ((input[0] == 'a' || input[0] == 'h') && (input[1] == '2' || input[1] == '3' || input[1] == '4' || input[1] == '5' || input[1] == '6' || input[1] == '7'))) print(\"5\") else print(\"3\")\n}"}], "negative_code": [{"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}"}, {"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}"}], "src_uid": "6994331ca6282669cbb7138eb7e55e01"} {"source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var s = readLine()\n var del: MutableList = mutableListOf()\n\n for (i in 1..(n-1)){\n if (n % i == 0) del.add(i)\n }\n\n del.forEach {\n s = s!!.substring(0..(it - 1)).reversed() + s!!.substring(it..(s!!.length - 1))\n }\n print(s!!.reversed())\n\n}", "positive_code": [{"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.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 var str = scanner.next()\n var i = 1;\n val d = ArrayList()\n while (i * i <= n) {\n if (n % i == 0) {\n str = str.substring(0, i).reversed() + str.substring(i)\n if (n / i != i)\n d.add(n / i)\n }\n i++\n }\n d.sort()\n for (j in d)\n str = str.substring(0, j).reversed() + if (j != n) str.substring(j) else \"\"\n println(str)\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//}"}, {"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.toLong() }.sorted()\n var s = r.readLine()!!\n fun fac(i:Int):List{\n val ans = mutableListOf()\n for (j in 1..i){\n if (i%j==0) ans += j\n }\n return ans\n }\n val swap = fac(n)\n swap.forEach {\n s = s.substring(0, it).reversed()+s.substring(it, n)\n }\n println(s)\n}"}, {"source_code": "\nimport java.io.*\nimport java.util.*\n\nfun solve() {\n\n val n = nextInt()\n var s = next()\n\n for (d in 2..n) {\n if (n % d == 0) {\n val t = s.substring(0, d).reversed()\n s = s.replaceRange(0, d, t)\n }\n }\n\n print(s)\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}"}, {"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 until 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// print(\"$i \")\n// println(String(b))\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}"}, {"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\n var finalStr = s\n\n for ((index, x) in s.withIndex()) {\n if (index > 0 && s.length % (index) == 0) {\n\n finalStr = s.substring(0, index).reversed()\n finalStr += s.substring(index,s.length)\n\n s = finalStr\n }\n }\n\n print(finalStr.reversed())\n}"}, {"source_code": "fun main(args: Array) {\n val len = readLine()!!.toInt()\n var str = readLine()!!\n\n for (divider in getDividers(len)) {\n str = str.take(divider).reversed() + str.drop(divider)\n\n debug { println(\"div: $divider; str=$str\") }\n }\n\n print(str)\n}\nfun getDividers(num: Int) : Array {\n val arr = hashSetOf(1,num)\n if (num == 1 || num == 2) return arr.toTypedArray()\n for (i in 2 until num) if (num % i == 0)arr.add(i)\n\n debug { println(\"dividers: $arr\") }\n return arr.toTypedArray().sortedArray()\n}\ninline fun debug(block: () -> Unit) {\n if (false) block()\n}\n\n"}, {"source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n\n val n = readInt()\n var t = readLine()!!\n for (pos in 2..n)\n if (n % pos == 0)\n t = t.substring(0, pos).reversed() + t.substring(pos, n)\n print(t)\n}"}, {"source_code": "fun 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 val n = readInt()\n var s = readString()\n for (i in 1..n) {\n if (n % i == 0) {\n s = s.take(i).reversed() + s.takeLast(n - i)\n }\n }\n println(s)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.io.InputStream\nimport java.util.*\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 var s = scan.next()\n\n val d = getDivisors(n)\n\n for(i in d) {\n// println(\"processing $i\")\n val first = s.substring(0, i)\n// println(\"first = $first\")\n val firstr = first.reversed()\n// println(\"firstr = $firstr\")\n val second = s.substring(i, n)\n// println(\"second = $second\")\n s = firstr + second\n }\n\n println(s)\n}\n\nfun getDivisors(n: Int): List =\n (1..n).filter { n % it == 0 }\n"}, {"source_code": "import java.util.*\n\n//07/07/2018\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val n = nextInt()\n val s = next()\n val delimiters = collectDelimiters(n)\n print(restore(s, delimiters))\n}\n\nfun restore(s: String, delimiters: Iterator): String {\n if (!delimiters.hasNext()) return s\n val delimiter = delimiters.next()\n return restore(s.substring(0, delimiter).reversed() + s.substring(delimiter), delimiters)\n}\n\nfun collectDelimiters(n: Int): Iterator {\n val res = mutableListOf()\n var d = n;\n while (d >1) {\n if (n % d == 0) {\n res.add(d);\n }\n d--\n }\n return res.reversed().iterator()\n}\n"}, {"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 rev(S : CharArray, idx : Int) {\n for (i in 0..idx / 2 - 1) S[i] = S[idx - 1 - i].also{S[idx - 1 - i] = S[i]}\n}\n\nfun main() {\n val n = readInt()\n var s : String = readLn()\n var S = s.toCharArray()\n \n for (i in 1..n) {\n if (n % i == 0) rev(S, i)\n }\n \n println(S)\n}"}, {"source_code": "//package codeForces.v1\n\nfun main(args: Array) {\n val n = readLine()!!.toInt()\n var s = readLine()!!\n\n for (i in 2..n) {\n if (n % i != 0)\n continue\n\n s = s.substring(0, i).reversed() + s.substring(i, n)\n }\n\n println(s)\n}"}, {"source_code": "fun reverse(s: MutableList, r: Int): MutableList {\n for (i in 0..(r - 1)/2) {\n s[i] = s[r - i - 1].also { s[r - i - 1] = s[i] }\n }\n\n return s\n}\n\nfun main() {\n val n = readLine()!!.toInt()\n var s = readLine()!!.toMutableList()\n\n var div = 1\n while (div <= n) {\n if (n % div == 0) {\n s = reverse(s, div)\n }\n\n ++div\n }\n\n print(s.joinToString(\"\"))\n}"}], "negative_code": [{"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}"}, {"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}"}], "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3"} {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n var painting = readLine()!!\n\n painting =\n painting.replace(\"C?Y\", \"CMY\")\n .replace(\"C?M\", \"CYM\")\n .replace(\"Y?C\", \"YMC\")\n .replace(\"Y?M\", \"YCM\")\n .replace(\"M?C\", \"MYC\")\n .replace(\"M?Y\", \"MCY\")\n\n with (painting) {\n if (contains(\"CC\") || contains(\"MM\") || contains(\"YY\")) {\n println(\"No\")\n return\n }\n if (painting.count { it == '?' } == 0) {\n println(\"No\")\n return\n }\n }\n\n println(\"Yes\")\n}", "positive_code": [{"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.first() == '?' || 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}"}, {"source_code": "\nfun main(args : Array) {\n var input = System.`in`.bufferedReader()\n try {\n var n = input.readLine().toInt()\n var s = input.readLine()\n \n var i = 0\n var ok = false\n mainloop@ while (i < s.length) {\n when (s[i]) {\n '?' -> {\n var j = i\n while (j < s.length && s[i] == s[j])\n ++j\n \n if (j - i >= 2)\n ok = true\n else {\n var lch = if (i > 0) s[i - 1] else '\\u0000'\n var rch = if (j < s.length) s[j] else '\\u0000'\n if (lch == rch || lch == '\\u0000' || rch == '\\u0000')\n ok = true\n }\n i = j\n }\n else -> {\n if (i < s.length - 1 && s[i] == s[i + 1]) {\n ok = false\n break@mainloop\n } else\n ++i\n }\n }\n }\n \n println(if (ok) \"Yes\" else \"No\")\n } finally {\n input.close()\n }\n}\n"}], "negative_code": [{"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) {\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}"}, {"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}"}, {"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}"}], "src_uid": "f8adfa0dde7ac1363f269dbdf00212c3"} {"source_code": "fun main(args: Array) {\n var lo = readLine()!!.toLong()\n if(lo < 2) print(lo) else {\n if(++lo % 2L == 0L) print(lo/2)\n else print(lo)\n }\n}", "positive_code": [{"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.nextLong()\n if (n == 0L)\n println(0)\n else if (n % 2 == 1L)\n println((n + 1) / 2)\n else\n println(n + 1)\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)"}, {"source_code": "import java.util.*\nimport java.math.*\n\n\nfun main(args: Array)\n{\n var sc=Scanner(System.`in`)\n var n=sc.nextLong()\n if(n==0L)\n {\n println(\"0\");\n return ;\n }\n n++;\n if(n%2==0L)n/=2\n println(n);\n}\n"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toLong()\n val k = n + 1\n val r = when {\n k == 1L -> 0L\n k % 2 == 0L -> k / 2\n else -> k\n }\n println(r)\n}"}, {"source_code": "import java.io.*\nimport java.util.*\n\nconst val INPUT_FILE_NAME = \"input\"\nconst val OUTPUT_FILE_NAME = \"output\"\n\nfun main(args: Array) {\n solve(System.`in`, System.out)\n// solve(FileInputStream(\"$INPUT_FILE_NAME.txt\"), FileOutputStream(\"$OUTPUT_FILE_NAME.txt\"))\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.nextLong()\n if (n == 0L) {\n writer.println(\"0\")\n return\n }\n if (n % 2 == 0L) {\n writer.println(n + 1)\n } else {\n writer.println((n + 1) / 2)\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}"}, {"source_code": "fun main(args: Array){\n val n: Long = readLine()?.toLong() ?: 0\n val pieces = n+1\n if (pieces%2 == 0L)\n println(pieces/2)\n else if (pieces == 1L)\n println(0)\n else\n println(pieces)\n}"}, {"source_code": "\n\nfun main(){\n var n = readLine()!!.toLong()+1\n\n if (n==1L){\n println(0)\n }else{\n if (n%2L==0L){\n println(n/2)\n }else{\n println(n)\n }\n }\n}"}, {"source_code": "fun main() {\n val numPeople = readLine()!!.toLong() + 1\n if (numPeople == 1L) return print(0)\n print(if (numPeople and 1 == 0L) numPeople / 2 else numPeople)\n}"}, {"source_code": "fun main(args: Array){\n\tval cats = readLine()!!.toLong() + 1L\n\tif(cats==1L){\n\t\tprintln(0)\n\t\treturn\n\t}\n\tval res = if(cats.rem(2L)==0L) cats/2L else cats\n\tprintln(res)\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toLong()\n\n if (n == 0L) {\n println(0)\n return\n }\n\n val ans = if ((n + 1) % 2 == 0L) (n + 1) / 2 else n + 1\n println(ans)\n}\n"}, {"source_code": "/**\n * Created by aursaty on 5/14/2018.\n */\n\nfun main(args : Array) {\n var n : Long = 0\n n = readLine()!!.toLong() + 1\n when {\n n % 2 == 0.toLong() -> print(n/2)\n n == 1.toLong() -> print(0)\n else -> print(n)\n }\n}"}], "negative_code": [{"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.nextLong()\n if (n % 2 == 1L)\n println((n + 1) / 2)\n else\n println(n + 1)\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)"}, {"source_code": "import java.util.*\nimport java.math.*\n\n\nfun main(args: Array)\n{\n var sc=Scanner(System.`in`)\n var n=sc.nextLong()\n if(n==0L)\n {\n println(\"0\");\n }\n n++;\n if(n%2==0L)n/=2\n println(n);\n}\n"}, {"source_code": "import java.io.*\nimport java.util.*\n\nconst val INPUT_FILE_NAME = \"input\"\nconst val OUTPUT_FILE_NAME = \"output\"\n\nfun main(args: Array) {\n solve(System.`in`, System.out)\n// solve(FileInputStream(\"$INPUT_FILE_NAME.txt\"), FileOutputStream(\"$OUTPUT_FILE_NAME.txt\"))\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.nextLong()\n if (n % 2 == 0L) {\n writer.println(n + 1)\n } else {\n writer.println((n + 1) / 2)\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}"}, {"source_code": "fun main(args: Array){\n val n: Long = readLine()?.toLong() ?: 0\n val pieces = n+1\n if (pieces%2 == 0L)\n println(pieces/2)\n else\n println(pieces)\n}"}, {"source_code": "fun main() {\n val numPeople = readLine()!!.toLong() + 1\n print(if (numPeople and 1 == 0L) numPeople / 2 else numPeople)\n}"}, {"source_code": "fun main() {\n val numPeople = readLine()!!.toLong() + 1\n if (numPeople == 0L) return print(0)\n print(if (numPeople and 1 == 0L) numPeople / 2 else numPeople)\n}"}, {"source_code": "fun main(args : Array) {\n var n = 0\n n = readLine()!!.toInt() + 1\n if (n % 2 == 0)\n print(n/2)\n else\n if (n == 1)\n print(0)\n print(n)\n}"}], "src_uid": "236177ff30dafe68295b5d33dc501828"} {"source_code": "fun main() {\n val (a, b) = readLine()!!.split(\" \")\n println(if (a==b) a else \"1\")\n}", "positive_code": [{"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 (a, b) = readLine()!!.split(\" \")\n println(if (a == b) a else \"1\")\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"}, {"source_code": "fun main() {\n val (a, b) = readLine()!!.split(\" \")\n print(if (a == b) a else 1)\n}"}, {"source_code": " fun main(args: Array) {\n val (a, b) = readLine()!!.split(\" \")\n println( if (a == b) a else \"1\" )\n }\n\n"}], "negative_code": [], "src_uid": "9c5b6d8a20414d160069010b2965b896"} {"source_code": "fun main(args: Array){\n\tval debug = false\n\tval k = readLine()!!.toInt()\n\tval stroka = readLine().toString()\n\tval mapa = mutableMapOf()\n\n\tfor (i in 0..k-2){\n\t\tif (debug) println(\"Debug! $i ${stroka.substring(i,i+2)}\")\n\t\tval digr = stroka.substring(i,i+2)\n\t\tif (mapa.containsKey(digr)){\n\t\t\tmapa.put(digr, mapa.getValue(digr) + 1)\n\t\t}else{\n\t\t\tmapa.put(digr,1)\n\t\t}\n\t}\n\tval sorted = mapa.toList().sortedBy{-it.second}\n//\tprintln(n)\n\tprintln(sorted[0].first)\n\tif (debug) println(\"Debug!\")\n}", "positive_code": [{"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 0 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}"}, {"source_code": "fun twoGram(input: String) = input.windowed(2).groupingBy { it }.eachCount().maxBy { it.value }?.key\n\nfun main(args: Array) {\n readLine()\n println(readLine()?.let { twoGram(it) })\n}"}, {"source_code": "fun twoGram(input: String) = input.windowed(2).groupingBy { it }.eachCount().maxBy { it.value }?.key\n\nfun main() {\n readLine()\n println(readLine()?.let { twoGram(it) })\n}"}, {"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 scanner.nextLine()\n val string = scanner.nextLine()\n val max =\n IntRange(0, string.length - 2)\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"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n val s = readLine()!!\n\n val valueToCount = HashMap()\n\n for (i in 0 until n - 1) {\n val value = \"${s[i]}${s[i + 1]}\"\n valueToCount[value] = (valueToCount[value] ?: 0) + 1\n }\n\n val entry = valueToCount.maxBy { (_, value) -> value }\n println(entry!!.key)\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n scanner.nextInt()\n val str = scanner.next()\n val d = IntArray(676)\n var c = str[0]\n for (i in 1 until str.length) {\n d[(c - 'A') * 26 + (str[i] - 'A')]++\n c = str[i]\n }\n val a = d.indexOf(d.max()!!)\n println(\"${'A' + a / 26}${('A' + a % 26)}\")\n}"}, {"source_code": "fun main(args: Array) {\n val numberOfLines = readLine()?.toInt() ?: 0\n var string = readLine()\n val substrings = string?.chunked(2)\n val entries = mutableMapOf()\n\n for (i in 0 until numberOfLines) {\n val firstEntry = string?.get(i)\n val secondEntry = if (i == numberOfLines - 1) \"\" else string?.get(i + 1)\n val finalKey = \"$firstEntry$secondEntry\"\n\n if (entries.containsKey(finalKey)) {\n entries.merge(finalKey, 1) { old, value ->\n old + value\n }\n } else {\n entries[finalKey] = 1\n }\n }\n\n val max = entries.maxBy { it.value }\n println(max?.key)\n}"}, {"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\n\nfun main(args: Array) {\n val n = readInt()\n var s = readLn()\n\n val freq = mutableMapOf()\n\n for (i in 0 until n - 1) {\n val twoGram = s.substring(i, i + 2)\n freq[twoGram] = freq.getOrDefault(twoGram, 0) + 1\n }\n\n var result = \"\"\n var maxCount = 0\n for (item in freq) {\n if (item.value > maxCount) {\n maxCount = item.value\n result = item.key\n }\n }\n\n println(result)\n}\n"}, {"source_code": "import java.util.HashMap\nimport java.util.Scanner\n fun main(args:Array) {\n val sc = Scanner(System.`in`)\n sc.nextInt()\n val s = sc.next()\n println(solve(s))\n sc.close()\n }\n internal fun solve(s:String):String {\n val twoGramToCount = HashMap()\n for (i in 0 until s.length - 1)\n {\n val twoGram = s.substring(i, i + 2)\n twoGramToCount.put(twoGram, (twoGramToCount as java.util.Map).getOrDefault(twoGram, 0) + 1)\n }\n val maxCount = twoGramToCount.values.stream().mapToInt({ x-> x }).max().getAsInt()\n return twoGramToCount.keys.stream().filter({ twoGram-> twoGramToCount.get(twoGram) == maxCount }).findAny()\n .get()\n }"}, {"source_code": "fun main(args: Array) {\n\n // reading the input and saving it\n val amountOfLetters = readLine()!!.toInt()\n val inputString = readLine()!!\n\n // the var will be the temporary string containing the two-gram to be checked while traversing through\n // the input String\n var tempString: String\n\n // the hashmap will contain the two-gram string along with the occurences\n // it will be initialied with the first two-gram and its counter value of 1\n var counterHashMap: MutableMap = mutableMapOf(inputString.subSequence(0,2).toString() to 1)\n\n // iterating over the string, saving each two-gram in a temporary string\n // checking if the two-gram exists in the hashmap\n // yes: increase the value, no: adding the two-gram to the hasmap and initializing the value to 1\n for((index,character) in inputString.withIndex()) {\n // to avoid the indexOutOfBounce exception, the index is being checked\n if(index == inputString.length-1) break\n // skip the first 2 letters as they have been added in the initialisation\n if(index == 0) continue;\n\n // concatenating two chars\n tempString = \"\" + character + inputString[index+1]\n // check if the two-gram is in the haspMap\n if(tempString in counterHashMap) {\n // increase the value if it does\n counterHashMap.set(tempString, counterHashMap.get(tempString)!!.plus(1))\n } else {\n // add the value to hashmap if it doesnt with value 1\n counterHashMap.put(tempString,1)\n }\n }\n println(counterHashMap.maxBy{it.value}.toString().subSequence(0,2))\n}"}, {"source_code": "val occur = HashMap()\n\nfun main() {\n val n = readLine()!!.toInt()\n val s = readLine()!!\n for(i in 0 until n-1) {\n val t = s.substring(i, i+2)\n if(t in occur)\n occur[t] = occur[t]!! + 1\n else\n occur[t] = 1\n }\n println(occur.maxBy { it.value }!!.key)\n}"}, {"source_code": "\n\nfun main(args: Array) {\n val array = Array(27, { IntArray(27) })\n val length = readLine()!!.toInt()\n var lastChar = 's'\n var max = 0\n var str = StringBuilder()\n val string = readLine()!!\n string.toCharArray().forEachIndexed { i, c ->\n if (i != 0) {\n array[lastChar.toInt() - 65][c.toInt() - 65]++\n if (array[lastChar.toInt() - 65][c.toInt() - 65] > max) {\n max = array[lastChar.toInt() - 65][c.toInt() - 65]\n str = StringBuilder()\n str.append(lastChar)\n str.append(c)\n }\n }\n lastChar = c\n }\n println(str.toString())\n\n}"}, {"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() }\nprivate fun Boolean.toInt() = if (this) 1 else 0\n \nprivate fun isPalindrome(s: String): Int {\n val n = s.length\n for(i in 0..n/2-1){\n if (s[i] != s[n-i-1]){\n return 0\n }\n }\n return 1\n}\n \nfun main(args : Array) {\n var n = readInt()\n var s = readLn()\n var cnt = mutableMapOf()\n for(i in 1..n-1){\n var key = s.substring(i-1,i+1)\n if (cnt[key] == null){\n cnt[key] = 1\n }\n else {\n cnt[key] = cnt[key]!! + 1\n }\n }\n var dg = \"##\"\n var c = 0\n for((k,v) in cnt){\n if (v > c){\n dg = k\n c = v\n }\n }\n print(dg)\n}\n"}, {"source_code": "import java.util.*\nimport kotlin.collections.HashMap\nimport kotlin.math.max\n\nfun main() {\n\n val scan = Scanner(System.`in`)\n var n: Int = scan.nextLine().trim().toInt()\n val str: String = scan.nextLine().trim()\n\n val hashMap = HashMap()\n\n for (i in 0 until str.length - 1) {\n val diagram = str.substring(i, i + 2)\n if (hashMap.contains(diagram)) {\n val value = hashMap.getValue(diagram)\n hashMap.replace(diagram, value + 1)\n } else {\n hashMap[diagram] = 1\n }\n }\n\n val maxValue = hashMap.values.max()\n print(hashMap.filterValues { it == maxValue }.keys.toList()[0])\n\n\n}\n"}, {"source_code": "fun main() {\n val l = readLine()!!.toInt()\n val s = readLine()!!\n\n val r :HashMap = hashMapOf()\n\n for (i in 0 until l - 1) {\n val x = s.substring(i, i + 2)\n if (r.containsKey(x)) {\n r[x] = r[x]!!.plus(1)\n } else {\n r[x] = 0\n }\n }\n\n var z = -1\n var y = \"\"\n for (j in r) {\n if (j.value > z) {\n z = j.value\n y = j.key\n }\n }\n println(y)\n}"}, {"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\n\nprivate fun solve() {\n var mx = 0\n var ans = \"\"\n val n = readInt()\n val s = readLn()\n val ar = mutableListOf()\n for (i in 1 until s.length){\n var temp: String = (s[i - 1]).toString()\n temp += s[i]\n ar.add(temp)\n }\n for (i in 0 until ar.size){\n var cnt = 0\n val cur = ar[i]\n for (j in 1 until s.length) {\n //println(s.substring(IntRange(j - 1, j)))\n if (s.substring(IntRange(j - 1, j)) == cur)\n cnt++\n }\n if (cnt > mx) {\n mx = cnt\n ans = cur\n }\n\n }\n println(ans)\n}\nfun main(args: Array) {\n solve()\n}"}, {"source_code": "import java.io.PrintWriter\nimport java.util.*\n\n\n/**\n * Created on : May 12, 2018\n * Author : zetbaitsu\n * Name : Zetra\n * GitHub : https://github.com/zetbaitsu\n */\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = Scanner(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Solver()\n solver.solve(input, output)\n output.close()\n}\n\nclass Solver {\n fun solve(input: Scanner, output: PrintWriter) {\n val n = input.nextInt()\n input.nextLine()\n val s = input.nextLine()\n\n val map = mutableMapOf()\n (0 until n - 1)\n .map { \"${s[it]}${s[it + 1]}\" }\n .forEach {\n if (map.containsKey(it)) {\n val value = map[it]!!\n map[it] = value + 1\n } else {\n map[it] = 1\n }\n }\n\n output.println(map.entries.maxBy { it.value }?.key)\n }\n}"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n\n val n = sc.nextInt()\n val str = sc.next()\n\n val map = HashMap()\n\n for (i in 0 until n - 1) {\n val dg = \"${str[i]}${str[i+1]}\"\n val dg2 = \"ldksjflskdjflksdjf\"\n if (!map.containsKey(dg)) {\n map[dg] = 0\n }\n if (!map.containsKey(dg2)) {\n //map[dg2] = 0\n }\n if (dg == dg2) {\n map[dg] = map[dg]!! + 1\n } else {\n map[dg] = map[dg]!! + 1\n //map[dg2] = map[dg2]!! + 1\n }\n }\n\n var max = -1\n var maxv = \"sf\"\n\n map.forEach({k, v ->\n if (v > max) {\n max = v\n maxv = k\n }\n })\n println(maxv)\n}\n\n"}, {"source_code": "fun main(a:Array){val l=readLine()!!.toInt();val s=readLine()!!;val m=HashMap();(0 until l-1).map{\"${s[it]}${s[it +1]}\"}.forEach{if(m.containsKey(it))m[it]=m[it]!!+1 else m[it]=1};println(m.maxBy{ it.value}!!.key)}"}, {"source_code": "import java.io.StreamTokenizer\n\nfun main(args: Array) {\n val tokenizer = StreamTokenizer(System.`in`)\n val n = tokenizer.nextInt()\n val s = tokenizer.nextString().toCharArray()\n val map = HashMap, Int>()\n var max = 0\n var ans: Pair? = null\n for (i in 0 until n - 1) {\n val p = Pair(s[i], s[i + 1])\n val v = (map[p] ?: 0) + 1\n map[p] = v\n if (v > max) {\n max = v\n ans = p\n }\n }\n println(\"${ans!!.first}${ans.second}\")\n}\n\nfun StreamTokenizer.nextString(): String {\n return if (nextToken() == StreamTokenizer.TT_WORD) sval else \"\"\n}\n\nfun StreamTokenizer.nextInt(): Int {\n return if (nextToken() == StreamTokenizer.TT_NUMBER) nval.toInt() else -1\n}\n\nfun StreamTokenizer.nextDouble(): Double {\n return if (nextToken() == StreamTokenizer.TT_NUMBER) nval else 0.0\n}"}, {"source_code": "import java.util.regex.Pattern\n\nfun main(args: Array) {\n val ss = twogram1()\n print(ss)\n}\n\nfun twogram1(): String?{\n val n = readLine()?.toInt() ?: 0\n val s = readLine().orEmpty()\n val chars = s.toList()\n return if(n == chars.size) {\n (0 until chars.size - 1).mapNotNull { i ->\n if (i + 1 < chars.size)\n chars[i].toString() + chars[i + 1].toString()\n else null\n }.groupBy { it }.maxBy { it.value.size }?.key\n } else \"\"\n}\n\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n var n = scanner.nextLine()\n val s = scanner.nextLine()\n\n val map: HashMap = hashMapOf()\n\n s.forEachIndexed { i, c ->\n if (i < s.length - 1) {\n val char0 = s[i]\n val char1 = s[i + 1]\n if (char0.isUpperCase() && char1.isUpperCase()) {\n val res = map.get(\"$char0$char1\")\n\n if (res == null) {\n map.put(\"$char0$char1\", 1)\n } else {\n map.put(\"$char0$char1\", res + 1)\n }\n }\n }\n }\n var max = 0\n var result = \"\"\n map.forEach { ss, count ->\n if (count > max) {\n max = count\n result = ss\n }\n }\n\n println(result)\n\n}"}, {"source_code": "import java.util.*\n\nfun min(a:Double,b:Double) = if (ab) a else b \nfun min(a:Int,b:Int) = if (ab) a else b \nfun printD(d: Double) { print(d) }\nfun printI(d:Int) { print(d) }\nfun printS(d: String) { print(d) }\nfun printL(d: Long) { print(d) }\nclass pair (var first:Int, var second:Int) \n\nfun main() {\n val cin = Scanner(System.`in`)\n \n /* --------- */ \n \n /* \n map[q] <=> map.getOrDefault(q,0)\n \n */ \n var a=cin.nextInt() \n var s=cin.next()\n var max1=0; \n var ans=\"\"; \n //var m=IntArray \n var map=hashMapOf();\n \n for (i in 0..a-2) {\n var q=\"\"; q+=s[i]; q+=s[i+1];\n map[q]=map.getOrDefault(q,0)+1; \n if (map.getOrDefault(q,0)>max1) {max1=map.getOrDefault(q,0); ans=q; }\n }\n print(ans); \n \n /* --------- */ \n \n}\n"}, {"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\nprivate fun readLongs() = readStrings().map{it.toLong()}\n//const val MOD = 1000000007\n\nfun main(args:Array){\n val n = readInt()\n val s = readLn()\n\n val skipString = s.substring(1, s.length)\n\n val list = s.asSequence()\n .chunked(2).map { it.joinToString(\"\") }.toList()\n\n val skiplist = skipString.asSequence()\n .chunked(2).map { it.joinToString(\"\") }.toList()\n\n val map = mutableMapOf()\n\n countGram(list, map)\n countGram(skiplist, map)\n\n var max = -1\n var key = \"\"\n map.forEach { t, u ->\n if (u>max && t.length==2){\n max = u\n key = t\n }\n }\n println(key)\n\n}\n\nfun countGram(list: List, map: MutableMap) {\n list.forEach {\n if (map.contains(it)) {\n val count = map[it]!!\n map[it] = count + 1\n } else {\n map[it] = 1\n }\n }\n}"}, {"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\n\nfun main() {\n var n = readInt()\n var s = readLn()\n var m = HashMap()\n\n for (i in 0..s.length-2) {\n var str = s[i].toString() + s[i + 1]\n if (m.containsKey(str))\n m[str] = m[str]!! + 1\n else\n m[str] = 1\n }\n var mx = Pair(\"\", 0)\n for ((k,v) in m) {\n if (mx.second < v) {\n mx = Pair(k,v)\n }\n }\n print(mx.first)\n}"}, {"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"}, {"source_code": "\n\nimport java.util.*\nimport kotlin.collections.ArrayList\n\nfun main() {\n val input = Scanner(System.`in`)\n val n = input.nextInt()\n val s = input.next()\n\n val letters = s.split(\"\")\n val iSize = letters.size - 3\n val dGrams: ArrayList = ArrayList()\n for (i in 1..iSize) {\n dGrams.add(\"${letters[i]}${letters[i + 1]}\")\n }\n\n var mGram = Int.MIN_VALUE\n var mIndex = 0\n val count: ArrayList> = ArrayList()\n for (i in dGrams) {\n var exists = false\n var gIndex = 0\n count.forEachIndexed { index, pair ->\n if (pair.first == i) {\n exists = true\n gIndex = index\n return@forEachIndexed\n }\n }\n if (!exists) {\n count.add(Pair(i, 1))\n } else {\n val num = count[gIndex].second + 1\n count[gIndex] = Pair(i, num)\n if (num > mGram) {\n mGram = num\n mIndex = gIndex\n }\n }\n }\n\n print(count[mIndex].first)\n}\n"}, {"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[k] = m.getOrDefault(k, 0) + 1\n println(m.maxBy { it.value }?.key)\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n val input = readLine()!!.substring(0, n)\n\n println(twoGram(input))\n}\n\nfun twoGram(input: String): String {\n val map = HashMap()\n\n var maxCount = 0\n var maxGram = \"\"\n\n for(i in 0..(input.length - 2)) {\n val key = \"${input[i]}${input[i+1]}\"\n map[key] = (map[key]?:0).plus(1)\n\n if(map[key]?.compareTo(maxCount)?:0 > 0) {\n maxCount = map[key]?:0\n maxGram = key\n }\n }\n\n return maxGram\n}"}, {"source_code": "import java.util.Scanner\nimport kotlin.collections.HashMap\nimport kotlin.collections.set\nfun main() {\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) map[word] = 1 else map[word] = count + 1\n }\n\n println(map.entries.stream().max { entry1, entry2 -> if (entry1.value > entry2.value) 1 else -1 }.get().key)\n}\n"}, {"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 for (i in 0 .. n - 2) {\n val candidate = s.substring(i, i + 2)\n map[candidate] = (map[candidate] ?: 0) + 1\n }\n println(map.maxBy { it.value }?.key)\n}"}, {"source_code": "fun main(): Unit {\n readLine()\n print(\n readLine()!!.asSequence()\n .windowed(2, 1)\n .map { \"${it[0]}${it[1]}\"}\n .groupBy { it }\n .maxBy { it.value.size }?.key\n )\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n val s = readLine()!!\n val tgc = ByteArray(836)\n\n var i = s[0] - 'A'\n for(j in 1 until n) {\n val k = s[j] - 'A'\n tgc[i shl 5 or k]++\n i = k\n }\n var max = tgc[0]\n i = 0\n for (j in 1 until tgc.size) {\n val v = tgc[j]\n if (v > max) {\n max = v\n i = j\n }\n }\n println(\"${'A' + (i shr 5)}${'A' + (i and 31)}\")\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.HashMap\n\nfun main(vararg args: String) {\n val scanner = Scanner(System.`in`)\n val length = scanner.nextInt()\n val string = scanner.next()\n println(find(length, string))\n}\n\nfun find(length: Int, string: String): String {\n val map = HashMap()\n for (i in 0 until length - 1) {\n val str = string.substring(i, i + 2)\n if (map.containsKey(str)) {\n map[str] = map[str]!! + 1\n } else {\n map[str] = 1\n }\n }\n return map.maxBy { it.value }!!.key\n}\n\n"}, {"source_code": "import kotlin.system.measureTimeMillis\n\nfun main() {\n val n = readLine()!!.toInt()\n val s = readLine()!!\n val counts = mutableMapOf()\n for(i in 0 until s.length - 1) {\n val sub = s.substring(i, i + 2)\n counts[sub] = counts.getOrDefault(sub, 0) + 1\n }\n println(counts.maxBy { it.value }!!.key)\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n Scanner(System.`in`).use { scanner ->\n scanner.nextInt() // not needed for first approach...\n val string = scanner.next()\n println(TwoGramSolver.solve(string))\n }\n}\n\nprivate object TwoGramSolver {\n\n internal fun solve(string: String): String {\n val twoGrams = mutableMapOf()\n var maxTwoGram: Pair? = null\n\n string.windowed(2).forEach { twoGram ->\n val twoGramCount = (twoGrams[twoGram] ?: 0).inc()\n twoGrams[twoGram] = twoGramCount\n\n if (maxTwoGram == null) {\n maxTwoGram = twoGram to twoGramCount\n return@forEach\n }\n\n if (twoGramCount > maxTwoGram!!.second) {\n maxTwoGram = twoGram to twoGramCount\n }\n }\n\n return maxTwoGram!!.first\n }\n}"}, {"source_code": "import kotlin.system.measureTimeMillis\n\nfun main() {\n val n = readLine()!!.toInt()\n val s = readLine()!!\n val counts = mutableMapOf()\n for(i in 0 until s.length - 1) {\n val sub = s.substring(i, i + 2)\n counts[sub] = (counts[sub] ?: 0) + 1\n }\n println(counts.maxBy { it.value }!!.key)\n}"}, {"source_code": "import java.util.*\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, value) in mp) {\n if (value > mx) {\n mx = value\n ans = key\n }\n }\n println(ans)\n}\n"}, {"source_code": "fun main(args : Array) {\n var n = readLine()!!.toInt()\n var str = readLine()!!\n\n var map = mutableMapOf()\n for (i in 0..n - 2) {\n var sub = str.substring(i..i + 1)\n if (!map.contains(sub)) map[sub] = 1\n else map[sub] = map[sub]!! + 1\n }\n\n var max = 0\n var ans = \"\"\n map.forEach {\n if (it.value > max) {\n max = it.value\n ans = it.key\n }\n }\n println(ans)\n}"}, {"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 = readInt()\n val k = readLn()\n findSequence(k, 0, n)\n val res = map.maxBy { it.value }\n println(res?.key.toString().capitalize())\n}\n\nfun 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}"}, {"source_code": "fun main() {\n val count = readLine()!!.toInt()\n val str = readLine()!!\n\n var max = Int.MIN_VALUE\n var maxStr = str.subSequence(0, 2)\n for (i in 0 .. count - 2) {\n val subStr = str.substring(i, i + 2)\n var current = 0\n for (i in 0 .. count - 2) {\n val subStr2 = str.substring(i, i + 2)\n if (subStr == subStr2)\n current++\n }\n\n if (current > max) {\n max = current\n maxStr = subStr\n }\n }\n print(maxStr)\n}"}, {"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 grams.add(s.substring(i,i+2))\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"}, {"source_code": "import kotlin.math.absoluteValue\nimport kotlin.math.pow\n\n\nfun main(args: Array) {\n val n = readLine()!!.toInt()\n val s = readLine()!!\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}"}, {"source_code": "fun main(args: Array) {\n readLine()\n val s = readLine()!!\n val map = HashMap()\n s.windowed(2).forEach { substr ->\n map[substr] = map.getOrDefault(substr, 0) + 1\n }\n val maxL = map.values.max()!!\n println(map.entries.find { it.value == maxL }!!.key)\n}"}, {"source_code": "fun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main(args: Array) {\n var n = readInt()\n var s = readLn()\n val fre = Array(26, {IntArray(26){0}})\n for(i in 0..n-2){\n fre[s[i].toInt() - 'A'.toInt()][s[i+1].toInt()-'A'.toInt()]++\n }\n var mx = 0\n var an = \"\"\n for(i in 0..25){\n for(j in 0..25){\n if(fre[i][j] > mx){\n mx = fre[i][j]\n an=\"\"+(i+'A'.toInt()).toChar()\n an+=(j+'A'.toInt()).toChar()\n }\n }\n }\n println(an)\n}"}, {"source_code": "private fun readLnString() = readLine()!! // string line\nprivate fun readInt() = readLnString().toInt() // single int\nprivate fun readStrings() = readLnString().split(\" \") // list of strings\nprivate fun readIntList() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongList() = readStrings().map { it.toLong() } // list of longs\nprivate fun readStringPair() = readStrings().zipWithNext()[0]\nprivate fun readIntPair() = readStrings().map { it.toInt() }.zipWithNext()[0]\n\n//Your task is to find any two-gram contained in the given string as a substring (i.e. two consecutive characters of the\n// string) maximal number of times. For example, for string s = \"BBAABBBA\" the answer is two-gram \"BB\", which contained\n// in s three times. In other words, find any most frequent two-gram.\n\n//7\n//ABACABA\n//AB\nfun main() {\n val size = readInt()\n val string = readLnString()\n\n val map = mutableMapOf()\n\n for (index in 0..string.length - 2) {\n val substring = string.substring(index, index + 2)\n\n if (map.containsKey(substring))\n map[substring] = map.getOrDefault(substring, 1) + 1\n else\n map[substring] = 1\n }\n\n println(map.maxBy { entry -> entry.value}?.component1())\n}\n"}, {"source_code": "fun 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}"}, {"source_code": "\nimport java.io.InputStream\nimport kotlin.math.max\n\nconst val A = 'A'.toInt()\nconst val Z = 'Z'.toInt()\n\nfun main() {\n for (c in twoGram(System.`in`)) {\n print(c)\n }\n}\n\nfun twoGram(input: InputStream): CharArray {\n var len = 0\n var i: Int\n\n while (true) {\n i = input.read()\n if (i == System.lineSeparator()[0].toInt()) break\n\n len *= 10\n len += i - 0x30\n }\n\n input.skip((System.lineSeparator().length - 1).toLong())\n\n val size = Z - A + 1\n val result = Array(size) { IntArray(size) }\n\n var m = 0\n\n var c = input.read() - A\n\n for (j in 1 until len) {\n val cc = input.read() - A\n\n var v = result[c][cc]\n result[c][cc] = ++v\n m = max(m, v)\n c = cc\n }\n\n for (x in result.indices) {\n val arr = result[x]\n for (y in arr.indices) {\n if (arr[y] == m) {\n return charArrayOf((x + A).toChar(), (y + A).toChar())\n }\n }\n }\n\n return charArrayOf()\n}"}, {"source_code": "fun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun ctoi(c : Char): Int{\n return c.toInt() - 'A'.toInt()\n}\nfun itoc(c : Int): Char{\n return (c+'A'.toInt()).toChar()\n}\nfun main(args: Array) {\n var n = readInt()\n var s = readLn()\n val fre = Array(26, {IntArray(26){0}})\n for(i in 0..n-2){\n fre[ctoi(s[i])][ctoi(s[i+1])]++\n }\n var mx = 0\n var an = \"\"\n for(i in 0..25){\n for(j in 0..25){\n if(fre[i][j] > mx){\n mx = fre[i][j]\n an=\"\"+itoc(i)\n an+=itoc(j)\n }\n }\n }\n println(an)\n}"}, {"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.next()\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}"}, {"source_code": "import java.util.*\n \n/**\n * Kotlin Heroes: Practice 2\n * B. \u0414\u0432\u0443\u0433\u0440\u0430\u043c\u043c\u0430\n * http://codeforces.com/contest/1212/problem/B\n * */\nclass B\n \nfun main() {\n readLine()\n val s = readLine()!!.toCharArray()\n val arr = Array(pos('Z', 'Z') + 1) { 0 }\n \n var max = 0\n var maxS = \"\"\n for (i in 1 until s.size) {\n val pos = pos(s[i - 1], s[i])\n if (++arr[pos] > max) {\n max = arr[pos]\n maxS = \"${s[i - 1]}${s[i]}\"\n }\n }\n println(maxS)\n}\n \nfun pos(a: Char, b: Char) = (a - 'A') * ('Z' - 'A' + 1) + (b - 'A')"}, {"source_code": "import 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 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}"}, {"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(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}"}, {"source_code": "import java.io.OutputStream\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.PrintWriter\nimport java.util.Scanner\nimport java.util.HashMap\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 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 var 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"}, {"source_code": "import java.io.OutputStream\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.PrintWriter\nimport java.util.Scanner\nimport java.util.HashMap\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 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"}, {"source_code": "import java.util.*\n\nfun main() {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n sc.nextLine()\n val s = sc.nextLine()\n s.zipWithNext()\n .groupingBy { it }\n .eachCount()\n .maxBy { it.value }\n ?.key\n ?.run { println(\"$first$second\") }\n}"}, {"source_code": "fun 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}"}, {"source_code": "\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(-1, \"\")\n for(i in 0 until n-1){\n val sub = \"${str[i]}${str[i+1]}\"\n var count = 0\n for(i in 0 until str.length-1){\n if(str[i] == sub[0] && str[i+1] == sub[1]) count++\n }\n if(count > tg.first){\n tg = Pair(count, sub)\n }\n }\n return tg.second\n }\n\n}\n"}, {"source_code": "import java.util.StringTokenizer\nimport java.io.InputStreamReader\nimport java.io.BufferedReader\nimport java.io.InputStream\nimport java.util.HashMap\nimport kotlin.math.max\n\nfun main() {\n\n R.init(System.`in`)\n var n = R.nextInt()\n var s = R.next()\n val map:HashMap = HashMap();\n var max=0\n var ans=\"\"\n for(i in 0..n-2){\n var x = s.substring(i,i+2)\n if(map.containsKey(x)){\n map.put(x,map.getValue(x)+1)\n }\n else{\n map.put(x,1);\n }\n if(maxtotal[most]) most=x\n }\n print(\"${((most/26)+'A'.toInt()).toChar() }${((most%26)+'A'.toInt()).toChar()}\\n\")\n}\nfun hash(i:Char, j:Char):Int{\n return (i-'A')*26 + (j-'A')\n}"}, {"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 ints\n\nvar m = HashMap();\n\nfun main(){\n var n:Int = readInt()\n var s: String = readLn()\n for(i in 0..n-2){\n m[s.substring(i, i+2)] = m.getOrDefault(s.substring(i, i+2), 0) + 1;\n }\n // println(m);\n var temp = 0;\n var ans:String? = null;\n for(e in m){\n if(e.value > temp){\n temp = e.value;\n ans = e.key\n }\n }\n println(ans)\n}"}, {"source_code": "fun main() {\n val inputLen = readLine()?.toInt()\n println(readLine()?.let { input ->\n val map = mutableMapOf()\n for (i in 0 until inputLen?.dec()!!) {\n input.substring(i, i.plus(2)).let { tg ->\n map[tg] = map[tg]?.inc() ?: 1\n }\n }\n map.maxBy {\n it.value\n }?.key\n })\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n val input = Scanner(System.`in`)\n\n val n = input.nextLine().toInt()\n val s = input.nextLine().toString()\n var max = 0\n var sequence = \"\"\n\n s.windowed(2,1, false) { toTest ->\n var count = 0\n s.windowed(2,1, false) { toMatch ->\n if (toTest == toMatch) {\n count ++\n }\n if (count>max) {\n max = count\n sequence = toTest.toString()\n }\n }\n }\n\n println(sequence)\n}"}, {"source_code": "fun main(args: Array) {\n val t = 1 // 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 while(i \")\n ma[ss] = ma[ss]!!.inc() \n // println(\"${ma[ss]}\")\n }\n i++\n }\n \n var ssmax = ma.keys.first()\n // println(\"${ssmax} ${ma[ssmax]}\")\n \n for (ss in ma.keys) { \n // println(\"${ss} ${ma[ss]!!} ${}\")\n \n if ( ma[ss]!! > ma[ssmax]!! ) {\n // println(\"${ss} > ${ssmax}\")\n ssmax = ss\n }\n } \n \n println(ssmax)\n \n }\n}\n"}, {"source_code": "fun main() {\n val n = (readLine() as String).toInt()\n val s = readLine() as String\n test(n, s)\n}\n\nfun test(n: Int, s: String) {\n val results = mutableMapOf()\n (0 until n -1).forEach {\n val twoGram = \"${s[it]}${s[it + 1]}\"\n results.compute(twoGram) { key, v ->\n (v ?: 0) + 1\n }\n\n }\n val result = results.entries.reduce { e1, e2 -> if (e1.value >= e2.value) e1 else e2 }\n println(result.key)\n}"}, {"source_code": "fun main() {\n val n = (readLine() as String).toInt()\n val s = readLine() as String\n test(n, s)\n}\n\nfun test(n: Int, s: String) {\n val results = mutableMapOf()\n\n\n (0 until n -1).forEach {\n val twoGram = \"${s[it]}${s[it + 1]}\"\n results.compute(twoGram) { key, v ->\n (v ?: 0) + 1\n }\n }\n\n val result = results.maxBy { it.value }!!\n\n //val result = results.entries.reduce { e1, e2 -> if (e1.value >= e2.value) e1 else e2 }\n println(result.key)\n}"}, {"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 = i;\n }\n \n i = i + 1;\n }\n \n println(characters.substring(best_index, best_index + 2));\n }"}, {"source_code": "fun main() {\n val numLetters = readLine()!!.toInt()\n val word = readLine()!!\n\n var twoGramFrequencies = mutableMapOf()\n for (i in 0 until numLetters - 1) {\n var currentTwoGram = word.substring(i..i + 1)\n if (twoGramFrequencies.containsKey(currentTwoGram)) {\n twoGramFrequencies.entries.filter { it.key == currentTwoGram }.map { it.setValue(it.value + 1) }\n } else {\n twoGramFrequencies[currentTwoGram] = 0\n }\n }\n\n println(twoGramFrequencies.maxBy { it.value }!!.key)\n}"}, {"source_code": "\nfun main(args: Array) {\n val nbCharacters: Int = readLine()!!.toInt()\n val word: String = readLine()!!\n val map: MutableMap = mutableMapOf()\n for (i in 0 .. nbCharacters-2) {\n val w = word.substring(i, i+2)\n val value = map.getOrElse(w) {0} + 1\n map.put(w, value )\n }\n\n var maxVal = -1\n var comb = \"\"\n map.forEach { k, v ->\n if (v > maxVal) {\n comb = k\n maxVal = v\n }\n }\n print(comb)\n}\n"}, {"source_code": "import java.util.Scanner\nfun main(args: Array){\n val input = Scanner(System.`in`)\n var pituus = readLine()!!\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}"}, {"source_code": "import java.util.Scanner;\n\nfun main() {\n val input = Scanner(System.`in`);\n\n var n = readLine()!!.toInt()\n var str = readLine()!!.toCharArray()\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"}, {"source_code": "/**\n * You can edit, run, and share this code. \n * play.kotlinlang.org \n */\nval scan = java.util.Scanner(System.`in`)\nfun main() {\n scan.nextInt()\n var s = scan.next()\n var maxTwogram = \"\"\n var maxCount = 0\n for(i in 0 until s.length-1) {\n val twogram = s.substring(i, i+2)\n var count = 0\n for (j in i until s.length-1) {\n if(s.substring(j).startsWith(twogram)) count ++\n }\n if(maxCount < count) {\n maxTwogram = twogram\n maxCount = count\n }\n }\n println(maxTwogram)\n}"}], "negative_code": [{"source_code": "import java.util.*\n\n/**\n * Kotlin Heroes: Practice 2\n * B. \u0414\u0432\u0443\u0433\u0440\u0430\u043c\u043c\u0430\n * http://codeforces.com/contest/1212/problem/B\n * */\nclass B\n\nfun main() {\n readLine()\n val s = readLine()!!.toCharArray()\n val arr = Array(pos('Z', 'Z') + 1) { 0 }\n\n var max = 0\n var maxS = \"\"\n for (i in 1 until s.size) {\n val pos = pos(s[i - 1], s[i])\n if (++arr[pos] > max) {\n max = arr[pos]\n maxS = \"${s[i - i]}${s[i]}\"\n }\n }\n println(maxS)\n}\n\nfun pos(a: Char, b: Char) = (a - 'A') * ('Z' - 'A' + 1) + (b - 'A')\n"}, {"source_code": "fun main() {\n val count = readLine()!!.toInt()\n val str = readLine()!!\n\n var max = Int.MIN_VALUE\n var maxStr = str.subSequence(0, 2)\n for (i in 0 .. count - 2) {\n val subStr = str.subSequence(i, i + 2)\n val count = subStr.count { subStr.contains(it) }\n if (count > max) {\n max = count\n maxStr = subStr\n }\n }\n print(maxStr)\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n val input = Scanner(System.`in`)\n\n// val n = input.nextLine().toInt()\n val s = input.nextLine().toString()\n var max = 0\n var sequence = \"\"\n\n s.windowed(2,1, false) { toTest ->\n var count = 0\n s.windowed(2,1, false) { toMatch ->\n if (toTest == toMatch) {\n count ++\n }\n if (count>max) {\n max = count\n sequence = toTest.toString()\n }\n }\n }\n\n println(sequence)\n}"}, {"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\nprivate fun readLongs() = readStrings().map{it.toLong()}\n//const val MOD = 1000000007\n\nfun main(args:Array){\n val n = readInt()\n val s = readLn()\n\n val skipString = s.substring(1, s.length-1)\n\n val list = s.asSequence()\n .chunked(2).map { it.joinToString(\"\") }.toList()\n\n val skiplist = skipString.asSequence()\n .chunked(2).map { it.joinToString(\"\") }.toList()\n\n val map = mutableMapOf()\n\n countGram(list, map)\n countGram(skiplist, map)\n\n var max = -1\n var key = \"\"\n map.forEach { t, u ->\n println(\"$t $u\")\n if (u>max && t.length==2){\n max = u\n key = t\n }\n }\n println(key)\n\n}\n\nfun countGram(list: List, map: MutableMap) {\n list.forEach {\n if (map.contains(it)) {\n val count = map[it]!!\n map[it] = count + 1\n } else {\n map[it] = 1\n }\n }\n}"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array) {\n\n val reader = Scanner(System.`in`)\n\n fun twoGram(n: Int, s: String): String {\n var mostCommonTwoGram: Pair = Pair(s.substring(0, 1), 1)\n val twoGramOccurrences = mutableMapOf()\n for (i in 0..n - 2) {\n val twoGram = s.substring(i, i + 2)\n twoGramOccurrences[twoGram] = twoGramOccurrences.getOrDefault(twoGram, 0) + 1\n if (twoGramOccurrences[twoGram] ?: 0 > mostCommonTwoGram.second) {\n mostCommonTwoGram = Pair(twoGram, twoGramOccurrences[twoGram] ?: 0)\n }\n\n }\n return mostCommonTwoGram.first\n }\n println(twoGram(reader.nextInt(), reader.next()))\n}"}, {"source_code": "fun twoGram(input: String) = input.windowed(2).groupingBy { it }.eachCount().maxBy { it.value }?.key\n\nfun main(args: Array) {\n println(args)\n println(args.size)\n if (args.size == 2) {\n val twoGram = twoGram(args[1])\n print(twoGram)\n }\n}"}, {"source_code": "fun main(args: Array) {\n val t = 1 //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 while(i ma[ssmax]!! ) ssmax=ss\n }\n } \n \n println(ssmax)\n \n }\n}\n"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array) {\n\n val reader = Scanner(System.`in`)\n\n fun twoGram(n: Int, s: String): String {\n var mostCommonTwoGram: Pair = Pair(s.substring(0, 1), 1)\n val twoGramOccurrences = mutableMapOf()\n for (i in 0..n - 2) {\n val twoGram = s.substring(i, i + 2)\n twoGramOccurrences[twoGram] = twoGramOccurrences.getOrDefault(twoGram, 0) + 1\n if (twoGramOccurrences[twoGram] ?: 0 > mostCommonTwoGram.second) {\n mostCommonTwoGram = Pair(twoGram, twoGramOccurrences[twoGram] ?: 0)\n }\n\n }\n return mostCommonTwoGram.first\n }\n println(twoGram(reader.nextInt(), reader.next()))\n}"}, {"source_code": "fun readInts() = readLine()!!.split(' ').map(String::toInt)\n\nfun main(){\n var n = readLine()!!.toInt()\n var str = readLine()!!.toString()\n var ans = \"\"\n var ansCnt = 0\n for(i in 0 until (n - 1)){\n var curr = 0\n val newStr = str[i].toString() + str[i + 1].toString()\n for(j in (i + 1) until (n - 1)){\n val prStr = str[j].toString() + str[j + 1].toString()\n if(newStr == prStr){\n curr++\n }\n }\n if(curr > ansCnt){\n ansCnt = curr\n ans = newStr\n }\n }\n print(ans)\n}"}, {"source_code": "import java.util.regex.Pattern\n\nfun main(args: Array) {\n twogram()\n}\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}\n\n"}, {"source_code": "fun main(args: Array) {\n val numberOfLines = readLine()?.toInt() ?: 0\n var string = readLine()\n val substrings = string?.chunked(2)\n val entries = mutableMapOf()\n\n for (i in 0 until numberOfLines) {\n val firstEntry = string?.get(i)\n val secondEntry = if (i == numberOfLines - 1) \"\" else string?.get(i + 1)\n val finalKey = \"$firstEntry$secondEntry\"\n\n if (entries.containsKey(finalKey)) {\n entries.merge(finalKey, 1) { old, value ->\n old + value\n }\n } else {\n entries[finalKey] = 1\n }\n }\n \n val max = entries.maxBy { it.value }\n println(max?.key)\n println(max?.value)\n}"}, {"source_code": "\nfun main(args: Array) {\n val nbCharacters: Int = readLine()!!.toInt()\n val word: String = readLine()!!\n val map: MutableMap = mutableMapOf()\n for (i in 0 .. nbCharacters-2) {\n val w = word.substring(i, i+2)\n map.put(w, map.getOrElse(w) {0})\n }\n\n var maxVal = -1\n var comb = \"\"\n map.forEach { k, v ->\n if (v > maxVal) {\n comb = k\n maxVal = v\n }\n }\n print(comb)\n}\n"}, {"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\nfun solve() {\n val n=readInt()\n val s=readLn().toCharArray()\n var m= mutableMapOf()\n for(i in 0..n-2) {\n val a=s[i].toString()+s[i+1].toString()\n m[a]=m[a]?:0+1\n }\n var maxx=0\n for(i in m){\n maxx= maxOf(i.value,maxx)\n }\n for(i in m){\n if(i.value==maxx){\n print(i.key)\n return\n }\n }\n}\n\nfun main() {\n var T=1\n// T = readInt()\n for (t in 1..T) { solve() }\n}"}, {"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 = Integer.valueOf(readLine())\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}"}, {"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.toString(), AtomicInteger(0)).incrementAndGet()\n if (cnt > maxCounts) {\n maxCounts = cnt\n twoGramma = candidate.toString()\n }\n }\n if (twoGramma != null) {\n println(twoGramma)\n }\n}"}, {"source_code": " fun main(arguments: Array){\n val length = Integer.parseInt(readLine()!!);\n val string = readLine()!!;\n \n var best_index = 0;\n var best_count = 0;\n \n var i = 0;\n while(i < (length - 1)){\n var count = 1;\n val reference1 = string.get(i);\n val reference2 = string.get(i + 1);\n \n var j = i + 1;\n while(j < (length - 1)){\n val char1 = string.get(j);\n val char2 = string.get(j);\n \n if(reference1 == char1 && reference2 == char2){\n count = count + 1;\n }\n \n j = j + 1;\n }\n \n if(count > best_count){\n best_count = count;\n best_index = i;\n }\n \n i = i + 1;\n }\n \n println(string.substring(best_index, best_index + 2));\n }"}, {"source_code": "fun main() {\n val inputLen = readLine()?.toInt()\n println(readLine()?.let { input ->\n val map = mutableMapOf()\n for (i in 0 until inputLen?.dec()!!) {\n input.substring(i, i.plus(2)).let { tg ->\n println(\"i=$i and tg=$tg\")\n map[tg] = map[tg]?.inc() ?: 1\n }\n }\n map.maxBy {\n it.value\n }?.key\n })\n}"}, {"source_code": "val scan = java.util.Scanner(System.`in`)\nfun main() {\n scan.nextInt()\n var s = scan.nextLine()\n var maxTwogram = \"\"\n var maxCount = 0\n for(i in 0 until s.length-1) {\n val twogram = s.substring(i, i+2)\n var count = 0\n for (j in i until s.length-1) {\n if(s.substring(j).startsWith(twogram)) count ++\n }\n if(maxCount < count) {\n maxTwogram = twogram\n maxCount = count\n }\n }\n print(maxTwogram)\n}"}, {"source_code": "import java.util.StringTokenizer\nimport java.io.InputStreamReader\nimport java.io.BufferedReader\nimport java.io.InputStream\nimport java.util.HashMap\nimport kotlin.math.max\n\nfun main() {\n\n R.init(System.`in`)\n var n = R.nextInt()\n var s = R.next()\n val map:HashMap = HashMap();\n var ans=0\n var count=0\n for(i in 0..n-2){\n var x = s.substring(i,i+2)\n if(map.containsKey(x)){\n map.put(x,map.getValue(x)+1)\n }\n else{\n map.put(x,1);\n }\n ans = maxOf(ans,map.getValue(x))\n count++\n }\n println(ans)\n \n\n}\n\ninternal object R {\n private lateinit var reader: BufferedReader\n private lateinit var tokenizer: StringTokenizer\n fun init(input: InputStream) {\n reader = BufferedReader(InputStreamReader(input))\n tokenizer = StringTokenizer(\"\")\n }\n\n fun next(): String {\n while (!tokenizer.hasMoreTokens()) tokenizer = StringTokenizer(reader.readLine())\n return tokenizer.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextDouble() = next().toDouble()\n fun nextLong() = next().toLong();\n}"}, {"source_code": "fun twoGram(input: String) = input.windowed(2).groupingBy { it }.eachCount().maxBy { it.value }?.key\n\nfun main(args: Array) {\n if (args.size == 2) {\n val twoGram = twoGram(args[1])\n println(twoGram)\n }\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n val s = readLine()!!\n\n var i = 0\n val h = HashMap()\n while (i <= n - 2) {\n val tg = s.take(2)\n h[tg] = (h[tg] ?: 0) + 1\n i++\n }\n var max = Int.MIN_VALUE\n var tg = \"\"\n for ((k,v) in h.entries) {\n if (v > max) {\n tg = k\n max = v\n }\n }\n println(tg)\n}"}, {"source_code": " fun main(arguments: Array){\n val length = Integer.parseInt(readLine()!!);\n val string = readLine()!!;\n \n var best_index = 0;\n var best_count = 0;\n \n var i = 0;\n while(i < (length - 1)){\n var count = 1;\n val reference1 = string.get(i);\n val reference2 = string.get(i + 1);\n \n var j = i + 1;\n while(j < (length - 1)){\n val char1 = string.get(j);\n val char2 = string.get(j);\n \n if(reference1 == char1 && reference2 == char2){\n count = count + 1;\n }\n \n j = j + 1;\n }\n \n if(count > best_count){\n best_count = count;\n best_index = i;\n }\n \n i = i + 1;\n }\n \n println(string.substring(best_index, best_index + 2));\n }"}, {"source_code": "fun main() {\n readLn()\n val s = readLn()\n val twoGrams = mutableMapOf()\n\n for (i in 0 until s.length - 1) {\n val twoGram = s.substring(i, i + 2)\n twoGrams[twoGram] = if (twoGrams.containsKey(twoGram)) (twoGrams[twoGram] ?: + 1) else 1\n }\n\n println(twoGrams.maxBy { it.value }?.key)\n}\n\n// Input Reader\nprivate fun readLn() = readLine()!!\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val cin = Scanner(System.`in`)\n val len = cin.nextInt()\n val str = cin.next()\n\n val dict = HashMap()\n for (i in 0 until len - 2) {\n if (!dict.containsKey(str.substring(i, i + 2))) {\n dict[str.substring(i, i + 2)] = 0\n }\n dict[str.substring(i, i + 2)] = dict[str.substring(i, i + 2)]!! + 1\n }\n\n var ans = \"\"\n var topMatch = 0\n for (cur in dict) {\n if (cur.value!! > topMatch) {\n topMatch = cur.value!!\n ans = cur.key\n }\n }\n println(ans)\n}"}, {"source_code": "object 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 str.forEach { f ->\n str.substring(1).forEach {s ->\n val match = \"$f$s\"\n val times = match.toRegex().findAll(str).count()\n if(times > tg.first)\n tg = Pair(times, match)\n }\n }\n return tg.second\n }\n\n}"}, {"source_code": "\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"}, {"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 - 2) {\n for(j in i + 1 until input.length) {\n if (input[i] == input[j]) {\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 }\n }\n val sorted = result.toSortedMap(compareBy { it })\n println(sorted)\n}"}, {"source_code": "fun main(args : Array) {\n val length = readLine()!!.toInt()\n val input = readLine()!!\n val twoGramMap = mutableMapOf()\n for (i in 0..length-2) {\n val twoGram = input.subSequence(i, i+2).toString()\n if (twoGramMap.containsKey(twoGram)) twoGramMap[twoGram]!!.inc() else twoGramMap[twoGram] = 1\n }\n\n println(twoGramMap.entries.maxWith(Comparator { o1, o2 -> o1.value.compareTo(o2.value) })?.key)\n}"}, {"source_code": "import java.util.*\n\n/**\n * Kotlin Heroes: Practice 2\n * B. \u0414\u0432\u0443\u0433\u0440\u0430\u043c\u043c\u0430\n * http://codeforces.com/contest/1212/problem/B\n * */\nclass B\n\nfun main() {\n readLine()\n val s = readLine()!!.toCharArray()\n val arr = Array(pos('Z', 'Z') + 1) { 0 }\n\n var max = 0\n var maxS = \"\"\n for (i in 1 until s.size) {\n val pos = pos(s[i - 1], s[i])\n if (++arr[pos] > max) {\n max = arr[pos]\n maxS = \"${s[i - i]}${s[i]}\"\n }\n }\n println(maxS)\n}\n\nfun pos(a: Char, b: Char) = (a - 'A') * ('Z' - 'A' + 1) + (b - 'A')\n"}, {"source_code": "fun main(args: Array) {\n readLine()\n val s = readLine()!!\n println(s.windowed(2).groupingBy { it }.eachCount().values.max()!!)\n}"}, {"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 if (input[i] == input[j]) {\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 }\n println(result.maxBy { it.value })\n}"}, {"source_code": "fun twoGram(input: String) {\n val result = input.windowed(2).groupingBy { it }.eachCount().maxBy { it.value }?.key\n println(result)\n}\n\nfun main(args: Array) {\n if (args.size == 2)\n twoGram(args[1])\n}"}, {"source_code": "\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 var sss = str\n val match = str.substring(i, i+2)\n var times = 0;\n while(true){\n val find = match.toRegex().find(sss)\n if(find != null && find?.range?.first!! > -1){\n times++\n sss = sss.removeRange(0, find.range.first+1)\n }else{\n break;\n }\n }\n\n if(times > tg.first)\n tg = Pair(times, match)\n }\n return tg.second\n }\n\n}\n"}, {"source_code": "fun main() {\n readLine()\n val s = readLine()\n val mp = mutableMapOf()\n var ans = \"\"\n var mx = -1\n for (i in 1 until s!!.length) {\n val str = \"\" + s[i - 1] + s[i]\n if (str in mp) {\n mp[str]!!.plus(1)\n } else {\n mp[str] = 1\n }\n if (mp[str]!! > mx) {\n ans = str;\n mx = mp[str]!!\n }\n }\n println(ans)\n}"}, {"source_code": "fun main(args: Array) {\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 \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}"}, {"source_code": "\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 var sss = str\n val match = str.substring(i, i+2)\n var times = 0;\n while(true){\n val find = match.toRegex().find(sss)\n if(find != null && find?.range?.first!! > -1){\n times++\n sss = sss.removeRange(0, find.range.first+1)\n }else{\n break;\n }\n }\n\n if(times > tg.first)\n tg = Pair(times, match)\n }\n return tg.second\n }\n\n}\n"}, {"source_code": "fun main() {\n readLn()\n val s = readLn()\n val twoGrams = mutableMapOf()\n\n for (i in 0 until s.length - 1) {\n val twoGram = s.substring(i, i + 2)\n twoGrams[twoGram] = if (twoGrams.containsKey(twoGram)) twoGrams[twoGram]?.plus(1)!! else 1\n }\n\n println(twoGrams)\n println(twoGrams.maxBy { it.value }?.key)\n}\n\n// Input Reader\nprivate fun readLn() = readLine()!!\n"}, {"source_code": "import java.util.*\nimport kotlin.collections.HashMap\n\nfun main(vararg args: String) {\n val scanner = Scanner(System.`in`)\n val length = scanner.nextInt()\n val string = scanner.next()\n println(find(length, string))\n}\n\nfun find(length: Int, string: String): String {\n val map = HashMap()\n for (i in 0 until length - 1) {\n val str = string.substring(i, i + 2)\n if (map.containsKey(str)) {\n map[str]!!.plus(1)\n } else {\n map[str] = 0\n }\n }\n return map.maxBy { it.value }!!.key\n}"}, {"source_code": "fun main() {\n readLine()\n val s = readLine()\n val mp = mutableMapOf()\n var ans = \"\"\n var mx = -1\n for (i in 1 until s!!.length) {\n val str = \"\" + s[i - 1] + s[i]\n if (str in mp) {\n mp[str]!!.plus(1)\n } else {\n mp[str] = 1\n }\n if (mp[str]!! > mx) {\n ans = str;\n mx = mp[str]!!\n }\n }\n println(ans)\n}"}, {"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\nprivate fun readLongs() = readStrings().map{it.toLong()}\n//const val MOD = 1000000007\n\nfun main(args:Array){\n val n = readInt()\n val s = readLn()\n\n val skipString = s.substring(1, s.length-1)\n\n val list = s.asSequence()\n .chunked(2).map { it.joinToString(\"\") }.toList()\n\n val skiplist = skipString.asSequence()\n .chunked(2).map { it.joinToString(\"\") }.toList()\n\n val map = mutableMapOf()\n\n countGram(list, map)\n countGram(skiplist, map)\n\n var max = -1\n var key = \"\"\n map.forEach { t, u ->\n println(\"$t $u\")\n if (u>max && t.length==2){\n max = u\n key = t\n }\n }\n println(key)\n\n}\n\nfun countGram(list: List, map: MutableMap) {\n list.forEach {\n if (map.contains(it)) {\n val count = map[it]!!\n map[it] = count + 1\n } else {\n map[it] = 1\n }\n }\n}"}, {"source_code": "\n\nimport java.util.*\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\nfun readIntArr(): MutableList {\n val l = readLine()!!.split(\" \").map { it.toInt() }\n var m : MutableList = ArrayList()\n for(x in l) m.add(x)\n return m\n}\n\nfun min(a: Int, b: Int) : Int {\n return if(ab) a else b\n}\n\nfun ispal(s: String): Boolean {\n var i = 0\n var j = s.length-1\n while(i()\n\n for(i in 0..n-3){\n val ss = s.substring(i,i+2)\n if(!m.containsKey(ss)) m.set(ss,0)\n m.computeIfPresent(ss) { _, v -> v + 1 }\n }\n\n var best = 0\n for((k,v) in m){\n if(v>best){\n best = v\n s = k\n }\n }\n\n println(s);\n}\n\n\n\n\n\n\n\n\n\n"}, {"source_code": "import java.util.*\nimport kotlin.collections.HashMap\n\nfun main(vararg args: String) {\n val scanner = Scanner(System.`in`)\n val length = scanner.nextInt()\n val string = scanner.next()\n println(find(length, string))\n}\n\nfun find(length: Int, string: String): String {\n val map = HashMap()\n for (i in 0 until length - 1) {\n val str = string.substring(i, i + 2)\n if (map.containsKey(str)) {\n map[str]!!.plus(1)\n } else {\n map[str] = 0\n }\n }\n return map.maxBy { it.value }!!.key\n}"}, {"source_code": "\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"}, {"source_code": "import java.util.*\n\nfun main() {\n Scanner(System.`in`).use { scanner ->\n val stringLength = scanner.nextInt()\n val string = scanner.next()\n val twoGram = TwoGramSolver.solve(stringLength, string)\n println(\"${twoGram[0]}${twoGram[1]}\")\n }\n}\n\nprivate object TwoGramSolver {\n\n internal fun solve(stringLength: Int, string: String): Array {\n if (stringLength == 2 || stringLength == 3) {\n return arrayOf(string[0], string[1])\n }\n\n val twoGrams = mutableMapOf, Int>()\n var maxTwoGram = arrayOf(string[0], string[1])\n var maxTwoGramValue = 1\n\n for (index in 1 until stringLength - 1) {\n val twoGram = arrayOf(string[index], string[index + 1])\n\n val twoGramCount = (twoGrams[twoGram] ?: 0).inc()\n twoGrams[twoGram] = twoGramCount\n\n if (twoGramCount > maxTwoGramValue) {\n maxTwoGram = twoGram\n maxTwoGramValue = twoGramCount\n }\n }\n\n return maxTwoGram\n }\n}"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array) {\n\n val reader = Scanner(System.`in`)\n\n fun twoGram(n: Int, s: String): String {\n var mostCommonTwoGram: Pair = Pair(s.substring(0, 1), 1)\n val twoGramOccurrences = mutableMapOf()\n for (i in 0..n - 2) {\n val twoGram = s.substring(i, i + 2)\n twoGramOccurrences[twoGram] = twoGramOccurrences.getOrDefault(twoGram, 0) + 1\n if (twoGramOccurrences[twoGram] ?: 0 > mostCommonTwoGram.second) {\n mostCommonTwoGram = Pair(twoGram, twoGramOccurrences[twoGram] ?: 0)\n }\n\n }\n return mostCommonTwoGram.first\n }\n println(twoGram(reader.nextInt(), reader.next()))\n}"}, {"source_code": "\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 var sss = str.removeRange(0, i)\n val match = str.substring(i, i+2)\n var times = 0;\n while(true){\n val find = match.toRegex().find(sss)\n if(find != null && find?.range?.first!! > -1){\n times++\n sss = sss.removeRange(0, find.range.first+1)\n }else{\n break;\n }\n }\n\n if(times >= tg.first)\n tg = Pair(times, match)\n }\n return tg.second\n }\n\n}"}, {"source_code": "\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 var sss = str\n val match = str.substring(i, i+2)\n var times = 0;\n while(true){\n val find = match.toRegex().find(sss)\n if(find != null && find?.range?.first!! > -1){\n times++\n sss = sss.removeRange(0, find.range.first+1)\n }else{\n break;\n }\n }\n\n if(times > tg.first)\n tg = Pair(times, match)\n }\n return tg.second\n }\n\n}\n"}, {"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\nfun solve() {\n val n=readInt()\n val s=readLn().toCharArray()\n var m= mutableMapOf()\n for(i in 0..n-2) {\n val a=100*(s[i]).toInt()+(s[i+1]).toInt()\n m[a]=m[a]?:0+1\n }\n var maxx=0\n for(i in m){\n maxx= maxOf(i.value,maxx)\n }\n for(i in m){\n if(i.value==maxx){\n val c=(i.key%100).toChar()\n val d=(i.key/100).toChar()\n print(c)\n print(d)\n return\n }\n }\n}\n\nfun main() {\n var T=1\n// T = readInt()\n for (t in 1..T) { solve() }\n}"}, {"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\n val ps = s.asSequence().zipWithNext().toList()\n\n val x = ps.sortedBy {\n if (it.first == it.second) {\n it.second\n } else {\n it.first\n }\n }\n var count = 1\n var max = 0\n var r = x[0]\n for (i in 0 until n - 2) {\n if (x[i] == x[i + 1]) {\n count++\n } else {\n max = if (max < count) {\n r = x[i]\n count\n } else {\n max\n }\n count = 1\n }\n }\n print(r.first)\n println(r.second)\n\n}\n\n\n/*\nval (n, k) = readInts()\nval li: MutableList = readInts() as MutableList\nli.sort()\nprintln(li)\nif(li[k - 1] == li[k]){\n println(-1)\n} else {\n print(li[k - 1])\n}\n*/\n"}, {"source_code": "import java.util.*\n\nfun main() {\n val input = readLine()\n \n if (input == null) {\n return\n }\n \n val map = mutableMapOf, Int>() \n\n input.zipWithNext().forEach {\n if (map.get(it) == null) {\n map.put(it, 1)\n } else {\n map.put(it, map.get(it)!! + 1)\n }\n }\n \n var maxPair: Pair? = null\n var maxCount = 0\n \n for ((pair, count) in map) {\n if (count > maxCount) {\n maxPair = pair\n maxCount = count\n }\n }\n \n if (maxPair == null) {\n return\n }\n \n print(maxPair.component1())\n print(maxPair.component2())\n}"}, {"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\n\nfun main() {\n var n = readInt()\n var s = readLn()\n var m = HashMap()\n\n for (i in 0..s.length-2) {\n var str = s[i].toString() + s[i + 1]\n if (m.containsKey(str))\n m[str] = m[str]!! + 1\n else\n m[str] = 0\n }\n var mx = Pair(\"\", 0)\n for ((k,v) in m) {\n if (mx.second < v) {\n mx = Pair(k,v)\n }\n }\n print(mx.first)\n}"}, {"source_code": "import java.util.regex.Pattern\n\nfun main(args: Array) {\n val ss = twogram1()\n print(ss?.first)\n}\n\nfun twogram1(): Pair?{\n val n = readLine()?.toInt() ?: 0\n val s = readLine().orEmpty()\n val chars = s.toList()\n if(chars.size == n && chars.size > 1) {\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 s to 0\n}\n\n"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val value = scanner.nextInt()\n if (value in 2..100) {\n val text = scanner.next()\n if (text.length != value) {\n print(\"wrong\")\n } else {\n var maxi = 0\n var gram = \"\"\n repeat(text.length - 1) { _times ->\n val sub = text.substring(_times, _times + 2)\n val temp = calll(sub, text)\n if (temp > maxi) {\n maxi = temp\n println(\"sonuc : $maxi\")\n gram = sub\n }\n }\n println(gram)\n }\n } else {\n print(\"Wrong\")\n }\n}\n\nfun calll(sub: String, value: String): Int {\n var cnt = 0\n repeat(value.length - 1) { k ->\n if (value[k] == sub[0] && value[k + 1] == sub[1])\n cnt++\n }\n return cnt\n}"}, {"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}"}, {"source_code": "\n\nimport java.util.*\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\nfun readIntArr(): MutableList {\n val l = readLine()!!.split(\" \").map { it.toInt() }\n var m : MutableList = ArrayList()\n for(x in l) m.add(x)\n return m\n}\n\nfun min(a: Int, b: Int) : Int {\n return if(ab) a else b\n}\n\nfun ispal(s: String): Boolean {\n var i = 0\n var j = s.length-1\n while(i()\n\n for(i in 0..n-3){\n val ss = s.substring(i,i+2)\n if(!m.containsKey(ss)) m.set(ss,0)\n m.computeIfPresent(ss) { _, v -> v + 1 }\n }\n\n var best = 0\n for((k,v) in m){\n if(v>best){\n best = v\n s = k\n }\n }\n\n println(s);\n}\n\n\n\n\n\n\n\n\n\n"}, {"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}"}, {"source_code": "fun main(args : Array) {\n var n = readLine()!!.toInt()\n var str = readLine()!!\n println(str.substring(0..1))\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n val string = readLine()!!\n val grams = ArrayList(n)\n for (i in 0 until n - 1) {\n grams.add(string.substring(i..i + 1))\n }\n print(grams.maxBy { grams.count { grams.contains(it) } })\n}"}, {"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\n val ps = s.asSequence().zipWithNext().toList()\n\n val x = ps.sortedBy {\n if (it.first == it.second) {\n it.second\n } else {\n it.first\n }\n }\n var count = 1\n var max = 0\n var r = x[0]\n for (i in 0 until n - 2) {\n if (x[i] == x[i + 1]) {\n count++\n } else {\n max = if (max < count) {\n r = x[i]\n count\n } else {\n max\n }\n count = 1\n }\n }\n print(r.first)\n println(r.second)\n\n}\n\n\n/*\nval (n, k) = readInts()\nval li: MutableList = readInts() as MutableList\nli.sort()\nprintln(li)\nif(li[k - 1] == li[k]){\n println(-1)\n} else {\n print(li[k - 1])\n}\n*/\n"}, {"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}"}, {"source_code": "import java.util.regex.Pattern\n\nfun main(args: Array) {\n twogram()\n}\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}\n\n"}, {"source_code": "fun main() {\n val l = readLine()!!.toInt()\n val s = readLine()!!\n\n val r :HashMap = hashMapOf()\n\n for (i in 0 until l - 1) {\n val x = s.substring(i, i + 2)\n if (r.containsKey(x)) {\n r[x] = r[x]!!.plus(1)\n } else {\n r[x] = 0\n }\n }\n\n val z = -1\n var y = \"\"\n for (j in r) {\n if (j.value > z) {\n y = j.key\n }\n }\n println(y)\n}"}, {"source_code": "fun main() {\n val l = readLine()!!.toInt()\n val s = readLine()!!\n\n val r :HashMap = hashMapOf()\n\n for (i in 0 until l - 1) {\n val x = s.substring(i, i + 2)\n if (r.containsKey(x)) {\n r[x] = r[x]!!.plus(1)\n } else {\n r[x] = 0\n }\n }\n\n val z = -1\n var y = \"\"\n for (j in r) {\n if (j.value > z) {\n y = j.key\n }\n }\n println(y)\n}"}, {"source_code": "import java.util.regex.Pattern\n\nfun main(args: Array) {\n twogram()\n}\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}\n\n"}, {"source_code": "\nimport java.util.*\nimport kotlin.collections.ArrayList\n\nfun main() {\n val input = Scanner(System.`in`)\n val n = input.nextInt()\n val s = input.next()\n\n val letters = s.split(\"\")\n val iSize = letters.size - 2\n val dGrams: ArrayList = ArrayList()\n for (i in 0..iSize) {\n dGrams.add(\"${letters[i]}${letters[i + 1]}\")\n }\n\n var mGram = Int.MIN_VALUE\n var mIndex = 0\n val count: ArrayList> = ArrayList()\n for (i in dGrams) {\n var exists = false\n var gIndex = 0\n count.forEachIndexed { index, pair ->\n if (pair.first == i) {\n exists = true\n gIndex = index\n return@forEachIndexed\n }\n }\n if (!exists) {\n count.add(Pair(i, 1))\n } else {\n val num = count[gIndex].second + 1\n count[gIndex] = Pair(i, num)\n if (num > mGram) {\n mGram = num\n mIndex = gIndex\n }\n }\n }\n\n print(count[mIndex].first)\n}\n"}, {"source_code": "fun main() {\n val inputLen = readLine()?.toInt()\n println(readLine()?.let { input ->\n val map = mutableMapOf()\n for (i in 0 until inputLen?.dec()!!) {\n input.substring(i, i.plus(2)).let { tg ->\n println(\"i=$i and tg=$tg\")\n map[tg] = map[tg]?.inc() ?: 1\n }\n }\n map.maxBy {\n it.value\n }?.key\n })\n}"}, {"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\nprivate fun readLongs() = readStrings().map{it.toLong()}\n//const val MOD = 1000000007\n\nfun main(args:Array){\n val n = readInt()\n val s = readLn()\n\n val skipString = s.substring(1, s.length-1)\n\n val list = s.asSequence()\n .chunked(2).map { it.joinToString(\"\") }.toList()\n\n val skiplist = skipString.asSequence()\n .chunked(2).map { it.joinToString(\"\") }.toList()\n\n val map = mutableMapOf()\n\n countGram(list, map)\n countGram(skiplist, map)\n\n var max = -1\n var key = \"\"\n map.forEach { t, u ->\n println(\"$t $u\")\n if (u>max && t.length==2){\n max = u\n key = t\n }\n }\n println(key)\n\n}\n\nfun countGram(list: List, map: MutableMap) {\n list.forEach {\n if (map.contains(it)) {\n val count = map[it]!!\n map[it] = count + 1\n } else {\n map[it] = 1\n }\n }\n}"}, {"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 = Integer.valueOf(readLine())\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}"}, {"source_code": "fun twoGram(input: String) {\n val result = input.windowed(2).groupingBy { it }.eachCount().maxBy { it.value }?.key\n println(result)\n}\n\nfun main(args: Array) {\n// if (args.size == 2)\n// twoGram(args[1])\n print(\"AB\")\n}"}, {"source_code": "fun main() {\n readLine()\n val s = readLine()\n val mp = mutableMapOf()\n var ans = \"\"\n var mx = -1\n for (i in 1 until s!!.length) {\n val str = \"\" + s[i - 1] + s[i]\n if (str in mp) {\n mp[str]!!.plus(1)\n } else {\n mp[str] = 1\n }\n if (mp[str]!! > mx) {\n ans = str;\n mx = mp[str]!!\n }\n }\n println(ans)\n}"}, {"source_code": "object 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 str.forEach { f ->\n str.substring(1).forEach {s ->\n val match = \"$f$s\"\n val times = match.toRegex().findAll(str).count()\n if(times > tg.first)\n tg = Pair(times, match)\n }\n }\n return tg.second\n }\n\n}"}, {"source_code": "import java.util.Scanner\n\n/*\n\tScanner scanner_variable = Scanner(System.`in`)\n\t//Reading Int input\n\tscanner_variable.nextInt()\n\t//Reading Float Input\n\tscanner_variable.nextFloat()\n\t//Reading Double Input\n\tscanner_variable.nextDouble()\n\t//Reading Boolean Input\n\tscanner_variable.nextBoolean()\n\t//Reading Short Input\n\tscanner_variable.nextShort()\n\t//Reading Long Input\n\tscanner_variable.nextLong()\n\t//Reading String Input\n\tscanner_variable.nextLine()\n\n\ttoChar() \u2013 To convert a type to Char type.\n\ttoInt() \u2013 To convert a type to Int type.\n\ttoLong() \u2013 To convert a type to Long type.\n\ttoFloat() \u2013 To convert a type to Float type.\n\ttoDouble() \u2013 To convert a type to Double type.\n\ttoByte() \u2013 To convert a type to Byte type.\n\ttoShort() \u2013 To convert a type to Short type.\n\n\tval parts = str.split(\" \")\n\n\tfun meAjuda(L: List) {\n\t\tfor(s in L)\n\t\t\tprintln(s)\n\t}\t\n*/\n\nfun main() {\n\tval n = readLine()\n\tval str = readLine().toString()\n\n\tvar cur = -1\n\tvar ans = \"AA\"\n\n\tfor(a in 'A'..'Z') {\n\t\tfor(b in a..'Z') {\n\t\t\tvar s = a.toString() + b.toString()\n\t\t\tvar par = 0\n\t\t\tfor(i in 1..(str.length-1))\n\t\t\t\tif(s == str.get(i - 1).toString() + str.get(i).toString())\n\t\t\t\t\tpar++\n\t\t\tif(par > cur) {\n\t\t\t\tans = s\n\t\t\t\tcur = par\n\t\t\t}\n\t\t}\n\t}\n\tprintln(ans)\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n val input = Scanner(System.`in`)\n\n// val n = input.nextLine().toInt()\n val s = input.nextLine().toString()\n var max = 0\n var sequence = \"\"\n\n s.windowed(2,1, false) { toTest ->\n var count = 0\n s.windowed(2,1, false) { toMatch ->\n if (toTest == toMatch) {\n count ++\n }\n if (count>max) {\n max = count\n sequence = toTest.toString()\n }\n }\n }\n\n println(sequence)\n}"}, {"source_code": "\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 var sss = str\n val match = str.substring(i, i+2)\n var times = 0;\n while(true){\n val find = match.toRegex().find(sss)\n if(find != null && find?.range?.first!! > -1){\n times++\n sss = sss.removeRange(0, find.range.first+1)\n }else{\n break;\n }\n }\n\n if(times > tg.first)\n tg = Pair(times, match)\n }\n return tg.second\n }\n\n}\n"}, {"source_code": "fun main(args: Array) {\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 \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}"}, {"source_code": "fun main() {\n val inputLen = readLine()?.toInt()\n println(readLine()?.let { input ->\n val map = mutableMapOf()\n for (i in 0 until inputLen?.dec()!!) {\n input.substring(i, i.plus(2)).let { tg ->\n println(\"i=$i and tg=$tg\")\n map[tg] = map[tg]?.inc() ?: 1\n }\n }\n map.maxBy {\n it.value\n }?.key\n })\n}"}, {"source_code": "fun main() {\n readLn()\n val s = readLn()\n val twoGrams = mutableMapOf()\n\n for (i in 0 until s.length - 1) {\n val twoGram = s.substring(i, i + 2)\n twoGrams[twoGram] = if (twoGrams.containsKey(twoGram)) (twoGrams[twoGram] ?: + 1) else 1\n }\n\n println(twoGrams.maxBy { it.value }?.key)\n}\n\n// Input Reader\nprivate fun readLn() = readLine()!!\n"}, {"source_code": "val scan = java.util.Scanner(System.`in`)\nfun main() {\n scan.nextInt()\n var s = scan.nextLine()\n var maxTwogram = \"\"\n var maxCount = 0\n for(i in 0 until s.length-1) {\n val twogram = s.substring(i, i+2)\n var count = 0\n for (j in i until s.length-1) {\n if(s.substring(j).startsWith(twogram)) count ++\n }\n if(maxCount < count) {\n maxTwogram = twogram\n maxCount = count\n }\n }\n print(maxTwogram)\n}"}, {"source_code": "import java.util.Scanner\n\n/*\n\tScanner scanner_variable = Scanner(System.`in`)\n\t//Reading Int input\n\tscanner_variable.nextInt()\n\t//Reading Float Input\n\tscanner_variable.nextFloat()\n\t//Reading Double Input\n\tscanner_variable.nextDouble()\n\t//Reading Boolean Input\n\tscanner_variable.nextBoolean()\n\t//Reading Short Input\n\tscanner_variable.nextShort()\n\t//Reading Long Input\n\tscanner_variable.nextLong()\n\t//Reading String Input\n\tscanner_variable.nextLine()\n\n\ttoChar() \u2013 To convert a type to Char type.\n\ttoInt() \u2013 To convert a type to Int type.\n\ttoLong() \u2013 To convert a type to Long type.\n\ttoFloat() \u2013 To convert a type to Float type.\n\ttoDouble() \u2013 To convert a type to Double type.\n\ttoByte() \u2013 To convert a type to Byte type.\n\ttoShort() \u2013 To convert a type to Short type.\n\n\tval parts = str.split(\" \")\n\n\tfun meAjuda(L: List) {\n\t\tfor(s in L)\n\t\t\tprintln(s)\n\t}\t\n*/\n\nfun main() {\n\tval n = readLine()\n\tval str = readLine().toString()\n\n\tvar cur = -1\n\tvar ans = \"AA\"\n\n\tfor(a in 'A'..'Z') {\n\t\tfor(b in a..'Z') {\n\t\t\tvar s = a.toString() + b.toString()\n\t\t\tvar par = 0\n\t\t\tfor(i in 1..(str.length-1))\n\t\t\t\tif(s == str.get(i - 1).toString() + str.get(i).toString())\n\t\t\t\t\tpar++\n\t\t\tif(par > cur) {\n\t\t\t\tans = s\n\t\t\t\tcur = par\n\t\t\t}\n\t\t}\n\t}\n\tprintln(ans)\n}"}, {"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\n val ps = s.asSequence().zipWithNext().toList()\n\n var max = 0\n var count = 1\n var r = ps[0]\n for(i in 0 until n - 2){\n if(ps[i] == ps[i + 1]){\n count++\n } else {\n max = if(max < count) {\n r = ps[i]\n count\n } else {\n max\n }\n count = 1\n }\n }\n print(\"${r.first}${r.second}\")\n \n\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n Scanner(System.`in`).use { scanner ->\n val stringLength = scanner.nextInt()\n val string = scanner.next()\n println(TwoGramSolver.solve(stringLength, string))\n }\n}\n\nprivate object TwoGramSolver {\n\n internal fun solve(stringLength: Int, string: String): String {\n val twoGrams = mutableMapOf()\n var maxTwoGram: Pair? = null\n\n for (index in 0 until stringLength - 1) {\n val twoGramStringBuilder = StringBuffer(2)\n twoGramStringBuilder.append(string[index])\n twoGramStringBuilder.append(string[index + 1])\n val twoGram = twoGramStringBuilder.toString()\n\n val twoGramCount = (twoGrams[twoGram] ?: 0).inc()\n twoGrams[twoGram] = twoGramCount\n\n if (maxTwoGram == null) {\n maxTwoGram = twoGram to twoGramCount\n break\n }\n\n if (twoGramCount > maxTwoGram.second) {\n maxTwoGram = twoGram to twoGramCount\n }\n }\n\n return maxTwoGram!!.first\n }\n}"}, {"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 if (input[i] == input[j]) {\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 }\n println(result.maxBy { it.value })\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val cin = Scanner(System.`in`)\n val len = cin.nextInt()\n val str = cin.next()\n\n val dict = HashMap()\n for (i in 0 until len - 2) {\n if (!dict.containsKey(str.substring(i, i + 2))) {\n dict[str.substring(i, i + 2)] = 0\n }\n dict[str.substring(i, i + 2)] = dict[str.substring(i, i + 2)]!! + 1\n }\n\n var ans = \"\"\n var topMatch = 0\n for (cur in dict) {\n if (cur.value!! > topMatch) {\n topMatch = cur.value!!\n ans = cur.key\n }\n }\n println(ans)\n}"}, {"source_code": "fun main(args: Array) {\n\n // reading the input and saving it\n val amountOfLetters = readLine()!!.toInt()\n val inputString = readLine()!!\n\n // the var will be the temporary string containing the two-gram to be checked while traversing through\n // the input String\n var tempString: String\n\n // the hashmap will contain the two-gram string along with the occurences\n // it will be initialied with the first two-gram and its counter value of 1\n var counterHashMap: MutableMap = mutableMapOf(inputString.subSequence(0,2).toString() to 1)\n\n // iterating over the string, saving each two-gram in a temporary string\n // checking if the two-gram exists in the hashmap\n // yes: increase the value, no: adding the two-gram to the hasmap and initializing the value to 1\n for((index,character) in inputString.withIndex()) {\n // to avoid the indexOutOfBounce exception, the index is being checked\n if(index == inputString.length-1) break\n // skip the first 2 letters as they have been added in the initialisation\n if(index == 0) continue;\n\n // concatenating two chars\n tempString = \"\" + character + inputString[index+1]\n println(tempString)\n // check if the two-gram is in the haspMap\n if(tempString in counterHashMap) {\n // increase the value if it does\n counterHashMap.set(tempString, counterHashMap.get(tempString)!!.plus(1))\n } else {\n // add the value to hashmap if it doesnt with value 1\n counterHashMap.put(tempString,1)\n }\n }\n println(counterHashMap.maxBy{it.value}.toString().subSequence(0,2))\n}"}, {"source_code": "import kotlin.io.*\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\nfun main() {\n var n = readInt()\n var str = readStrings()[0]\n\n var m = mutableMapOf()\n var setted = false\n var best = String()\n for(i in 0..str.length-2) {\n var s = str[i].toString()+str[i+1].toString();\n if(m.containsKey(s)) {\n m[s] = m[s]!!+1\n if(setted) {\n if(m[s]!!>m[best]!!) {\n best=s\n }\n }else {\n best=s\n }\n }else {\n m[s]=1\n }\n }\n\n println(\"$best\")\n}"}, {"source_code": "object 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 str.forEach { f ->\n str.substring(1).forEach {s ->\n val match = \"$f$s\"\n val times = match.toRegex().findAll(str).count()\n if(times > tg.first)\n tg = Pair(times, match)\n }\n }\n return tg.second\n }\n\n}"}, {"source_code": "\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 var sss = str\n val match = str.substring(i, i+2)\n var times = 0;\n while(true){\n val find = match.toRegex().find(sss)\n if(find != null && find?.range?.first!! > -1){\n times++\n sss = sss.removeRange(0, find.range.first+1)\n }else{\n break;\n }\n }\n\n if(times > tg.first)\n tg = Pair(times, match)\n }\n return tg.second\n }\n\n}\n"}, {"source_code": "private fun f(str: String): String {\n val counts = (0..str.length - 2).fold(mutableMapOf()) { collector, i ->\n val twoGram = str.subSequence(i, i + 2)\n collector[twoGram] = collector.getOrDefault(twoGram, 0) + 1\n collector\n }\n return counts.maxBy { it.value }?.key.toString()\n}\n\nfun main() {\n val str = readLn()\n println(f(str))\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"}, {"source_code": "import java.util.*\n\nfun main() {\n Scanner(System.`in`).use { scanner ->\n val stringLength = scanner.nextInt()\n val string = scanner.next()\n val twoGram = TwoGramSolver.solve(stringLength, string)\n println(\"${twoGram[0]}${twoGram[1]}\")\n }\n}\n\nprivate object TwoGramSolver {\n\n internal fun solve(stringLength: Int, string: String): Array {\n if (stringLength == 2 || stringLength == 3) {\n return arrayOf(string[0], string[1])\n }\n\n val twoGrams = mutableMapOf, Int>()\n var maxTwoGram = arrayOf(string[0], string[1])\n var maxTwoGramValue = 1\n\n for (index in 1 until stringLength - 1) {\n val twoGram = arrayOf(string[index], string[index + 1])\n\n val twoGramCount = (twoGrams[twoGram] ?: 0).inc()\n twoGrams[twoGram] = twoGramCount\n\n if (twoGramCount > maxTwoGramValue) {\n maxTwoGram = twoGram\n maxTwoGramValue = twoGramCount\n }\n }\n\n return maxTwoGram\n }\n}"}, {"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\n\nfun main() {\n var n = readInt()\n var s = readLn()\n var m = HashMap()\n\n for (i in 0..s.length-2) {\n var str = s[i].toString() + s[i + 1]\n if (m.containsKey(str))\n m[str] = m[str]!! + 1\n else\n m[str] = 0\n }\n var mx = Pair(\"\", 0)\n for ((k,v) in m) {\n if (mx.second < v) {\n mx = Pair(k,v)\n }\n }\n print(mx.first)\n}"}, {"source_code": "\nfun main(args: Array) {\n val nbCharacters: Int = readLine()!!.toInt()\n val word: String = readLine()!!\n val map: MutableMap = mutableMapOf()\n for (i in 0 .. nbCharacters-2) {\n val w = word.substring(i, i+2)\n map.put(w, map.getOrElse(w) {0})\n }\n\n var maxVal = -1\n var comb = \"\"\n map.forEach { k, v ->\n if (v > maxVal) {\n comb = k\n maxVal = v\n }\n }\n print(comb)\n}\n"}, {"source_code": "fun main() {\n val l = readLine()!!.toInt()\n val s = readLine()!!\n\n val r :HashMap = hashMapOf()\n\n for (i in 0 until l - 1) {\n val x = s.substring(i, i + 2)\n if (r.containsKey(x)) {\n r[x] = r[x]!!.plus(1)\n } else {\n r[x] = 0\n }\n }\n\n val z = 0\n var y = \"\"\n for (j in r) {\n if (j.value > z) {\n y = j.key\n }\n }\n println(y)\n}"}, {"source_code": "import java.util.regex.Pattern\n\nfun main(args: Array) {\n twogram()\n}\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}\n\n"}, {"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 = Integer.valueOf(readLine())\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}"}, {"source_code": "fun main() {\n val num = readLine()!!.toInt()\n val str = readLine()!!.take(num)\n println(bigramCountMax(str))\n}\n\nfun bigramCountMax(str: String): String {\n var maxCount = 0\n var leadSubstring = str.take(2)\n val leadChar = str[0]\n for ((index, value) in str.substring(1).withIndex()) {\n var count = 0\n if (leadChar == value) {\n count = countSubstring(leadChar + value.toString(), str)\n } else {\n count = countSubstring(leadChar + value.toString(), str) + countSubstring(value.toString() + leadChar, str)\n }\n if(count > maxCount) {\n maxCount = count\n leadSubstring = leadChar + value.toString()\n }\n }\n return leadSubstring\n}\n\nfun countSubstring(s: String, sub: String): Int = s.split(sub).size - 1"}, {"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\nfun solve() {\n val n=readInt()\n val s=readLn().toCharArray()\n var m= mutableMapOf()\n for(i in 0..n-2) {\n val a=100*(s[i]).toInt()+(s[i+1]).toInt()\n m[a]=m[a]?:0+1\n }\n var maxx=0\n for(i in m){\n maxx= maxOf(i.value,maxx)\n }\n for(i in m){\n if(i.value==maxx){\n val c=(i.key%100).toChar()\n val d=(i.key/100).toChar()\n print(c)\n print(d)\n return\n }\n }\n}\n\nfun main() {\n var T=1\n// T = readInt()\n for (t in 1..T) { solve() }\n}"}, {"source_code": "\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 var sss = str\n val match = str.substring(i, i+2)\n var times = 0;\n while(true){\n val find = match.toRegex().find(sss)\n if(find != null && find?.range?.first!! > -1){\n times++\n sss = sss.removeRange(0, find.range.first+1)\n }else{\n break;\n }\n }\n\n if(times >= tg.first)\n tg = Pair(times, match)\n }\n return tg.second\n }\n\n}\n"}, {"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\n val ps = s.asSequence().zipWithNext().toList()\n\n val x = ps.sortedBy {\n if (it.first == it.second) {\n it.second\n } else {\n it.first\n }\n }\n var count = 1\n var max = 0\n var r = x[0]\n for (i in 0 until n - 2) {\n if (x[i] == x[i + 1]) {\n count++\n } else {\n max = if (max < count) {\n r = x[i]\n count\n } else {\n max\n }\n count = 1\n }\n }\n print(r.first)\n println(r.second)\n\n}\n\n\n/*\nval (n, k) = readInts()\nval li: MutableList = readInts() as MutableList\nli.sort()\nprintln(li)\nif(li[k - 1] == li[k]){\n println(-1)\n} else {\n print(li[k - 1])\n}\n*/\n"}, {"source_code": "fun main() {\n readLn()\n val s = readLn()\n val twoGrams = mutableMapOf()\n\n for (i in 0 until s.length - 1) {\n val twoGram = s.substring(i, i + 2)\n twoGrams[twoGram] = if (twoGrams.containsKey(twoGram)) (twoGrams[twoGram] ?: + 1) else 1\n }\n\n println(twoGrams.maxBy { it.value }?.key)\n}\n\n// Input Reader\nprivate fun readLn() = readLine()!!\n"}, {"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 })\n}"}], "src_uid": "e78005d4be93dbaa518f3b40cca84ab1"} {"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 (n == 2L)\n print(2)\n else if (n == 3L) {\n print(3)\n } else if (mm == -1L) {\n println(n)\n } else {\n println(mm)\n }\n}\n", "positive_code": [{"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 = 2L\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, 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}"}, {"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 % i == 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}"}, {"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.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\n\n/** @author Spheniscine */\nfun main() {\n output {\n val n = readLong()\n\n val ans = n.factorize().distinct().singleOrNull() ?: 1\n\n println(ans)\n }\n}\n\nfun Long.factorize() = sequence {\n var n = this@factorize\n\n for(p in 2..Long.MAX_VALUE) {\n if(p * p > n) break\n\n while(n % p == 0L) {\n yield(p)\n n /= p\n }\n }\n\n if(n > 1) yield(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)\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}"}, {"source_code": "fun main() {\n val n = readLine()!!.toLong()\n var i = 2L\n val divisors = MutableList(0) { 0L }\n while (i * i <= n) {\n if (0L == n % i) {\n divisors.add(i)\n divisors.add(n/i)\n }\n i++\n }\n var gcd = n;\n for (d in divisors) {\n gcd = gcd(gcd, d)\n }\n println(gcd)\n\n}\n\nfun gcd(a: Long, b: Long): Long {\n if (b == 0L) {\n return a\n } else {\n return gcd(b, a % b)\n }\n}"}, {"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 println(n)\n}"}, {"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 if (factors.isNotEmpty()) {\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 }\n print(\n when {\n factors.isEmpty() -> n\n factors.size == 1 -> factors.first()\n else -> 1\n }\n )\n}"}, {"source_code": "fun main() {\n var n = readLine()!!.toLong()\n if (n == 1L) {\n println(1)\n return\n }\n for (i in 2..10000000) if (n % i == 0L) {\n while (n % i == 0L)\n n /= i\n println(if (n == 1L) i else 1)\n return\n }\n println(n)\n}"}, {"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 == 0L) {\n coll.add(i)\n\n n /= i\n\n while (n % i == 0L) {\n n /= i\n }\n }\n }\n\n if (!coll.any()) {\n println(n)\n } else if (coll.size == 1 && n == 1L) {\n println(coll[0])\n } else {\n println(1)\n }\n}\n"}], "negative_code": [{"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"}, {"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 for (i in 2L..(sqrt(n.toDouble()).toLong() + 1L)) {\n if(n % i == 0L) {\n numbers.add(i)\n n /= i\n }\n }\n\n when {\n numbers.size == 0 -> {\n println(n)\n }\n numbers.size == 1 -> {\n println(numbers.first())\n }\n else -> {\n println(1)\n }\n }\n}"}, {"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 for (i in 2L..(sqrt(n.toDouble()).toLong() + 1L)) {\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 println(numbers.first())\n }\n else -> {\n println(1)\n }\n }\n}"}, {"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 for (i in 2L..(sqrt(n.toDouble()).toLong() + 1L)) {\n if(n % i == 0L) {\n numbers.add(i)\n n /= i\n }\n }\n\n when {\n numbers.size == 0 -> {\n println(n)\n }\n numbers.size == 1 -> {\n println(2)\n }\n else -> {\n println(1)\n }\n }\n}"}, {"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}"}, {"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() + 10\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}"}, {"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 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 mm = i\n break\n }\n }\n if (mm == -1L) {\n println(n)\n } else {\n println(mm)\n }\n}\n"}, {"source_code": "import kotlin.math.ceil\nimport kotlin.math.sqrt\n\nfun readints() = readLine()!!.split(\" \").map { it.toInt() }\nfun readstrs() = readLine()!!.split(\" \")\n\n\nfun main() {\n val (n) = readints()\n var mm = -1\n for (i in 2..(ceil(sqrt(n.toFloat())).toInt() + 1)) {\n if (n % i == 0) {\n mm = i\n break\n }\n }\n if (mm == -1) {\n println(n)\n } else {\n println(mm)\n }\n}\n"}, {"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"}, {"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}"}, {"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}"}], "src_uid": "f553e89e267c223fd5acf0dd2bc1706b"} {"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 if (a < 2) return res\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 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\n val itera = lista.iterator()\n while (itera.hasNext()) {\n val idx = listb.indexOf(itera.next())\n if (idx != -1) {\n listb.removeAt(idx)\n itera.remove()\n }\n }\n if ((lista.isNotEmpty() && lista.last() > 5) ||\n (listb.isNotEmpty() && listb.last() > 5)) bw.write(\"-1\\n\")\n else bw.write(\"${lista.size + listb.size}\\n\")\n\n bw.close()\n}\n", "positive_code": [{"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\n if (a == 1 && b == 1) bw.write(\"0\\n\")\n else if (a == 1) {\n if (listb.last() > 5) bw.write(\"-1\\n\")\n else bw.write(\"${listb.size}\\n\")\n }\n else if (b == 1) {\n if (lista.last() > 5) bw.write(\"-1\\n\")\n else bw.write(\"${lista.size}\\n\")\n }\n else {\n val itera = lista.iterator()\n while (itera.hasNext()) {\n val idx = listb.indexOf(itera.next())\n if (idx != -1) {\n listb.removeAt(idx)\n itera.remove()\n }\n }\n if ((lista.isNotEmpty() && lista.last() > 5) ||\n (listb.isNotEmpty() && listb.last() > 5)) bw.write(\"-1\\n\")\n else bw.write(\"${lista.size + listb.size}\\n\")\n }\n\n bw.close()\n}\n"}], "negative_code": [{"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 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\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() != listb.last()) bw.write(\"-1\\n\")\n else {\n while (lista.isNotEmpty() && listb.isNotEmpty() && lista.last() == listb.last()) {\n lista.removeAt(lista.lastIndex)\n listb.removeAt(listb.lastIndex)\n }\n bw.write(\"${lista.size + listb.size}\\n\")\n }\n\n bw.close()\n}\n"}, {"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\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 {\n val itera = lista.iterator()\n while (itera.hasNext()) {\n val idx = listb.indexOf(itera.next())\n if (idx != -1) {\n listb.removeAt(idx)\n itera.remove()\n }\n }\n if ((lista.isNotEmpty() && lista.last() > 5) ||\n (listb.isNotEmpty() && listb.last() > 5)) bw.write(\"-1\\n\")\n else bw.write(\"${lista.size + listb.size}\\n\")\n }\n\n bw.close()\n}\n"}, {"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"}, {"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\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 while (lista.isNotEmpty() && listb.isNotEmpty() && lista.last() == listb.last()) {\n lista.removeAt(lista.lastIndex)\n listb.removeAt(listb.lastIndex)\n }\n bw.write(\"${lista.size + listb.size}\\n\")\n }\n\n bw.close()\n}\n"}, {"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 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\n if (lista.last() != listb.last()) bw.write(\"-1\\n\")\n else {\n while (lista.isNotEmpty() && listb.isNotEmpty() && lista.last() == listb.last()) {\n lista.removeAt(lista.lastIndex)\n listb.removeAt(listb.lastIndex)\n }\n bw.write(\"${lista.size + listb.size}\\n\")\n }\n\n bw.close()\n}\n"}], "src_uid": "75a97f4d85d50ea0e1af0d46f7565b49"} {"source_code": "fun main() {\n val x = readLn()\n\n var e = ModInt(1)\n var ans = ModInt(0)\n for(c in x.reversed()) {\n ans *= 2\n if(c == '1') ans += e\n e *= 4\n }\n\n println(ans)\n}\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\n/** modint inline class, requires hardcoded mod base **/\nconst val MODBASE = 1000000007\n\ninline fun Int.toModInt() = ModInt(this umod MODBASE)\ninline fun Long.toModInt() = ModInt((this umod MODBASE).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 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) // MODBASE < 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(MODBASE - int)\n\n inline operator fun times(other: ModInt) = times(other.int)\n inline operator fun times(other: Int) = ModInt(int.mulMod(other, MODBASE))\n\n fun pow(exponent: Int): ModInt {\n val e = if(exponent < 0) exponent umod MODBASE - 1 else exponent // assumes MODBASE is prime\n return ModInt(int.powMod(e, MODBASE))\n }\n\n inline fun inv() = 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(MODBASE - 2) // assumes MODBASE is prime\n }\n fun inv_memoized() = _invMemoized(this)\n\n operator fun div(other: ModInt) = times(other.inv())\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\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 = size == 0\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(1L) { acc, it -> acc * it.int % MODBASE }.toModInt()\nfun Sequence.product() = fold(1L) { acc, it -> acc * it.int % MODBASE }.toModInt()\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() }", "positive_code": [{"source_code": "fun main() {\n val x = readLn()\n\n var e = ModInt(1)\n var ans = ModInt(0)\n for(c in x.reversed()) {\n ans *= 2\n if(c == '1') ans += e\n e *= 4\n }\n\n println(ans)\n}\n\ninline fun Array.numSortBy(crossinline f: (T) -> Any?) = groupingBy(f).eachCount().values\n .fold(ModInt(1)) { acc, i -> acc * i.factorial() }\n\nval _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\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\n/** modint inline class, requires hardcoded mod base **/\nconst val MODBASE = 1000000007\n\ninline fun Int.toModInt() = ModInt(this umod MODBASE)\ninline fun Long.toModInt() = ModInt((this umod MODBASE).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 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) // MODBASE < 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(MODBASE - int)\n\n inline operator fun times(other: ModInt) = times(other.int)\n inline operator fun times(other: Int) = ModInt(int.mulMod(other, MODBASE))\n\n fun pow(exponent: Int): ModInt {\n val e = if(exponent < 0) exponent umod MODBASE - 1 else exponent // assumes MODBASE is prime\n return ModInt(int.powMod(e, MODBASE))\n }\n\n inline fun inv() = 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(MODBASE - 2) // assumes MODBASE is prime\n }\n fun inv_memoized() = _invMemoized(this)\n\n operator fun div(other: ModInt) = times(other.inv())\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\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 = size == 0\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(1L) { acc, it -> acc * it.int % MODBASE }.toModInt()\nfun Sequence.product() = fold(1L) { acc, it -> acc * it.int % MODBASE }.toModInt()\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() }"}], "negative_code": [], "src_uid": "89b51a31e00424edd1385f2120028b9d"} {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (_, numDays) = readInts()\n val daysRequired = readInts().mapIndexed { index, i -> i to index }.sortedBy { it.first }\n var currentDays = 0\n var sol = 0\n val solList = mutableListOf()\n for (days in daysRequired)\n if (currentDays + days.first <= numDays) {\n currentDays += days.first\n sol++\n solList.add(days.second + 1)\n } else break\n println(sol)\n print(solList.joinToString(\" \"))\n}", "positive_code": [{"source_code": "import java.io.BufferedReader\n\nfun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n val (n, k) = r.readLine()!!.split(\" \").map { it.toInt() }\n val v2 = List(n) {\n val a = r.readInt()\n Pair(a, it)\n }.sortedBy { it.first }\n //val v1 = r.readLine()!!.split(\" \").map { it.toInt() }.sorted()\n val v = v2.map { it.first }.toIntArray()\n (1..n - 1).forEach { v[it] += v[it - 1] }\n fun f(intArray: IntArray, x: Int): Int {\n var le = 0\n var ri = intArray.size\n while (le < ri) {\n val mi = le + (ri - le) / 2\n when {\n intArray[mi] <= x -> le = mi + 1\n intArray[mi] > x -> ri = mi\n }\n }\n return le - 1\n }\n\n val i = f(v, k)\n println(i + 1)\n println(v2.subList(0, i + 1).map { it.second+1 }.joinToString(\" \"))\n //val n = r.readLine()!!.toInt()\n}\n\ntailrec fun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a % b)\n\n// Hakiobo's code for faster reading input\nprivate const val SPACE_INT = ' '.toInt()\nprivate const val ZERO_INT = '0'.toInt()\nprivate const val NL_INT = '\\n'.toInt()\n\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\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"}, {"source_code": "import java.util.HashMap\n\nfun main() {\n var (n, k) = readLine()!!.split(\" \").map { it.toInt() }\n var list = readLine()!!.split(\" \").map { it.toInt() }\n var sum = 0\n var hashMap = HashMap()\n for ((index, value) in list.withIndex()) {\n hashMap.put(index, value)\n }\n var ans = mutableListOf()\n var t = list.sorted()\n for (i in t) {\n k -= i\n if (k >= 0) {\n for (j in hashMap) {\n if (j.value == i) {\n ans.add(j.key+1)\n hashMap.remove(j.key)\n break\n }\n }\n }\n }\n println(ans.size)\n for(i in ans){\n print(\"$i \")\n }\n\n}"}], "negative_code": [{"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 v1 = r.readLine()!!.split(\" \").map { it.toInt() }.sorted()\n val v = v1.toIntArray()\n (1..n-1).forEach { v[it]+=v[it-1] }\n fun f(intArray: IntArray, x:Int):Int{\n var le = 0\n var ri = intArray.size\n while (le le = mi+1\n intArray[mi]>x -> ri = mi\n }\n }\n return le-1\n }\n val i = f(v, k)\n println(i+1)\n println(v1.subList(0, i+1).joinToString(\" \"))\n //val n = r.readLine()!!.toInt()\n}"}, {"source_code": "fun main() {\n var (n, k) = readLine()!!.split(\" \").map { it.toInt() }\n var list = readLine()!!.split(\" \").map { it.toInt() }.sorted()\n var sum = 0\n var ans = mutableListOf()\n for ((index,value) in list.withIndex()) {\n k-=value\n if (k>=0){\n ans.add(index+1)\n }\n }\n println(ans.size)\n for (i in ans){\n print(\"$i \")\n }\n}"}, {"source_code": "fun main() {\n var (n, k) = readLine()!!.split(\" \").map { it.toInt() }\n var list = readLine()!!.split(\" \").map { it.toInt() }.sorted()\n var sum = 0\n var ans = mutableListOf()\n for (i in list) {\n k-=i\n if (k>=0){\n ans.add(i)\n }\n }\n println(ans.size)\n for (i in ans){\n print(\"$i \")\n }\n}"}], "src_uid": "dbb164a8dd190e63cceba95a31690a7c"} {"source_code": "import kotlin.math.max\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n val used = BooleanArray(5)\n var sol = 0\n val permutation = mutableListOf()\n val happiness = Array(5) { IntArray(5) }\n\n fun permute() {\n if (permutation.size == 5) {\n var oneSol = 0\n oneSol += happiness[permutation[0]][permutation[1]] + happiness[permutation[1]][permutation[0]]\n oneSol += happiness[permutation[2]][permutation[3]] + happiness[permutation[3]][permutation[2]]\n oneSol += happiness[permutation[1]][permutation[2]] + happiness[permutation[2]][permutation[1]]\n oneSol += happiness[permutation[3]][permutation[4]] + happiness[permutation[4]][permutation[3]]\n oneSol += happiness[permutation[2]][permutation[3]] + happiness[permutation[3]][permutation[2]]\n oneSol += happiness[permutation[3]][permutation[4]] + happiness[permutation[4]][permutation[3]]\n sol = max(sol, oneSol)\n } else {\n for (pos in 0..4) {\n if (used[pos]) continue\n used[pos] = true\n permutation.add(pos)\n permute()\n permutation.removeAt(permutation.lastIndex)\n used[pos] = false\n }\n }\n }\n\n for (row in 0 until 5) happiness[row] = readInts().toIntArray()\n permute()\n print(sol)\n}", "positive_code": [{"source_code": "import java.io.*\nimport java.util.*\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 g = Array(5) { IntArray(5) }\n var max = 0\n\n for (i in 0..4)\n for (j in 0..4)\n g[i][j] = ir.nextInt()\n\n for (a in 0..4)\n for (b in 0..4)\n for (c in 0..4)\n for (d in 0..4)\n for (e in 0..4) {\n var count = 0\n val x = HashSet()\n x.add(a)\n x.add(b)\n x.add(c)\n x.add(d)\n x.add(e)\n if (x.size == 5)\n count = g[a][b] + g[b][a] + 2 * (g[c][d] + g[d][c]) + g[b][c] + g[c][b] + 2 * (g[d][e] + g[e][d])\n max = Math.max(max, count)\n }\n\n pw.print(max)\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}"}], "negative_code": [], "src_uid": "be6d4df20e9a48d183dd8f34531df246"} {"source_code": "fun main(args: Array) {\n var (a, b, n) = readLine()!!.split(' ').map { it.toInt() }\n\n var s = true\n while (n >= 0){\n n -= gcd(if (s) a else b, n)\n s = !s\n }\n println(if (s) 0 else 1)\n}\n\nfun gcd(n1: Int, n2: Int): Int = if (n2 != 0) gcd(n2, n1 % n2) else n1", "positive_code": [{"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) = 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 fun gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)\n\n val io = ProblemIO.console()\n val v = IntArray(2)\n v[0] = io.readInt()\n v[1] = io.readInt()\n val n = io.readInt()\n var cur = 0\n var r = n\n while (true) {\n val g = gcd(r, v[cur])\n cur = 1 - cur\n if (g > r) break\n r -= g\n }\n io.println(cur)\n io.close()\n}\n\nfun main(args: Array) {\n Thread({ solve() }).start()\n}\n"}, {"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}\n\ntailrec fun gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)"}, {"source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n val input = readLine()!!.split(\" \").map(String::toInt)\n val a = input[0]\n val b = input[1]\n var n = input[2]\n\n var isA = true\n while (n > 0) {\n val player = if (isA) \"a\" else \"b\"\n// println(\"$player's Turn\")\n\n val value = if (isA) a else b\n val removed = gcd(n, value)\n// println(\"Removed: $removed\")\n\n n -= removed\n// println(\"$n left\")\n\n isA = !isA\n// println()\n }\n\n if (isA) {\n println(1)\n } else {\n println(0)\n }\n\n}\n\nfun gcd(a: Int, b: Int): Int {\n if (a == 0) {\n return b\n }\n if (b == 0) {\n return a\n }\n\n val min = min(a, b)\n val max = max(a, b)\n\n return gcd(min, max % min)\n}"}, {"source_code": "import java.util.*\nfun gcd(n1:Int,n2:Int):Int {\n var gcd = 1\n var i = 1\n while (i <= n1 && i <= n2) {\n if (n1 % i == 0 && n2 % i == 0)\n gcd = i\n ++i\n }\n return gcd\n}\nfun main(args: Array) {var reader = Scanner(System.`in`)\n var a:Int = reader.nextInt()\n var b:Int= reader.nextInt()\n var n:Int = reader.nextInt()\n var (aC,bC)= listOf(0,0)\n //print(gcd(a,n))\n while (n!=0){\n if (n!=0) {\n n -= gcd(a, n)\n aC++\n }\n if (n!=0) {\n n -= gcd(b, n)\n bC++\n }\n }\n if (aC>bC) print(0)\n else print(1)\n}"}, {"source_code": "import java.math.BigInteger\n\n\nfun main() {\n var (a, b, n) = readLine()!!.split(' ').map { it.toInt() }\n var flag = false\n while (n>0){\n if (!flag){\n if (n-gcd(a,n)>=0){\n n-=gcd(a,n)\n flag = true\n }\n }else{\n if (n-gcd(b,n)>=0){\n n-=gcd(b,n)\n flag = false\n }\n }\n }\n if (!flag){\n println(1)\n }else{\n println(0)\n }\n\n\n}\n\nfun gcd(a: Int, b: Int): Int {\n var i = 1\n var gcd = 1\n while (i <= a && i <= b) {\n if (a % i == 0 && b % i == 0) {\n gcd = i\n }\n i++\n }\n return gcd\n}"}, {"source_code": "fun main(args: Array) {\n var (a, b, n) = readLine()!!.split(' ').map { it.toInt() }\n\n fun gcd(x: Int, y: Int) = x.toBigInteger().gcd(y.toBigInteger()).toInt()\n\n while (true) {\n val ax = gcd(a, n)\n if (ax > n) {\n println(1)\n return\n }\n n -= ax\n val bx = gcd(b, n)\n if (bx > n) {\n println(0)\n return\n }\n n -= bx\n }\n}"}, {"source_code": "fun main() {\n var (a, b, n) = readLine()!!.split(\" \").map { it.toInt() }\n var s = true\n while (n >= 0) {\n n -= gcd(if (s) a else b, n)\n s = !s\n }\n println(if (s) 0 else 1)\n}\n\nfun gcd(n1: Int, n2: Int): Int = if (n2 != 0) gcd(n2, n1 % n2) else n1"}, {"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 infix fun Long.maxMin(b: Long): Pair {\n return if (this >= b) this to b else b to this\n }\n\n fun gcd(a: Long, b: Long): Long {\n var (max, min) = a maxMin b\n while (min != 0L) {\n val newMin = max % min\n max = min\n min = newMin\n }\n return max\n }\n\n var (a, b, n) = readLongs()\n\n while (true) {\n n -= gcd(a, n)\n if (n < 0) {\n print(1)\n return\n }\n n -= gcd(b, n)\n if (n < 0) {\n print(0)\n return\n }\n }\n}"}, {"source_code": "fun gcd(x: Int, y: Int): Int {\n var s = x\n var l = y\n \n while (s != 0) {\n val temp = s\n s = l % s\n l = temp\n }\n\n return l\n}\n\nfun main(args: Array) {\n var (s, a, stones) = readLine() !!.split(' ').map { it.toInt() }\n var sTurn = true\n while (true) {\n val greatestDivisor = if (sTurn) gcd(s, stones) else gcd(a, stones)\n if (greatestDivisor <= stones) {\n stones -= greatestDivisor\n }\n else {\n println(if (sTurn) 1 else 0)\n return\n }\n\n sTurn = !sTurn\n }\n}"}], "negative_code": [{"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}"}, {"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 if (a % 10 == 0 && b % 10 == 0 && n %10 == 0) println(0)\n else println(1)\n}"}], "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2"} {"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(\"0 ${-sum} ${sum} 0\")\n } else {\n println(\"${-sum} 0 0 ${-sum}\")\n }\n}", "positive_code": [{"source_code": "fun main() {\n val (x, y) = readLine()!!.split(\" \").map { it.toLong() }\n when {\n x > 0 && y > 0 -> print(\"0 ${x + y} ${x + y} 0\")\n x < 0 && y > 0 -> print(\"${x - y} 0 0 ${-x + y}\")\n x < 0 && y < 0 -> print(\"${x + y} 0 0 ${x + y}\")\n x > 0 && y < 0 -> print(\"0 ${-x + y} ${x - y} 0\")\n }\n}"}, {"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 -> \"-$z 0 0 -$z\"\n x < 0 && y > 0 -> \"-$z 0 0 $z\"\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}"}], "negative_code": [{"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(\"0 ${-sum} ${sum} 0\")\n }else{\n println(\"0 ${-sum} ${-sum} 0\")\n }\n}"}, {"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}"}, {"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}"}, {"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}"}], "src_uid": "e2f15a9d9593eec2e19be3140a847712"} {"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 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", "positive_code": [{"source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var digits = readLine()!!.count {it == '8'}\n println(minOf(n / 11, digits))\n}\n"}, {"source_code": "import kotlin.math.min\n\nfun main(args: Array) {\n\n val n = readLine()?.toInt() ?: 0\n val text = readLine().toString()\n\n val nc = n / 11\n\n var ec = 0\n for(c in text) {\n if(c == '8')\n ec++\n }\n\n println(min(ec, nc))\n\n}"}, {"source_code": "import kotlin.math.min\n\nfun main() {\n readLine()\n val s = readLine()!!\n print(min(s.count { it == '8' }, s.length / 11))\n}"}], "negative_code": [{"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"}], "src_uid": "259d01b81bef5536b969247ff2c2d776"} {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val ms = br.readLine().split(\" \").map { it.toInt() }\n val m = ms[0]\n val s = ms[1]\n\n if (s == 0){\n println(if (m == 1) \"0 0\" else \"-1 -1\")\n }else{\n\n if (s < 10){\n if (m == 1){\n println(\"$s $s\")\n }else{\n val maxNum = s.toString() + \"0\".repeat(m - 1)\n val minNum = \"1\" + \"0\".repeat(m - 2) + (s - 1).toString()\n println(\"$minNum $maxNum\")\n }\n\n } else if (s == 0 || m*9 < s){\n println(\"-1 -1\")\n } else{\n\n val ans = getMinAndMax(m, s)\n\n println(\"${ans.first} ${ans.second}\")\n\n }\n\n }\n\n}\n\nfun getMinAndMax(m: Int, s: Int): Pair{\n val num9s = s / 9\n val missing = m - num9s\n val nines = if (missing >= 2 && s % 9 == 0) \"9\".repeat(num9s - 1) else \"9\".repeat(num9s)\n val minNum: String\n val maxNum: String\n\n val d = if (s - 9*num9s == 0) 9 else s - 9*num9s\n\n if (missing == 0){\n minNum = nines\n maxNum = nines\n } else if (missing <= 1){\n minNum = d.toString() + nines\n maxNum = nines + d.toString()\n }else{\n val l = 1\n val h = (d - 1)\n val zeroes = \"0\".repeat(if (s % 9 == 0) missing - 1 else missing - 2)\n\n minNum = l.toString() + zeroes + h + nines\n maxNum = nines + d.toString() + zeroes + \"0\"\n }\n return Pair(minNum, maxNum)\n}", "positive_code": [{"source_code": "import kotlin.math.min\n\nfun main() {\n val (m, s) = readLine()!!.split(' ').map(String::toInt)\n if (m == 1 && s == 0) {\n println(\"0 0\")\n return\n }\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}"}, {"source_code": "fun main(args: Array) {\n val (m, s) = readLine()!!.split(' ').map { it.toInt() }\n\n if ((s==0 && m>1) || (m * 9 < s) ){\n println(\"-1 -1\")\n return\n }\n\n val arr = IntArray(m, {if (it == 0 && s > 0) 1 else 0})\n val arr2 = IntArray(m)\n\n for (i in 0 until m){\n var delta = s - 9 * i - 1\n if (delta <= 0) break\n arr[m - i - 1] = minOf(9, delta + if (i == m-1) 1 else 0)\n }\n\n\n for (i in 0 until m){\n var delta = s - 9 * i\n if (delta <= 0) break\n arr2[i] = minOf(9, delta)\n }\n\n\n\n\n println(\"${arr.joinToString(separator = \"\")} ${arr2.joinToString (separator = \"\")}\")\n}"}, {"source_code": "fun fill(array: Array, totalSum: Int): Int {\n var rem = totalSum\n for (i in 0 until array.size) {\n if (rem >= 9) {\n array[i] = 9\n rem -= 9\n }\n else {\n array[i] = rem\n return 0\n }\n }\n\n return rem\n}\n\nfun main(args: Array) {\n val (m, s) = readLine()!!.split(' ').map { it.toInt() }\n val max = Array(m, { 0 })\n\n if ((s == 0 && m > 1) || fill(max, s) != 0) {\n println(\"-1 -1\")\n return\n }\n\n val min = Array(m, { 0 })\n fill(min, s - 1)\n min[min.size - 1] += 1\n\n return println(\"${min.reversed().joinToString(separator = \"\")} ${max.joinToString(separator = \"\")}\")\n}\n"}, {"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(m==1 && s==0) println(\"0 0\")\n else if(s==0 || m*9 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 readInt() = readToken().toInt()\n fun readLong() = readToken().toLong()\n fun readLine() : String {\n tok = StringTokenizer(\"\")\n return rd.readLine()\n }\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 m = io.readInt()\n val s = io.readInt()\n\n if (s == 0) {\n if (m == 1) {\n io.println(\"0 0\")\n } else {\n io.println(\"-1 -1\")\n }\n } else {\n if (s > m * 9) {\n io.println(\"-1 -1\")\n } else {\n var rs = s\n for (i in 1 .. m) {\n val d = Math.max(if (i == 1) 1 else 0, rs - (m - i) * 9)\n io.print(d)\n rs -= d\n }\n io.print(\" \")\n rs = s\n for (i in 1 .. m) {\n val d = Math.min(9, rs)\n io.print(d)\n rs -= d\n }\n io.println(\"\")\n }\n }\n}\n"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val (len, sum) = r.readLine()!!.split(\" \").map { it.toInt() }\n when {\n (len > 1 && sum == 0) || len * 9 < sum -> {\n println(\"-1 -1\")\n }\n else -> {\n var maxSum = sum\n var minSum = sum\n val max = MutableList(len) { 0 }\n for (i in 0..len-1){\n if (maxSum>=9){\n max[i] = 9\n maxSum -= 9\n } else {\n max[i] = maxSum\n maxSum -= maxSum\n }\n }\n val min = MutableList(len) { 0 }\n min[0] = 1\n minSum -= 1\n //println(len)\n for (i in len-1 downTo 0){\n min[i] += minOf(9, minSum)\n minSum -= minOf(9, minSum)\n }\n println(\"${min.joinToString(\"\")} ${max.joinToString(\"\")}\")\n }\n }\n}"}, {"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 if(digits.size == 0) return \"$s\"\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}"}, {"source_code": "import java.io.PrintWriter\nimport kotlin.math.min\n\n\nfun main() {\n io.apply {\n\n val (m, s) = int to int\n\n if (s == 0 && m == 1) {\n cout .. 0 .. 0 .. nl\n } else if (s <= 0 || s > m * 9)\n cout .. -1 .. -1 .. nl\n else {\n val str = CharArray(m) { '0' }\n str[0] = '1'\n var q = s - 1\n for (i in m - 1 downTo 0) {\n var d = min(9, q)\n str[i] = (str[i] + d)\n q -= d\n }\n cout .. String(str) .. \" \"\n str.fill('0')\n q = s\n for (i in 0 until m) {\n var d = min(9, q)\n str[i] = (str[i] + d)\n q -= d\n }\n cout .. String(str) .. nl\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"}, {"source_code": "fun main() {\n val (m, s) = readLine()!!.split(\" \").map { it.toInt() }\n var ansLittle = \"\"\n var ansBig = \"\"\n\n if (9 * m >= s && (s == 0 && m == 1 || s > 0)) {\n var t = m\n var k = s\n while (t > 0) {\n if (k > 9) {\n ansBig += \"9\"\n k -= 9\n } else {\n ansBig += k.toString()\n k = 0\n }\n t--\n }\n\n t = m\n k = s\n if ((t - 1) * 9 > k) {\n ansLittle += \"1\"\n k -= 1\n t--\n }\n while (t > 0) {\n if (t * 9 == k) {\n ansLittle += \"9\"\n k -= 9\n } else if ((t - 1) * 9 > k) {\n ansLittle += \"0\"\n } else {\n val q = k - ((t - 1) * 9)\n ansLittle += q.toString()\n k -= q\n }\n t--\n }\n } else {\n ansLittle = \"-1\"\n ansBig = \"-1\"\n }\n\n print(\"$ansLittle $ansBig\")\n}"}, {"source_code": "import java.util.*\n\nval noSolution = Pair(intArrayOf(-1), intArrayOf(-1))\n\nfun main(args: Array) {\n cf()\n}\n\nprivate fun cf() = with(Scanner(System.`in`)) {\n val m = nextInt()\n val s = nextInt()\n val (mi, ma) = run(m, s)\n\n print(mi.joinToString(\"\"))\n print(\" \")\n println(ma.joinToString(\"\"))\n}\n\nprivate fun run(m: Int, s: Int): Pair {\n if (m == 1 && s > 9) return noSolution\n if (m == 1) return Pair(intArrayOf(s), intArrayOf(s))\n if (s == 0) return noSolution\n\n var numOfNines = s / 9\n var rem = s % 9\n if (rem == 0) {\n rem = 9\n numOfNines--\n }\n\n if (numOfNines + 1 > m) return noSolution\n\n val ma = IntArray(m)\n for (i in 0 until numOfNines)\n ma[i] = 9\n ma[numOfNines] = rem\n\n val mi = ma.clone()\n if (numOfNines + 1 == m) {\n mi.reverse()\n } else {\n mi[mi.size - 1] = 1\n mi[numOfNines]--\n mi.reverse()\n }\n\n return Pair(mi, ma)\n}\n"}, {"source_code": "\nfun main(){\n var input = readLine()!!.split(' ')\n val m = input[0].toInt()\n val s = input[1].toInt()\n if (m == 1 && s == 0){\n println(\"0 0\")\n return\n }\n\n if ((1 > s) || (s > 9 * m)){\n println(\"-1 -1\")\n return\n }\n\n var smallestNumberWithMDigits = CharArray(m){'0'}\n var greatestNumberWithMDigits = CharArray(m){'9'}\n smallestNumberWithMDigits[0] = '1'\n\n var startingIndex = m-1\n var digitSumVar = smallestNumberWithMDigits.sumBy { (it-'0') }\n while (digitSumVar + 9 <= s){\n digitSumVar += 9\n smallestNumberWithMDigits[startingIndex] = '9'\n startingIndex -= 1\n }\n\n while (digitSumVar < s){\n val current_digit = smallestNumberWithMDigits[startingIndex]\n smallestNumberWithMDigits[startingIndex] = current_digit + 1\n digitSumVar += 1\n if (current_digit == '8'){\n startingIndex -= 1\n }\n }\n\n\n startingIndex = m-1\n digitSumVar = greatestNumberWithMDigits.sumBy { (it-'0') }\n while (digitSumVar - 9 >= s){\n digitSumVar -= 9\n greatestNumberWithMDigits[startingIndex] = '0'\n startingIndex -= 1\n }\n\n while (digitSumVar > s){\n val currentDigit = greatestNumberWithMDigits[startingIndex]\n greatestNumberWithMDigits[startingIndex] = currentDigit - 1\n digitSumVar -= 1\n if (currentDigit == '1'){\n startingIndex -= 1\n }\n }\n\n println(\"${smallestNumberWithMDigits.joinToString(\"\")} ${greatestNumberWithMDigits.joinToString(\"\")}\");\n}\n\n"}, {"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 == 1 && sum == 0) {\n print(\"0 0\")\n return\n }\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"}, {"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\tprintln ( findMin(n,sum) + \" \" + findMax(n, sum) )\n}"}, {"source_code": "import kotlin.math.min\n\n/* template start */\n// input\nprivate fun readString() = readLine()!!\nprivate fun readStrings() = readString().split(\" \")\nprivate fun readInt() = readString().toInt()\nprivate fun readDigits() = readString().map { it - '0' }\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\n\n// output\nprivate fun T.print(map: (T) -> String = { it.toString() }) = println(map(this))\nprivate fun Iterable.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)\nprivate fun Array.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)\nprivate fun IntArray.print(sep: String? = null, map: ((Int) -> String)? = null) = asSequence().print(sep, map)\nprivate fun Sequence.print(sep: String? = null, map: ((T) -> String)? = null) =\n println(joinToString(sep ?: \"\", transform = map ?: { it.toString() }))\n\n// others\nprivate val Int.isEven: Boolean get() = this % 2 == 0\nprivate val Int.isOdd: Boolean get() = !this.isEven\nprivate fun queries(block: (Int) -> Unit) = repeat(readInt(), block)\n\n/* template end */\n\nfun main() {\n val (len, sum) = readInts()\n if (sum == 0) {\n if (len != 1) println(\"-1 -1\")\n else println(\"0 0\")\n } else if (len * 9 < sum) {\n println(\"-1 -1\")\n } else {\n val maxNum = buildString {\n var rem = sum\n repeat(len) {\n val next = min(rem, 9)\n append(next)\n rem -= next\n }\n }\n val minNum = mutableListOf()\n var rem = sum\n for (i in 0 until len) {\n if (rem > 1) {\n var next = min(rem - 1, 9)\n if (i == len - 1) {\n next++\n }\n minNum.add(0, next)\n rem -= next\n } else {\n if (i != len - 1)\n minNum.add(0, 0)\n else minNum.add(0, 1)\n }\n }\n\n println(\"${minNum.joinToString(\"\")} $maxNum\")\n }\n\n}\n"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n val (length, sum) = readInts()\n var quotient = sum / 9\n var rest = sum % 9\n if (length == 1 && sum == 0) {\n print(\"0 0\")\n return\n }\n if (length == 0 || sum == 0 || quotient > length || (quotient == length && rest != 0)) {\n print(\"-1 -1\")\n return\n }\n val sb1 = StringBuilder()\n for (i in 0 until quotient) sb1.append('9')\n if (quotient < length) sb1.append(rest)\n for (i in 0 until length - quotient - 1)\n sb1.append('0')\n val sb2 = StringBuilder()\n var oneEight = false\n if (length > quotient + 1) {\n rest--\n if (rest < 0) {\n rest = 0\n oneEight = true\n }\n sb2.append('1')\n for (i in 0 until length - quotient - 2) sb2.append('0')\n }\n if (quotient < length) sb2.append(rest)\n if(oneEight) {\n sb2.append('8')\n quotient--\n }\n for (i in 0 until quotient) sb2.append('9')\n print(\"$sb2 $sb1\")\n}\n\n\n// Shorter Python solution: https://codeforces.com/contest/489/submission/41588741"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val (m, s) = reader.readLine().split(' ').map { it.toInt() }\n\n if (s == 0) {\n val answer = if (m == 1) 0 else -1\n println(\"$answer $answer\")\n return\n }\n\n val maxN = Array(m) { if (it == 0) 1 else 0 }\n val minN = Array(m) { if (it == 0) 1 else 0 }\n\n var maxNPtr = 0\n var minNPtr = minN.lastIndex\n\n try {\n repeat(s-1) {\n if (maxN[maxNPtr] == 9) { maxNPtr++ }\n if (minN[minNPtr] == 9) { minNPtr-- }\n\n maxN[maxNPtr]++\n minN[minNPtr]++\n }\n } catch (e: IndexOutOfBoundsException) {\n println(\"-1 -1\")\n return\n }\n\n println(\"${minN.joinToString(\"\")} ${maxN.joinToString(\"\")}\")\n}"}, {"source_code": "// 7/7/2020 11:13 AM\n\n//package 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 val (m, s) = readInts()\n// findSumToN(m, s)\n printResult(findSmallest(m, s))\n print(\" \")\n printResult(findLargest(m, s))\n println()\n}\n\nfun findLargest(m: Int, s: Int) : List {\n if (s <= 0 && m > 1) return listOf()\n else if (s == 0 && m == 1) return listOf(0)\n\n var sumLeft = s\n val outputList = MutableList(m) {0}\n var idx = 0\n while (sumLeft > 0 && idx < m) {\n outputList[idx] = if (sumLeft >= 9) 9 else sumLeft\n sumLeft -= outputList[idx++]\n }\n if (sumLeft > 0)\n return listOf()\n else\n return outputList.toList()\n}\n\nfun findSmallest(m: Int, s: Int) : List {\n if (s <= 0 && m > 1) return listOf()\n else if (s == 0 && m == 1) return listOf(0)\n\n var sumLeft = s\n val outputList = MutableList(m) {0}\n\n val minFirst = s - 9 * (m - 1)\n\n if (minFirst <= 1)\n outputList[0] = 1\n else if (minFirst > 9)\n return listOf()\n else\n outputList[0] = minFirst\n\n sumLeft -= outputList[0]\n\n var idx = m - 1\n while (sumLeft > 0 && idx > 0) {\n outputList[idx] = if (sumLeft >= 9) 9 else sumLeft\n sumLeft -= outputList[idx--]\n }\n if (sumLeft > 0)\n return listOf()\n else\n return outputList.toList()\n}\n\nfun printResult(l: List) {\n if (l.isEmpty())\n print(\"-1\")\n else\n print(l.fold(\"\", {acc, cur -> acc + cur.toString()}))\n}\n\n//fun findSumToN(m: Int, s: Int) {\n//// findSumToN_recursive(m, s, listOf())\n// printLeastAndGreatest(findSumToN_iterative(m, s))\n//}\n//\n//fun 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//\n//fun findSumToN_iterative(m: Int, s: Int) : List {\n// var currentList = mutableListOf()\n// if (s <= 0 && m > 1) return currentList\n//\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"}], "negative_code": [{"source_code": "import java.io.PrintWriter\nimport kotlin.math.min\n\n\nfun main() {\n io.apply {\n\n val (m, s) = int to int\n\n if (s <= 0 || s > m * 9)\n cout .. -1 .. -1 .. nl\n else {\n val str = CharArray(m) { '0' }\n str[0] = '1'\n var q = s - 1\n for (i in m - 1 downTo 0) {\n var d = min(9, q)\n str[i] = (str[i] + d)\n q -= d\n }\n cout .. String(str) .. \" \"\n str.fill('0')\n q = s\n for (i in 0 until m) {\n var d = min(9, q)\n str[i] = (str[i] + d)\n q -= d\n }\n cout .. String(str) .. nl\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"}, {"source_code": "import java.io.PrintWriter\nimport kotlin.math.min\n\n\nfun main() {\n io.apply {\n\n val (m, s) = int to int\n\n if (s == 0 && m == 1) {\n cout .. 0 .. 1 .. nl\n } else if (s <= 0 || s > m * 9)\n cout .. -1 .. -1 .. nl\n else {\n val str = CharArray(m) { '0' }\n str[0] = '1'\n var q = s - 1\n for (i in m - 1 downTo 0) {\n var d = min(9, q)\n str[i] = (str[i] + d)\n q -= d\n }\n cout .. String(str) .. \" \"\n str.fill('0')\n q = s\n for (i in 0 until m) {\n var d = min(9, q)\n str[i] = (str[i] + d)\n q -= d\n }\n cout .. String(str) .. nl\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"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val ms = br.readLine().split(\" \").map { it.toInt() }\n val m = ms[0]\n val s = ms[1]\n\n if (s == 0){\n println(\"-1 -1\")\n }else{\n\n if (s < 10){\n val num = s.toString() + \"0\".repeat(m - 1)\n println(\"$num $num\")\n } else if (s == 0 || m*9 < s){\n println(\"-1 -1\")\n } else{\n\n val d = 9 - (m*9 - s)\n val base = \"9\".repeat(m - 1)\n\n println(\"${d.toString() + base} ${base + d.toString()}\")\n\n }\n\n }\n\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val ms = br.readLine().split(\" \").map { it.toInt() }\n val m = ms[0]\n val s = ms[1]\n\n if (s == 0){\n println(if (m == 1) \"0 0\" else \"-1 -1\")\n }else{\n\n if (s < 10){\n if (m == 1){\n println(\"$s $s\")\n }else{\n val maxNum = s.toString() + \"0\".repeat(m - 1)\n val minNum = \"1\" + \"0\".repeat(m - 2) + (s - 1).toString()\n println(\"$minNum $maxNum\")\n }\n\n } else if (s == 0 || m*9 < s){\n println(\"-1 -1\")\n } else{\n\n val ans = getMinAndMax(m, s)\n\n println(\"${ans.first} ${ans.second}\")\n\n }\n\n }\n\n}\n\nfun getMinAndMax(m: Int, s: Int): Pair{\n val num9s = s / 9\n val missing = m - num9s\n val nines = \"9\".repeat(num9s)\n val minNum: String\n val maxNum: String\n\n val d = s - 9*num9s\n\n if (missing <= 1){\n minNum = d.toString() + nines\n maxNum = nines + d.toString()\n }else{\n val l = 1\n val h = (d - 1)\n val zeroes = \"0\".repeat(missing - 2)\n\n minNum = l.toString() + zeroes + h + nines\n maxNum = nines + max(l, h) + min(l, h) + zeroes\n }\n return Pair(minNum, maxNum)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val ms = br.readLine().split(\" \").map { it.toInt() }\n val m = ms[0]\n val s = ms[1]\n\n if (s == 0){\n println(if (m == 1) \"0 0\" else \"-1 -1\")\n }else{\n\n if (s < 10){\n val num = s.toString() + \"0\".repeat(m - 1)\n println(\"$num $num\")\n } else if (s == 0 || m*9 < s){\n println(\"-1 -1\")\n } else{\n\n val ans = getMinAndMax(m, s)\n\n println(\"${ans.first} ${ans.second}\")\n\n }\n\n }\n\n}\n\nfun getMinAndMax(m: Int, s: Int): Pair{\n val num9s = s / 9\n val missing = m - num9s\n val nines = \"9\".repeat(num9s)\n val minNum: String\n val maxNum: String\n\n val d = s - 9*num9s\n\n if (missing <= 1){\n minNum = d.toString() + nines\n maxNum = nines + d.toString()\n }else{\n val l = 1\n val h = (d - 1)\n val zeroes = \"0\".repeat(missing - 2)\n\n minNum = l.toString() + zeroes + h + nines\n maxNum = nines + max(l, h) + min(l, h) + zeroes\n }\n return Pair(minNum, maxNum)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val ms = br.readLine().split(\" \").map { it.toInt() }\n val m = ms[0]\n val s = ms[1]\n\n if (s == 0){\n println(\"-1 -1\")\n }else{\n\n if (s < 10){\n val num = s.toString() + \"0\".repeat(m - 1)\n println(\"$num $num\")\n } else if (s == 0 || m*9 < s){\n println(\"-1 -1\")\n } else{\n\n val ans = getMinAndMax(m, s)\n\n println(\"${ans.first} ${ans.second}\")\n\n }\n\n }\n\n}\n\nfun getMinAndMax(m: Int, s: Int): Pair{\n val num9s = s / 9\n val missing = m - num9s\n val nines = \"9\".repeat(num9s)\n val minNum: String\n val maxNum: String\n\n val d = s - 9*num9s\n\n if (missing <= 1){\n minNum = d.toString() + nines\n maxNum = nines + d.toString()\n }else{\n val l = 1\n val h = (d - 1)\n val zeroes = \"0\".repeat(missing - 2)\n\n minNum = l.toString() + zeroes + h + nines\n maxNum = nines + max(l, h) + min(l, h) + zeroes\n }\n return Pair(minNum, maxNum)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val ms = br.readLine().split(\" \").map { it.toInt() }\n val m = ms[0]\n val s = ms[1]\n\n if (s == 0){\n println(if (m == 1) \"0 0\" else \"-1 -1\")\n }else{\n\n if (s < 10){\n if (m == 1){\n println(\"$s $s\")\n }else{\n val maxNum = s.toString() + \"0\".repeat(m - 1)\n val minNum = \"1\" + \"0\".repeat(m - 2) + (s - 1).toString()\n println(\"$minNum $maxNum\")\n }\n\n } else if (s == 0 || m*9 < s){\n println(\"-1 -1\")\n } else{\n\n val ans = getMinAndMax(m, s)\n\n println(\"${ans.first} ${ans.second}\")\n\n }\n\n }\n\n}\n\nfun getMinAndMax(m: Int, s: Int): Pair{\n val num9s = s / 9\n val missing = m - num9s\n val nines = \"9\".repeat(num9s)\n val minNum: String\n val maxNum: String\n\n val d = s - 9*num9s\n\n if (missing == 0){\n minNum = nines\n maxNum = nines\n } else if (missing <= 1){\n minNum = d.toString() + nines\n maxNum = nines + d.toString()\n }else{\n val l = 1\n val h = (d - 1)\n val zeroes = \"0\".repeat(missing - 2)\n\n minNum = l.toString() + zeroes + h + nines\n maxNum = nines + d.toString() + zeroes + \"0\"\n }\n return Pair(minNum, maxNum)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val ms = br.readLine().split(\" \").map { it.toInt() }\n val m = ms[0]\n val s = ms[1]\n\n if (s == 0){\n println(if (m == 1) \"0 0\" else \"-1 -1\")\n }else{\n\n if (s < 10){\n if (m == 1){\n println(\"$s $s\")\n }else{\n val maxNum = s.toString() + \"0\".repeat(m - 1)\n val minNum = \"1\" + \"0\".repeat(m - 2) + (s - 1).toString()\n println(\"$minNum $maxNum\")\n }\n\n } else if (s == 0 || m*9 < s){\n println(\"-1 -1\")\n } else{\n\n val ans = getMinAndMax(m, s)\n\n println(\"${ans.first} ${ans.second}\")\n\n }\n\n }\n\n}\n\nfun getMinAndMax(m: Int, s: Int): Pair{\n val num9s = s / 9\n val missing = m - num9s\n val nines = \"9\".repeat(num9s)\n val minNum: String\n val maxNum: String\n\n val d = if (s - 9*num9s == 0) 9 else s - 9*num9s\n\n if (missing == 0){\n minNum = nines\n maxNum = nines\n } else if (missing <= 1){\n minNum = d.toString() + nines\n maxNum = nines + d.toString()\n }else{\n val l = 1\n val h = (d - 1)\n val zeroes = \"0\".repeat(missing - 2)\n\n minNum = l.toString() + zeroes + h + nines\n maxNum = nines + d.toString() + zeroes + \"0\"\n }\n return Pair(minNum, maxNum)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val ms = br.readLine().split(\" \").map { it.toInt() }\n val m = ms[0]\n val s = ms[1]\n\n if (s == 0){\n println(if (m == 1) \"0 0\" else \"-1 -1\")\n }else{\n\n if (s < 10){\n if (m == 1){\n println(\"$s $s\")\n }else{\n val maxNum = s.toString() + \"0\".repeat(m - 1)\n val minNum = \"1\" + \"0\".repeat(m - 2) + (s - 1).toString()\n println(\"$minNum $maxNum\")\n }\n\n } else if (s == 0 || m*9 < s){\n println(\"-1 -1\")\n } else{\n\n val ans = getMinAndMax(m, s)\n\n println(\"${ans.first} ${ans.second}\")\n\n }\n\n }\n\n}\n\nfun getMinAndMax(m: Int, s: Int): Pair{\n val num9s = s / 9\n val missing = m - num9s\n val nines = \"9\".repeat(num9s)\n val minNum: String\n val maxNum: String\n\n val d = s - 9*num9s\n\n if (missing == 0){\n minNum = nines\n maxNum = nines\n } else if (missing <= 1){\n minNum = d.toString() + nines\n maxNum = nines + d.toString()\n }else{\n val l = 1\n val h = (d - 1)\n val zeroes = \"0\".repeat(missing - 2)\n\n minNum = l.toString() + zeroes + h + nines\n maxNum = nines + max(l, h) + min(l, h) + zeroes\n }\n return Pair(minNum, maxNum)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val ms = br.readLine().split(\" \").map { it.toInt() }\n val m = ms[0]\n val s = ms[1]\n\n if (s == 0 || m*9 < s){\n println(\"-1 -1\")\n }else{\n\n val d = 9 - (m*9 - s)\n var min = d.toString()\n var max = \"\"\n\n for (i in 1 until m){\n min += '9'\n\n }\n\n for (i in 0 until m){\n if (i == m - 1) max += d.toString()\n else max += '9'\n }\n\n println(\"$min $max\")\n\n }\n}"}, {"source_code": "import java.util.*\n\nval noSolution = Pair(intArrayOf(-1), intArrayOf(-1))\n\nfun main(args: Array) {\n cf()\n}\n\nprivate fun cf() = with(Scanner(System.`in`)) {\n val m = nextInt()\n val s = nextInt()\n val (mi, ma) = run(m, s)\n\n print(mi.joinToString(\"\"))\n print(\" \")\n println(ma.joinToString(\"\"))\n}\n\nprivate fun run(m: Int, s: Int): Pair {\n if (m == 1 && s > 10) return noSolution\n if (m == 1) return Pair(intArrayOf(s), intArrayOf(s))\n if (s == 0) return noSolution\n\n var numOfNines = s / 9\n var rem = s % 9\n if (rem == 0) {\n rem = 9\n numOfNines--\n }\n\n if (numOfNines + 1 > m) return noSolution\n\n val ma = IntArray(m)\n for (i in 0 until numOfNines)\n ma[i] = 9\n ma[numOfNines] = rem\n\n val mi = ma.clone()\n if (numOfNines + 1 == m) {\n mi.reverse()\n } else {\n mi[mi.size - 1] = 1\n mi[numOfNines]--\n mi.reverse()\n }\n\n return Pair(mi, ma)\n}\n"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n val (length, sum) = readInts()\n val quotient = sum / 9\n var rest = sum % 9\n if (length == 1 && sum == 0) {\n print(\"0 0\")\n return\n }\n if (length == 0 || sum == 0 || quotient > length || (quotient == length && rest != 0)) {\n print(\"-1 -1\")\n return\n }\n val sb1 = StringBuilder()\n for (i in 0 until quotient) sb1.append('9')\n sb1.append(rest)\n for (i in 0 until length - quotient - 1)\n sb1.append('0')\n val sb2 = StringBuilder()\n if (length > quotient + 1) {\n rest--\n sb2.append('1')\n for (i in 0 until length - quotient - 2) sb2.append('0')\n }\n sb2.append(rest)\n for (i in 0 until quotient) sb2.append('9')\n print(\"$sb2 $sb1\")\n}\n\n\n// Shorter Python solution: https://codeforces.com/contest/489/submission/41588741"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n val (length, sum) = readInts()\n val quotient = sum / 9\n var rest = sum % 9\n if (length == 1 && sum == 0) {\n print(\"0 0\")\n return\n }\n if (length == 0 || sum == 0 || quotient > length || (quotient == length && rest != 0)) {\n print(\"-1 -1\")\n return\n }\n val sb1 = StringBuilder()\n for (i in 0 until quotient) sb1.append('9')\n if (quotient < length) sb1.append(rest)\n for (i in 0 until length - quotient - 1)\n sb1.append('0')\n val sb2 = StringBuilder()\n if (length > quotient + 1) {\n rest--\n sb2.append('1')\n for (i in 0 until length - quotient - 2) sb2.append('0')\n }\n if (quotient < rest) sb2.append(rest)\n for (i in 0 until quotient) sb2.append('9')\n print(\"$sb2 $sb1\")\n}\n\n\n// Shorter Python solution: https://codeforces.com/contest/489/submission/41588741"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n val (length, sum) = readInts()\n val quotient = sum / 9\n var rest = sum % 9\n if (length == 1 && sum == 0) {\n print(\"0 0\")\n return\n }\n if (length == 0 || sum == 0 || quotient > length || (quotient == length && rest != 0)) {\n print(\"-1 -1\")\n return\n }\n val sb1 = StringBuilder()\n for (i in 0 until quotient) sb1.append('9')\n if (quotient < length) sb1.append(rest)\n for (i in 0 until length - quotient - 1)\n sb1.append('0')\n val sb2 = StringBuilder()\n if (length > quotient + 1) {\n rest--\n sb2.append('1')\n for (i in 0 until length - quotient - 2) sb2.append('0')\n }\n if (quotient < length) sb2.append(rest)\n for (i in 0 until quotient) sb2.append('9')\n print(\"$sb2 $sb1\")\n}\n\n\n// Shorter Python solution: https://codeforces.com/contest/489/submission/41588741"}, {"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"}, {"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 sb = StringBuilder()\n for(element in a) sb.append(element)\n for (i in 0 until length - a.size)\n sb.append('0')\n sb.append(' ')\n if(length > a.size) {\n a[a.lastIndex]--\n sb.append('1')\n for(i in 0 until length - a.size - 1) sb.append('0')\n }\n for(i in a.lastIndex downTo 0) sb.append(a[i])\n print(sb)\n}\n"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n val (length, sum) = readInts()\n val quotient = sum / 9\n var rest = sum % 9\n if (length == 1 && sum == 0) {\n print(\"0 0\")\n return\n }\n if (length == 0 || sum == 0 || quotient > length || (quotient == length && rest != 0)) {\n print(\"-1 -1\")\n return\n }\n val sb1 = StringBuilder()\n for (i in 0 until quotient) sb1.append('9')\n if (quotient < length) sb1.append(rest)\n for (i in 0 until length - quotient - 1)\n sb1.append('0')\n val sb2 = StringBuilder()\n if (length > quotient + 1) {\n rest--\n if (rest < 0) rest = 8\n sb2.append('1')\n for (i in 0 until length - quotient - 2) sb2.append('0')\n }\n if (quotient < length) sb2.append(rest)\n for (i in 0 until quotient) sb2.append('9')\n print(\"$sb2 $sb1\")\n}\n\n\n// Shorter Python solution: https://codeforces.com/contest/489/submission/41588741"}, {"source_code": "// 7/7/2020 11:13 AM\n\n//package 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}"}, {"source_code": "// 7/7/2020 11:13 AM\n\n//package 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 val (m, s) = readInts()\n findSumToN(m, s)\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 if (s <= 0 && m > 1) return currentList\n\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}"}, {"source_code": "// 7/7/2020 11:13 AM\n\n//package 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 val (m, s) = readInts()\n findSumToN(m, s)\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 if (s <= 0) return currentList\n\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}"}, {"source_code": "// 7/7/2020 11:13 AM\n\n//package 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 val (m, s) = readInts()\n// findSumToN(m, s)\n printResult(findSmallest(m, s))\n print(\" \")\n printResult(findLargest(m, s))\n println()\n}\n\nfun findLargest(m: Int, s: Int) : List {\n if (s <= 0) return listOf()\n\n var sumLeft = s\n val outputList = MutableList(m) {0}\n var idx = 0\n while (sumLeft > 0 && idx < m) {\n outputList[idx] = if (sumLeft >= 9) 9 else sumLeft\n sumLeft -= outputList[idx++]\n }\n if (sumLeft > 0)\n return listOf()\n else\n return outputList.toList()\n}\n\nfun findSmallest(m: Int, s: Int) : List {\n if (s <= 0) return listOf()\n\n var sumLeft = s\n val outputList = MutableList(m) {0}\n\n val minFirst = s - 9 * (m - 1)\n\n if (minFirst <= 1)\n outputList[0] = 1\n else if (minFirst > 9)\n return listOf()\n else\n outputList[0] = minFirst\n\n sumLeft -= outputList[0]\n\n var idx = m - 1\n while (sumLeft > 0 && idx > 0) {\n outputList[idx] = if (sumLeft >= 9) 9 else sumLeft\n sumLeft -= outputList[idx--]\n }\n if (sumLeft > 0)\n return listOf()\n else\n return outputList.toList()\n}\n\nfun printResult(l: List) {\n if (l.isEmpty())\n print(\"-1\")\n else\n print(l.fold(\"\", {acc, cur -> acc + cur.toString()}))\n}\n\n//fun findSumToN(m: Int, s: Int) {\n//// findSumToN_recursive(m, s, listOf())\n// printLeastAndGreatest(findSumToN_iterative(m, s))\n//}\n//\n//fun 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//\n//fun findSumToN_iterative(m: Int, s: Int) : List {\n// var currentList = mutableListOf()\n// if (s <= 0 && m > 1) return currentList\n//\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"}, {"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}"}, {"source_code": "fun main(args: Array) {\n val (m, s) = readLine()!!.split(' ').map { it.toInt() }\n (1 .. 900)\n .map { it.toString() }\n .filter { it.length == m && it.map { it - '0' }.sum() == s }\n .let { println(if (it.isEmpty()) \"-1 -1\" else \"${it.first()} ${it.last()}\") }\n}"}, {"source_code": "fun main(args: Array) {\n val (m, s) = readLine()!!.split(' ').map { it.toInt() }\n\n if ((s==0 && m>1) || (m * 9 < s) ){\n println(\"-1 -1\")\n return\n }\n\n val arr = IntArray(m, {if (it == 0) 1 else 0})\n val arr2 = IntArray(m)\n\n for (i in 0 until m){\n var delta = s - 9 * i - 1\n if (delta <= 0) break\n arr[m - i - 1] = minOf(9, delta + if (i == m-1) 1 else 0)\n }\n\n\n for (i in 0 until m){\n var delta = s - 9 * i\n if (delta <= 0) break\n arr2[i] = minOf(9, delta)\n }\n\n\n\n\n println(\"${arr.joinToString(separator = \"\")} ${arr2.joinToString (separator = \"\")}\")\n}"}, {"source_code": "fun main(args: Array) {\n val (m, s) = readLine()!!.split(' ').map { it.toInt() }\n val arr = IntArray(m, {if (it == 0) 1 else 0})\n val arr2 = IntArray(m)\n\n for (i in 0 until m){\n var delta = s - 9 * i - 1\n if (delta <= 0) break\n arr[m - i - 1] = minOf(9, delta + if (i == m-1) 1 else 0)\n\n delta ++\n arr2[i] = minOf(9, delta)\n }\n\n println(\"${arr.joinToString(separator = \"\")} ${arr2.joinToString (separator = \"\")}\")\n}"}, {"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 return\n }\n\n\n (1..s * 10).map { \"$it\" }\n .first { it.sumBy { it - '0' } == s }\n .let {\n print(\"$it${\"0\".repeat(m - it.length)} \")\n for (i in 0 until m) {\n print(maxOf(minOf(s - 9 * i, 9), 0))\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n val (m, s) = readLine()!!.split(' ').map { it.toInt() }\n\n if ( s == 0 || 9 * m < s) {\n println(\"-1 -1\")\n }else{\n with(StringBuilder()){\n (0 until m)\n .takeWhile { s - 9 * it > 0 }\n .forEach { this.append(minOf(9,s-9 * it))}\n\n val res = this.toString().reversed()\n val z = \"0\".repeat(m - res.length)\n print(\"${res.first()}$z${res.removeRange(0,1)} \")\n print(\"${res.reversed()}$z\")\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n val (m, s) = readLine()!!.split(' ').map { it.toInt() }\n\n if ( (s == 0 && m > 1) || 9 * m < s) {\n println(\"-1 -1\")\n }else{\n with(StringBuilder()){\n (0 until m)\n .takeWhile { s - 9 * it > 0 }\n .forEach { this.append(minOf(9,s-9 * it))}\n\n if (this.isEmpty()) this.append(0)\n\n val res = this.toString().reversed()\n val z = \"0\".repeat(m - res.length)\n print(\"${res.first()}$z${res.removeRange(0,1)} \")\n print(\"${res.reversed()}$z\")\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n val (m, s) = readLine()!!.split(' ').map { it.toInt() }\n\n (1..100).map { it.toString() }\n .filter { it.length == m && it.sumBy { it - '0' } == s }\n .let {\n println(if (it.isEmpty()) -1 else \"${it.first()} ${it.last()}\")\n }\n}"}, {"source_code": "fun main(args: Array) {\n val (m, s) = readLine()!!.split(' ').map { it.toInt() }\n\n if ( s == 0 || 9 * m < s) {\n println(\"-1 -1\")\n }else{\n with(StringBuilder()){\n (0 until m)\n .takeWhile { m - 9 * it > 0 }\n .forEach { this.append(minOf(9,m-9 * it))}\n val res = this.toString().reversed()\n val z = \"0\".repeat(m - res.length)\n print(\"${res.first()}$z${res.removeRange(0,1)} \")\n print(\"${res.reversed()}$z\")\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n val (m, s) = readLine()!!.split(' ').map { it.toInt() }\n\n (1..100).map { it.toString() }\n .filter { it.length == m && it.sumBy { it - '0' } == s }\n .let {\n println(if (it.isEmpty()) \"-1 -1\" else \"${it.first()} ${it.last()}\")\n }\n}"}, {"source_code": "fun main(args: Array) {\n val (m, s) = readLine()!!.split(' ').map { it.toInt() }\n\n if ((s==0 && m>1) || (m * 9 < s) ){\n println(\"-1 -1\")\n return\n }\n\n val arr = IntArray(m, {if (it == 0) 1 else 0})\n val arr2 = IntArray(m)\n\n for (i in 0 until m){\n var delta = s - 9 * i - 1\n if (delta <= 0) break\n arr[m - i - 1] = minOf(9, delta + if (i == m-1) 1 else 0)\n\n delta ++\n arr2[i] = minOf(9, delta)\n }\n\n println(\"${arr.joinToString(separator = \"\")} ${arr2.joinToString (separator = \"\")}\")\n}"}, {"source_code": "fun fill(array: Array, totalSum: Int): Int {\n var rem = totalSum\n for (i in 0 until array.size) {\n if (rem >= 9) {\n array[i] = 9\n rem -= 9\n }\n else {\n array[i] = rem\n return 0\n }\n }\n\n return rem\n}\n\nfun main(args: Array) {\n val (m, s) = readLine()!!.split(' ').map { it.toInt() }\n val max = Array(m, { 0 })\n\n if (s == 0 || fill(max, s) != 0) {\n println(\"-1 -1\")\n return\n }\n\n val min = Array(m, { 0 })\n fill(min, s - 1)\n min[min.size - 1] += 1\n\n return println(\"${min.reversed().joinToString(separator = \"\")} ${max.joinToString(separator = \"\")}\")\n}\n"}, {"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 println(minChar[i])\n minChar[i] = (lastNumberMax.toInt() -1).toChar()\n break\n }\n }\n min = String(minChar)\n }\n println(\"$min $max\")\n }\n}\n"}, {"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 || m*9 = 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 if( m == 1 && s <= 9)\n {\n println(\"$s $s\")\n return\n }\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 if(m == 0) break\n }\n if(result.isEmpty() || result.reduce{acc: Int, i: Int -> acc+i } == 0 || m + s != 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}"}, {"source_code": "fun readInts(): List = readLine()!!.split(\" \").map{ it.toInt() }\n\nfun main(){\n var (m, s) = readInts()\n val digits = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9).sortedDescending().toMutableList()\n val result = mutableListOf()\n while(m != 0 || s != 0){\n for(it in digits) {\n if( s - it >= 0){\n s -= it\n result.add(it)\n digits.remove(it)\n break\n }\n }\n m --\n }\n if(result.isEmpty()){\n println(\"-1 -1\")\n return\n }\n val resultString = result.joinToString(separator = \"\")\n print(resultString.reversed() + \" \" + resultString)\n}"}, {"source_code": "fun readInts(): List = readLine()!!.split(\" \").map{ it.toInt() }\n\nfun main(){\n var (m, s) = readInts()\n val digits = listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9).sortedDescending().toMutableList()\n val result = mutableListOf()\n while(m != 0 || s != 0){\n for(it in digits) {\n if( s - it >= 0){\n s -= it\n result.add(it)\n digits.remove(it)\n break\n }\n }\n m --\n }\n if(result.isEmpty() || result.reduce{acc: Int, i: Int -> acc+i } == 0){\n println(\"-1 -1\")\n return\n }\n val resultString = result.joinToString(separator = \"\")\n print(if(resultString[0]!='0') \"${resultString.reversed()} $resultString\"\n else \"$resultString $resultString\")\n}"}, {"source_code": "\nfun main(){\n var input = readLine()!!.split(' ')\n val m = input[0].toInt()\n val s = input[1].toInt()\n if (m == 1 && s == 0){\n println(\"0 0\")\n return\n }\n\n if ((1 > s) || (s > 9 * m)){\n println(\"-1 1\")\n return\n }\n\n var smallestNumberWithMDigits = CharArray(m){'0'}\n var greatestNumberWithMDigits = CharArray(m){'9'}\n smallestNumberWithMDigits[0] = '1'\n\n var startingIndex = m-1\n var digitSumVar = smallestNumberWithMDigits.sumBy { (it-'0') }\n while (digitSumVar + 9 <= s){\n digitSumVar += 9\n smallestNumberWithMDigits[startingIndex] = '9'\n startingIndex -= 1\n }\n\n while (digitSumVar < s){\n val current_digit = smallestNumberWithMDigits[startingIndex]\n smallestNumberWithMDigits[startingIndex] = current_digit + 1\n digitSumVar += 1\n if (current_digit == '8'){\n startingIndex -= 1\n }\n }\n\n\n startingIndex = m-1\n digitSumVar = greatestNumberWithMDigits.sumBy { (it-'0') }\n while (digitSumVar - 9 >= s){\n digitSumVar -= 9\n greatestNumberWithMDigits[startingIndex] = '0'\n startingIndex -= 1\n }\n\n while (digitSumVar > s){\n val current_digit = greatestNumberWithMDigits[startingIndex]\n greatestNumberWithMDigits[startingIndex] = current_digit - 1\n digitSumVar -= 1\n if (current_digit == '1'){\n startingIndex -= 1\n }\n }\n\n println(\"${smallestNumberWithMDigits.joinToString(\"\")} ${greatestNumberWithMDigits.joinToString(\"\")}\");\n}\n\n"}, {"source_code": "fun readInts(): List = readLine()!!.split(\" \").map{ it.toInt() }\n\nfun main(){\n var (m, s) = readInts()\n val digits = listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9).sortedDescending().toMutableList()\n val result = mutableListOf()\n while(m != 0 || s != 0){\n for(it in digits) {\n if( s - it >= 0){\n s -= it\n result.add(it)\n digits.remove(it)\n break\n }\n }\n m --\n }\n if(result.isEmpty() || result.reduce{acc: Int, i: Int -> acc+i } == 0){\n println(\"-1 -1\")\n return\n }\n val resultString = result.joinToString(separator = \"\")\n println(if(resultString[resultString.lastIndex]!='0') \"${resultString.reversed()} $resultString\"\n else \"$resultString $resultString\")\n}"}, {"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 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}"}, {"source_code": "fun readInts(): List = readLine()!!.split(\" \").map{ it.toInt() }\n\nfun main(){\n var (m, s) = readInts()\n val digits = listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9).sortedDescending().toMutableList()\n val result = mutableListOf()\n while(m != 0 || s != 0){\n for(it in digits) {\n if( s - it >= 0){\n s -= it\n result.add(it)\n digits.remove(it)\n break\n }\n }\n m --\n }\n if(result.isEmpty()){\n println(\"-1 -1\")\n return\n }\n val resultString = result.joinToString(separator = \"\")\n print(if(resultString[0]!='0') \"${resultString.reversed()} $resultString\"\n else \"$resultString $resultString\")\n}"}, {"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 if (digits[index] == 0 && result.isEmpty()) break\n result.add(digits[index])\n s -= digits[index]\n m --\n }\n if(s < digits[index]){\n index ++\n }\n if(m == 0) break\n }\n if(result.isEmpty() || result.reduce{acc: Int, i: Int -> acc+i } == 0 || m + s != 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}"}, {"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 if(m == 0) break\n }\n if(result.isEmpty() || result.reduce{acc: Int, i: Int -> acc+i } == 0 || m + s != 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}"}, {"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 if (digits[index] == 0 && digits.isEmpty()) break\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 || m + s != 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}"}, {"source_code": "fun readInts(): List = readLine()!!.split(\" \").map{ it.toInt() }\n\nfun main(){\n var (m, s) = readInts()\n val digits = listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9).sortedDescending().toMutableList()\n val result = mutableListOf()\n while(m != 0 || s != 0){\n for(it in digits) {\n if( s - it >= 0){\n s -= it\n result.add(it)\n digits.remove(it)\n break\n }\n }\n m --\n }\n if(result.isEmpty()){\n println(\"-1 -1\")\n return\n }\n val resultString = result.joinToString(separator = \"\")\n print(if(resultString[resultString.lastIndex]!='0') \"${resultString.reversed()} $resultString\"\n else \"$resultString $resultString\")\n}"}, {"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}"}, {"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, sum )\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}"}, {"source_code": "import kotlin.math.min\n\n/* template start */\n// input\nprivate fun readString() = readLine()!!\nprivate fun readStrings() = readString().split(\" \")\nprivate fun readInt() = readString().toInt()\nprivate fun readDigits() = readString().map { it - '0' }\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\n\n// output\nprivate fun T.print(map: (T) -> String = { it.toString() }) = println(map(this))\nprivate fun Iterable.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)\nprivate fun Array.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)\nprivate fun IntArray.print(sep: String? = null, map: ((Int) -> String)? = null) = asSequence().print(sep, map)\nprivate fun Sequence.print(sep: String? = null, map: ((T) -> String)? = null) =\n println(joinToString(sep ?: \"\", transform = map ?: { it.toString() }))\n\n// others\nprivate val Int.isEven: Boolean get() = this % 2 == 0\nprivate val Int.isOdd: Boolean get() = !this.isEven\nprivate fun queries(block: (Int) -> Unit) = repeat(readInt(), block)\n\n/* template end */\n\nfun main() {\n val (len, sum) = readInts()\n if (sum == 0) {\n if (len != 1) println(\"-1 -1\")\n else println(\"0 0\")\n } else if (len * 9 < sum) {\n println(\"-1 -1\")\n } else {\n val maxNum = buildString {\n var rem = sum\n repeat(len) {\n val next = min(rem, 9)\n append(next)\n rem -= next\n }\n }\n var minNum = 0\n var factor = 1\n var rem = sum\n for (i in 0 until len) {\n if (rem > 1) {\n var next = min(rem - 1, 9)\n if (i == len - 1 && next < 9) {\n next++\n }\n minNum += next * factor\n factor *= 10\n rem -= next\n } else {\n if (i == len - 1)\n minNum += factor\n factor *= 10\n }\n }\n\n println(\"$minNum $maxNum\")\n }\n\n}\n"}], "src_uid": "75d062cece5a2402920d6706c655cad7"} {"source_code": "\nimport java.io.*\nimport java.util.*\n\n\nfun solve() {\n\n var n = nextInt()\n var ans = 0\n while (n > 0) {\n n /= 2\n ans++\n }\n\n println(ans)\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}", "positive_code": [{"source_code": "import java.io.*\nimport java.lang.Math.abs\nimport java.util.*\nimport kotlin.math.log2\nimport kotlin.math.max\nimport kotlin.math.sqrt\n\nfun main(args : Array) = Thread { run() }.start()\nval scanner = Scanner(System.`in`)\n\nfun run() {\n\n var n = scanner.nextInt()\n var q = 0\n while (n > 0) {\n q++\n n /= 2\n }\n println(q)\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}"}, {"source_code": "import kotlin.math.log2\n\nfun main(args: Array) {\n val n = readLine()!!.toInt()\n println(log2(n.toDouble()).toInt() + 1)\n}"}, {"source_code": "import kotlin.math.*\n\nfun main() {\n val n = readInt()\n\n val ans = n.toBigInteger().bitLength()\n\n println(ans)\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 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() }"}, {"source_code": "import java.util.*\n\nfun main(args: Array ) {\n val sc = Scanner( System.`in` )\n var n = sc.nextInt()\n var s = 1\n var r = 0\n while ( n > 0 ) {\n n -= s\n s *= 2\n r ++\n }\n println( r )\n}\n"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n var s = 0L\n var i = 1\n var x = 0\n while(s < n) {\n s+=i\n i*=2\n x++\n }\n println(x)\n}\n"}], "negative_code": [{"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"}], "src_uid": "95cb79597443461085e62d974d67a9a0"} {"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() <= 29)\n println(12)\n else if (s[0].toInt() <= 30)\n println(11)\n else\n println(7)\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", "positive_code": [{"source_code": "import java.lang.StringBuilder\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.max\n\nfun main() {\n var (num, i, key) = readLine()!!.split(' ')\n var number = num.toInt()\n if (!key.equals(\"week\")) {\n if (1 <= number && number <= 29) {\n println(12)\n } else if ((number == 30 || number == 29)) {\n println(11)\n } else if (number == 31) {\n println(7)\n }\n } else {\n if (number == 6 || number == 5) {\n println(53)\n } else {\n println(52)\n }\n\n }\n}"}, {"source_code": "fun main() {\n val text = readLine()!!\n print(\n when {\n text == \"30 of month\" -> 11\n text == \"31 of month\" -> 7\n text.endsWith(\"month\") -> 12\n text[0] == '5' -> 53\n text[0] == '6' -> 53\n else -> 52\n }\n )\n}"}], "negative_code": [{"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"}], "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b"} {"source_code": "fun main(args: Array) {\n val t = \"qwertyuiopasdfghjkl;zxcvbnm,./\"\n val s = readLine()\n val m = if (s==\"R\") -1\n else 1\n val z = readLine()!!.toString()\n for (c in z) print(t[t.indexOf(c)+m])\n}", "positive_code": [{"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 }\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 readInt() = readToken().toInt()\n fun readLong() = readToken().toLong()\n fun readLine() : String {\n tok = StringTokenizer(\"\")\n return rd.readLine()\n }\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 kbd = arrayOf(\"qwertyuiop\", \"asdfghjkl;\", \"zxcvbnm,./\")\n val lm = HashMap()\n val rm = HashMap()\n for (s in kbd) {\n for (i in s.indices) {\n if (i > 0) lm[s[i]] = s[i - 1]\n if (i < s.lastIndex) rm[s[i]] = s[i + 1]\n }\n }\n val d = io.readToken()\n val m = if (d == \"L\") rm else lm\n val s = io.readToken()\n io.println(s.map({ ch -> m[ch] }).joinToString(\"\"))\n}\n"}, {"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 type = r.readLine()!!\n val str = \"qwertyuiopasdfghjkl;zxcvbnm,./\".split(\"\").filter { it.length > 0 }\n val before = r.readLine()!!\n before.forEach { \n var i = str.indexOf(it.toString())\n if (type==\"R\") i--\n else i++\n s.append(str[i])\n }\n println(s)\n}"}, {"source_code": "import java.lang.StringBuilder\n\nprivate const val layout = \"qwertyuiopasdfghjkl;zxcvbnm,./\"\n\nfun main(args: Array) {\n val direction = readLine()!!\n val message = readLine()!!\n val correction = if (direction == \"L\") 1 else -1\n val result = StringBuilder()\n for (char in message) {\n val currentIndex = layout.indexOf(char)\n val requiredCharIndex = currentIndex + correction\n val requiredChar = layout[requiredCharIndex]\n result.append(requiredChar)\n }\n print(result)\n}"}, {"source_code": "fun main() = Pair(readLine()!! == \"R\", readLine()!!)\n .let { (rightShifted, wrongMessage) ->\n val shiftedKeysMap = hashMapOf>().apply {\n \"qwertyuiopasdfghjkl;zxcvbnm,./\".let { keyboard ->\n keyboard.forEachIndexed { index, key ->\n put(\n key,\n Pair(keyboard.getOrNull(index - 1) ?: '*', keyboard.getOrNull(index + 1) ?: '*')\n )\n }\n }\n }\n wrongMessage\n .map { key -> shiftedKeysMap[key]!!.run { if (rightShifted) first else second } }\n .joinToString(\"\")\n }\n .run(::println)"}, {"source_code": "fun main() {\n val shift = readLine()!!\n val output = readLine()!!.map { getLetter(shift, it) }.joinToString(\"\")\n println(output)\n}\n\nfun getLetter(shift: String, char: Char): Char {\n val line = listOf(\n \"qwertyuiop\",\n \"asdfghjkl;\",\n \"zxcvbnm,./\"\n ).first { it.contains(char) }\n\n val position = line.indexOf(char)\n val shiftIndex = if (shift == \"L\") 1 else -1\n return line.get(position + shiftIndex)\n}"}, {"source_code": "fun main()\n{\n val abc=\"qwertyuiopasdfghjkl;zxcvbnm,./\"\n var dir = readLine().toString()\n var text = readLine().toString()\n val t = text.toCharArray()\n for(index in 0..text.length-1)\n {\n if (dir == \"R\") {\n val eindex: Int = abc.indexOf(t[index]) - 1\n t[index] = abc[eindex]\n\n } else {\n val eindex: Int = abc.indexOf(t[index]) + 1\n t[index] = abc[eindex]\n }\n\n }\n text = String(t)\n println(text)\n}\n\n"}, {"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 shifting = br.readLine()\n val s = br.readLine()\n val keys = (\"qwertyuiop\" + \"asdfghjkl;\" + \"zxcvbnm,./\").toList()\n val keysIndices = keys.zip(keys.indices).toMap()\n println(\n s.fold(StringBuilder()){acc, c ->\n acc.apply {\n append(\n if (shifting == \"R\") keys[keysIndices[c]!! - 1]\n else keys[keysIndices[c]!! + 1]\n )\n }\n }\n )\n}"}, {"source_code": "import java.math.BigInteger\n\n\nfun main() {\n var direction = readLine()!!\n var str = readLine()!!\n var ansStr = \"qwertyuiopasdfghjkl;zxcvbnm,./\"\n var ans =\"\"\n if (direction==\"R\"){\n for (i in str){\n var j = 1\n while (j) {\n val keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\"\n val dir = if (readLine()!! == \"R\") -1 else 1\n val input = readLine()!!\n println(String(input.map { it -> keyboard[keyboard.indexOf(it) + dir] }.toCharArray()))\n}"}, {"source_code": "fun main(args:Array) {\n val a=\"qwertyuiopasdfghjkl;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}"}, {"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 print(\"\\n\")\n }\n}\n"}, {"source_code": "fun main() {\n val shift = if (readLine()!! == \"R\") -1 else 1\n val text = readLine()!!\n val map = mutableMapOf>()\n val lines = arrayOf(\"qwertyuiop\", \"asdfghjkl;\", \"zxcvbnm,./\")\n for (linePos in 0 until 3)\n for ((charPos, char) in lines[linePos].withIndex())\n map[char] = linePos to charPos\n val sb = StringBuilder()\n for (c in text) {\n val (linePos, charPos) = map[c]!!\n sb.append(lines[linePos][charPos + shift])\n }\n print(sb.toString())\n}"}, {"source_code": "import java.util.TreeMap\n\ninterface LexicographicComparable : Comparable {\n fun num_fields() : Int\n fun compare_field(i : Int, other : T) : Int\n\n override fun compareTo(other : T) : Int {\n val n = num_fields()\n for (i in 0 .. (n - 1)) {\n val c = compare_field(i, other)\n if (c == 0) {\n // Do nothing ...\n } else {\n return c\n }\n }\n return 0\n }\n}\n\nclass KeyboardCharacter : LexicographicComparable {\n val row : Int\n val index : Int\n\n constructor(row : Int, index : Int) {\n this.row = row\n this.index = index\n }\n\n fun neighbor(l_or_r : String) : KeyboardCharacter {\n when (l_or_r) {\n \"L\" -> return KeyboardCharacter(this.row, this.index + 1)\n \"R\" -> return KeyboardCharacter(this.row, this.index - 1)\n else -> throw Exception(\"Unknown neighbor.\")\n }\n }\n\n override fun num_fields() : Int {\n return 2\n }\n\n override fun compare_field(i : Int, other : KeyboardCharacter) : Int {\n when (i) {\n 0 -> return this.row.compareTo(other.row)\n 1 -> return this.index.compareTo(other.index)\n else -> throw Exception(\"Invalid field!\")\n }\n }\n\n override fun toString() : String {\n return \"(${this.row}, ${this.index})\"\n }\n}\n\nfun updateKeyboard(row : Int,\n keys : String,\n kbToChar : TreeMap,\n charToKb : TreeMap) {\n var index = 0\n for (char in keys) {\n val kb = KeyboardCharacter(row, index)\n kbToChar.put(kb, char)\n charToKb.put(char, kb)\n index = index + 1\n }\n}\n\nfun readString() : String {\n val str_nullable = readLine()\n if (str_nullable == null) {\n throw Exception(\"Could not read string!\")\n } else {\n val str = str_nullable\n return str\n }\n}\n\nfun main(args : Array) {\n val row_0 = \"qwertyuiop\"\n val row_1 = \"asdfghjkl;\"\n val row_2 = \"zxcvbnm,./\"\n val kbToChar = TreeMap()\n val charToKb = TreeMap()\n updateKeyboard(0, row_0, kbToChar, charToKb)\n updateKeyboard(1, row_1, kbToChar, charToKb)\n updateKeyboard(2, row_2, kbToChar, charToKb)\n // println(\"${kbToChar}\")\n // println(\"${charToKb}\")\n val l_or_r = readString()\n val str = readString()\n fun translate(c : Char) : Char {\n val kb_nullable = charToKb[c]\n if (kb_nullable == null) {\n throw Exception(\"1. Could not translate character!\")\n } else {\n val kb = kb_nullable\n val kb_nbr = kb.neighbor(l_or_r)\n val nbr_c_nullable = kbToChar[kb_nbr]\n if (nbr_c_nullable == null) {\n throw Exception(\"2. Could not translate character!\")\n } else {\n val nbr_c = nbr_c_nullable\n return nbr_c\n }\n }\n }\n str.forEach({c -> val t = translate(c)\n print(t) })\n println()\n}\n"}, {"source_code": "import java.util.*\n\n/**\n * Created by tux on 08.11.16.\n */\n\nfun main(args: Array) {\n val K = listOf(\"qwertyuiop\", \"asdfghjkl;\", \"zxcvbnm,./\")\n val M = HashMap>()\n for (j in 0..(K.size - 1)) {\n for (i in 0..(K[j].length - 1)) {\n M.put(K[j][i], Pair(j, i))\n }\n }\n\n val offset = if (readLine()!![0] == 'R') -1 else +1\n var ret = \"\"\n readLine()!!.forEach {\n val p = M[it]!!\n ret += K[p.first][p.second + offset]\n }\n println(ret)\n}\n"}, {"source_code": "\nfun main(args: Array) {\n\n val first = \"qwertyuiopasdfghjkl;zxcvbnm,./\"\n\n val command = readLine()!!\n\n val message = readLine()!!\n\n\n var result= \"\"\n \n message.forEach { c ->\n val position = first.indexOf(c)\n result += if (command == \"R\"){\n first[position - 1]\n }else{\n first[position + 1]\n }\n\n }\n\n println(result)\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.*\nimport kotlin.system.measureTimeMillis\n\nfun getMinimumAmountOfChangeFrom(amount: Int): Int {\n val changes = listOf(10, 5, 1)\n var availableAmount = amount\n var numOfCoins = 0\n for (change in changes) {\n while (availableAmount > 0 && availableAmount / change.toDouble() >= 1) {\n numOfCoins += 1\n availableAmount -= change\n }\n }\n return numOfCoins\n}\n\nfun getMaximumValueOfTheLootWith(\n W: Int,\n valuePerUnitAndWeight: List>\n): Double {\n var maximumLootValue = 0.0\n var availableWeight = W\n for (pair in valuePerUnitAndWeight) {\n var availableWeightOfLootItem = pair.second\n while (availableWeight > 0 && availableWeightOfLootItem > 0) {\n maximumLootValue += pair.first\n availableWeightOfLootItem -= 1\n availableWeight -= 1\n }\n }\n return maximumLootValue\n}\n\nfun getMinimumNumOfRefills(d: Int, m: Int, stops: List): Int {\n var availableDistance = d\n var minimumRefills = 0\n var currentRefill = 0\n var lastRefill = 0\n val realStops = listOf(0, *stops.toTypedArray(), d)\n while (availableDistance > 0 && currentRefill < realStops.size) {\n var movedForward = false\n while (currentRefill < realStops.size && (realStops[currentRefill] - realStops[lastRefill]) <= m) {\n if (realStops[currentRefill] - realStops[lastRefill] == 0) {\n movedForward = false\n currentRefill++\n } else {\n movedForward = true\n currentRefill++\n }\n }\n if (movedForward) {\n minimumRefills++\n currentRefill--\n availableDistance -= (realStops[currentRefill] - realStops[lastRefill])\n lastRefill = currentRefill\n } else {\n return -1\n }\n }\n return minimumRefills - 1\n}\n\nfun getMaximizedSumOfProduct(profitPerClick: List, averageNumberOfClicks: List): Long {\n var sum = 0L\n println(profitPerClick.toString())\n println(averageNumberOfClicks.toString())\n profitPerClick.forEachIndexed { index, profit ->\n sum += profit * averageNumberOfClicks[index]\n }\n return sum\n}\n\nfun getCommon(first: Int, last: Int, segments: MutableList>): String {\n var current = first\n val common = mutableListOf>()\n while (current <= last) {\n var numOfTimes = 0\n for (pair in segments) {\n if (current in pair.first..pair.second) {\n numOfTimes++\n }\n }\n if (numOfTimes > 1) {\n common.add(Pair(current, numOfTimes))\n }\n current++\n }\n common.sortByDescending { it -> it.second }\n if (common.first().second == segments.size) {\n return \"1\\n${common.first().first}\"\n }\n println(common)\n return \"${common.size}\\n${common.map { it.first }.joinToString(\" \")}\"\n}\n\nfun getMaximumSetOfPrizes(n: Int): String {\n var numbersOfN = \"\"\n var sumSoFar = 0\n if (n <= 2) {\n return \"1\\n$n\"\n }\n// println(\"2*square root of n = ${2 * sqrt(n.toDouble())}\")\n// for (i in 1..(2 * sqrt(n.toDouble()).toInt())){\n// if (i+sumSoFar<=n){\n// numbersOfN+=\"$i \"\n// sumSoFar+=i\n// }\n// }\n// var lastNumber = 1\n var currentNumber = 1\n while (((currentNumber + 1) + currentNumber) <= n - sumSoFar) {\n sumSoFar += currentNumber\n numbersOfN += \"$currentNumber \"\n currentNumber++\n }\n if (((n - currentNumber) + sumSoFar) == n || n - sumSoFar > 0) {\n currentNumber = n - sumSoFar\n sumSoFar += currentNumber\n numbersOfN += \"$currentNumber \"\n }\n// else if (n-sumSoFar>0){\n// currentNumber = n-sumSoFar\n// numbersOfN += \"$currentNumber \"\n// }\n return \"${numbersOfN.trim().split(\" \").size}\\n$numbersOfN\"\n}\n\n\nfun linelandMail(coordinates: List): String {\n val mins = mutableListOf()\n val maxs = mutableListOf()\n for (i in coordinates.indices) {\n if (i == 0) {\n mins.add(abs(coordinates[i] - coordinates[i + 1]))\n maxs.add(abs(coordinates[i] - coordinates[coordinates.size - 1]))\n } else if (i == coordinates.size - 1) {\n mins.add(abs(coordinates[i] - coordinates[i - 1]))\n maxs.add(abs(coordinates[i] - coordinates[0]))\n } else {\n if (abs(coordinates[i] - coordinates[i - 1])\n > abs(coordinates[i] - coordinates[i + 1])\n )\n mins.add(abs(coordinates[i] - coordinates[i + 1]))\n else\n mins.add(abs(coordinates[i] - coordinates[i - 1]))\n\n if (abs(coordinates[i] - coordinates[0])\n < abs(coordinates[i] - coordinates[coordinates.size - 1])\n )\n maxs.add(abs(coordinates[i] - coordinates[coordinates.size - 1]))\n else\n maxs.add(abs(coordinates[i] - coordinates[0]))\n }\n }\n return mins\n .zip(maxs)\n .map { pair -> \"${pair.first} ${pair.second}\" }\n .joinToString(\"\\n\")\n}\n\nfun snacktower(snacksWeights: List) {\n val n = snacksWeights.size\n var currentMax = n\n var current = 0\n var processed = mutableListOf()\n while (current < snacksWeights.size) {\n if (snacksWeights[current] < currentMax) {\n processed.add(snacksWeights[current])\n print(\"\\n\")\n current++\n } else {\n if (snacksWeights[current] == currentMax) {\n print(currentMax)\n currentMax--\n var currentProcessed = 0\n while (currentProcessed < processed.size) {\n var foundConsecutive = false\n if (processed[currentProcessed] == currentMax) {\n print(\" \")\n print(processed[currentProcessed])\n currentMax--\n foundConsecutive = true\n processed = processed.swap(currentProcessed, processed.size - 1).toMutableList()\n processed.removeAt(processed.size - 1)\n }\n if (!foundConsecutive) {\n currentProcessed++\n } else {\n currentProcessed = 0\n }\n }\n println()\n current++\n }\n }\n }\n}\n\nfun List.swap(a: Int, b: Int): List = this\n .toMutableList()\n .also {\n it[a] = this[b]\n it[b] = this[a]\n }\n\nfun `Oath of the Night's Watch`(stewardsStrengths: List) {\n val sortedStrengths = stewardsStrengths.sorted()\n var numberOfThoseWhoNeedSupport = 0\n for (strengthIndex in sortedStrengths.indices) {\n val precedingSteward = strengthIndex - 1\n val nextSteward = strengthIndex + 1\n if (precedingSteward>=0 && nextStewardsortedStrengths[strengthIndex]){\n numberOfThoseWhoNeedSupport++\n }\n }\n }\n println(numberOfThoseWhoNeedSupport)\n}\n\nfun pangram(characters: String){\n print(if (characters.toLowerCase().toSet().size==26) \"YES\" else \"NO\")\n}\n\nfun twins(coinsValues: List){\n val sortedValues = coinsValues.sortedDescending()\n var mySumSoFar = 0\n var numberOfCoinsIWillTake = 0\n for (index in sortedValues.indices){\n mySumSoFar+=sortedValues[index]\n numberOfCoinsIWillTake++\n if (mySumSoFar>sortedValues.subList(index+1,sortedValues.size).sum()){\n break\n }\n }\n println(numberOfCoinsIWillTake)\n}\n\nfun keyboard(handSlippedTo: Char, codedMessage: String){\n val hisKeyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\"\n for (char in codedMessage){\n when(handSlippedTo){\n 'R'->{\n print(hisKeyboard[hisKeyboard.indexOf(char)-1])\n }\n 'L'->{\n print(hisKeyboard[hisKeyboard.indexOf(char)+1])\n }\n }\n }\n}\nfun main() {\n\n// val scanner = Scanner(System.`in`)\n// val n = scanner.nextInt()\n// val snacksWeights = MutableList(n) { index -> 0 }\n// for (i in 0 until n) {\n// snacksWeights[i] = scanner.nextInt()\n// }\n// snacktower(snacksWeights)\n// val scanner = Scanner(System.`in`)\n// val n = scanner.nextInt()\n// val strengths = MutableList(n) { index -> 0 }\n// for (i in 0 until n) {\n// strengths[i] = scanner.nextInt()\n// }\n// `Oath of the Night's Watch`(strengths)\n val scanner = Scanner(System.`in`)\n val direction = scanner.next()\n val codedMessage = scanner.next()\n keyboard(direction[0],codedMessage)\n}\n\n\n// start of stress test\n// while (true) {\n// val n = Random.nextLong(1000000)\n// val m = Random.nextLong(100000)\n// if (m) {\n val strs = arrayOf(\"qwertyuiop\", \"asdfghjkl;\", \"zxcvbnm,./\")\n val R = mutableMapOf()\n val L = mutableMapOf()\n for (str in strs) {\n for (i in 1..str.length-1) {\n R.put(str[i-1], str[i])\n L.put(str[i], str[i-1])\n }\n }\n val dir = readLine()!![0]\n val s = readLine()!!\n for (c in s) {\n if (dir == 'R') {\n print(L[c])\n } else {\n print(R[c])\n }\n }\n print(\"\\n\")\n}\n"}, {"source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n var Direction: String = input.next()\n var Word: String = input.next()\n var lettList = ArrayList()\n\n val keyboard = \"qwertyuiop[]asdfghjkl;'zxcvbnm,./\"\n\n for(letter in Word.indices) {\n for (checker in keyboard.indices) {\n if(Word.get(letter) == keyboard.get(checker)) {\n if(Direction.equals(\"R\")) {\n lettList.add(keyboard.get(checker-1))\n } else {\n lettList.add(keyboard.get(checker+1))\n }\n }\n }\n }\n\n var Res: String = lettList.joinToString(\"\")\n println(Res)\n}"}], "negative_code": [{"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}"}, {"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"}], "src_uid": "df49c0c257903516767fdb8ac9c2bfd6"} {"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()\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 = n\n\n for (l in (0 until n / 2).reversed()) {\n val pref = s.slice(0..l)\n val r = 2 * l + 1\n val nexts = s.slice(l + 1..r)\n\n if (pref == nexts) {\n val t = pref.length + 1 + (n - 2 * pref.length)\n ans = min(ans, t)\n }\n }\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}", "positive_code": [{"source_code": "import java.util.*\nimport kotlin.math.*\n\nfun check(s: String, start: Int): Boolean {\n for (i in 0 until start) {\n if (start + i >= s.length || s[i] != s[start + i])\n return false\n }\n return true\n}\n\nfun main(args: Array) {\n Scanner(System.`in`.buffered()).use {\n val n = it.nextInt()\n val s = it.next()\n\n var ans = n\n for (i in 1 .. n / 2) {\n if (check(s, i))\n ans = min(ans, i + 1 + n - 2 * i)\n }\n\n println(ans)\n }\n}"}], "negative_code": [], "src_uid": "ed8725e4717c82fa7cfa56178057bca3"} {"source_code": "import kotlin.math.abs\n\nfun main() {\n var (n, pos, l, r) = readLine()!!.split(\" \").map(String::toInt)\n val toDelete = mutableListOf>()\n if (l > 1)\n toDelete.add(pos - l to l)\n if (r < n)\n toDelete.add(r - pos to r)\n toDelete.sortBy { it.first }\n var sol = 0\n for(tab in toDelete) {\n sol += abs(pos -tab.second) + 1\n pos = tab.second\n }\n print(sol)\n}", "positive_code": [{"source_code": "import java.util.*\n\nfun abs(x: Int) = if (x >= 0) x else -x\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 = abs(pos - l) + 1 + (1 + r - l) * (if (r != n) 1 else 0)\n val rightToLeft = abs(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"}, {"source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.min\n\n\nclass B {\n fun solve(input : InputStream, output : OutputStream) {\n val reader = InputReader(BufferedInputStream(input))\n val writer = PrintWriter(BufferedOutputStream(output))\n\n val n = reader.nextInt()\n val pos = reader.nextInt()\n val l = reader.nextInt()\n val r = reader.nextInt()\n\n writer.println(solve(n, pos, l, r))\n\n writer.close()\n }\n\n fun range(a : Int, b : Int) : Int {\n return abs(a - b)\n }\n\n fun solve(n : Int, pos : Int, l : Int, r : Int) : Int {\n if (l == 1 && r == n) {\n return 0\n }\n if (l == 1) {\n return range(pos, r) + 1\n }\n if (r == n) {\n return range(pos, l) + 1\n }\n\n val leftFirst = range(pos, l) + 1 + range(l, r) + 1\n val rightFirst = range(pos, r) + 1 + range(l, r) + 1\n return min(leftFirst, rightFirst)\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 B().solve(System.`in`, System.out)\n}"}], "negative_code": [{"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}"}, {"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"}], "src_uid": "5deaac7bd3afedee9b10e61997940f78"} {"source_code": "fun main() {\n val n = Integer.valueOf(readLine()!!)\n\n repeat(n) {\n val x = Integer.valueOf(readLine()!!)\n val r = x % 7\n val d = x / 7\n if(r == 0) {\n println(d)\n } else if(r == 1){\n println(d + 2)\n } else {\n println(d + 1)\n }\n }\n}\n", "positive_code": [{"source_code": "private fun readInt() = readLine()?.toInt()!!\n\nprivate fun rollTry(point: Int) =\n if (point in 2..7) 1\n else (point / 6) + if (point % 6 != 0) 1 else 0\n\n\nfun main() {\n\n val num = readInt()\n (1..num)\n .map { readInt() }\n .forEach { println(rollTry(it)) }\n}"}, {"source_code": "fun readInt(): Int {\n return readLine()!!.toInt()\n}\n\nfun main() {\n val T = readInt()\n for(i in 1..T) {\n var result = 0\n var n = readInt()\n while(n > 0) {\n if(n % 7 == 1)\n n -= 4\n else if(n >= 7)\n n -= 7\n else\n n -= n % 7\n result++\n }\n println(result)\n }\n}"}, {"source_code": "fun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\n\nfun main() {\n val testCases = readInt()\n for (i in 1..testCases) {\n val n = readInt()\n println((n / 7) + 1)\n }\n}"}, {"source_code": "import java.io.*\nimport java.util.*\nimport java.lang.Math.*\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 t = nextInt()\n for (it in 0 until t) {\n val x = nextInt()\n if (x <= 7) {\n println(1)\n } else if (x % 2 == 0) {\n println(x / 2)\n } else {\n println(1 + (x - 3) / 2)\n }\n }\n}"}, {"source_code": "fun main(args: Array){\n var t:Int = readLine()?.toInt()?:0\n for(i in 1..t)\n {\n var b:Int = readLine()?.toInt()?:0\n var result = b/2;\n println(result)\n }\n}"}, {"source_code": "fun main() {\n var t = readLine()!!.toInt()\n for (i in 1..t) {\n var number = readLine()!!.toInt()\n if (number % 2 == 0) {\n println(number / 2)\n } else {\n println((number - 1) / 2)\n }\n }\n}"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n\n val n = scanner.nextInt()\n\n repeat(n){\n println(findNumberOfRoles(scanner.nextInt()))\n }\n }\n\n private fun findNumberOfRoles(q: Int): Int {\n return q/2\n }"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n\n repeat(scanner.nextInt()){\n println(scanner.nextInt()/2)\n }\n}"}, {"source_code": "fun main() {\n val nQueries = readLine()!!.toInt()\n for (i in 0 until nQueries) {\n val value = readLine()!!.toInt()\n println(value / 7 + 1)\n }\n}\n"}, {"source_code": "import java.util.*\n\nfun main() {\n\n val scanner = Scanner(System.`in`)\n var t = scanner.nextInt()\n\n while (t > 0) {\n t--\n val num = scanner.nextInt()\n var idx=2\n while (idx<=7){\n val c = num % idx\n val c2 = num / idx\n if (c != 1) {\n if (c > 0) println(c2 + 1)\n else println(c2)\n break\n }\n idx++\n }\n }\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n\n val scanner = Scanner(System.`in`)\n var t = scanner.nextInt() \n\n while (t > 0) {\n t--\n var num = scanner.nextInt()\n for (i in 2..7) {\n var c = num % i\n var c2 = num / i\n if (c != 1) {\n if (c > 0) println(c2 + 1)\n else println(c2)\n break\n }\n }\n }\n\n}"}, {"source_code": "import java.util.Scanner\nfun main() {\n val read = Scanner(System.`in`)\n var t = read.nextInt()\n //var t : Int = 3\n while (t-- != 0) {\n var n = read.nextInt()\n var ans : Int = 0\n var i : Int\n for (i in 7 downTo 2) {\n if (n % i == 0) {\n ans = n / i\n } else if (n % i >= 2 && n % i < i) {\n ans = n / i + 1\n }\n }\n println(ans)\n }\n\n }"}, {"source_code": "/* https://codeforces.com/problemset/problem/1093/A */\n\nfun main() {\n val numOfQueries = readLine()!!.toInt()\n for (i in 1..numOfQueries) {\n val targetPoints = readLine()!!.toInt()\n val numOfRolls = targetPoints / 7 + 1\n println(numOfRolls)\n }\n}"}, {"source_code": "import kotlin.math.min\n\nval dp = IntArray(103)\n\nfun main(){\n dp[0] = 0\n for(i in 1..100){\n dp[i] = Int.MAX_VALUE\n for(j in 2..7)\n if(i >= j && dp[i-j] != Int.MAX_VALUE)\n dp[i] = min(dp[i], 1 + dp[i-j])\n }\n val t = readLine()!!.toInt()\n repeat(t){\n val x = readLine()!!.toInt()\n println(dp[x])\n }\n}"}, {"source_code": "fun main(){\n var t = readLine()!!.toInt()\n val answers = mutableListOf()\n while (t-- > 0){\n val x = readLine()!!.toInt()\n answers.add((x/2).toString())\n }\n\n println(answers.joinToString(\"\\n\"))\n}\n"}, {"source_code": "fun main() {\n\n val solver = Solver()\n// val res = solver.solve(13)\n// print(res)\n val parsed: List = Parser().parse()\n val res = parsed.map { x -> solver.solve(x) }\n res.forEach{x-> println(x)}\n}\n\nclass Solver {\n private val faces : List = listOf(2,3,4,5,6,7).reversed()\n\n fun solve(target: Int): Int {\n var currentTarget: Int = target\n var rollCount = 0\n while (currentTarget > 0) {\n val face = findNextFace(currentTarget)\n currentTarget -= face\n rollCount++\n }\n return rollCount\n }\n\n fun findNextFace(target : Int) : Int {\n val idx: Int = faces.size - 1\n var currentFace: Int = 0\n for (i: Int in 0..idx) {\n currentFace = faces[i]\n if (target >= currentFace) {\n return currentFace\n }\n }\n return currentFace\n }\n}\n\nclass Parser {\n private fun lineSequence(limit: Int = Int.MAX_VALUE) = generateSequence { readLine() }.constrainOnce().take(limit)\n private fun readln() = readLine()!!\n private fun readlnInt() = readln().toInt()\n\n fun parse(): List {\n val queryNumber: Int = readlnInt()\n return lineSequence(queryNumber).map { x -> x.toInt() }.toList()\n }\n}"}, {"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 = sc.nextInt()\n IntRange(1, t).forEach {\n val x = sc.nextInt()\n println(x / 2)\n }\n }\n}\n"}, {"source_code": "fun main() {\n var t = readLine()!!.toInt();\n while(t>0) {\n var x=readLine()!!.toInt();\n var ans=(x/7);\n var ans2=(x%7);\n if(ans2==0)\n println(ans);\n else\n println(ans+1);\n t--;\n }\n}"}, {"source_code": "fun main() {\n val t = readLine()!!.toInt()\n for (x in 0 until t) {\n val n=readLine()!!.toInt()\n println(n/2)\n }\n}"}, {"source_code": "//package com.happypeople.codeforces.c1093\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 (1..n).forEach {\n val i=sc.nextInt()\n val rolls=if(i==2) 1 else i/3\n println(\"$rolls\")\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}"}, {"source_code": "import java.util.Scanner\n\nobject programkt {\n @JvmStatic fun main(args:Array) {\n val sc = Scanner(System.`in`)\n val t = sc.nextInt()\n for (i in 0 until t)\n {\n val x = sc.nextInt()\n if (x <= 7)\n {\n println(1)\n }\n else\n {\n println(x / 2)\n }\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n for (i in 1..n) {\n val t1 = readLine()!!.toInt()\n println(getCount(t1))\n }\n}\n\nfun getCount(x: Int): Int {\n var c = 0\n var s = x\n if (x % 2 != 0) {\n s -= 3\n c++\n }\n c += s / 2\n return c\n}"}, {"source_code": "fun main() {\n repeat(readLine()!!.toInt()) {\n val n = readLine()!!.toInt();\n println(\"${n/2}\");\n }\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.File\nimport kotlin.system.measureTimeMillis\n\nfun solve(input: BufferedReader) {\n val t = input.readLine().toInt()\n for (i in 0 until t) {\n val n = input.readLine().toInt()\n println(n / 2)\n }\n}\n\n\nfun main(args: Array) {\n System.err.println(\"time = ${measureTimeMillis {\n solve(System.`in`.bufferedReader())\n// solve(File(\"a.out\").`bufferedReader())\n }}ms\")\n}\n"}, {"source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n\n val numQueries = readInt()\n val sol = IntArray(numQueries)\n for (query in 0 until numQueries) {\n val x = readInt()\n sol[query] = x / 7 + if (x % 7 == 0) 0 else 1\n }\n print(sol.joinToString(System.lineSeparator()))\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n BufferedReader(InputStreamReader(System.`in`)).use { reader ->\n val count = reader.readLine().toInt()\n reader.lineSequence()\n .take(count)\n .map {\n it.toInt() / 2\n }.joinToString(separator = \"\\n\") {\n it.toString()\n }\n .let(::println)\n }\n}"}, {"source_code": "/*\nfun main(args: Array) {\n val t = readLine()!!.toInt()\n repeat(t) {\n val x = readLine()!!.toInt()\n println((x + 6) / 7)\n }\n}\n*/\nfun main(args: Array){ \n var i = 1;\n var t: Int =Integer.valueOf(readLine())\n repeat(t)\n {\n var x: Int =Integer.valueOf(readLine())\n println((x-1)/7 + 1)\n }\n}"}, {"source_code": "fun main(args: Array) {\n val out = generateSequence(::readLine)\n .drop(1)\n .mapNotNull{it?.toInt()}\n .map{it / 7 + 1}\n .joinToString(\"\\n\")\n\n print(out)\n}"}, {"source_code": "fun calcurate(sum: Int): Int {\n val quotient = sum / 7\n val mod = sum % 7 // 7\u3067\u5272\u3063\u305f\u4f59\u308a\n return when {\n /*\n * 1\u306f\u51fa\u305b\u306a\u3044\u306e\u3067\u5272\u308b\u6570\u3092\u6e1b\u3089\u3059 -> quotient - 1\n * 8\u4f59\u308b\u306e\u30676\u3067\u5272\u308b -> +1\n * 2\u4f59\u308b -> +1\n * => quotient - 1 + 1 + 1\n */\n mod == 1 -> quotient + 1\n /*\n * 2\u301c6\u4f59\u308b -> +1\n */\n else -> quotient + 1\n }\n}\n\nfun dice(input: Sequence): String {\n return input.drop(1)\n .mapNotNull{it?.toInt()}\n .map(::calcurate)\n .joinToString(\"\\n\")\n}\n\nfun main(args: Array) {\n print(dice(generateSequence(::readLine)))\n}\n"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n for(i in 0 until n){\n val x = readLine()!!.toInt()\n println((x+6)/7)\n }\n}\n"}, {"source_code": "fun main() {\n val t = readLine()!!.toInt()\n repeat((1..t).count()) {\n val n = readLine()!!.toInt()\n println(n/7 + if(n.rem(7) == 0) 0 else 1 )\n }\n}"}, {"source_code": "import kotlin.math.sign\n\nclass DiceRolling {\n data class Problem(val id: Int, val target: Int)\n\n data class Solution(val count: Int) {\n override fun toString(): String {\n return \"$count\\n\"\n }\n }\n\n fun readProblem(problemId: Int): Problem {\n return Problem(problemId, readLine()!!.toInt())\n }\n\n fun solveProblem(problem: Problem): Solution {\n return Solution(problem.target / 7 + (problem.target % 7).sign)\n }\n}\n\nfun main() {\n val diceRolling = DiceRolling()\n val n = readLine()!!.toInt()\n (1..n).map(diceRolling::readProblem)\n .map(diceRolling::solveProblem)\n .onEach(::print)\n}"}, {"source_code": "import kotlin.math.sign\n\ndata class Problem(val id: Int, val target: Int)\n\ndata class Solution(val count: Int) {\n override fun toString(): String {\n return \"$count\\n\"\n }\n}\n\nfun readProblem(problemId: Int): Problem {\n return Problem(problemId, readLine()!!.trim().toInt())\n}\n\nfun solveProblem(problem: Problem): Solution {\n return Solution(problem.target / 7 + (problem.target % 7).sign)\n}\n\nfun main(args: Array) {\n var n = readLine()!!.toInt()\n (1..n).map(::readProblem)\n .map(::solveProblem)\n .onEach(::print)\n}\n"}, {"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 T = readInt()\n for (t in 0..T-1) {\n val n = readInt()\n println(n / 2)\n }\n}\n"}, {"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 T = readInt()\n val output = mutableListOf()\n for (t in 0..T-1) {\n val n = readInt()\n output += \"${n/2}\"\n }\n println(output.joinToString(\"\\n\"))\n}\n"}, {"source_code": "fun main(args: Array) {\n val t = readLine()!!.toInt()\n repeat(t) {\n val x = readLine()!!.toInt()\n println((x + 6) / 7)\n }\n}"}, {"source_code": "\nfun main(args: Array) {\n val count = readLine()!!.toInt()\n for (i in 0 until count) {\n val target = readLine()!!.toInt()\n val roll = Math.ceil(target / 7.0).toInt()\n println(roll)\n }\n}\n"}, {"source_code": "fun main() {\n readLine()?.toInt()?.let { \n repeat(it) {\n readLine()?.toInt()?.let {\n println(1 + it / 7)\n }\n }\n }\n}"}, {"source_code": "import kotlin.math.sign\n\nfun main() {\n repeat(readInt()) {\n val n = readInt()\n println(n / 7 + (n % 7).sign)\n }\n}\n\nfun readInt() = readLine()?.toInt() ?: 0"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n repeat (n) {\n val i = readLine()!!.toInt()\n println(1+i/7)\n }\n}"}, {"source_code": "object programkt {\n\n @JvmStatic\n fun main(args: Array) {\n val t = readLine()!!.toInt()\n\n for (i in 0 until t) {\n val x = readLine()!!.toInt()\n println(x / 2)\n }\n }\n\n}"}, {"source_code": "fun rollCount(score: Int, base: Int = 7): Int {\n if(score <= 7) {\n return 1\n }\n val ost = score % base\n val full = score / base\n return when(ost) {\n 0 -> full\n 1 -> (full-1) + rollCount(score - (full-1)*base, base-1)\n else -> full + 1\n }\n}\n\nfun main() {\n val count = readLine()!!.toInt()\n repeat(count) {\n val score = readLine()!!.toInt()\n println(rollCount(score))\n } \n}"}, {"source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n// var arr2 = readLine()!!.split(\" \").map { x -> x.toLong() }\n// var arr = readLine()!!.split(\" \").map { x -> x.toLong() }\n\n for (a in 0 until n) {\n var count = readLine()!!.toInt()\n if (count < 8) println (1)\n else println(count / 7 + 1)\n }\n\n}"}, {"source_code": "fun main() {\n val n = Integer.valueOf(readLine()!!)\n\n repeat(n) {\n val x = Integer.valueOf(readLine()!!)\n if(x % 7 == 0) {\n println(x / 7)\n } else if(x % 7 == 1){\n println(x / 7 + 2)\n } else {\n println(x / 7 + 1)\n }\n }\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n repeat(n) {\n val x = readLine()!!.toInt()\n val res = if (x > 7) {\n x/7 + 1\n } else 1\n println(res)\n }\n}"}, {"source_code": "fun x()=readLine()!!.toInt()\nfun main()=repeat(x()){println(x()/2)}"}, {"source_code": "fun main() {\n val n = readInt()\n for (j in 1..n) {\n val v = readInt()\n println(v / 2)\n }\n}\n\nfun readln() = readLine()!!\nfun readlnByte() = readln().toByte()\nfun readlnShort() = readln().toShort()\nfun readlnInt() = readln().toInt()\nfun readlnLong() = readln().toLong()\nfun readlnFloat() = readln().toFloat()\nfun readlnDouble() = readln().toDouble()\nfun readlnBigInt(radix: Int = 10) = readln().toBigInteger(radix)\nfun readlnBigDecimal() = readln().toBigDecimal()\n\nfun lineSequence(limit: Int = Int.MAX_VALUE) = generateSequence { readLine() }.constrainOnce().take(limit)\nfun readlnStrings() = readln().split(' ')\nfun readlnBytes() = readlnStrings().map { it.toByte() }\nfun readlnShorts() = readlnStrings().map { it.toShort() }\nfun readlnInts() = readlnStrings().map { it.toInt() }\nfun readlnLongs() = readlnStrings().map { it.toLong() }\nfun readlnFloats() = readlnStrings().map { it.toFloat() }\nfun readlnDoubles() = readlnStrings().map { it.toDouble() }\n\nfun readByteArray() = readlnStrings().run { ByteArray(size) { get(it).toByte() } }\nfun readShortArray() = readlnStrings().run { ShortArray(size) { get(it).toShort() } }\nfun readIntArray() = readlnStrings().run { IntArray(size) { get(it).toInt() } }\nfun readLongArray() = readlnStrings().run { LongArray(size) { get(it).toLong() } }\nfun readFloatArray() = readlnStrings().run { FloatArray(size) { get(it).toFloat() } }\nfun readDoubleArray() = readlnStrings().run { DoubleArray(size) { get(it).toDouble() } }\n\nfun readlnByteArray(n: Int) = ByteArray(n) { readlnByte() }\nfun readlnShortArray(n: Int) = ShortArray(n) { readlnShort() }\nfun readlnIntArray(n: Int) = IntArray(n) { readlnInt() }\nfun readlnLongArray(n: Int) = LongArray(n) { readlnLong() }\nfun readlnFloatArray(n: Int) = FloatArray(n) { readlnFloat() }\nfun readlnDoubleArray(n: Int) = DoubleArray(n) { readlnDouble() }\n\nfun readByteArray2d(rows: Int, cols: Int) = Array(rows) { readByteArray().also { require(it.size == cols) } }\nfun readShortArray2d(rows: Int, cols: Int) = Array(rows) { readShortArray().also { require(it.size == cols) } }\nfun readLongArray2d(rows: Int, cols: Int) = Array(rows) { readLongArray().also { require(it.size == cols) } }\nfun readIntArray2d(rows: Int, cols: Int) = Array(rows) { readIntArray().also { require(it.size == cols) } }\nfun readFloatArray2d(rows: Int, cols: Int) = Array(rows) { readFloatArray().also { require(it.size == cols) } }\nfun readDoubleArray2d(rows: Int, cols: Int) = Array(rows) { readDoubleArray().also { require(it.size == cols) } }\n\nfun isWhiteSpace(c: Char) = c in \" \\r\\n\\t\"\n\n// JVM-only targeting code follows next\n\n// readString() via sequence is still slightly faster than Scanner\nfun readString() = generateSequence { System.`in`.read().toChar() }\n .dropWhile { isWhiteSpace(it) }.takeWhile { !isWhiteSpace(it) }.joinToString(\"\")\n\nfun readByte() = readString().toByte()\nfun readShort() = readString().toShort()\nfun readInt() = readString().toInt()\nfun readLong() = readString().toLong()\nfun readFloat() = readString().toFloat()\nfun readDouble() = readString().toDouble()\nfun readBigInt(radix: Int = 10) = readString().toBigInteger(radix)\nfun readBigDecimal() = readString().toBigDecimal()\n\nfun readBytes(n: Int) = generateSequence { readByte() }.take(n)\nfun readShorts(n: Int) = generateSequence { readShort() }.take(n)\nfun readInts(n: Int) = generateSequence { readInt() }.take(n)\nfun readLongs(n: Int) = generateSequence { readLong() }.take(n)\nfun readFloats(n: Int) = generateSequence { readFloat() }.take(n)\nfun readDoubles(n: Int) = generateSequence { readDouble() }.take(n)\n\n"}, {"source_code": "import java.util.*\n \nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = readLine()!!.toInt()\n for(x in 0..n-1){\n \tval tmp = readLine()!!.toInt()\n \tif(tmp <= 6) println(\"1\")\n \telse{\n \t\tprintln(tmp/6+1)\n \t}\n }\n \n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\n\n internal var br = BufferedReader(InputStreamReader(System.`in`))\n internal var st: StringTokenizer? = null\n internal var out = PrintWriter(System.out)\n\n @Throws(IOException::class)\n private fun solve() {\n val t = nextInt()\n for (i in 0 until t) {\n val x = nextInt()\n out.println(x / 2)\n }\n }\n\n internal fun next(): String {\n while (st == null || !st!!.hasMoreTokens()) {\n st = StringTokenizer(br.readLine())\n }\n return st!!.nextToken()\n }\n\n @Throws(IOException::class)\n internal fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n @Throws(IOException::class)\n internal fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n @Throws(IOException::class)\n private fun run() {\n solve()\n out.close()\n }\n\n\n fun main(args: Array) {\n run()\n }\n\n\n"}, {"source_code": "fun main(arg: Array){\n\tvar n = readLine()!!.toInt()\n\twhile (n > 0){\n\t\tval x = readLine()!!.toInt()\n\t\tval y = if(x.rem(7)==0) x/7 else x/7+1\n\t\tprintln(y)\n\t\tn = n - 1\n\t}\n}"}, {"source_code": "fun main()\n{ \n\tvar s= arrayOf(2,3,4,5,6,7)\n\tvar t=readLine()!!.toInt()\n\trepeat(t)\n\t{ var c: Int=0\n\t\tvar p: Int=readLine()!!.toInt()\n\t\twhile (p>0)\n\t\t\t{\n\t\t if(p>7)\n\t\t\t\t { p=p-s.random()\n\t\t\t\t\t c++\n\t\t\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t { c++\n\t\t\t\t\t p=0\n\t\t\t\t\t\t\t}\n\t }\n\t\tprintln(c)\n\t}\n}"}, {"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 T = readInt()\n while(T>0) {\n var x = readInt()\n println(\"%d\".format(x/2))\n T--\n }\n\n}"}, {"source_code": "fun main(){\n fun x()=readLine()!!.toInt()\n for(i in 1..x())println(x()/2)\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n//https://www.javatpoint.com/kotlin-smart-cast\nfun main() {\n val read=Scanner(System.`in`);\n var test=read.nextInt();\n while((test--)>0){\n var x=read.nextInt();\n var cnt=0;\n if(x%2==1){\n x-=3;\n cnt+=1;\n }\n cnt+=x/2;\n println(cnt);\n }\n}\n"}, {"source_code": "fun main(args: Array)\n{\nval t=readLine()!!.toInt()\nrepeat(t)\n{\nval n=readLine()!!.toInt()\n\nprintln(n/2);\n\n}\n}"}, {"source_code": "fun main(args: Array)\n{\nval t= readLine()!!.toInt()\nrepeat(t)\n{\nval x= readLine()!!.toInt()\nprintln(x/2)\n}\n\n}"}, {"source_code": "fun main(args : Array) {\n val numberOfQueries = readLine()!!.toInt()\n \n for (i in 1..numberOfQueries) {\n println(readLine()!!.toInt() / 2)\n }\n}\n"}, {"source_code": "fun main(args: Array) {\n val t = readLine()!!.toInt()\n repeat(t) {\n val x = readLine()!!.toInt()\n if (x % 2 == 0){\n println(x / 2)\n }else{\n var a = x - 3\n println(a / 2 + 1)\n }\n }\n}"}, {"source_code": "fun main(args : Array) {\n val numberOfQueries = readLine()!!.toInt()\n \n for (i in 1..numberOfQueries) {\n println(readLine()!!.toInt() / 2)\n }\n}\n"}, {"source_code": "fun main() {\n for (i in 1..readLine()!!.toInt()) {\n println(readLine()!!.toInt() / 2)\n }\n}\n"}, {"source_code": "fun main(args : Array) {\n val numberOfQueries = readLine()!!.toInt()\n\n for (i in 1..numberOfQueries) {\n val points = readLine()!!.toInt()\n\n if (points % 2 == 0) {\n println(points / 2)\n } else {\n println((points - 3) / 2 + 1)\n }\n }\n}\n"}, {"source_code": "import java.io.File\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/inpsut.txt\")\n\nfun getLine() = reader.line\nfun readInt() = getLine().toInt()\nfun readInts() = getLine().split(\" \").map { it.toInt() }\n\nfun main() {\n val n = readInt()\n repeat(n) { i ->\n var num = readInt()\n var ans = 0\n if (num % 2 == 1) {\n ans = 1\n num -= 3\n }\n println(num / 2 + ans)\n }\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n for (i in 0 until n) {\n val t = readLine()!!.toInt()\n if (t <= 7) {\n println(1)\n continue\n }\n val s = t / 7\n val rem = t % 7\n if (rem == 0) {\n println(s)\n } else {\n println(s + 1)\n }\n }\n}"}, {"source_code": "fun main() {\n for (i in 1..readLine()!!.toInt()) {\n val r: Int = readLine()!!.toInt() / 2\n println(r)\n }\n}"}, {"source_code": "fun main() {\n val numberOfQueries = readLine()!!.toInt()\n val output = mutableListOf()\n\n repeat(numberOfQueries) {\n val target = readLine()!!.toInt()\n\n val result = when {\n target < 8 -> 1\n target % 7 == 0 -> target / 7\n else -> ((target - (target % 7)) / 7) + 1\n }\n\n output.add(result)\n }\n\n output.forEach { x -> println(x) }\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n for (i in 0 until n) {\n val x = readLine()!!.toInt()\n println(x/2)\n }\n}"}, {"source_code": "fun readInt(separator: Char = ' ') = readLine()!!.toInt()\nfun main() {\n val n = readInt()\n for(i in 0 until n){\n val x = readInt()/2\n println(\"$x\")\n }\n}"}, {"source_code": "fun main() {\n var n = readLine()!!.toInt()\n while (n > 0) {\n val t = readLine()!!.toInt()\n println(t / 2)\n n -= 1\n }\n}"}, {"source_code": "import java.io.*\nimport java.util.*\n\nobject programkt {\n @JvmStatic\n fun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val `in` = InputReader(inputStream)\n val out = OutputWriter(outputStream)\n val solver = Problem()\n solver.solve(`in`, out)\n out.close()\n }\n\n internal class Problem {\n fun solve(`in`: InputReader, out: OutputWriter) {\n val t = `in`.readInt()\n val x = IntArray(t)\n for (i in 0 until t) x[i] = `in`.readInt()\n for (i in 0 until t) out.printLine(x[i] / 2)\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: 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 var sgn = 1\n if (c == '-'.toInt()) {\n sgn = -1\n c = read()\n }\n var res: Long = 0\n do {\n if (c < '0'.toInt() || c > '9'.toInt())\n throw InputMismatchException()\n res *= 10\n res += (c - '0'.toInt()).toLong()\n c = read()\n } while (!isSpaceChar(c))\n return res * 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\n internal class 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}\n\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n var rows = input.nextInt()\n var row = 0\n do {\n row = input.nextInt()\n if (row < 8) {\n println(1)\n } else {\n println(row / 2)\n }\n --rows\n } while(rows > 0)\n}"}, {"source_code": "fun main() {\n for (i in 1..r())\n println(r() / 2)\n}\n\ninline fun r() = readLine()!!.toInt()"}, {"source_code": "import java.util.*\nimport java.io.*\nfun main(args:Array) {\n\tval sc = Scanner(System.`in`)\n\t// PrintWriter out=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n\tvar x = sc.nextInt();\n\twhile (x-- > 0)\n\t{\n\t\tval t = sc.nextInt();\n\t\tval ans:Int\n\t\tif (t % 2 == 0)\n\t\t ans = t / 2\n\t\telse\n\t\t ans = (t - 3) / 2 + 1\n\t\tprintln(ans)\n\t\t// x -= 1;\n\t // out.write(ans);\n\t}\n// out.close();\n}\n"}], "negative_code": [{"source_code": "fun main() {\n val tests = readLine()!!.toInt();\n repeat(tests) {\n val points = readLine()!!.toInt()\n print((points / 7) + 1)\n }\n}"}, {"source_code": "import java.util.*\n\nfun main(){\n val scanner = Scanner(System.`in`)\n var queries = scanner.nextInt()\n var queryList = arrayListOf()\n\n if(queries<=100) {\n while (queries > 0) {\n val contest = scanner.nextInt()\n if(contest in 2..100)\n {queryList.add(contest)}\n queries--\n }\n }\n for(elem in queryList){\n rollDice(elem)\n }\n}\n\nval diceEyes = listOf(2,3,4,5,6,7)\n\nval evenEyes = listOf(2,4,6)\n\nfun rollDice(number: Int): List{\n val rolls = mutableListOf()\n var sum = 0\n var i = 0\n if(number % 2 == 0){\n i = evenEyes.size-1\n }else{\n i = diceEyes.size-1\n }\n while(sum != number && i >= 0){\n var tempSum = sum\n if(number % 2 == 0){\n tempSum+=evenEyes[i]\n }else{\n tempSum += diceEyes[i]\n }\n\n if(tempSum <= number){\n sum = tempSum\n rolls.add(diceEyes[i])\n }else{\n i--\n }\n }\n println(\"${rolls.size}\")\n return rolls\n}\n"}, {"source_code": "import kotlin.random.Random\n\nfun main(args: Array) {\n args.slice(1 until args.size).forEach{\n var number = it.toInt()\n var counter = 0\n while( number > 7 ){\n number -= Random.nextInt(2, 7)\n counter++\n }\n println(counter)\n }\n}"}, {"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 T = readInt()\n for (t in 0..T-1) {\n val n = readInt()\n println((n + 1) / 2)\n }\n}\n"}, {"source_code": "fun main() {\n var t = Integer.parseInt(readLine())\n\n while(t > 0) {\n var res = solve(Integer.parseInt(readLine()))\n println(res)\n t--\n }\n\n}\n\nfun solve(n:Int):Int {\n var res = 0\n var m = n\n for(i in 7 downTo 2) {\n res += m/i\n m %= i\n }\n return res\n}\n"}, {"source_code": "fun main(){\n val roundCount = readLine()!!\n val length = roundCount.length\n if (length == 1){\n if (roundCount.toInt() == 2 || roundCount.toInt() == 3)\n println(\"1\")\n else\n println(\"2\")\n\n return\n }\n println(roundCount.substring(0, roundCount.length-1).toInt() * 2)\n\n}"}, {"source_code": "fun main() {\n val parsed: List = Parser().parse()\n val solver = Solver()\n val res = parsed.map { x -> solver.solve(x) }\n res.forEach{x-> println(x)}\n}\n\nclass Solver {\n private val faces : List = listOf(2,3,4,5,6,7)\n\n fun solve(target : Int) : Int {\n var idx: Int = faces.size - 1\n var rollCount = 1\n var currentTarget: Int = target\n for (i: Int in 0..idx) {\n val currentFace: Int = faces[idx]\n if (currentTarget < currentFace) {\n continue\n }\n currentTarget -= currentFace\n rollCount++\n }\n return rollCount\n }\n}\n\nclass Parser {\n private fun lineSequence(limit: Int = Int.MAX_VALUE) = generateSequence { readLine() }.constrainOnce().take(limit)\n private fun readln() = readLine()!!\n private fun readlnInt() = readln().toInt()\n\n fun parse(): List {\n val queryNumber: Int = readlnInt()\n return lineSequence(queryNumber).map { x -> x.toInt() }.toList()\n }\n}"}, {"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 T = readInt()\n while(T>0) {\n var x = readInt()\n println(\"%d\".format(x/2+x%2))\n T--\n }\n\n}"}, {"source_code": "import java.util.*\n \nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = readLine()!!.toInt()\n for(x in 0..n-1){\n \tval tmp = readLine()!!.toInt()\n \tif(tmp <= 6) println(\"1\")\n \telse{\n \t\tprintln(tmp/6+tmp%6)\n \t}\n }\n \n}"}, {"source_code": "import java.util.*\n\nfun main() {\n val sc = Scanner(System.`in`)\n val t = sc.nextInt()\n repeat(t) {\n val x = sc.nextInt()\n println((x-1)/2+1)\n }// \n}"}, {"source_code": "fun main(args: Array) = args.forEach { println(it) }"}, {"source_code": "\n\n\nfun calculate(target: Int): Int {\n var nums = listOf(7, 6, 5, 4, 3, 2)\n var currentTarget = target\n var throws = 0\n while (nums.isNotEmpty()) {\n while (currentTarget >= nums.first()) {\n currentTarget -= nums.first()\n throws++\n }\n nums = nums.drop(1)\n }\n return throws\n}\n\n\nfun main(args: Array) {\n repeat(readLine()!!.toInt()) {\n println(calculate(readLine()!!.toInt()))\n }\n}\n"}, {"source_code": "import java.util.*\n\nfun main(){\n val scanner = Scanner(System.`in`)\n var queries = scanner.nextInt()\n if(queries<=100) {\n while (queries > 0) {\n val contest = scanner.nextInt()\n if(contest in 2..100)\n {rollDice(contest)}\n queries--\n }\n }\n}\n\nval diceEyes = listOf(2,3,4,5,6,7)\n\nfun rollDice(number: Int): List{\n val rolls = mutableListOf()\n var sum = 0\n var i = diceEyes.size-1\n while(sum != number && i >= 0){\n var tempSum = sum\n tempSum += diceEyes[i]\n if(tempSum <= number){\n sum = tempSum\n rolls.add(diceEyes[i])\n }else{\n i--\n }\n }\n println(\"${rolls.size}\")\n return rolls\n}\n"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n for (i in 0 until n) {\n val x = readLine()!!.toInt()\n val t = x / 2\n if (t*2 == x) {\n println(t)\n } else {\n println(t+1)\n }\n }\n}"}, {"source_code": "import java.util.*\n\nfun main(){\n val scanner = Scanner(System.`in`)\n var queries = scanner.nextInt()\n while (queries >0){\n rollDice(scanner.nextInt())\n queries--\n }\n}\n\nval diceEyes = listOf(2,3,4,5,6,7)\n\nfun rollDice(number: Int): List{\n val rolls = mutableListOf()\n var sum = 0\n var i = diceEyes.size-1\n while(sum != number && i >= 0){\n var tempSum = sum\n tempSum += diceEyes[i]\n if(tempSum <= number){\n sum = tempSum\n rolls.add(diceEyes[i])\n }else{\n i--\n }\n }\n println(\"${rolls.size}\")\n return rolls\n}\n"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n repeat (n) {\n readLine()!!.toInt()\n println(n)\n }\n}"}, {"source_code": "fun main()\n{\n val t = readLine()!!.toInt()\n for (i in 1 .. t)\n {\n println(treatTestCase())\n }\n}\n\nfun treatTestCase(): String\n{\n val x = readLine()!!.toInt()\n\n // if even, return divided by 2\n // else if its 3 return 1\n // else remove three then return divided by 2 + 1\n\n return when\n {\n x % 2 == 0 ->\n {\n println(\"Roll 2 ${x / 2} times\")\n (x / 2).toString()\n }\n x == 3 ->\n {\n println(\"Roll 3 once\")\n (1).toString()\n }\n else ->\n {\n println(\"Roll 3 once and 2 ${(x - 3) / 2} times\")\n ((x - 3) / 2 + 1).toString()\n }\n }\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n BufferedReader(InputStreamReader(System.`in`)).lineSequence().drop(1).map {\n it.toInt() / 2\n }.joinToString {\n it.toString()\n }.let(::println)\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val t = nextInt()\n val x = nextInt()\n println(x)\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n repeat (n) {\n readLine()!!.toInt()\n println(n)\n }\n}"}, {"source_code": "fun main(){\n val roundCount = readLine()!!\n val length = roundCount.length\n if (length == 1){\n if (roundCount.toInt() == 2 || roundCount.toInt() == 3)\n println(\"1\")\n else\n println(\"2\")\n\n return\n }\n println(roundCount.substring(0, roundCount.length-1).toInt() * 2)\n\n}"}, {"source_code": "fun main(args: Array) {\n val numOfLines = readLine()!!.toInt()\n\n (0 until numOfLines)\n .map { readLine()!!.toInt() }\n .forEach {query ->\n val answer = query % 7 + 1\n println(answer)\n }\n\n}\n"}, {"source_code": "fun main(args : Array){\n if (args.isNotEmpty()) {\n for (i in 1..args[0].toInt()) {\n println(args[i].toInt() / 7)\n }\n }\n}"}, {"source_code": "fun main()\n{\n var n = readLine()!!.toInt()\n \n for (i in 1..n)\n {\n var x = readLine()!!.toInt()\n \n var j = 0\n \n while (x >= 6)\n {\n j++\n x -= 6\n }\n \n \n \n } \n}\n"}, {"source_code": "fun main() {\n var t = Integer.parseInt(readLine())\n\n while(t > 0) {\n var res = solve(Integer.parseInt(readLine()))\n println(res)\n t--\n }\n\n}\n\nfun solve(n:Int):Int {\n var res = 0\n var m = n\n for(i in 7 downTo 2) {\n res += m/i\n m %= i\n }\n return res\n}\n"}, {"source_code": "fun main(args: Array) {\n val numOfLines = readLine()!!.toInt()\n\n (0 until numOfLines)\n .map { readLine()!!.toInt() }\n .forEach {query ->\n val answer = query % 7 + 1\n println(answer)\n }\n\n}\n"}, {"source_code": "fun main() {\n\n val queries = readLine()!!.toInt()\n\n for (i in 0 until queries) {\n val points = readLine()!!.toInt()\n\n val maxRolls = Math.ceil(points / 2.0)\n\n println(maxRolls.toInt())\n }\n\n}"}, {"source_code": "val sides = arrayOf(2, 3, 4, 5, 6, 7)\nval output = mutableListOf()\n\nfun main() {\n\n val requestCounts = readInt()\n for (i in 0 until requestCounts) {\n val number: Int = readInt()\n calculateAttemptCounts(number)\n }\n\n for (out in output) {\n println(out)\n }\n}\n\nfun readInt(): Int {\n return readLine()!!.toInt()\n}\n\nfun calculateAttemptCounts(number: Int) {\n var tempNumber = number\n var attemptCounts = 0\n for (side in sides.reversedArray()) {\n val tempCount: Int = tempNumber / side\n\n if (tempCount == 0) continue\n\n attemptCounts += tempCount\n\n if (tempNumber % side == 0) {\n output.add(attemptCounts)\n break\n }\n\n tempNumber %= side\n }\n}"}, {"source_code": "fun main() {\n val MIN_VAL = 2\n val MAX_VAL = 7\n val N = readLine()!!.toInt()\n val scores: MutableList = ArrayList()\n for (i in 0 until N) {\n scores.add(readLine()!!.toInt())\n }\n val answer: MutableList = ArrayList()\n\n scores.forEach {\n var currentScore = MAX_VAL\n var currentAmountScore = it\n var amountSteps = 0\n\n while (currentAmountScore >= 0 && currentScore >= MIN_VAL) {\n while (currentScore <= currentAmountScore) {\n currentAmountScore -= currentScore\n amountSteps++\n }\n currentScore--\n }\n answer.add(amountSteps)\n }\n answer.forEach(::println)\n}\n"}, {"source_code": "fun getInputs(): List {\n val count = readLine()!!\n return List(count.toInt()) { readLine()!!.toInt() }\n}\n\n\nfun calculate(target: Int): Int {\n var nums = listOf(7, 6, 5, 4, 3, 2)\n var currentTarget = target\n var throws = 0\n while (nums.isNotEmpty()) {\n while (currentTarget >= nums.first()) {\n currentTarget -= nums.first()\n throws++\n }\n nums = nums.drop(1)\n }\n return throws\n}\n\n\nfun main(args: Array) {\n val queries = getInputs()\n queries.forEach { println(calculate(it)) }\n}\n"}, {"source_code": "import java.util.Scanner\nfun main(args:Array) {\n val read = Scanner(System.`in`)\n val n:Int = read.nextInt()\n val ans = n/2 + n%2\n println(\"$ans\")\n\n}"}, {"source_code": "fun main() {\n val solver = Solver()\n val res = solver.solve(100)\n println(res)\n}\n\nclass Solver {\n private val faces : List = listOf(2,3,4,5,6,7)\n\n fun solve(target : Int) : Int {\n var idx: Int = faces.size - 1\n var rollCount = 1\n var currentTarget: Int = target\n for (i: Int in 0..idx) {\n val currentFace: Int = faces[idx]\n if (currentTarget < currentFace) {\n continue\n }\n currentTarget -= currentFace\n rollCount++\n }\n return rollCount\n }\n}\n\nclass Parser {\n private fun lineSequence(limit: Int = Int.MAX_VALUE) = generateSequence { readLine() }.constrainOnce().take(limit)\n private fun readln() = readLine()!!\n private fun readlnInt() = readln().toInt()\n\n fun parse(): List {\n val queryNumber: Int = readlnInt()\n return lineSequence(queryNumber).map { x -> x.toInt() }.toList()\n }\n}"}, {"source_code": "fun main(args: Array) {\n val countLine = readLine()\n println(countLine)\n}"}, {"source_code": "fun main(){\n val points = readLine()!!.toInt()\n print((points/7)+1)\n}"}, {"source_code": "fun main(){\n val roundCount = readLine()?.toIntOrNull()\n roundCount?.let {count->\n val arrayOfPoints = Array(3){\n readLine()?.toIntOrNull()\n }\n arrayOfPoints.forEach {\n it?.let {\n println(it/2)\n }\n }\n }\n}"}, {"source_code": "import java.util.*\n\nfun main(){\n val scanner = Scanner(System.`in`)\n var queries = scanner.nextInt()\n if(queries<=100) {\n while (queries > 0) {\n rollDice(scanner.nextInt())\n queries--\n }\n }\n}\n\nval diceEyes = listOf(2,3,4,5,6,7)\n\nfun rollDice(number: Int): List{\n val rolls = mutableListOf()\n var sum = 0\n var i = diceEyes.size-1\n while(sum != number && i >= 0){\n var tempSum = sum\n tempSum += diceEyes[i]\n if(tempSum <= number){\n sum = tempSum\n rolls.add(diceEyes[i])\n }else{\n i--\n }\n }\n println(\"${rolls.size}\")\n return rolls\n}\n"}, {"source_code": "fun getInputs(): List {\n val count = readLine()!!\n return List(count.toInt()) { readLine()!!.toInt() }\n}\n\n\nfun calculate(target: Int): Int {\n var nums = listOf(7, 6, 5, 4, 3, 2)\n var currentTarget = target\n var throws = 0\n while (nums.isNotEmpty()) {\n while (currentTarget >= nums.first()) {\n currentTarget -= nums.first()\n throws++\n }\n nums = nums.drop(1)\n }\n return throws\n}\n\n\nfun main(args: Array) {\n val queries = getInputs()\n queries.forEach { println(calculate(it)) }\n}\n"}, {"source_code": "import java.util.Scanner\nobject programkt {\n @JvmStatic fun main(args:Array) {\n val sc = Scanner(System.`in`)\n val tc = sc.nextInt()\n for (i in 1..tc)\n {\n val n = sc.nextInt()\n println(n)\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n for (i in 1..n) {\n val x = readLine()!!.toInt()\n when {\n x < 8 -> print(1)\n x % 2 == 0 -> print(x / 2)\n else -> print((x - 3) / 2 + 1)\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n args.slice(1 until args.size).forEach{\n var number = it.toInt()\n var counter = 0\n while( number > 0 ){\n number -= 7\n counter++\n }\n println(counter)\n }\n}"}, {"source_code": "import com.sun.org.apache.xpath.internal.operations.Bool\n\nfun main(args: Array) {\n val scanner = java.util.Scanner(System.`in`)\n var inputCount = scanner.nextLine()\n val count = inputCount.toInt()\n var inputList = ArrayList(count)\n\n val minBoneValue = 2\n val maxBoneValue = 7\n val minValue = 1\n\n for (x in minValue..count) {\n var value = scanner.nextLine()\n inputList.add(value.toInt())\n }\n\n for (x in inputList) {\n if(x >= minBoneValue && x <= maxBoneValue){\n println(minValue)\n }\n else {\n var throwsCount = (x/maxBoneValue)\n val remainder = x%maxBoneValue\n if(remainder != minValue)\n throwsCount++\n println(throwsCount)\n }\n }\n}\n\n\n"}, {"source_code": "fun main(args : Array) {\n if (args.isNotEmpty()) {\n Array(args[0].toInt()) { i ->(args[i+1].toInt()/7)+1 }.forEach(::println)\n }\n}"}, {"source_code": "fun main() {\n diceRolling()\n}\n\nval mins = mapOf(\n 2 to 1,\n 3 to 1,\n 4 to 1,\n 5 to 1,\n 6 to 1,\n 7 to 1,\n 8 to 2,\n 9 to 2,\n 10 to 2,\n 11 to 2,\n 12 to 2,\n 13 to 2,\n 14 to 2,\n 15 to 3,\n 16 to 3,\n 17 to 3,\n 18 to 3,\n 19 to 3,\n 20 to 3,\n 21 to 3,\n 22 to 4,\n 23 to 4,\n 24 to 4,\n 25 to 4,\n 26 to 4,\n 27 to 4,\n 28 to 4,\n 29 to 5,\n 30 to 5,\n 31 to 5,\n 32 to 5,\n 33 to 5,\n 34 to 5,\n 35 to 5,\n 36 to 6,\n 37 to 6,\n 38 to 6,\n 39 to 6,\n 40 to 6,\n 41 to 6,\n 42 to 6,\n 43 to 7,\n 44 to 7,\n 45 to 7,\n 46 to 7,\n 47 to 7,\n 48 to 7,\n 49 to 7,\n 50 to 8,\n 51 to 8,\n 52 to 8,\n 53 to 8,\n 54 to 8,\n 55 to 8,\n 56 to 8,\n 57 to 9,\n 58 to 9,\n 59 to 9,\n 60 to 9,\n 61 to 9,\n 62 to 9,\n 63 to 9,\n 64 to 10,\n 65 to 10,\n 66 to 10,\n 67 to 10,\n 68 to 10,\n 69 to 10,\n 70 to 10,\n 71 to 11,\n 72 to 11,\n 73 to 11,\n 74 to 11,\n 75 to 11,\n 76 to 11,\n 77 to 11,\n 78 to 12,\n 79 to 12,\n 80 to 12,\n 81 to 12,\n 82 to 12,\n 83 to 12,\n 84 to 12,\n 85 to 13,\n 86 to 13,\n 87 to 13,\n 88 to 13,\n 89 to 13,\n 90 to 13,\n 91 to 13,\n 92 to 14,\n 93 to 14,\n 94 to 14,\n 95 to 14,\n 96 to 14,\n 97 to 14,\n 98 to 14,\n 99 to 15,\n 100 to 15\n)\n\nfun diceRolling() {\n// val units = listOf(7, 6, 5, 4, 3, 2)\n val inputCount = readLine()!!.toInt()\n \n for (i in 0 until inputCount) {\n println(mins[i])\n }\n\n// (2..100).forEach {\n// println(\"$it to ${compute(it, units)}\")\n// }\n}\n\n//fun compute(target: Int, units: List): Int {\n// if (target in units) return 1\n// if (target == units.max()!! + 1) return 2\n// return 1 + compute(target - units.max()!!, units)\n//}\n"}, {"source_code": "val scan = java.util.Scanner(System.`in`)\nfun main(args: Array) {\n var t = scan.nextInt()\n repeat(t) {\n var n = scan.nextInt()\n var f = IntArray(n + 7, {0})\n f[0] = 0\n f[1] = 1\n for (i in 2..6) {\n f[i] = 1\n }\n for (i in 7..n) {\n f[i] = Math.min(Math.min(Math.min(f[i - 2], f[i - 3]), Math.min(f[i - 4], f[i - 5])), f[i - 6]) + 1\n }\n print(f[n])\n }\n}"}, {"source_code": "fun main() {\n println(numRolls(2))\n println(numRolls(13))\n println(numRolls(37))\n println(numRolls(100))\n}\n\nprivate fun numRolls(points: Int): Int {\n var numRolls = 0\n var remainingPoints = points\n for (i in 2..7) {\n var rolls = remainingPoints / i\n while (rolls > 0) {\n numRolls += rolls\n remainingPoints %= i\n rolls = remainingPoints / i\n }\n }\n return numRolls\n}"}, {"source_code": "fun main(args : Array){\n if (args.isNotEmpty()) {\n for (i in 1..args[0].toInt()) {\n println(args[i].toInt() / 7)\n }\n }\n}"}, {"source_code": "fun main() {\n val t = readInt()\n for (i in 1..t) {\n val summ = readLine()!!.toInt()\n recCal(summ)\n }\n }\n\nfun recCal(value: Int): Int {\n return when {\n value in 2..7 -> 1\n value == 8 -> 2\n else -> 1 + recCal(value - 7)\n \n }\n}\nfun check(value: Int, m: Int) = (value / m) * m + (value % m)\nfun readInt() = readLine()!!.toInt()"}, {"source_code": "fun main() {\n val tests = readLine()!!.toInt();\n repeat(tests) {\n val points = readLine()!!.toInt()\n print((points / 7) + 1)\n }\n}"}, {"source_code": "fun main(args: Array) {\n args.slice(1 until args.size).forEach{\n var number = it.toInt()\n var counter = 0\n while( number > 0 ){\n number -= 7\n counter++\n }\n println(counter)\n }\n}"}, {"source_code": "val sides = arrayOf(2, 3, 4, 5, 6, 7)\nval output = mutableListOf()\n\nfun main() {\n\n val requestCounts = readInt()\n for (i in 0 until requestCounts) {\n val number: Int = readInt()\n calculateAttemptCounts(number)\n }\n\n for (out in output) {\n println(out)\n }\n}\n\nfun readInt(): Int {\n return readLine()!!.toInt()\n}\n\nfun calculateAttemptCounts(number: Int) {\n var tempNumber = number\n var attemptCounts = 0\n for (side in sides.reversedArray()) {\n val tempCount: Int = tempNumber / side\n\n if (tempCount == 0) continue\n\n attemptCounts += tempCount\n\n if (tempNumber % side == 0) {\n output.add(attemptCounts)\n break\n }\n\n tempNumber %= side\n }\n}"}, {"source_code": "val sides = arrayOf(2, 3, 4, 5, 6, 7)\nval output = mutableListOf()\n\nfun main() {\n\n val requestCounts = readInt()\n for (i in 0 until requestCounts) {\n val number: Int = readInt()\n calculateAttemptCounts(number)\n }\n\n output.forEachIndexed { index, i ->\n if (index == output.lastIndex) print(i)\n else println(i)\n }\n}\n\nfun readInt(): Int {\n return readLine()!!.toInt()\n}\n\nfun calculateAttemptCounts(number: Int) {\n var tempNumber = number\n var attemptCounts = 0\n for (side in sides.reversedArray()) {\n val tempCount: Int = tempNumber / side\n\n if (tempCount == 0) continue\n\n attemptCounts += tempCount\n\n if (tempNumber % side == 0) {\n output.add(attemptCounts)\n break\n }\n\n tempNumber %= side\n }\n}"}, {"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 T = readInt()\n while(T>0) {\n var x = readInt()\n println(\"%d\".format(x))\n T--\n }\n\n}"}, {"source_code": "import java.util.Scanner\nfun main(args:Array) {\n val read = Scanner(System.`in`)\n val t:Int = read.nextInt()\n for (i in 1..t)\n {\n val n:Int = read.nextInt()\n val ans = n/2 + n%2\n println(\"$ans\")\n }\n\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n val reader = Scanner(System.`in`)\n val queries = reader.nextInt()\n println(queries)\n val output = IntArray(queries)\n for (i in 0 until queries) {\n val point = reader.nextInt()\n output[i] = getCount(point)\n }\n output.forEach {\n println(it)\n }\n}\n\nfun getCount(point: Int): Int {\n return if (point in 2..7) {\n 1\n } else {\n val rem = point % 7\n if (rem == 0) {\n point / 7\n } else {\n (point / 7) + 1\n }\n }\n}"}, {"source_code": "fun main(){\n val roundCount = readLine()?.toIntOrNull()\n roundCount?.let {count->\n val arrayOfPoints = Array(3){\n readLine()?.toIntOrNull()\n }\n arrayOfPoints.forEach {\n it?.let {\n println(it/2)\n }\n }\n }\n}"}, {"source_code": "fun main(args : Array){\n if (args.isNotEmpty()) {\n Array(args[0].toInt()) { i ->(args[i+1].toInt()/7)+1 }.forEach(::print)\n }\n}"}, {"source_code": "import java.util.*\n \nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = readLine()!!.toInt()\n for(x in 0..n-1){\n \tval tmp = readLine()!!.toInt()\n \tprintln(tmp)\n }\n \n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n repeat (n) {\n readLine()!!.toInt()\n println(n)\n }\n}"}, {"source_code": "fun main(){\n val points = readLine()!!.toInt()\n println((points/7)+1)\n}"}, {"source_code": "fun main() {\n val MIN_VAL = 2\n val MAX_VAL = 7\n val N = readLine()!!.toInt()\n val scores: MutableList = ArrayList()\n for (i in 0 until N) {\n scores.add(readLine()!!.toInt())\n }\n val answer: MutableList = ArrayList()\n\n scores.forEach {\n var currentScore = MAX_VAL\n var currentAmountScore = it\n var amountSteps = 0\n\n while (currentAmountScore >= 0 && currentScore >= MIN_VAL) {\n while (currentScore <= currentAmountScore) {\n currentAmountScore -= currentScore\n amountSteps++\n }\n currentScore--\n }\n answer.add(amountSteps)\n }\n answer.forEach(::println)\n}\n"}, {"source_code": "import java.io.*\nimport java.math.*\nimport java.text.*\nimport java.util.*\nimport java.util.regex.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val t = scan.nextInt()\n for (i in 1..t) {\n val num = scan.nextInt()\n if( num%2==0)\n print(\"1\\n\")\n else\n print(\"2\\n\")\n }\n}"}, {"source_code": "fun main()\n{\n val t = readLine()!!.toInt()\n for (i in 1 .. t)\n {\n println(treatTestCase())\n }\n}\n\nfun treatTestCase(): String\n{\n val x = readLine()!!.toInt()\n\n // if even, return divided by 2\n // else if its 3 return 1\n // else remove three then return divided by 2 + 1\n\n return when\n {\n x % 2 == 0 ->\n {\n println(\"Roll 2 ${x / 2} times\")\n (x / 2).toString()\n }\n x == 3 ->\n {\n println(\"Roll 3 once\")\n (1).toString()\n }\n else ->\n {\n println(\"Roll 3 once and 2 ${(x - 3) / 2} times\")\n ((x - 3) / 2 + 1).toString()\n }\n }\n}"}, {"source_code": "fun main() {\n readLine()?.toInt()?.let { numCases ->\n for (case in 0 until numCases) {\n readLine()?.toInt()?.let { println(numRolls(it)) }\n }\n }\n}\n\nprivate fun numRolls(points: Int): Int {\n var numRolls = 0\n var remainingPoints = points\n for (i in 7 downTo 2) {\n var rolls = remainingPoints / i\n while (rolls > 0) {\n numRolls += rolls\n remainingPoints %= i\n rolls = remainingPoints / i\n }\n }\n return numRolls\n}"}, {"source_code": "fun main()\n{\n val t = readLine()!!.toInt()\n for (i in 1 .. t)\n {\n println(treatTestCase())\n }\n}\n\nfun treatTestCase(): String\n{\n val x = readLine()!!.trim().toInt()\n\n // if even, return divided by 2\n // else if its 3 return 1\n // else remove three then return divided by 2 + 1\n\n return when\n {\n x % 2 == 0 ->\n {\n println(\"Roll 2 ${x / 2} times\")\n (x / 2).toString()\n }\n x == 3 ->\n {\n println(\"Roll 3 once\")\n (1).toString()\n }\n else ->\n {\n println(\"Roll 3 once and 2 ${(x - 3) / 2} times\")\n ((x - 3) / 2 + 1).toString()\n }\n }\n}"}, {"source_code": "private fun main() {\n\n val t = readInt()\n val mas = mutableListOf()\n (0 until t).forEach {\n mas += readInt()\n }\n\n mas.forEach { num ->\n if (num == 2) {\n println(1)\n\n } else if (num % 2 == 0) {\n println(num / 2)\n } else {\n println((num - 1) / 2 + 1)\n }\n }\n}\n\n////////////////////////////////////////////////// STUFF ///////////////////////////////////////////////////////////////\n\n// input\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n\n// algorithms\n\n// binomial coefficients C^n_k\n\nprivate fun cN2(n: Int): Int {\n if (n <= 1)\n throw IllegalArgumentException(\"n must be positive integer >= 2\")\n\n return n * (n - 1) / 2\n}"}, {"source_code": "fun main(args: Array) {\n args.forEach{\n println(it)\n }\n}"}, {"source_code": "fun main() {\n var t = Integer.parseInt(readLine())\n\n while(t > 0) {\n var res = solve(Integer.parseInt(readLine()))\n println(res)\n t--\n }\n\n}\n\nfun solve(n:Int):Int {\n var res = 0\n var m = n\n for(i in 7 downTo 2) {\n res += m/i\n m %= i\n }\n return res\n}\n"}, {"source_code": "fun main(){\n val points = readLine()!!.toInt()\n println((points/7)+1)\n}"}, {"source_code": "fun main() {\n val t = readLine()!!.toInt()\n for (i in 1..t) {\n val x = readLine()!!.toInt()\n println (x / 2 + x % 2)\n }\n}"}, {"source_code": "fun main() {\n var t = Integer.parseInt(readLine())\n\n while(t > 0) {\n var res = solve(Integer.parseInt(readLine()))\n println(res)\n t--\n }\n\n}\n\nfun solve(n:Int):Int {\n var res = 0\n var m = n\n for(i in 7 downTo 2) {\n res += m/i\n m %= i\n }\n return res\n}\n"}, {"source_code": "fun main(args: Array) {\n args.slice(1 until args.size).forEach{\n var number = it.toInt()\n var counter = 0\n while( number > 0 ){\n number -= 7\n counter++\n }\n println(counter)\n }\n}"}, {"source_code": "fun main()\n{\n var n = readLine()!!.toInt()\n \n for (i in 1..n)\n {\n var x = readLine()!!.toInt()\n \n var j = 0\n \n while (x >= 6)\n {\n j++\n x -= 6\n }\n \n println(j)\n \n } \n}\n"}, {"source_code": "fun main()\n{\n val n = readLine()!!.toInt() / 2\n println(n)\n}"}, {"source_code": "fun main() {\n readLine()?.toInt()?.let { numCases ->\n for (case in 0 until numCases) {\n readLine()?.toInt()?.let { println(numRolls(it)) }\n }\n }\n}\n\nprivate fun numRolls(points: Int): Int {\n var numRolls = 0\n var remainingPoints = points\n for (i in 7 downTo 2) {\n var rolls = remainingPoints / i\n while (rolls > 0) {\n numRolls += rolls\n remainingPoints %= i\n rolls = remainingPoints / i\n }\n }\n return numRolls\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n for (i in 0 until sc.nextInt()) {\n val n = sc.nextInt()\n val q = n / 2\n val p = n % 2\n println(q - p)\n }\n}\n"}, {"source_code": "fun main(args: Array) {\n\n val diceNumbers = 7 downTo 2\n val rounds = readLine()!!.toInt()\n\n val queriedNumbers = (1..rounds).asSequence()\n .map { readLine() }\n .filterNotNull()\n .map { it.toInt() }\n .toList()\n\n for (queriedNumber in queriedNumbers)\n {\n var rolls = 0\n var remaining = queriedNumber\n\n for (diceNumber in diceNumbers)\n {\n val rollsWithCurrentNumber = remaining / diceNumber\n\n rolls += rollsWithCurrentNumber\n remaining -= rollsWithCurrentNumber * diceNumber\n\n if (remaining == 0)\n {\n break\n }\n }\n\n println(rolls)\n }\n}\n\n"}, {"source_code": "class DiceRolling {\n fun all(points: List): List {\n val results = mutableListOf()\n points.forEach { results.add(one(it)) }\n return results\n }\n\n // 2, 3, 4, 5, 6, 7\n fun one(point: Int): Int {\n return if (point <= 7) 1\n else {\n 1 + one(point - 6)\n }\n }\n}\n\nfun main(args: Array) {\n val points = args.drop(1).map { Integer.parseInt(it) }\n println(DiceRolling().all(points))\n}"}, {"source_code": "fun main() {\n val t = readLine()!!.toInt()\n for (i in 1..t) {\n val x = readLine()!!.toInt()\n println (x / 2 - x % 2)\n }\n}"}, {"source_code": "fun main(args: Array) {\n val scanner = java.util.Scanner(System.`in`)\n var inputCount = scanner.nextLine()\n val count = inputCount.toInt()\n var inputList = ArrayList(count)\n\n val minBoneValue = 2\n val maxBoneValue = 7\n val minValue = 1\n\n for (x in minValue..count) {\n var value = scanner.nextLine()\n inputList.add(value.toInt())\n }\n\n for (x in inputList) {\n if(x >= minBoneValue && x <= maxBoneValue){\n println(minValue)\n }\n else {\n var throwsCount = (x/maxBoneValue)\n val remainder = x%maxBoneValue\n if(remainder > minValue)\n throwsCount++\n println(throwsCount)\n }\n }\n}\n\n\n"}, {"source_code": "fun main()\n{\n val t = readLine()!!.toInt()\n for (i in 1 .. t)\n {\n println(treatTestCase())\n }\n}\n\nfun treatTestCase(): String\n{\n var x = readLine()!!.toInt()\n\n var c = 7\n var count = 0\n\n while (x > 0 && c > 1)\n {\n if (x >= c)\n {\n val remainder = x % c\n count += (x - remainder) / c\n x = remainder\n }\n\n c--\n }\n\n return count.toString()\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.ArrayList\nfun main() {\n val read=Scanner(System.`in`);\n var test=read.nextInt();\n while((test--)>0){\n var x=read.nextInt();\n println(x);\n var cnt=0;\n\n for (i in 7 downTo 2){\n\n if(x==0)break;\n cnt+=x/i;\n x %= i;\n }\n println(cnt);\n }\n}\n"}, {"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 T = readInt()\n for (t in 0..T-1) {\n val n = readInt()\n println((n + 1) / 2)\n }\n}\n"}, {"source_code": "import java.util.*\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readLong() = readLn().toLong()\n// etc for other types you'd use in your solutions\nfun main(args: Array){\n val t = readInt()\n for(i in 1..t){\n var x = readInt()\n var total: Int=0\n for(j in 7 downTo 2){\n total += x/j\n x = x%j\n }\n println(\"$total\")\n }\n}"}, {"source_code": "\n\nimport java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)){\n\n val dice = arrayOf(7,6,5,4,3,2)\n\n val t = nextInt()\n val points = IntArray(t)\n for (count in 0 until t)\n points[count] = nextInt()\n\n for(point in points){\n var rolls = 0\n var tempPoint = point\n for(num in dice)\n if(num <= tempPoint)\n {\n rolls += (tempPoint/num)\n tempPoint %= num\n }\n println(rolls)\n }\n}"}, {"source_code": "fun main(args: Array) {\n val countLine = readLine()\n println(countLine)\n}"}, {"source_code": "import java.util.*\n\nfun main(){\n val scanner = Scanner(System.`in`)\n var queries = scanner.nextInt()\n var queryList = arrayListOf()\n\n if(queries<=100) {\n while (queries > 0) {\n val contest = scanner.nextInt()\n if(contest in 2..100)\n {queryList.add(contest)}\n queries--\n }\n }\n for(elem in queryList){\n rollDice(elem)\n }\n}\n\nval diceEyes = listOf(2,3,4,5,6,7)\n\nval evenEyes = listOf(2,4,6)\n\nfun rollDice(number: Int): List{\n val rolls = mutableListOf()\n var sum = 0\n var i = 0\n if(number % 2 == 0){\n i = evenEyes.size-1\n }else{\n i = diceEyes.size-1\n }\n while(sum != number && i >= 0){\n var tempSum = sum\n if(number % 2 == 0){\n tempSum+=evenEyes[i]\n }else{\n tempSum += diceEyes[i]\n }\n\n if(tempSum <= number){\n sum = tempSum\n rolls.add(diceEyes[i])\n }else{\n i--\n }\n }\n println(\"${rolls.size}\")\n return rolls\n}\n"}, {"source_code": "fun main() {\n val MIN_VAL = 2\n val MAX_VAL = 7\n val N = readLine()!!.toInt()\n val scores: MutableList = ArrayList()\n for (i in 0 until N) {\n scores.add(readLine()!!.toInt())\n }\n val answer: MutableList = ArrayList()\n\n scores.forEach {\n var currentScore = MAX_VAL\n var currentAmountScore = it\n var amountSteps = 0\n\n while (currentAmountScore >= 0 && currentScore >= MIN_VAL) {\n while (currentScore <= currentAmountScore) {\n currentAmountScore -= currentScore\n amountSteps++\n }\n currentScore--\n }\n answer.add(amountSteps)\n }\n answer.forEach(::println)\n}\n"}, {"source_code": "fun main() {\n val parsed: List = Parser().parse()\n val solver = Solver()\n val res = parsed.map { x -> solver.solve(x) }\n res.forEach{x-> println(x)}\n}\n\nclass Solver {\n private val faces : List = listOf(2,3,4,5,6,7)\n\n fun solve(target : Int) : Int {\n var idx: Int = faces.size - 1\n var rollCount = 1\n var currentTarget: Int = target\n for (i: Int in 0..idx) {\n val currentFace: Int = faces[idx]\n if (currentTarget < currentFace) {\n continue\n }\n currentTarget -= currentFace\n rollCount++\n }\n return rollCount\n }\n}\n\nclass Parser {\n private fun lineSequence(limit: Int = Int.MAX_VALUE) = generateSequence { readLine() }.constrainOnce().take(limit)\n private fun readln() = readLine()!!\n private fun readlnInt() = readln().toInt()\n\n fun parse(): List {\n val queryNumber: Int = readlnInt()\n return lineSequence(queryNumber).map { x -> x.toInt() }.toList()\n }\n}"}, {"source_code": "import com.sun.org.apache.xpath.internal.operations.Bool\n\nfun main(args: Array) {\n val scanner = java.util.Scanner(System.`in`)\n var inputCount = scanner.nextLine()\n val count = inputCount.toInt()\n var inputList = ArrayList(count)\n\n val minBoneValue = 2\n val maxBoneValue = 7\n val minValue = 1\n\n for (x in minValue..count) {\n var value = scanner.nextLine()\n inputList.add(value.toInt())\n }\n\n for (x in inputList) {\n if(x >= minBoneValue && x <= maxBoneValue){\n println(minValue)\n }\n else {\n var throwsCount = (x/maxBoneValue)\n val remainder = x%maxBoneValue\n if(remainder != minValue)\n throwsCount++\n println(throwsCount)\n }\n }\n}\n\n\n"}, {"source_code": "import java.io.*\nimport java.math.*\nimport java.text.*\nimport java.util.*\nimport java.util.regex.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val t = scan.nextInt()\n for (i in 1..t) {\n val num = scan.nextInt()\n if( num%2==0)\n print(\"1\\n\")\n else\n print(\"2\\n\")\n }\n}"}, {"source_code": "fun readInts(separator: Char = ' ') = readLine()!!.split(separator).map(String::toInt)\nfun main() {\n val A = readInts()\n for(i in 1..A.size-1){\n val x = A[i]/2\n println(\"$x\")\n }\n}"}, {"source_code": "fun main() {\n var t = Integer.parseInt(readLine())\n\n while(t > 0) {\n var res = solve(Integer.parseInt(readLine()))\n println(res)\n t--\n }\n\n}\n\nfun solve(n:Int):Int {\n var res = 0\n var m = n\n for(i in 7 downTo 2) {\n res += m/i\n m %= i\n }\n return res\n}\n"}, {"source_code": "import java.io.*\nimport java.math.*\nimport java.text.*\nimport java.util.*\nimport java.util.regex.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val t = scan.nextInt()\n for (i in 1..t) {\n val num = scan.nextInt()\n if( num%2==0)\n print(\"1\\n\")\n else\n print(\"2\\n\")\n }\n}"}, {"source_code": "import java.util.*\n\nfun main(){\n val scanner = Scanner(System.`in`)\n var queries = scanner.nextInt()\n if(queries<=100) {\n while (queries > 0) {\n rollDice(scanner.nextInt())\n queries--\n }\n }\n}\n\nval diceEyes = listOf(2,3,4,5,6,7)\n\nfun rollDice(number: Int): List{\n val rolls = mutableListOf()\n var sum = 0\n var i = diceEyes.size-1\n while(sum != number && i >= 0){\n var tempSum = sum\n tempSum += diceEyes[i]\n if(tempSum <= number){\n sum = tempSum\n rolls.add(diceEyes[i])\n }else{\n i--\n }\n }\n println(\"${rolls.size}\")\n return rolls\n}\n"}, {"source_code": "fun main() {\n println(5)\n}"}, {"source_code": "import kotlin.random.Random\n\nfun main(args: Array) {\n args.slice(1 until args.size).forEach{\n var number = it.toInt()\n var counter = 0\n while( number > 7 ){\n number -= Random.nextInt(2, 7)\n counter++\n }\n println(counter)\n }\n}"}, {"source_code": "import java.util.*\n \nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = readLine()!!.toInt()\n for(x in 0..n-1){\n \tval tmp = readLine()!!.toInt()\n \tif(tmp <= 6) println(\"1\")\n \telse{\n \t\tprintln(tmp/6+tmp%6)\n \t}\n }\n \n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n for (i in 0 until n) {\n val x = readLine()!!.toInt()\n val t = x / 2\n if (t*2 == x) {\n println(t)\n } else {\n println(t+1)\n }\n }\n}"}, {"source_code": "fun main() {\n var t = Integer.parseInt(readLine())\n\n while(t > 0) {\n var res = solve(Integer.parseInt(readLine()))\n println(res)\n t--\n }\n\n}\n\nfun solve(n:Int):Int {\n var res = 0\n var m = n\n for(i in 7 downTo 2) {\n res += m/i\n m %= i\n }\n return res\n}\n"}, {"source_code": "fun main() {\n diceRolling()\n}\n\nval mins = mapOf(\n 2 to 1,\n 3 to 1,\n 4 to 1,\n 5 to 1,\n 6 to 1,\n 7 to 1,\n 8 to 2,\n 9 to 2,\n 10 to 2,\n 11 to 2,\n 12 to 2,\n 13 to 2,\n 14 to 2,\n 15 to 3,\n 16 to 3,\n 17 to 3,\n 18 to 3,\n 19 to 3,\n 20 to 3,\n 21 to 3,\n 22 to 4,\n 23 to 4,\n 24 to 4,\n 25 to 4,\n 26 to 4,\n 27 to 4,\n 28 to 4,\n 29 to 5,\n 30 to 5,\n 31 to 5,\n 32 to 5,\n 33 to 5,\n 34 to 5,\n 35 to 5,\n 36 to 6,\n 37 to 6,\n 38 to 6,\n 39 to 6,\n 40 to 6,\n 41 to 6,\n 42 to 6,\n 43 to 7,\n 44 to 7,\n 45 to 7,\n 46 to 7,\n 47 to 7,\n 48 to 7,\n 49 to 7,\n 50 to 8,\n 51 to 8,\n 52 to 8,\n 53 to 8,\n 54 to 8,\n 55 to 8,\n 56 to 8,\n 57 to 9,\n 58 to 9,\n 59 to 9,\n 60 to 9,\n 61 to 9,\n 62 to 9,\n 63 to 9,\n 64 to 10,\n 65 to 10,\n 66 to 10,\n 67 to 10,\n 68 to 10,\n 69 to 10,\n 70 to 10,\n 71 to 11,\n 72 to 11,\n 73 to 11,\n 74 to 11,\n 75 to 11,\n 76 to 11,\n 77 to 11,\n 78 to 12,\n 79 to 12,\n 80 to 12,\n 81 to 12,\n 82 to 12,\n 83 to 12,\n 84 to 12,\n 85 to 13,\n 86 to 13,\n 87 to 13,\n 88 to 13,\n 89 to 13,\n 90 to 13,\n 91 to 13,\n 92 to 14,\n 93 to 14,\n 94 to 14,\n 95 to 14,\n 96 to 14,\n 97 to 14,\n 98 to 14,\n 99 to 15,\n 100 to 15\n)\n\nfun diceRolling() {\n// val units = listOf(7, 6, 5, 4, 3, 2)\n val inputCount = readLine()!!.toInt()\n \n for (i in 0 until inputCount) {\n println(mins[i])\n }\n\n// (2..100).forEach {\n// println(\"$it to ${compute(it, units)}\")\n// }\n}\n\n//fun compute(target: Int, units: List): Int {\n// if (target in units) return 1\n// if (target == units.max()!! + 1) return 2\n// return 1 + compute(target - units.max()!!, units)\n//}\n"}], "src_uid": "a661b6ce166fe4b2bbfd0ace56a7dc2c"} {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (_, s) = readInts()\n val a = readInts()\n print(if (a.sum() - a.max()!! <= s) \"YES\" else \"NO\")\n}", "positive_code": [{"source_code": "import java.util.*\n \nfun min(a:Double,b:Double) = if (ab) a else b \nfun min(a:Int,b:Int) = if (ab) a else b \nfun printD(d: Double) { print(d) }\nfun printI(d:Int) { print(d) }\nfun printS(d: String) { print(d) }\nfun printL(d: Long) { print(d) }\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readInts() = readLn().split(\" \").map{it.toInt()}\nfun readLong() = readLn().toLong()\nclass pair (var first:Int, var second:Int) \n \nfun solve() {\n val cin = Scanner(System.`in`)\n \n /* \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 print(\"${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 \n readInt() - \u043e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e \n readInts() - \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u0435\u043b \n \n */ \n \n \n \n /* --------- */ \n \n var (a,b)=readInts();\n var q=readInts(); \n var sum=0; \n var max1=0; \n for (i in q) {\n max1=max(max1,i); sum+=i; }\n if (b>=sum-max1) print(\"YES\"); else print(\"NO\"); \n /* --------- */ \n \n}\n \n fun main() {\n val cin = Scanner(System.`in`)\n \n var T=1; \n //T=readLine()!!.toInt(); \n \n for (i55555 in 1..T) solve()\n}\n "}, {"source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`), {\n var (n, s) = readLine()!!.split(\" \").map { it.toInt() }\n var mx = 0\n var sum = 0\n for (i in 1..n) {\n sum += nextInt().apply { mx = Math.max(mx, this) }\n }\n if (sum - mx <= s) print(\"YES\") else print(\"NO\")\n})"}], "negative_code": [], "src_uid": "496baae594b32c5ffda35b896ebde629"} {"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(\"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", "positive_code": [{"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(\"YES\") else println(if ((b - a) % c == 0L) \"YES\" else \"NO\")\n else println(\"NO\")\n //TODO(\"KYS\")\n}\n\n\n\n"}, {"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 && ((b >= a&&c>0)||(b<=a&&c<0))) \"YES\" else \"NO\")\n }\n}"}, {"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 (seq == 0L) {\n println(\"NO\")\n return\n }\n if ((desired - initial) % seq == 0L && ((desired - initial) / seq) > 0)\n println(\"YES\")\n else println(\"NO\")\n}\n"}, {"source_code": "fun main() {\n val (a, b, c) = readLine()!!.split(\" \").map(String::toLong)\n print(when {\n a == b -> \"YES\"\n c == 0L -> \"NO\"\n b > a && c < 0 -> \"NO\"\n b < a && c > 0 -> \"NO\"\n (b - a) % c == 0L -> \"YES\"\n else -> \"NO\"\n })\n}"}], "negative_code": [{"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}"}, {"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 if (c == 0L) println(\"NO\") else\n println(if ((b - a) % c == 0L) \"YES\" else \"NO\")\n}"}, {"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"}, {"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"}, {"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) = readInts(3)\n if (a == b) println(\"YES\")\n else if (a < c && b > 0) if (b == 1) println(\"YES\") else println(if ((b - a) % c == 0) \"YES\" else \"NO\")\n else if (a > c && b < 0) if (b == -1) println(\"NO\") else println(if ((b - a) % c == 0) \"YES\" else \"NO\")\n else println(\"NO\")\n //TODO(\"KYS\")\n}\n\n\n\n"}, {"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 < c && b > 0) if (b == 1L) println(\"YES\") else println(if ((b - a) % c == 0L) \"YES\" else \"NO\")\n else if (a > c && b < 0) if (b == -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"}, {"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) = readInts(3)\n if (a == b) println(\"YES\")\n else if (a < c && b > 0) if (b == 1) println(\"YES\") else println(if ((b - a) % c == 0) \"YES\" else \"NO\")\n else if (a > c && b < 0) if (b == -1) println(\"NO\") else println(if ((b + a) % c == 0) \"YES\" else \"NO\")\n else println(\"NO\")\n //TODO(\"KYS\")\n}\n\n\n\n"}], "src_uid": "9edf42c20ddf22a251b84553d7305a7d"} {"source_code": "import java.lang.Integer.min\n\nfun main() {\n val (x, y, z) = readLine()!!.split(\" \").map { it.toInt() }\n var (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n a -= x\n if (a < 0) {\n println(\"NO\")\n return\n }\n b += a\n b -= y\n if (b < 0) {\n println(\"NO\")\n return\n }\n c += b\n c -= z\n if (c < 0) {\n println(\"NO\")\n return\n }\n println(\"YES\")\n}\n", "positive_code": [{"source_code": "fun main(args: Array) {\n val (x, y, z) = readLine()!!.split(\" \").map { it.toInt() }\n var (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n\n if(a>=x && a-x+b >= y && a-x+b-y+c >= z ){\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n }"}, {"source_code": "import java.lang.Math.min\n\nfun main(args : Array) {\n val want = IntArray(3)\n val have = IntArray(3)\n for (i in 0 until want.size) {\n want[i] = readInt()\n }\n for (i in 0 until have.size) {\n have[i] = readInt()\n }\n for (i in 0 until want.size) {\n var sum = 0\n for (j in 0 .. i) {\n sum += have[j]\n }\n if (sum < want[i]) {\n println(\"NO\")\n return\n }\n var rest = want[i]\n for (j in 0 .. i) {\n if (rest <= have[j]) {\n have[j] -= rest\n break\n } else {\n rest -= have[j]\n have[j] = 0\n }\n }\n }\n println(\"YES\")\n}\n\nprivate fun readln() = readLine()!!\nprivate fun readlnByte() = readln().toByte()\nprivate fun readlnShort() = readln().toShort()\nprivate fun readlnInt() = readln().toInt()\nprivate fun readlnLong() = readln().toLong()\nprivate fun readlnFloat() = readln().toFloat()\nprivate fun readlnDouble() = readln().toDouble()\nprivate fun readlnBigInt(radix: Int = 10) = readln().toBigInteger(radix)\nprivate fun readlnBigDecimal() = readln().toBigDecimal()\n\nprivate fun lineSequence(limit: Int = Int.MAX_VALUE) = generateSequence { readLine() }.constrainOnce().take(limit)\nprivate fun readlnStrings() = readln().split(' ')\nprivate fun readlnBytes() = readlnStrings().map { it.toByte() }\nprivate fun readlnShorts() = readlnStrings().map { it.toShort() }\nprivate fun readlnInts() = readlnStrings().map { it.toInt() }\nprivate fun readlnLongs() = readlnStrings().map { it.toLong() }\nprivate fun readlnFloats() = readlnStrings().map { it.toFloat() }\nprivate fun readlnDoubles() = readlnStrings().map { it.toDouble() }\n\nprivate fun readByteArray() = readlnStrings().run { ByteArray(size) { get(it).toByte() } }\nprivate fun readShortArray() = readlnStrings().run { ShortArray(size) { get(it).toShort() } }\nprivate fun readIntArray() = readlnStrings().run { IntArray(size) { get(it).toInt() } }\nprivate fun readLongArray() = readlnStrings().run { LongArray(size) { get(it).toLong() } }\nprivate fun readFloatArray() = readlnStrings().run { FloatArray(size) { get(it).toFloat() } }\nprivate fun readDoubleArray() = readlnStrings().run { DoubleArray(size) { get(it).toDouble() } }\n\nprivate fun readlnByteArray(n: Int) = ByteArray(n) { readlnByte() }\nprivate fun readlnShortArray(n: Int) = ShortArray(n) { readlnShort() }\nprivate fun readlnIntArray(n: Int) = IntArray(n) { readlnInt() }\nprivate fun readlnLongArray(n: Int) = LongArray(n) { readlnLong() }\nprivate fun readlnFloatArray(n: Int) = FloatArray(n) { readlnFloat() }\nprivate fun readlnDoubleArray(n: Int) = DoubleArray(n) { readlnDouble() }\n\nprivate fun readByteArray2d(rows: Int, cols: Int) = Array(rows) { readByteArray().also { require(it.size == cols) } }\nprivate fun readShortArray2d(rows: Int, cols: Int) = Array(rows) { readShortArray().also { require(it.size == cols) } }\nprivate fun readLongArray2d(rows: Int, cols: Int) = Array(rows) { readLongArray().also { require(it.size == cols) } }\nprivate fun readIntArray2d(rows: Int, cols: Int) = Array(rows) { readIntArray().also { require(it.size == cols) } }\nprivate fun readFloatArray2d(rows: Int, cols: Int) = Array(rows) { readFloatArray().also { require(it.size == cols) } }\nprivate fun readDoubleArray2d(rows: Int, cols: Int) = Array(rows) { readDoubleArray().also { require(it.size == cols) } }\n\nprivate fun isWhiteSpace(c: Char) = c in \" \\r\\n\\t\"\n\n// JVM-only targeting code follows next\n\n// readString() via sequence is still slightly faster than Scanner\nprivate fun readString() = generateSequence { System.`in`.read().toChar() }\n .dropWhile { isWhiteSpace(it) }.takeWhile { !isWhiteSpace(it) }.joinToString(\"\")\nprivate fun readByte() = readString().toByte()\nprivate fun readShort() = readString().toShort()\nprivate fun readInt() = readString().toInt()\nprivate fun readLong() = readString().toLong()\nprivate fun readFloat() = readString().toFloat()\nprivate fun readDouble() = readString().toDouble()\nprivate fun readBigInt(radix: Int = 10) = readString().toBigInteger(radix)\nprivate fun readBigDecimal() = readString().toBigDecimal()\n\nprivate fun readBytes(n: Int) = generateSequence { readByte() }.take(n)\nprivate fun readShorts(n: Int) = generateSequence { readShort() }.take(n)\nprivate fun readInts(n: Int) = generateSequence { readInt() }.take(n)\nprivate fun readLongs(n: Int) = generateSequence { readLong() }.take(n)\nprivate fun readFloats(n: Int) = generateSequence { readFloat() }.take(n)\nprivate fun readDoubles(n: Int) = generateSequence { readDouble() }.take(n)"}, {"source_code": "import java.util.Scanner;\n\nfun main() {\n with(Scanner(System.`in`)) {\n var x = nextInt()\n var y = nextInt()\n var z = nextInt()\n var a = nextInt() // green\n var b = nextInt() // purple\n var c = nextInt() // black\n a = a - x\n if (a < 0) {\n println(\"NO\")!!\n return\n }\n if (b >= y) {\n b = b - y\n y = 0\n } else {\n y = y - b\n b = 0\n }\n if (a >= y) {\n a = a - y\n y = 0\n } else {\n y = y - a\n a = 0\n }\n if (y > 0) {\n println(\"NO\")!!\n return\n }\n if (a + b + c >= z) {\n println(\"YES\")!!\n } else {\n println(\"NO\")!!\n }\n }\n}"}, {"source_code": "fun main() {\n val targetGrapes = readLine()!!\n val nGrapes = readLine()!!\n println(getGoodString(targetGrapes.split(\" \"), nGrapes.split(\" \")))\n}\n\nfun getGoodString(targetGrapes: List, nGrapes: List): String {\n val targetAndrew = targetGrapes[0].toInt()\n val targetDmitry = targetGrapes[1].toInt()\n val targetMichal = targetGrapes[2].toInt()\n var nGreen = nGrapes[0].toInt()\n val nPurple = nGrapes[1].toInt()\n val nBlack = nGrapes[2].toInt()\n if (nGreen < targetAndrew) return \"NO\"\n nGreen -= targetAndrew\n if (nGreen + nPurple < targetDmitry) return \"NO\"\n val remaining = nGreen + nPurple + nBlack - targetDmitry\n if (remaining < targetMichal) return \"NO\"\n return \"YES\"\n}"}, {"source_code": "import kotlin.math.min\n\nfun readThree() = readLine()!!.split(\" \").map { it.toInt() }\nfun main() {\n var (andrew, dmitry, michal) = readThree()\n var (green, purple, black) = readThree()\n\n green -= andrew\n\n if (green < 0) println(\"NO\")\n else {\n val greenForDmitry = min(green, dmitry)\n green -= greenForDmitry\n dmitry -= greenForDmitry\n\n purple -= dmitry\n when {\n purple < 0 -> println(\"NO\")\n green + purple + black < michal -> println(\"NO\")\n else -> println(\"YES\")\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n var (x,y,z)=readLine()!!.split(\" \").map{it.toInt()}\n var (a,b,c)=readLine()!!.split(\" \").map{it.toInt()}\n if(a = readLine().orEmpty().split(\" \").map { it.toLong() }\n\nfun main() {\n val x = readInts().cumsum()\n val y = readInts().cumsum()\n\n val yes = (x zip y).all { (a, b) -> a <= b }\n\n println(if (yes) \"YES\" else \"NO\")\n}\n\nfun Iterable.reductions(initial: R, operation: (acc: R, T) -> R): Sequence = sequence {\n var last = initial\n forEach {\n last = operation(last, it)\n yield(last)\n }\n}\n\nfun List.cumsum() = this.reductions(0L) { acc, l -> acc + l }.toList()"}, {"source_code": "private fun readln() = readLine()!!\nprivate fun readlnStrings() = readln().split(' ')\nprivate fun readIntArray() = readlnStrings().run { IntArray(size) { get(it).toInt() } }\n\nfun main(args: Array) {\n\tval a = readIntArray()\n\tval b = readIntArray()\n\tif (a[0] > b[0]) {\n\t\tprintln(\"NO\")\n\t\treturn\n\t}\n\tb[1] += b[0] - a[0]\n\tif (a[1] > b[1]) {\n\t\tprintln(\"NO\")\n\t\treturn\n\t}\n\tb[2] += b[1] - a[1]\n\tif (a[2] > b[2]) println(\"NO\")\n\telse println(\"YES\")\n}"}, {"source_code": "private fun readln() = readLine()!!\nprivate fun readlnStrings() = readln().split(' ')\nprivate fun readIntArray() = readlnStrings().run { IntArray(size) { get(it).toInt() } }\n\nfun main(args: Array) {\n\tval a = readIntArray()\n\tval b = readIntArray()\n\tfor (i in 0..2) {\n\t\tif (a[i] > b[i]) {\n\t\t\tprintln(\"NO\")\n\t\t\treturn\n\t\t}\n\t\tif (i < 2) b[i+1] += b[i] - a[i]\n\t}\n\tprintln(\"YES\")\n}"}, {"source_code": "private fun readLn() = readLine()!!\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n\nfun main() {\n val (x, y, z) = readInts()\n val (a, b, c) = readInts()\n\n println(f(x, y, z, a, b, c))\n}\n\nfun f(x: Int, y: Int, z: Int, a: Int, b: Int, c: Int): String {\n var a1 = a\n var y1 = y\n var b1 = b\n\n if (a1 < x) return \"NO\"\n a1 -= x\n\n if (a1 + b1 < y1) return \"NO\"\n if (a1 < y1) {\n y1 -= a1\n a1 -= a1\n b1 -= y1\n } else {\n a1 -= y1\n }\n\n return if (a1 + b1 + c < z) \"NO\" else \"YES\"\n}"}, {"source_code": "import kotlin.math.*\n\nfun read() = readLine()!!\nfun getInt() = read().toInt()\nfun getInts() = read().split(\" \").map(String::toInt)\n\nfun main() {\n var (x, y, z) = getInts()\n var (a, b, c) = getInts()\n var tmp = min(a, x)\n x -= tmp\n a -= tmp\n tmp = min(y, a)\n y -= tmp\n a -= tmp\n tmp = min(y, b)\n y -= tmp\n b -= tmp\n tmp = min(z, a)\n z -= tmp\n a -= tmp\n tmp = min(z, b)\n z -= tmp\n b -= tmp\n tmp = min(z, c)\n z -= tmp\n c -= tmp\n if (x > 0 || y > 0 || z > 0) {\n println(\"NO\")\n } else {\n println(\"YES\")\n }\n}"}, {"source_code": "fun main() {\n val a=readInts().toIntArray()\n val b=readInts().toIntArray()\n if (a[0]>b[0]){\n println(\"NO\")\n return\n }\n b[1]+=b[0]-a[0]\n if (a[1]>b[1]) {\n println(\"NO\")\n return\n }\n b[2]+=b[1]-a[1]\n if (a[2]>b[2]) {\n println(\"NO\")\n return\n }\n println(\"YES\")\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"}, {"source_code": "fun main() {\n\n val arr = readInts()\n val arr2 = readInts()\n\n\n val x = arr[0] // A - only G\n val y = arr[1] // D - G and F\n val z = arr[2] // M - any\n\n val a = arr2[0] // G\n val b = arr2[1] // F\n val c = arr2[2] // B\n\n\n val overleftAndrey = a - x\n\n if (overleftAndrey < 0) {\n println(\"NO\")\n return\n }\n\n val overleftDmitry = (overleftAndrey + b) - y\n\n if (overleftDmitry < 0) {\n println(\"NO\")\n return\n }\n\n val overleftMicha = (overleftDmitry + c) - z\n\n if (overleftMicha < 0) {\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n}\n\nfun readInts() = readLine()!!.split(' ').map { it.toInt() }"}, {"source_code": "import kotlin.system.exitProcess\n\nfun main()\n{\n var (x, y, z) = readLine()!!.split(' ').map(String::toInt)\n \n var (a, b, c) = readLine()!!.split(' ').map(String::toInt)\n \n if (a < x)\n {\n println(\"NO\")\n exitProcess(0)\n }\n a -= x\n \n if (a + b < y)\n {\n println(\"NO\")\n exitProcess(0)\n }\n \n var remaining_grapes = a + b - y + c\n \n if (remaining_grapes < z)\n {\n println(\"NO\")\n exitProcess(0)\n }\n \n println(\"YES\")\n}\n \n"}, {"source_code": "import kotlin.math.min\n\n/**\n * x=a\n * y=a+b\n * z=a+b+c\n */\nfun main() {\n var (x, y, z) = readLine()!!.split(' ').map(String::toInt)\n var (a, b, c) = readLine()!!.split(' ').map(String::toInt)\n\n if (a < x || a + b < y || a + b + c < z) return print(\"NO\")\n\n\n // ===== Andrew ===== //\n\n min(x, a).also {\n x -= it\n a -= it\n }\n\n if (x != 0) return println(\"NO\")\n\n\n // ===== Dmitry ===== //\n\n min(y, a).also {\n y -= it\n a -= it\n }\n\n min(y, b).also {\n y -= it\n b -= it\n }\n\n if (y != 0) return println(\"NO\")\n\n // ===== Michal ===== //\n\n min(z, a).also {\n z -= it\n a -= it\n }\n\n min(z, b).also {\n z -= it\n b -= it\n }\n\n min(z, c).also {\n z -= it\n c -= it\n }\n\n if (z != 0) return println(\"NO\")\n\n println(\"YES\")\n}\n"}, {"source_code": "import java.util.*\n\nfun main() {\n val scanner = Scanner(System.`in`)\n var x = scanner.nextInt()\n var y = scanner.nextInt()\n var z = scanner.nextInt()\n\n var a = scanner.nextInt()\n var b = scanner.nextInt()\n var c = scanner.nextInt()\n\n a -= x\n if (a < 0) {\n println(\"NO\")\n return\n }\n\n if (a > 0) {\n a -= y\n if (a < 0) {\n y = a * -1\n } else {\n y = 0\n }\n }\n\n b -= y\n if (b < 0) {\n println(\"NO\")\n return\n }\n\n if (a > 0) {\n a -= z\n if (a < 0) {\n z = a * -1\n } else {\n z = 0\n }\n }\n\n if (b > 0) {\n b -= z\n if (b < 0) {\n z = b * -1\n } else {\n z = 0\n }\n }\n\n c -= z\n if (c < 0) {\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n}"}, {"source_code": "import java.lang.Math.abs\n\nfun main() {\n val (a, d, m) = readLine()!!.split(' ').map(String::toInt)\n val (g, v, b) = readLine()!!.split(' ').map(String::toInt)\n print(check(a, d, m, g, v, b))\n}\n\n/*1 2 10\n10 2 1*/\n\nfun check(a: Int, d: Int, m: Int, g: Int, v: Int, b: Int): String {\n\n val v1 = v\n val b1 = b\n val a1 = a - g\n var d1 = d\n var m1 = m\n\n return if (a1 <= 0) {\n\n d1 -= abs(a1)\n if (d1 <= 0) {\n\n m1 -= abs(d1) + v1\n return if (m1 <= 0) \"YES\"\n else {\n m1 -= b1\n if (m1 <= 0) \"YES\" else \"NO\"\n }\n } else {\n d1 -= v1\n return if (d1 <= 0) {\n\n m1 -= abs(d1)\n if (m1 <= 0) \"YES\"\n else {\n m1 -= b1\n if (m1 <= 0) \"YES\" else \"NO\"\n }\n } else \"NO\"\n }\n } else \"NO\"\n}"}, {"source_code": "fun anyGrapes(want:List, grapes:List){\n if(want[0].toInt() - grapes[0].toInt() > 0){\n println(\"NO\")\n }\n else {\n val greenRem = grapes[0].toInt() - want[0].toInt()\n val micha = if((want[2].toInt() - grapes[2].toInt()) < 0){\n 0\n }\n else {\n want[2].toInt() - grapes[2].toInt()\n }\n\n if(greenRem + grapes[1].toInt() >= (micha + want[1].toInt())){\n println(\"YES\")\n return\n }\n println(\"NO\")\n }\n}\n\nfun main(args:Array){\n val want = readLine()!!.split(\" \")\n val grapes = readLine()!!.split(\" \")\n anyGrapes(want, grapes)\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.split(\" \").map(String::toInt)\n val h = readLine()!!.split(\" \").map(String::toInt)\n println(if(h[0] >= n[0] && h[0] + h[1] >= n[0] + n[1] && h[0] + h[1] + h[2] >= n[0] + n[1] + n[2]) \"YES\" else \"NO\")\n}"}, {"source_code": "import java.util.Scanner\n\nval no = \"NO\"\nval yes = \"YES\"\n\nfun main() {\n val scanner = Scanner(System.`in`)\n\n val and = scanner.nextInt()\n var dm = scanner.nextInt()\n val mi = scanner.nextInt()\n\n var green = scanner.nextInt()\n var purple = scanner.nextInt()\n val black = scanner.nextInt()\n\n if (and > green) {\n println(no)\n return\n }\n green -= and\n if (dm > green + purple) {\n println(no)\n return\n }\n\n if (dm > green) {\n dm -= green\n green = 0\n purple -= dm\n } else {\n green -= dm\n }\n\n println(if (green + purple + black >= mi) yes else no)\n}"}, {"source_code": "\nfun good (a: CharArray) : Int {\n\n for (i in 0..a.size-1) {\n if (a[i] != a[a.size - i - 1])\n return 1\n }\n return 0\n}\n\nfun taskC() {\n var t = readLine()!!.toInt()\n while (t-- > 0) {\n var a = readLine()!!.toString()\n var arr = a.toCharArray()\n arr.sort()\n if (good(arr) == 1)\n println(arr.joinToString(\"\"))\n else\n println(-1)\n }\n}\nfun taskD() {\n var a = readLine()!!.split(\" \").map {it.toInt()}\n var b = readLine()!!.split(\" \").map {it.toInt()}\n var sum = 0\n for (i in 0..2) {\n sum += b[i]\n if (sum >= a[i]) {\n sum -= a[i]\n }\n else {\n print(\"NO\")\n return\n }\n }\n print(\"YES\")\n}\n\nfun main()\n{\n taskD()\n}\nfun taskB() {\n var (a, b, c) = readLine()!!.split(\" \").map{it.toInt()}\n var mn = Math.min (a, Math.min (b-1, c-2))\n print(mn + mn + 1 + mn + 2)\n}"}, {"source_code": "const val GREEN = 0\nconst val PURPLE = 1\nconst val BLACK = 2\nconst val ANDREW = 0\nconst val DIMITRY = 1\nconst val MICHAEL = 2\nfun main() {\n val request = readLine()!!.split(\" \").map { it.toInt() }\n val box = readLine()!!.split(\" \").map { it.toInt() }\n\n if (request[ANDREW] > box[GREEN])\n print(\"NO\")\n else {\n val leftOfGreen = box[GREEN] - request[ANDREW]\n\n val leftOfGreenAndPurple = leftOfGreen + box[PURPLE]\n\n if (leftOfGreenAndPurple < request[DIMITRY]) {\n println(\"NO\")\n } else {\n\n val sumOfAllLeft = leftOfGreenAndPurple - request[DIMITRY] + box[BLACK]\n\n if (sumOfAllLeft < request[MICHAEL]) {\n print(\"NO\")\n } else {\n println(\"YES\")\n }\n\n }\n\n }\n\n}\n\n\n"}, {"source_code": "fun main(args: Array) {\n val (vA, vD, vM) = readLine()!!.split(' ').map(String::toInt)\n val (v1, v2, v3) = readLine()!!.split(' ').map(String::toInt)\n\n val o1 = v1 - vA\n if (o1 < 0) {\n println(\"NO\")\n return\n }\n val o12 = v2 + o1 - vD\n if (o12 < 0) {\n println(\"NO\")\n return\n }\n if (o12 + v3a || (x+y)>(a+b) || (x+y+z)>(a+b+c)) println(\"NO\") else println(\"YES\")\n}"}, {"source_code": "// contest/1171/problem/B Kotlin heroes training done\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n var canDo: Boolean\n val xyz = readInts()\n var (x,y,z) = xyz\n val abc = readInts()\n var (a,b,c) = abc\n if (a < x) {\n canDo = false\n } else {\n a -= x\n if (a+b < y) {\n canDo = false\n } else {\n if (a > y) {\n a -= y\n } else {\n b -= (y-a)\n a = 0\n }\n canDo = (a+b+c) >= z\n }\n }\n\n println( if (canDo) \"YES\" else \"NO\" )\n}\n"}, {"source_code": "import java.lang.System.exit\n\nfun main() {\n val (andrew, dmitry, michal) = readLine()!!.split(' ').map { it.toInt() }\n var (green, purple, black) = readLine()!!.split(' ').map { it.toInt() }\n green-=andrew\n if (green < 0) fail()\n val leftover = green + purple - dmitry\n if (leftover < 0) fail()\n if (leftover + black - michal < 0) fail()\n println(\"YES\")\n}\n\nfun fail() {\n println(\"NO\")\n exit(0)\n}"}, {"source_code": "import kotlin.system.exitProcess\n\nfun readInts() = readLine()!!.split(\" \").map { it.toInt() }\n\n\nfun main()\n{\n var (x, y, z) = readInts()\n var (a, b, c) = readInts()\n\n if (x > a){\n println(\"NO\")\n exitProcess(0)\n }\n\n a-=x\n a+=b\n\n if (a < y){\n println(\"NO\")\n exitProcess(0)\n }\n\n a-=y\n a+=c\n\n if (a < z){\n println(\"NO\")\n exitProcess(0)\n }\n\n println(\"YES\")\n}"}, {"source_code": "fun readln() = readLine()!!.trim()\nfun readlnInt() = readln().toInt()\nfun readlnStrings() = readln().split(' ')\nfun readlnInts() = readlnStrings().map { it.toInt() }\nfun dbg(x: String) = System.err.println(x)\n\nfun solve(l: List, l2: List): String {\n\tvar (x, y, z) = l;\n\tvar (a, b, c) = l2;\n\n\tif (x > a) {\n\t\treturn \"NO\";\n\t}\n\tif (x + y > a + b) {\n\t\treturn \"NO\"\n\t}\n\tif (x + y + z > a + b + c) {\n\t\treturn \"NO\"\t\n\t}\n\n\treturn \"YES\"\n}\n\nfun main(args: Array) {\n\tvar l = readlnInts();\n\tvar l2 = readlnInts();\n\tvar res = solve(l, l2);\n\tprintln(res);\n}"}, {"source_code": "import java.util.Scanner\n fun bad() {\n println(\"NO\")\n System.exit(0)\n }\n\n\n fun main(args: Array) {\n val sc = Scanner(System.`in`)\n val x = sc.nextInt()\n var y = sc.nextInt()\n val z = sc.nextInt()\n var a = sc.nextInt()\n var b = sc.nextInt()\n val c = sc.nextInt()\n a -= x\n if (a < 0)\n bad()\n if (a > y) {\n a -= y\n y = 0\n } else {\n y -= a\n a = 0\n b -= y\n if (b < 0)\n bad()\n }\n if (a + b + c < z)\n bad()\n println(\"YES\")\n }\n"}, {"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 (x > a) {\n print(\"NO\")\n return\n }\n val r = a - x\n if (y > r + b) {\n print(\"NO\")\n return\n }\n if (z > c + r + b - y) {\n print(\"NO\")\n return\n }\n print(\"YES\")\n}"}, {"source_code": "fun main() {\n val require = readLine()!!.split(\" \").map { it.toInt() }.toMutableList()\n val exist = readLine()!!.split(\" \").map { it.toInt() }.toMutableList()\n\n when {\n require[0] > exist[0] -> \"NO\"\n require[1] > exist[0] - require[0] + exist[1] -> \"NO\"\n require[2] > exist[0] - require[0] + exist[1] - require[1] + exist[2] -> \"NO\"\n else -> \"YES\"\n }.run { println(this) }\n}\n"}, {"source_code": "fun main() {\n var (x, y, z) = readLine()!!.split(\" \").map { it.toInt() }\n var (green, purple, black) = readLine()!!.split(\" \").map { it.toInt() }\n\n var condition = true\n\n if (!(green >= x && green - x + purple >= y && green - x + purple - y + black >= z)) {\n condition = false\n }\n\n println(if (condition) \"YES\" else \"NO\")\n}"}, {"source_code": "import java.io.*\nimport java.util.*\n\nfun canEat(): Boolean {\n var x = inp.nextInt()\n var y = inp.nextInt()\n var z = inp.nextInt()\n\n var a = inp.nextInt()\n var b = inp.nextInt()\n var c = inp.nextInt()\n\n if (a < x) {\n return false\n }\n a -= x\n x = 0\n\n if (a + b < y) {\n return false\n }\n val remAB = a + b - y\n return remAB + c >= z\n}\n\nfun run() {\n val res: String = if (canEat()) \"YES\" else \"NO\"\n out.println(res)\n}\n\nprivate val inp = FastInput()\nprivate val out = FastOutput()\n\nfun main() {\n run()\n out.flush()\n out.close()\n}\n\ninternal class FastInput(private val bufferedReader: BufferedReader) {\n private var tokenizer: StringTokenizer? = null\n\n constructor() : this(System.`in`)\n constructor(stream: InputStream) : this(BufferedReader(InputStreamReader(stream)))\n constructor(file: File) : this(BufferedReader(FileReader(file)))\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(bufferedReader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int = next().toInt()\n fun nextLong(): Long = next().toLong()\n}\n\ninternal class FastOutput constructor(outputStream: OutputStream = System.out) {\n private val bufferedWriter = BufferedWriter(OutputStreamWriter(outputStream))\n\n private fun printOne(obj: T) {\n bufferedWriter.write(\"$obj\")\n }\n\n fun println(obj: T) = bufferedWriter.write(\"$obj\\n\")\n\n fun print(vararg objs: Any) = printd(\"\", *objs)\n\n fun printd(delimiter: String, vararg objs: Any) {\n for (i in 0 until objs.size) {\n printOne(objs[i])\n printOne(delimiter)\n }\n }\n\n fun flush() = bufferedWriter.flush()\n fun close() = bufferedWriter.close()\n}"}, {"source_code": "import kotlin.system.exitProcess\n\nfun main()\n{\n var (x,y,z)= readLine()!!.split(' ').map(String::toInt)\n var (a,b,c)= readLine()!!.split(' ').map(String::toInt)\n\n a-=x\n if(a<0 || a+b=y) a-=y\n else\n {\n y-=a\n a=0\n b-=y\n }\n if(z>a+b+c)\n {\n print(\"NO\")\n exitProcess(0)\n }\n print(\"YES\")\n}"}, {"source_code": "fun isEnough(wish: List, grapes: List) {\n val enough = grapes[0] >= wish[0] &&\n grapes[0] + grapes[1] >= wish[1] + wish[0] &&\n grapes[0] + grapes[1] + grapes[2] >= wish[2] + wish[0] + wish[1]\n println(when(enough) {\n true -> \"YES\"\n else -> \"NO\"\n })\n}\n\nfun main() {\n val wish = readLine()!!.split(\" \").map { it.toInt() }\n val grapes = readLine()!!.split(\" \").map { it.toInt() }\n\n isEnough(wish, grapes)\n}"}, {"source_code": "fun main()\n{\n var (x, y, z) = readLine()!!.split(\" \").map{it.toInt()};\n var (a, b, c) = readLine()!!.split(\" \").map{it.toInt()};\n if (x>a)\n println(\"NO\");\n else\n {\n a-=x;\n if (y>a+b)\n println(\"NO\");\n else\n {\n var tot = a+b+c-y;\n if (z>tot)\n println(\"NO\");\n else\n println(\"YES\");\n }\n }\n}"}, {"source_code": "fun main() {\n var (x, y, z) = readLine()!!.split(\" \").map{it.toInt()}\n var (a, b, c) = readLine()!!.split(\" \").map{it.toInt()}\n if (a < x) {\n println(\"NO\")\n return\n }\n val d = Math.min(y, a - x);\n a -= d + x\n y -= d\n if(b < y) {\n println(\"NO\")\n return\n }\n if(a + b + c >= z + y) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}"}, {"source_code": "fun main(){\n val (a,b,c)=readLine()!!.split(\" \").map{it.toInt()}\n val (x,y,z)=readLine()!!.split(\" \").map{it.toInt()}\n if(x) {\n\n val NT = 1//readLine()?.toInt() ?: 0\n\n\n for(test in 1..NT){\n val (x, y, z) = readLine()!!.split(\" \").map { it.toInt() }\n val (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n val ok = (a >= x) && (a + b >= x + y) && (a + b + c >= x + y + z)\n println(if(ok)\"YES\" else \"NO\")\n }\n\n}"}, {"source_code": "import java.util.Scanner\nimport java.util.Arrays\n\nfun main(args: Array) {\n\tval reader = Scanner(System.`in`)\n\n\tvar x:Int = reader.nextInt()\n \tvar y:Int = reader.nextInt()\n \tvar z:Int = reader.nextInt()\n \n \tvar g:Int = reader.nextInt()\n \tvar p:Int = reader.nextInt()\n \tvar b:Int = reader.nextInt()\n\t\n\tvar aux:Int \n\n \tif(g>=x){\n\t\tg-=x\n\t\taux=g+p\n\t\tif(aux>=y){\n\t\t\taux-=y\n\t\t\taux+=b\n\t\t\tif(aux>=z){\n\t\t\t\tprintln(\"YES\")\n\t\t\t}\n\t\t\telse{\n\t\t\t\tprintln(\"NO\")\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tprintln(\"NO\")\n\t\t}\n \t}\n\telse{\n\t\tprintln(\"NO\")\n\t}\n}\n"}, {"source_code": "import kotlin.system.exitProcess\n\nfun main(args: Array) {\n val (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n val (x, y, z) = readLine()!!.split(\" \").map { it.toInt() }\n if (a > x) {\n print(\"NO\")\n exitProcess(0)\n }\n if (b <= y + x - a && c + b <= x - a + y + z) {\n print(\"YES\")\n } else {\n print(\"NO\")\n }\n\n}\n"}, {"source_code": "import java.util.Scanner\nimport java.util.Arrays\nfun main(args:Array){\n\tval reader = Scanner(System.`in`)\n\tvar t:Int = reader.nextInt()\n\tvar t1:Int = reader.nextInt()\n\tvar t2:Int = reader.nextInt()\n\tvar g:Int = reader.nextInt()\n\tvar g1:Int = reader.nextInt()\n\tvar g2:Int = reader.nextInt()\n\tif(t<=g){\n\t\tg-=t\n\t\tif(t1<=g+g1){\n\t\t\tif(t2 <= (g-t1)+g1+g2){\n\t\t\t\tprintln(\"YES\")\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\tprintln(\"NO\")\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\tprintln(\"NO\")\n\t\t}\n\t} else {\n\t\tprintln(\"NO\")\n\t}\n}"}, {"source_code": "fun main() {\n println(\n if (gotGrapes()) { \"YES\" } else { \"NO\" }\n )\n}\n\nfun gotGrapes() : Boolean {\n var (andrew, dimitry, michal) = readLine()!!.split(\" \").map(String::toInt)\n var (green, purple, black) = readLine()!!.split(\" \").map(String::toInt)\n\n green -= andrew\n\n if (green < 0) return false\n\n val g = kotlin.math.min(dimitry, green)\n dimitry -= g\n green -= g\n purple -= dimitry\n\n if (purple < 0) return false\n\n return (green + purple + black) >= michal\n}\n\n"}, {"source_code": "import java.util.Scanner\nimport java.util.Arrays\nfun main(args:Array){\n\tval reader = Scanner(System.`in`)\n\tvar t:Int = reader.nextInt()\n\tvar t1:Int = reader.nextInt()\n\tvar t2:Int = reader.nextInt()\n\tvar g:Int = reader.nextInt()\n\tvar g1:Int = reader.nextInt()\n\tvar g2:Int = reader.nextInt()\n\tif(t<=g && t1<=(g-t)+g1 &&t2 <= (g-t1-t)+g1+g2){\n\t\tprintln(\"YES\")\n\t} else {\n\t\tprintln(\"NO\")\n\t}\n}"}, {"source_code": "import java.util.Scanner\nimport java.util.Arrays\nfun main(args:Array){\n\tval reader = Scanner(System.`in`)\n\tvar t:Int = reader.nextInt()\n\tvar t1:Int = reader.nextInt()\n\tvar t2:Int = reader.nextInt()\n\tvar g:Int = reader.nextInt()\n\tvar g1:Int = reader.nextInt()\n\tvar g2:Int = reader.nextInt()\n\tif(t<=g){\n\t\tg-=t\n\t\tif(t1<=g+g1){\n\t\t\tg-=t1;\n\t\t\tif(g<0){\n\t\t\t\tg1+=g\n\t\t\t\tg = 0\n\t\t\t}\n\t\t\tif(t2 <= g+g1+g2){\n\t\t\t\tprintln(\"YES\")\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\tprintln(\"NO\")\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\tprintln(\"NO\")\n\t\t}\n\t} else {\n\t\tprintln(\"NO\")\n\t}\n}"}, {"source_code": "fun main() {\n var andrew = 0 // -> green\n var dmitry = 0 // -> green or purple\n var michal = 0\n readLine()!!.split(\" \").mapIndexed { index, s ->\n when (index) {\n 0 -> andrew = s.toInt()\n 1 -> dmitry = s.toInt()\n 2 -> michal = s.toInt()\n }\n }\n\n var green = 0\n var purple = 0\n var black = 0\n readLine()!!.split(\" \").mapIndexed { index, s ->\n when (index) {\n 0 -> green = s.toInt()\n 1 -> purple = s.toInt()\n 2 -> black = s.toInt()\n }\n }\n\n green -= andrew\n\n if (green < 0) {\n println(\"NO\")\n } else {\n green -= dmitry\n\n if (green < 0) {\n purple -= -green\n\n if (purple < 0) {\n println(\"NO\")\n } else {\n if (purple + black < michal) {\n println(\"NO\")\n } else {\n println(\"YES\")\n }\n }\n\n } else {\n if (green + purple + black < michal) {\n println(\"NO\")\n } else {\n println(\"YES\")\n }\n }\n }\n\n\n}"}, {"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 (x, y, z) = readInts()\n val (a, b, c) = readInts()\n val ok = a >= x && a + b >= x + y && a + b + c >= x + y + z\n println(if (ok) \"YES\" else \"NO\")\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n\n val reader = Scanner(System.`in`)\n val input1 = reader.nextLine()\n val input2 = reader.nextLine()\n\n val neededGrapes = input1.split(\" \")\n val andrewWants = neededGrapes[0].toInt()\n val dmitryWants = neededGrapes[1].toInt()\n val michalWants = neededGrapes[2].toInt()\n\n val totalAvailableGrapes = input2.split(\" \")\n\n var totalGreenGrapes = totalAvailableGrapes[0].toInt()\n var totalPurpleGrapes = totalAvailableGrapes[1].toInt()\n var totalBlackGrapes = totalAvailableGrapes[2].toInt()\n\n\n if (andrewWants > totalGreenGrapes) {\n println(\"NO\")\n return\n } else {\n totalGreenGrapes -= andrewWants;\n }\n\n if (dmitryWants > (totalGreenGrapes + totalPurpleGrapes)) {\n println(\"NO\")\n return\n } else {\n totalGreenGrapes -= dmitryWants\n if (totalGreenGrapes < 0) {\n totalPurpleGrapes += totalGreenGrapes\n totalGreenGrapes = 0\n }\n }\n\n if (michalWants > (totalGreenGrapes + totalPurpleGrapes + totalBlackGrapes)) {\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n\n}"}, {"source_code": "import kotlin.math.min\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 var (x, y, z) = readInts()\n var (a, b, c) = readInts()\n a -= x\n if (a < 0) {\n println(\"NO\")\n return\n }\n var k = min(b, y)\n y -= k\n b -= k\n k = min(a, y)\n y -= k\n a -= k\n if (y > 0) {\n println(\"NO\")\n return\n }\n k = min(z, a)\n a -= k\n z -= k\n k = min(z, b)\n b -= k\n z -= k\n k = min(z, c)\n c -= k\n z -= k\n if (a < 0 || b < 0 || c < 0 || z > 0) {\n println(\"NO\")\n return\n }\n println(\"YES\")\n}"}, {"source_code": "\nimport java.util.Scanner\n\nfun main(args: Array) {\n exercise4()\n}\n\nfun exercise4(){\n val reader = Scanner(System.`in`)\n val andrew = reader.nextInt()\n var dimitri = reader.nextInt()\n val michael = reader.nextInt()\n\n var green = reader.nextInt()\n var purple = reader.nextInt()\n var black = reader.nextInt()\n\n green -= andrew\n if (green < 0){\n println(\"NO\")\n } else {\n if (green >= dimitri){\n green -= dimitri\n if (green < 0){\n println(\"NO\")\n } else {\n if (green + purple + black >= michael) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n }\n } else {\n dimitri -= green\n purple -= dimitri\n green = 0\n if (purple < 0){\n println(\"NO\")\n } else {\n if (green + purple + black >= michael) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n }\n }\n \n\n }\n\n}"}, {"source_code": "import java.util.*\n\n\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n\n var andrew = sc.nextInt()\n var dimitry = sc.nextInt()\n var michal = sc.nextInt()\n\n var green = sc.nextInt()\n var purple = sc.nextInt()\n var black = sc.nextInt()\n\n\n //Andrew\n if(green >= andrew){\n green -= andrew\n andrew = 0\n }\n\n\n //Dimitry\n if(green >= dimitry){\n green -= dimitry\n dimitry = 0\n } else if(dimitry > 0){\n dimitry -= green\n green = 0\n }\n\n if(purple >= dimitry){\n purple -= dimitry\n dimitry = 0\n } else if(dimitry > 0){\n dimitry -= purple\n purple = 0\n }\n\n\n\n\n if(green >= michal){\n green -= michal\n michal = 0\n } else if(michal > 0){\n michal -= green\n green = 0\n }\n\n if(purple >= michal){\n purple -= michal\n michal = 0\n } else if(michal > 0){\n michal -= purple\n purple = 0\n }\n\n if(black >= michal){\n black -= michal\n michal = 0\n } else if(michal > 0){\n michal -= black\n black = 0\n }\n\n\n\n println(if(andrew == 0 && dimitry == 0 && michal == 0) \"YES\" else \"NO\")\n}\n"}, {"source_code": "import java.util.*\n\nfun main() {\n with(Scanner(System.`in`)) {\n val req = nextLine().split(\" \").map{ it.toInt() }.toIntArray()\n val grapeCount = nextLine().split(\" \").map{ it.toInt() }.toIntArray()\n\n var remainingGrape = 0\n for (i in 0..2) {\n if (grapeCount[i] + remainingGrape < req[i]) {\n println(\"NO\")\n return\n }\n remainingGrape = grapeCount[i] + remainingGrape - req[i]\n }\n println(\"YES\")\n }\n}"}, {"source_code": "import java.io.*\nimport java.lang.Math.max\nimport java.lang.Math.min\nimport java.lang.StringBuilder\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n// val n = br.readLine()!!.toInt()\n\n// repeat(n)\n// {\n val (x,y,z) = br.readLine()!!.split(' ').map{it.toInt()}\n val (a,b,c) = br.readLine()!!.split(' ').map{it.toInt()}\n\n// val s = br.readLine()\n// solve1(a)\n// solve2(a,b,c)\n// solve3(s)\n solve4(x,y,z,a,b,c)\n// }\n\n}\n\nfun solve4(x: Int, y: Int, z: Int, a: Int, b: Int, c: Int) {\n // x -> only a\n // y -> not c\n // z -> anything\n\n val ret = if( a >= x && a - x + b >= y && a - x + b - y + c >= z) \"YES\" else \"NO\"\n println(ret)\n}\n\n\nfun solve3(s: String) {\n\n var ns = s.toCharArray().sorted()\n var sb = StringBuilder()\n for(ch in ns)\n {\n sb.append(ch)\n }\n var nss = sb.toString()\n\n if(nss.reversed() == nss)\n {\n println(-1)\n }\n else\n {\n println(nss)\n }\n}\n\nfun solve2(a: Int, b: Int, c: Int) {\n\n var m = min(a, b-1)\n m = min(m, c-2)\n println(3 * m + 3)\n}\n\nfun solve1(num : Int)\n{\n println(num/2)\n}\n\n\n"}, {"source_code": "private val inputRegex = \"\"\"(\\d+)\\s(\\d+)\\s(\\d+)\"\"\".toRegex()\n\nfun main() {\n val (x, y, z) = inputRegex.find(readLine()!!)!!.destructured.toList().map { it.toInt() }\n val (a, b, c) = inputRegex.find(readLine()!!)!!.destructured.toList().map { it.toInt() }\n\n val result = if (satisfiedCondition(x, y, z, a, b, c)) \"YES\" else \"NO\"\n println(result)\n\n\n}\n\nfun satisfiedCondition(x: Int, y: Int, z: Int, a: Int, b: Int, c: Int): Boolean {\n if (a < x) return false\n if (a + b < x + y) return false\n if (a + b + c < x + y + z) return false\n\n return true\n}\n"}, {"source_code": "private val inputRegex = \"\"\"(\\d+)\\s(\\d+)\\s(\\d+)\"\"\".toRegex()\n\nfun main() {\n val (x, y, z) = inputRegex.find(readLine()!!)!!.destructured.toList().map { it.toInt() }\n val (a, b, c) = inputRegex.find(readLine()!!)!!.destructured.toList().map { it.toInt() }\n\n val result = if (satisfiedCondition(x, y, z, a, b, c)) \"YES\" else \"NO\"\n println(result)\n\n\n}\n\nfun satisfiedCondition(x: Int, y: Int, z: Int, a: Int, b: Int, c: Int): Boolean {\n if (a < x) return false\n val ab = a+b\n val xy = x+y\n if (ab < xy) return false\n if (ab + c < xy + z) return false\n\n return true\n}"}, {"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 && a - x + b - y + c >= z) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}"}, {"source_code": "fun main() {\n var (x, y, z) = readLine()!!.split(' ').map { it.toInt() }\n var (a, b, c) = readLine()!!.split(' ').map { it.toInt() }\n\n if (a < x) {\n print(\"NO\")\n return\n } else {\n a -= x\n x = 0\n }\n\n if (a > 0) {\n if (y > a) {\n y -= a\n a = 0\n } else {\n a -= y\n y = 0\n }\n }\n\n if (y > 0) {\n if (y > b) {\n print(\"NO\")\n return\n } else {\n b -= y\n y = 0\n }\n }\n\n if(a > 0){\n if (z > a) {\n z -= a\n } else {\n print(\"YES\")\n return\n }\n }\n\n if(b > 0){\n if (z > b) {\n z -= b\n } else {\n print(\"YES\")\n return\n }\n }\n\n if(c > 0){\n if (z > c) {\n print(\"NO\")\n return\n } else {\n print(\"YES\")\n return\n }\n }\n\n if(x == 0 && y ==0 && z ==0){\n print(\"YES\")\n }else{\n print(\"NO\")\n }\n}"}, {"source_code": "/**\n * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools\n */\n\nfun main() {\n val (x,y,z) = readInts()\n val (a,b,c) = readInts()\n val a1 = a - x\n val b1 = b + a1 - y\n val c1 = c + b1 - z\n val res = a1 >= 0 && b1 >= 0 && c1 >= 0\n println(if (res) \"YES\" else \"NO\")\n}\n\nprivate fun readInts() = readLine()!!.split(\" \").map { it.toInt() }"}, {"source_code": "fun main(args : Array) {\n val (x1, y1, z1) = readLine()!!.split(' ')\n val (g1, p1, b1) = readLine()!!.split(' ')\n var x = x1.toInt()\n var y = y1.toInt()\n var z = z1.toInt()\n var g = g1.toInt()\n var p = p1.toInt()\n var b = b1.toInt()\n var d = 0\n var m = 0\n\n if(g>=x){\n d = g + p - x\n if(d>=y){\n m = g+p+b-x-y\n if(m>=z){\n println(\"YES\")\n }\n else{\n println(\"NO\")\n }\n }\n else{\n println(\"NO\")\n }\n\n }\n else{\n println(\"NO\")\n }\n\n}"}, {"source_code": "fun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readStrings() = readLn().split(\" \")\nfun readInts() = readStrings().map(String::toInt)\n\nfun main() {\n val (x, y, z) = readInts()\n val (a, b, c) = readInts()\n\n if (a < x || a + b < x + y || a + b + c < x + y + z)\n println(\"NO\")\n else\n println(\"YES\")\n}\n\n"}, {"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"}, {"source_code": "import java.util.*\n\nfun main() {\n\n val sc = Scanner(System.`in`)\n val xyz = IntArray(3)\n val abc = IntArray(3)\n\n for (i in 0..2) xyz[i] = sc.nextInt()\n for (i in 0..2) abc[i] = sc.nextInt()\n\n if (abc[0] < xyz[0]) {\n print(\"NO\")\n return\n } else abc[1] += (abc[0] - xyz[0])\n\n if (abc[1] < xyz[1]) {\n print(\"NO\")\n return\n } else abc[2] += (abc[1] - xyz[1])\n\n if (abc[2] < xyz[2]) {\n print(\"NO\")\n return\n }\n\n print(\"YES\")\n\n}"}, {"source_code": "fun main() {\n val needed = readLine()!!.split(' ').map { it.toInt() }\n val available = readLine()!!.split(' ').map { it.toInt() }\n var leftOver = 0\n for (i in 0..2) {\n if (leftOver + available[i] < needed[i]) {\n println(\"NO\")\n return\n } else {\n leftOver = leftOver + available[i] - needed[i]\n }\n }\n println(\"YES\")\n}\n"}, {"source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val x = sc.nextInt()\n val y = sc.nextInt()\n val z = sc.nextInt()\n var a = sc.nextInt()\n var b = sc.nextInt()\n var c = sc.nextInt()\n if (a >= x) {\n a -= x\n b += a\n } else {\n println(\"NO\")\n return\n }\n\n if (b >= y) {\n b -= y\n c += b\n } else {\n println(\"NO\")\n return\n }\n\n if (c >= z) {\n\n } else {\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n}\n"}, {"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 val take = Math.min(want[i], have[j])\n want[i] -= take\n have[j] -= take\n }\n if ( want[i] > 0 ) {\n println( \"NO\" )\n return\n }\n }\n println( \"YES\" )\n}"}, {"source_code": "fun main(args: Array) {\n val (x, y, z) = readLine()!!.split(\" \").map { it.toInt() }\n var (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n if (a < x) {\n println(\"NO\")\n return\n }\n a -= x\n if (a + b < y) {\n println(\"NO\")\n return\n }\n c += a + b - y\n if (c < z) {\n println(\"NO\")\n return\n }\n println(\"YES\")\n}"}, {"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+b>=x+y)&&(a+b+c>=x+y+z))\n println(\"YES\");\n else\n println(\"NO\");\n}"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (x, y, z) = readInts()\n val (green, purple, black) = readInts()\n print(if (green >= x && green + purple - x >= y && green + purple + black >= x + y + z) \"YES\" else \"NO\")\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main() {\n val tokenizer = BufferedReader(InputStreamReader(System.`in`)).use { StringTokenizer(it.readText()) }\n val a = Array(6) { tokenizer.nextInt() }\n if (a[3] >= a[0] && a[3] + a[4] >= a[0] + a[1] && a[3] + a[4] + a[5] >= a[0] + a[1] + a[2])\n println(\"YES\")\n else\n println(\"NO\")\n}\n\nfun StringTokenizer.nextInt() = nextToken().toInt()\nfun StringTokenizer.nextLong() = nextToken().toLong()\n"}, {"source_code": "fun main() {\n var str = readLine().toString()\n var arr = str.split(\" \").toTypedArray()\n var a = arr[0].toInt()\n var d = arr[1].toInt()\n var m = arr[2].toInt()\n str = readLine().toString()\n arr = str.split(\" \").toTypedArray()\n var g = arr[0].toInt()\n var p = arr[1].toInt()\n var b = arr[2].toInt()\n if (((g-a) >= 0) && ((p+g-a-d) >= 0) && ((g+p+b) >= (a+d+m))) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}"}, {"source_code": "fun main( )\n{\n var (x, y, z) = readLine()!!.split(' ').map(String::toInt)\n var (a, b, c) = readLine()!!.split(' ').map(String::toInt)\n if (a) = with(Scanner(System.`in`)) {\n val x = nextInt()\n val y = nextInt()\n val z = nextInt()\n\n val a = nextInt()\n val b = nextInt()\n val c = nextInt()\n\n val greenDiff = a - x\n if (greenDiff < 0) {\n print(\"NO\")\n return@with\n }\n\n val purpleDiff = greenDiff + b - y\n if (purpleDiff < 0) {\n print(\"NO\")\n return@with\n }\n\n val blackDiff = purpleDiff + c - z\n if (blackDiff < 0) {\n print(\"NO\")\n return@with\n }\n\n print(\"YES\")\n}"}], "negative_code": [{"source_code": "import java.util.*\n\n\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n\n var andrew = sc.nextInt()\n var dimitry = sc.nextInt()\n var michal = sc.nextInt()\n\n var green = sc.nextInt()\n var purple = sc.nextInt()\n var black = sc.nextInt()\n\n\n if(green > andrew){\n green -= andrew\n andrew = 0\n }\n\n\n\n if(green > dimitry){\n green -= dimitry\n dimitry = 0\n } else {\n dimitry -= green\n green = 0\n }\n\n if(purple > dimitry){\n purple -= dimitry\n dimitry = 0\n } else {\n dimitry -= purple\n purple = 0\n }\n\n\n\n\n if(green > michal){\n green -= michal\n michal = 0\n } else {\n michal -= green\n green = 0\n }\n\n if(purple > michal){\n purple -= michal\n michal = 0\n } else {\n michal -= purple\n purple = 0\n }\n\n if(black > michal){\n black -= michal\n michal = 0\n } else {\n michal -= black\n green = 0\n }\n\n\n\n println(if(andrew == 0 && dimitry == 0 && michal == 0) \"YES\" else \"NO\")\n}\n"}, {"source_code": "fun main(args: Array) {\n\n val (an, dm, mh) = readLine()!!\n .split(\" \")\n .map { Integer.valueOf(it)!! }\n\n var (green, purple, black) = readLine()!!\n .split(\" \")\n .map { Integer.valueOf(it)!! }\n if (green < an) {\n no()\n return\n } else {\n green -= an\n }\n\n if (green + purple < dm) {\n no()\n return\n }\n\n if (green + purple + black - dm - mh > 0) {\n println(\"YES\")\n } else {\n no()\n }\n}\n\nfun no() {\n println(\"NO\")\n}\n"}, {"source_code": "fun main()\n{\n var (x, y, z) = readLine()!!.split(\" \").map{it.toInt()};\n var (a, b, c) = readLine()!!.split(\" \").map{it.toInt()};\n if (x>a)\n println(\"NO\");\n else\n {\n a-=x;\n if (y>a+c)\n println(\"NO\");\n else\n {\n var tot = a+b+c-y;\n if (z>tot)\n println(\"NO\");\n else\n println(\"YES\");\n }\n }\n}"}, {"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"}, {"source_code": "fun solve(x:Int, y:Int, z:Int, a:Int, b:Int, c:Int):Int {\n\tif (x > a || x+y > a+b+c || x+y+z > a+b+c)\n\t\treturn 1\n\telse\n\t\treturn 0\n}\n\nfun main() {\n\tval (x, y, z) = readLine()!!.split(' ').map(String::toInt)\n\tval (a, b, c) = readLine()!!.split(' ').map(String::toInt)\n\tval ans = solve(x, y, z, a, b, c);\n\tprint(arrayOf(\"YES\", \"NO\")[ans])\n}\n"}, {"source_code": "import java.util.Scanner\n\nval no = \"NO\"\nval yes = \"YES\"\n\nfun main() {\n val scanner = Scanner(System.`in`)\n\n val and = scanner.nextInt()\n var dm = scanner.nextInt()\n val mi = scanner.nextInt()\n\n var green = scanner.nextInt()\n var purple = scanner.nextInt()\n val black = scanner.nextInt()\n\n if (and > green) {\n println(no)\n return\n }\n green -= and\n if (dm > green + purple) {\n println(no)\n return\n }\n\n if (green >= dm) {\n green -= dm\n } else {\n dm -= green\n green = 0\n purple -= dm\n }\n\n println(if (green + purple + black > mi) yes else no)\n}"}, {"source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n val xyz = readLine()!!.split(' ')\n val abc = readLine()!!.split(' ')\n\n val x = xyz[0].toInt() // only a\n val y = xyz[1].toInt() // not c\n val z = xyz[2].toInt() // any\n\n val a = abc[0].toInt()\n val b = abc[1].toInt()\n val c = abc[2].toInt()\n\n val a0 = a - x\n\n if (a0 < 0) {\n println(\"NO\")\n return\n }\n\n val y0 = max(a0 - y, 0)\n val a1 = a0 - y0\n val b0 = b - (y - y0)\n\n if (b0 < 0) {\n println(\"NO\")\n return\n }\n\n val c0 = (a1 + b0 + c) - z\n\n if (c0 < 0) {\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n}"}, {"source_code": "import java.util.Scanner\n\nval no = \"NO\"\nval yes = \"YES\"\n\nfun main() {\n val scanner = Scanner(System.`in`)\n\n val and = scanner.nextInt()\n var dm = scanner.nextInt()\n val mi = scanner.nextInt()\n\n var green = scanner.nextInt()\n var purple = scanner.nextInt()\n val black = scanner.nextInt()\n\n if (and >= green) {\n println(no)\n return\n }\n green -= and\n if (dm >= green + purple) {\n println(no)\n return\n }\n\n if (green >= dm) {\n green -= dm\n } else {\n dm -= green\n green = 0\n purple -= dm\n }\n\n println(if (green + purple + black >= mi) yes else no)\n}"}, {"source_code": "import java.io.*\nimport java.lang.Math.max\nimport java.lang.Math.min\nimport java.lang.StringBuilder\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n// val n = br.readLine()!!.toInt()\n\n// repeat(n)\n// {\n val (x,y,z) = br.readLine()!!.split(' ').map{it.toInt()}\n val (a,b,c) = br.readLine()!!.split(' ').map{it.toInt()}\n\n// val s = br.readLine()\n// solve1(a)\n// solve2(a,b,c)\n// solve3(s)\n solve4(x,y,z,a,b,c)\n// }\n\n}\n\nfun solve4(x: Int, y: Int, z: Int, a: Int, b: Int, c: Int) {\n // x -> only a\n // y -> not c\n // z -> anything\n\n var ret = \"YES\"\n\n if(x > a)\n {\n ret = \"NO\"\n }\n else\n {\n var newa = a - x\n\n var newz = max( z - c, 0)\n\n var newc = if(z < c) c - z else 0\n\n val left = b + newa + newc\n\n if(y + newz > left) ret = \"NO\"\n }\n\n println(ret)\n}\n\n\nfun solve3(s: String) {\n\n var ns = s.toCharArray().sorted()\n var sb = StringBuilder()\n for(ch in ns)\n {\n sb.append(ch)\n }\n var nss = sb.toString()\n\n if(nss.reversed() == nss)\n {\n println(-1)\n }\n else\n {\n println(nss)\n }\n}\n\nfun solve2(a: Int, b: Int, c: Int) {\n\n var m = min(a, b-1)\n m = min(m, c-2)\n println(3 * m + 3)\n}\n\nfun solve1(num : Int)\n{\n println(num/2)\n}\n\n\n"}, {"source_code": "fun main(args: Array) {\n val parts = readLine()!!.toString().split(\" \")\n val A : Int =parts.get(0).toInt()\n val D : Int= parts.get(1).toInt()\n val M : Int = parts.get(2).toInt()\n\n val grappe = readLine()!!.toString().split(\" \")\n val G : Int =grappe.get(0).toInt()\n val P : Int= grappe.get(1).toInt()\n val B : Int = grappe.get(2).toInt()\n\n var res : String =\"YES\"\n\n val restG = G - A\n\n if(restG<0){\n res = \"NO\"\n }else{\n\n val restPG = D - (restG + P)\n if( restPG < 0){\n res = \"NO\"\n }else{\n val restPGD = M - restPG\n if(restPGD < 0 ){\n res = \"NO\"\n }\n }\n\n }\n\n println(\"$res\")\n}"}, {"source_code": "fun anyGrapes(want:List, grapes:List){\n if(want[0].toInt() > grapes[0].toInt()){\n println(\"NO\")\n }\n else {\n val dymiCurr = want[1].toInt()\n val michCurr = want[2].toInt() - grapes[2].toInt() //Michael gets all black grapes\n val remainGrPu = (grapes[0].toInt() + grapes[1].toInt()) - (want[0].toInt()) //remaining green and purple grapes\n\n if (((dymiCurr+michCurr) - remainGrPu) > 0){\n println(\"NO\")\n return\n }\n println(\"YES\")\n }\n}\n\n\nfun main(args:Array){\n val want = readLine()!!.split(\" \")\n val grapes = readLine()!!.split(\" \")\n anyGrapes(want, grapes)\n}"}, {"source_code": "// contest/1171/problem/B Kotlin heroes training done\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n var canDo: Boolean\n val xyz = readInts()\n var (x,y,z) = xyz\n val abc = readInts()\n var (a,b,c) = abc\n if (a < x) {\n canDo = false\n } else {\n a -= x\n if (a+b < y) {\n canDo = false\n } else {\n if (a > y) {\n y -= a\n } else {\n b -= (y-a)\n a = 0\n }\n canDo = (a+b+c) >= z\n }\n }\n\n println( if (canDo) \"YES\" else \"NO\" )\n}\n"}, {"source_code": "import kotlin.math.min\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 var (x, y, z) = readInts()\n var (a, b, c) = readInts()\n a -= x\n if (a < 0) {\n println(\"NO\")\n return\n }\n var k = min(a, y)\n y -= k\n a -= k\n if (y > 0) {\n c -= y\n }\n k = min(z, a)\n a -= k\n z -= k\n k = min(z, b)\n b -= k\n z -= k\n k = min(z, c)\n c -= k\n z -= k\n if (a < 0 || b < 0 || c < 0 || z > 0) {\n println(\"NO\")\n return\n }\n println(\"YES\")\n}"}, {"source_code": "fun main() {\n val (x, y, z) = readLine()!!.split(\" \").map(String::toInt)\n val (a, b, c) = readLine()!!.split(\" \").map(String::toInt)\n if (a >= x && a + b >= x + y && a + c + c >= x + y + z) print(\"YES\") else print(\"NO\")\n}\n"}, {"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}"}, {"source_code": " fun main(args:Array){\n val (a, b, c) = readLine()!!.split(' ')\n var x1:Int = a.toInt()\n var y1:Int = b.toInt()\n var z1:Int = c.toInt()\n val (a1, b1, c1) = readLine()!!.split(' ')\n var x:Int = a1.toInt()\n var y:Int = b1.toInt()\n var z:Int = c1.toInt()\n var flag = 0\n if(x1 <= x && flag == 0) {x -= x1}\n else {flag = 1}\n \n if(y1 <= (y + x) && flag == 0) \n {if(y1 <= y) y -= y1\n else y = 0; x -= (y - y1)}\n else {flag = 1}\n \n if(z1 <= (x + y + z) && flag == 0) {flag = 0}\n else {flag = 1} \n \n if(flag == 0) {println(\"YES\")}\n else {println(\"NO\")}\n}"}, {"source_code": "import 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(args: Array) {\n\n var(x,y,z) =readInts()\n var(green,purple,black) =readInts()\n\n var temp:Int\n\n temp=green-x\n if(temp<0){\n println(\"NO\")\n return\n }else{\n green-x\n }\n temp=(green+purple)-y\n if(temp<0){\n println(\"NO\")\n return\n }else{\n val purp=y-green\n val gre=y-purple\n green-gre\n purple-purp\n }\n\n temp=(green+purple+black)-z\n\n if(temp<0){\n println(\"NO\")\n return\n }\n println(\"YES\")\n\n\n}\n\n"}, {"source_code": "fun main() {\n val targetGrapes = readLine()!!\n val nGrapes = readLine()!!\n println(getGoodString(targetGrapes.split(\" \"), nGrapes.split(\" \")))\n}\n\nfun getGoodString(targetGrapes: List, nGrapes: List): String {\n val targetAndrew = targetGrapes[0].toInt()\n val targetDmitry = targetGrapes[1].toInt()\n val targetMichael = targetGrapes[2].toInt()\n var nGreen = nGrapes[0].toInt()\n val nPurple = nGrapes[1].toInt()\n val nBlack = nGrapes[2].toInt()\n if (nGreen < targetAndrew) return \"NO\"\n nGreen -= targetAndrew\n if (nGreen + nPurple < targetDmitry) return \"NO\"\n val remaining = nGreen + nPurple + nBlack - targetDmitry\n if (remaining < targetMichael) return \"YES\"\n return \"NO\"\n}"}, {"source_code": "fun main()\n{\n var (x, y, z) = readLine()!!.split(\" \").map{it.toInt()};\n var (a, b, c) = readLine()!!.split(\" \").map{it.toInt()};\n if (x>a)\n println(\"NO\");\n else\n {\n a-=x;\n if (y>a+c)\n println(\"NO\");\n else\n {\n var tot = a+b+c-y;\n if (z>tot)\n println(\"NO\");\n else\n println(\"YES\");\n }\n }\n}"}, {"source_code": "fun main() {\n val want = readLine()!!.split(\" \").map{it.toInt()}\n val box = readLine()!!.split(\" \").map{it.toInt()}\n\n\n\n if (box[0]= y) {\n b = b - y\n y = 0\n } else {\n y = y - b\n b = 0\n }\n if (c >= y) {\n c = c - y\n y = 0\n } else {\n y = y - c\n c = 0\n }\n if (y > 0) {\n println(\"NO\")!!\n return\n }\n if (a + b + c >= z) {\n println(\"YES\")!!\n } else {\n println(\"NO\")!!\n }\n }\n}"}, {"source_code": "\nimport java.util.Scanner\n\nfun main(args: Array) {\n exercise4()\n}\n\nfun exercise4(){\n val reader = Scanner(System.`in`)\n val andrew = reader.nextInt()\n var dimitri = reader.nextInt()\n val michael = reader.nextInt()\n\n var green = reader.nextInt()\n var purple = reader.nextInt()\n var black = reader.nextInt()\n\n green -= andrew\n if (green < 0){\n println(\"NO\")\n } else {\n if (green >= dimitri){\n green -= dimitri\n } else {\n dimitri -= green\n purple -= dimitri\n green = 0\n if (purple < 0){\n println(\"NO\")\n } else {\n if (green + purple + black >= michael) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n }\n }\n }\n\n}"}, {"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 (x, y, z) = readInts() // num they want to eat\n val (g, p, b) = readInts()\n \n // x will only eat greens\n // y will only eat green or black\n // z eats all\n \n var greens = g\n greens -= x // x eats the green grapes he wants\n var notBlack = greens + p\n notBlack -= y\n var rest = greens + notBlack + b\n rest -= z\n \n if (greens >= 0 && notBlack >= 0 && rest >= 0)\n println(\"YES\")\n else \n println(\"NO\")\n}\n"}, {"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"}, {"source_code": "\nfun main(args: Array) {\n val (andrew, dmitry, mischal) = readLine()!!.map { it.toInt() }\n val (green, purple, black) = readLine()!!.map { it.toInt() }\n\n if (green < andrew) {\n println(\"NO\")\n return\n }\n val remainGreen = green - andrew\n if (remainGreen + purple < dmitry) {\n println(\"NO\")\n return\n }\n val remain = remainGreen + purple - andrew\n if (remain + black < mischal) {\n println(\"NO\")\n return\n }\n println(\"YES\")\n}"}, {"source_code": "import 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 { it.toInt() } // list of ints\n\nfun main() {\n var (x, y, z) = readInts()\n var (a, b, c) = readInts()\n if (x+y+z>a+b+c || x>a || y>a-x+c) {\n println(\"NO\")\n } else {\n println(\"YES\")\n }\n}"}, {"source_code": "import 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(args: Array) {\n\n var(x,y,z) =readInts()\n var(green,purple,black) =readInts()\n\n var temp:Int\n\n temp=green-x\n if(temp<0){\n println(\"NO\")\n return\n }\n temp=(green+purple)-y\n if(temp<0){\n println(\"NO\")\n return\n }\n\n temp=(green+purple+black)-z\n\n if(temp<0){\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n\n\n}\n\n"}, {"source_code": "fun isEnough(wish: List, grapes: List) {\n val enough = grapes[0] >= wish[0] &&\n grapes[0] + grapes[1] >= wish[1] &&\n grapes[0] + grapes[1] + grapes[2] >= wish[2]\n println(when(enough) {\n true -> \"YES\"\n else -> \"NO\"\n })\n}\n\nfun main() {\n val wish = readLine()!!.split(\" \").map { it.toInt() }\n val grapes = readLine()!!.split(\" \").map { it.toInt() }\n\n isEnough(wish, grapes)\n}"}, {"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&&(x-a+b>=y)&&(x+y-a-b+c>=z)\n println(if (ans)\"YES\" else \"NO\")\n}"}, {"source_code": "// contest/1171/problem/B Kotlin heroes training done\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n var canDo: Boolean\n val xyz = readInts()\n var (x,y,z) = xyz\n val abc = readInts()\n var (a,b,c) = abc\n if (a < x) {\n canDo = false\n } else {\n a -= x\n if (a+b < y) {\n canDo = false\n } else {\n if (a > y) {\n y -= a\n } else {\n b -= (y-a)\n a = 0\n }\n canDo = (a+b+c) >= z\n }\n }\n\n println( if (canDo) \"YES\" else \"NO\" )\n}\n"}, {"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 (x>a) println(\"NO\")\n if (x+y>a+b) println(\"NO\")\n if (x+y+z>a+b+c) println(\"NO\") else println(\"YES\")\n}"}, {"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\n val grapesMap = mutableMapOf(\n \"green\" to a,\n \"purple\" to b,\n \"black\" to c\n )\n\n provideAndrew(grapesMap, x)\n provideDmitri(grapesMap, y)\n provideMichal(grapesMap, z)\n if (isValidDistribution(grapesMap)) println(\"YES\") else println(\"NO\")\n}\n\nprivate fun provideAndrew(grapesMap: MutableMap, wanted: Int) {\n grapesMap[\"green\"] = grapesMap[\"green\"]!!.minus(wanted)\n}\n\nprivate fun provideDmitri(grapesMap: MutableMap, wanted: Int) {\n val purple = grapesMap[\"purple\"]!!\n if (wanted <= purple) {\n grapesMap[\"purple\"] = purple.minus(wanted)\n return\n }\n grapesMap[\"purple\"] = 0\n grapesMap[\"green\"] = grapesMap[\"green\"]!!.minus(wanted - purple)\n}\n\nprivate fun provideMichal(grapesMap: MutableMap, wanted: Int) {\n grapesMap[\"black\"] = grapesMap[\"black\"]!!.minus(wanted)\n}\n\nprivate fun isValidDistribution(grapesMap: MutableMap): Boolean {\n return grapesMap.filter { it.value >= 0 }.size == grapesMap.size\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val (x, y, z) = scan.nextLine().split(\" \").map { it.toInt() }\n var (a, b, c) = scan.nextLine().split(\" \").map { it.toInt() }\n\n if (a < x) {\n println(\"NO\")\n return\n }\n\n a -= x // 3\n\n var greenAndPurple = a + b\n\n if(y < greenAndPurple) {\n println(\"NO\")\n return\n }\n\n greenAndPurple -= y\n\n val allGrapes = greenAndPurple + z\n if(allGrapes < z) {\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n}"}, {"source_code": "fun readInt(): Long = readLine()!!.toLong()\nfun readInts(): List = readLine().orEmpty().split(\" \").map { it.toLong() }\n\nfun main() {\n val x = readInts().cumsum()\n val y = readInts().cumsum()\n\n val yes = (x zip y).all { (a, b) -> a >= b }\n\n println(if (yes) \"YES\" else \"NO\")\n}\n\nfun Iterable.reductions(initial: R, operation: (acc: R, T) -> R): Sequence = sequence {\n var last = initial\n forEach {\n last = operation(last, it)\n yield(last)\n }\n}\n\nfun List.cumsum() = this.reductions(0L) { acc, l -> acc + l }.toList()"}, {"source_code": "fun main() {\n val want = readLine()!!.split(\" \").map{it.toInt()}\n val box = readLine()!!.split(\" \").map{it.toInt()}\n\n\n when {\n (box[0]+box[1]+box[2]-want[0]-want[1]) < want[2] -> println(\"NO\")\n box[0] println(\"NO\")\n box[0]-want[0]+box[2]-want[2]+box[1] println(\"NO\")\n else -> println(\"YES\")\n }\n\n}"}, {"source_code": "import 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(args: Array) {\n\n var (x, y, z) = readInts()\n var (green, purple, black) = readInts()\n\n var temp: Int\n\n temp = green-x\n if (temp < 0) {\n println(\"NO\")\n return\n } else {\n green -= x\n }\n temp = (green + purple)-y\n if (temp < 0) {\n println(\"NO\")\n return\n } else {\n val pur = y - green\n val gre = y - purple\n green -= gre\n purple -= pur\n }\n\n temp = (green + purple + black)-z\n\n if (temp < 0) {\n println(\"NO\")\n return\n }\n println(\"YES\")\n\n\n}\n\n"}, {"source_code": "import 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 { it.toInt() } // list of ints\n\nfun main() {\n var (x, y, z) = readInts()\n var (a, b, c) = readInts()\n if (x+y+z>a+b+c || x>a || y>a-x+c) {\n println(\"NO\")\n } else {\n println(\"YES\")\n }\n}"}, {"source_code": "fun main() {\n println(\n if (gotGrapes()) { \"YES\" } else { \"NO\" }\n )\n}\n\nfun gotGrapes() : Boolean {\n var (andrew, dimitry, michal) = readLine()!!.split(\" \").map(String::toInt)\n var (green, purple, black) = readLine()!!.split(\" \").map(String::toInt)\n\n green -= andrew\n\n if (green < 0) return false\n\n val i = kotlin.math.min(dimitry, green)\n dimitry -= i\n green -= i\n purple - dimitry\n\n if (purple < 0) return false\n\n return (green + purple + black) >= michal\n}"}, {"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, d, m) = read().map(String::toInt)\n var (g, p, b) = read().map(String::toInt)\n var ans = \"YES\"\n if (g < a) ans = \"NO\"\n else if ((g + p) < (a + d)) ans = \"NO\"\n else if ((g + p + b) <= (a + d + m)) ans = \"NO\"\n println(ans)\n\n\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n\n val needs = nextLine()!!.split(\"\\\\s\".toRegex())\n val peopleNeeds = needs.map { it.toInt() }.toMutableList()\n val grapes = nextLine()!!.split(\"\\\\s\".toRegex()).map { it.toInt() }.toMutableList()\n\n val peopleGrapes = listOf(intArrayOf(0), intArrayOf(0, 1), intArrayOf(0, 1, 2))\n\n val enoughGrapes = hasEnoughtGrapes(peopleNeeds, grapes, peopleGrapes)\n\n if (enoughGrapes) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n\n}\n\nfun hasEnoughtGrapes(peopleNeeds: MutableList, grapes: MutableList, peopleGrapes: List): Boolean {\n\n peopleNeeds.forEachIndexed { personIndex, need ->\n\n peopleGrapes[personIndex].forEachIndexed { index, grapeIndex ->\n val grapeAmount = grapes[grapeIndex]\n if (grapeAmount >= need) {\n grapes[grapeIndex] -= need\n peopleNeeds[personIndex] = 0\n } else {\n grapes[grapeIndex] = 0\n peopleNeeds[personIndex] -= grapeAmount\n }\n }\n\n if (peopleNeeds[personIndex] > 0 ) {\n return false\n }\n }\n\n return true\n\n}\n"}, {"source_code": "fun main() {\n val (andrew, dimitry, michael) = readLine()!!.split(\" \").map(Integer::valueOf)\n var (green, purple, black) = readLine()!!.split(\" \").map(Integer::valueOf)\n var a = false\n var b = false\n var c = false\n\n if (green >= andrew) {\n green -= andrew\n a = true\n }\n\n if (green + purple >= dimitry) {\n var remaining = dimitry\n if (remaining - green >= 0) {\n val removed = green\n remaining -= green\n green -= removed\n\n }\n\n if (remaining != 0 && purple >= remaining) {\n val removed = remaining\n purple -= removed\n remaining = 0\n }\n\n if (remaining == 0) {\n b = true\n }\n }\n\n if (black + green + purple >= michael) {\n c = true\n }\n\n if (a && b && c) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}"}, {"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 (x > a) {\n print(\"NO\")\n return\n }\n val r = a - x\n if (y > r + b) {\n print(\"NO\")\n return\n }\n if (z > c) {\n print(\"NO\")\n return\n }\n print(\"YES\")\n}"}, {"source_code": "import kotlin.math.min\n\nfun main(){\n var (a, d, m) = readInts()\n var (g, p, b) = readInts()\n\n if (g < a) {\n println(\"NO\")\n return\n }\n g -= a\n\n if (g+p < d) {\n println(\"NO\")\n return\n }\n\n d -= g\n g = min(0, g-p)\n p -= d\n\n if (g+p+b < m) {\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n}\n\n\nprivate fun readLn(): String = readLine()!!\nprivate fun readInt(): Int = readLn().toInt()\nprivate fun readStrings(): List = readLn().split(\" \")\nprivate fun readInts(): List = readStrings().map { it.toInt() }\nprivate fun readLines(n: Int): List = (0 until n).map { readLn() }\nprivate fun readIntLines(n: Int): List = readLines(n).map { it.toInt() }\nprivate fun String.isPalindrome(): Boolean = this == this.reversed()\nprivate fun String.containsSameChar(): Boolean = this.toCharArray().groupBy { it }.size == 1\nprivate fun String.rotate(n: Int): String = drop(n % length) + take(n % length)\n"}, {"source_code": "fun main( args : Array) {\n\n val (x,y,z)=readLine()!!.split(\" \").map{it.toInt()}\n var (a,b,c)=readLine()!!.split(\" \").map{it.toInt()}\n\n\n if (x<=a){\n a-=x\n if (y<=a+b){\n c=c+a+b-y\n }else{\n println(\"NO\")\n }\n if (z>c){\n println(\"NO\")\n }\n println(\"YES\")\n }else{\n println(\"NO\")\n }\n\n}"}, {"source_code": "fun main() {\n val targetGrapes = readLine()!!\n val nGrapes = readLine()!!\n println(getGoodString(targetGrapes.split(\" \"), nGrapes.split(\" \")))\n}\n\nfun getGoodString(targetGrapes: List, nGrapes: List): String {\n val targetAndrew = targetGrapes[0].toInt()\n val targetDmitry = targetGrapes[1].toInt()\n val targetMichael = targetGrapes[2].toInt()\n var nGreen = nGrapes[0].toInt()\n val nPurple = nGrapes[1].toInt()\n val nBlack = nGrapes[2].toInt()\n if (nGreen < targetAndrew) return \"NO\"\n nGreen -= targetAndrew\n if (nGreen + nPurple < targetDmitry) return \"NO\"\n val remaining = nGreen + nPurple + nBlack - targetDmitry\n if (remaining < targetMichael) return \"YES\"\n return \"NO\"\n}"}, {"source_code": "fun main(args : Array) {\n\n val NT = 1//readLine()?.toInt() ?: 0\n\n\n for(test in 1..NT){\n val (x, y, z) = readLine()!!.split(\" \").map { it.toInt() }\n val (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n val ok = a >= x && a + b >= x + y && a + b + c >= z\n println(if(ok)\"YES\" else \"NO\")\n }\n\n}"}, {"source_code": "fun main() {\n val (a, d, m) = readLine()!!.split(' ').map(String::toInt)\n val (g, v, b) = readLine()!!.split(' ').map(String::toInt)\n\n //a - g\n //d - g v\n //m - g v b\n\n var g1 = g\n var v1 = v\n val a1: Int\n val d1: Int\n\n val m1 = m - b\n\n //misha check\n if (m1 > 0) {\n v1 = v - m1\n if (v1 < 0) {\n print(\"NO\")\n } else {\n //dima check\n d1 = d - v1\n if (d1 > 0) {\n g1 = g - d1\n if (g1 < 0) {\n print(\"NO\")\n } else {\n //g1 - \u0437\u0435\u043b\u0435\u043d\u044b\u0435 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c\n //andrew check\n a1 = a - g1\n if (a1 > 0) {\n print(\"NO\")\n } else {\n print(\"YES\")\n }\n }\n }\n }\n } else {\n //dima check\n d1 = d - v1\n if (d1 > 0) {\n g1 = g - d1\n if (g1 < 0) {\n print(\"NO\")\n } else {\n //g1 - \u0437\u0435\u043b\u0435\u043d\u044b\u0435 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c\n //andrew check\n a1 = a - g1\n if (a1 > 0) {\n print(\"NO\")\n } else {\n print(\"YES\")\n }\n }\n }else{\n //andrew check\n a1 = a - g1\n if (a1 > 0) {\n print(\"NO\")\n } else {\n print(\"YES\")\n }\n }\n }\n}\n\n"}, {"source_code": "import java.util.Scanner;\n\nfun main() {\n with(Scanner(System.`in`)) {\n var x = nextInt()\n var y = nextInt()\n var z = nextInt()\n var a = nextInt() // green\n var b = nextInt() // purple\n var c = nextInt() // black\n a = a - x\n if (a < 0) {\n println(\"NO\")!!\n return\n }\n if (b >= y) {\n b = b - y\n y = 0\n } else {\n y = y - b\n b = 0\n }\n if (c >= y) {\n c = c - y\n y = 0\n } else {\n y = y - c\n c = 0\n }\n if (y > 0) {\n println(\"NO\")!!\n return\n }\n if (a + b + c >= z) {\n println(\"YES\")!!\n } else {\n println(\"NO\")!!\n }\n }\n}"}, {"source_code": "fun main() {\n println(\n if (gotGrapes()) { \"YES\" } else { \"NO\" }\n )\n}\n\nfun gotGrapes() : Boolean {\n var (andrew, dimitry, michal) = readLine()!!.split(\" \").map(String::toInt)\n var (green, purple, black) = readLine()!!.split(\" \").map(String::toInt)\n\n green -= andrew\n\n if (green < 0) return false\n\n val i = kotlin.math.min(dimitry, green)\n dimitry -= i\n green -= i\n purple - dimitry\n\n if (purple < 0) return false\n\n return (green + purple + black) >= michal\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val (x, y, z) = scan.nextLine().split(\" \").map { it.toInt() }\n var (a, b, c) = scan.nextLine().split(\" \").map { it.toInt() }\n\n if (a < x) {\n println(\"NO\")\n return\n }\n\n a -= x // 3\n\n var greenAndPurple = a + b\n\n if(y < greenAndPurple) {\n println(\"NO\")\n return\n }\n\n greenAndPurple -= y\n\n val allGrapes = greenAndPurple + z\n if(allGrapes < z) {\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n}"}, {"source_code": "\nfun main(args : Array) {\n\n val NT = 1//readLine()?.toInt() ?: 0\n\n\n for(test in 1..NT){\n var (x, y, z) = readLine()!!.split(\" \").map { it.toInt() }\n var (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n var ok = true\n a -= x\n if(a<0)ok = false\n y -= a\n if(y > 0)b-=y\n if(b < 0)ok = false\n z -= a + b\n c -= z\n if( c < 0)ok = false\n println(if(ok)\"YES\" else \"NO\")\n }\n\n}"}, {"source_code": "fun main() {\n val require = readLine()!!.split(\" \").map { it.toInt() }.toMutableList()\n val exist = readLine()!!.split(\" \").map { it.toInt() }.toMutableList()\n\n if (require[0] > exist[0]) {\n println(\"NO\"); return\n } else exist[1] += exist[0] - require[0]\n\n if (require[1] > exist[1]) {\n println(\"NO\"); return\n } else exist[2] += exist[1] - require[1]\n\n if(require[2] <= exist[2]) println(\"YES\")\n}"}, {"source_code": "\nconst val GREEN = 0\nconst val PURPLE = 1\nconst val BLACK = 2\nconst val ANDREW = 0\nconst val DIMITRY = 1\nconst val MICHAEL = 2\nfun main() {\n val request = readLine()!!.split(\" \").map { it.toInt() }\n val box = readLine()!!.split(\" \").map { it.toInt() }\n\n var green = box[GREEN]\n green -= request[ANDREW]\n\n if(green < 0){\n println(\"NO\")\n return\n }\n\n var greenAndPurple = box[PURPLE] + green\n greenAndPurple -= request[DIMITRY]\n\n if (greenAndPurple < 0)\n println(\"NO\")\n else if (greenAndPurple + request[BLACK] >= request[MICHAEL])\n println(\"YES\")\n\n\n}\n"}, {"source_code": "\nfun good (a: CharArray) : Int {\n\n for (i in 0..a.size-1) {\n if (a[i] != a[a.size - i - 1])\n return 1\n }\n return 0\n}\n\nfun taskC() {\n var t = readLine()!!.toInt()\n while (t-- > 0) {\n var a = readLine()!!.toString()\n var arr = a.toCharArray()\n arr.sort()\n if (good(arr) == 1)\n println(arr.joinToString(\"\"))\n else\n println(-1)\n }\n}\nfun taskD() {\n var a = readLine()!!.map {it.toInt()}\n var b = readLine()!!.map {it.toInt()}\n var sum = 0\n for (i in 0..2) {\n sum += b[i]\n if (sum >= a[i]) {\n sum -= a[i]\n }\n else {\n print(\"NO\")\n return\n }\n }\n print(\"YES\")\n}\n\nfun main()\n{\n taskD()\n return\n\n}\nfun taskB() {\n var (a, b, c) = readLine()!!.split(\" \").map{it.toInt()}\n var mn = Math.min (a, Math.min (b-1, c-2))\n print(mn + mn + 1 + mn + 2)\n}"}, {"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 (x > a || x + y > a + b || z > c) println(\"NO\") else println(\"YES\")\n}\n"}, {"source_code": "const val GREEN = 0\nconst val PURPLE = 1\nconst val BLACK = 2\nconst val ANDREW = 0\nconst val DIMITRY = 1\nconst val MICHAEL = 2\nfun main() {\n val request = readLine()!!.split(\" \").map { it.toInt() }\n val box = readLine()!!.split(\" \").map { it.toInt() }\n\n var green = box[GREEN]\n green -= request[ANDREW]\n\n var greenAndPurple = box[PURPLE] + green\n greenAndPurple -= request[DIMITRY]\n\n if (green < 0 || greenAndPurple < 0)\n println(\"NO\")\n else if (green + greenAndPurple + request[BLACK] >= request[MICHAEL])\n println(\"YES\")\n\n\n}\n"}, {"source_code": "\nfun main(args: Array) {\n val (andrew, dmitry, mischal) = readLine()!!.map { it.toInt() }\n val (green, purple, black) = readLine()!!.map { it.toInt() }\n\n if (green < andrew) {\n println(\"NO\")\n return\n }\n val remainGreen = green - andrew\n if (remainGreen + purple < dmitry) {\n println(\"NO\")\n return\n }\n if (green + purple + black < andrew + dmitry + mischal) {\n println(\"NO\")\n return\n }\n println(\"YES\")\n}"}, {"source_code": "\nfun main() {\n var (x, y, z) = readLine()!!.split(\" \").map { it.toInt() }\n var (green, purple, black) = readLine()!!.split(\" \").map { it.toInt() }\n\n var condition = true\n\n if (green < x) {\n condition = false\n }\n else {\n green -= x\n }\n\n if (green + purple < y) {\n condition = false\n }\n else {\n if (y >= purple) {\n y -= purple\n }\n else {\n purple -= y\n }\n\n if (y >= 0) {\n green -= y\n }\n }\n\n if (purple + green + black < z) {\n condition = false\n }\n\n println(if (condition) \"YES\" else \"NO\")\n}"}, {"source_code": "// https://kotlinlang.org/docs/tutorials/competitive-programming.html\n// https://stackoverflow.com/questions/41283393/reading-console-input-in-kotlin\n\nprivate fun readln() = readLine()!!\nprivate fun readlnByte() = readln().toByte()\nprivate fun readlnShort() = readln().toShort()\nprivate fun readlnInt() = readln().toInt()\nprivate fun readlnLong() = readln().toLong()\nprivate fun readlnFloat() = readln().toFloat()\nprivate fun readlnDouble() = readln().toDouble()\nprivate fun readlnBigInt(radix: Int = 10) = readln().toBigInteger(radix)\nprivate fun readlnBigDecimal() = readln().toBigDecimal()\n\nprivate fun lineSequence(limit: Int = Int.MAX_VALUE) = generateSequence { readLine() }.constrainOnce().take(limit)\nprivate fun readlnStrings() = readln().split(' ')\nprivate fun readlnBytes() = readlnStrings().map { it.toByte() }\nprivate fun readlnShorts() = readlnStrings().map { it.toShort() }\nprivate fun readlnInts() = readlnStrings().map { it.toInt() }\nprivate fun readlnLongs() = readlnStrings().map { it.toLong() }\nprivate fun readlnFloats() = readlnStrings().map { it.toFloat() }\nprivate fun readlnDoubles() = readlnStrings().map { it.toDouble() }\n\nprivate fun readByteArray() = readlnStrings().run { ByteArray(size) { get(it).toByte() } }\nprivate fun readShortArray() = readlnStrings().run { ShortArray(size) { get(it).toShort() } }\nprivate fun readIntArray() = readlnStrings().run { IntArray(size) { get(it).toInt() } }\nprivate fun readLongArray() = readlnStrings().run { LongArray(size) { get(it).toLong() } }\nprivate fun readFloatArray() = readlnStrings().run { FloatArray(size) { get(it).toFloat() } }\nprivate fun readDoubleArray() = readlnStrings().run { DoubleArray(size) { get(it).toDouble() } }\n\nprivate fun readlnByteArray(n: Int) = ByteArray(n) { readlnByte() }\nprivate fun readlnShortArray(n: Int) = ShortArray(n) { readlnShort() }\nprivate fun readlnIntArray(n: Int) = IntArray(n) { readlnInt() }\nprivate fun readlnLongArray(n: Int) = LongArray(n) { readlnLong() }\nprivate fun readlnFloatArray(n: Int) = FloatArray(n) { readlnFloat() }\nprivate fun readlnDoubleArray(n: Int) = DoubleArray(n) { readlnDouble() }\n\nprivate fun readByteArray2d(rows: Int, cols: Int) = Array(rows) { readByteArray().also { require(it.size == cols) } }\nprivate fun readShortArray2d(rows: Int, cols: Int) = Array(rows) { readShortArray().also { require(it.size == cols) } }\nprivate fun readLongArray2d(rows: Int, cols: Int) = Array(rows) { readLongArray().also { require(it.size == cols) } }\nprivate fun readIntArray2d(rows: Int, cols: Int) = Array(rows) { readIntArray().also { require(it.size == cols) } }\nprivate fun readFloatArray2d(rows: Int, cols: Int) = Array(rows) { readFloatArray().also { require(it.size == cols) } }\nprivate fun readDoubleArray2d(rows: Int, cols: Int) =\n Array(rows) { readDoubleArray().also { require(it.size == cols) } }\n\n\nprivate fun isWhiteSpace(c: Char) = c in \" \\r\\n\\t\"\n\n// JVM-only targeting code follows next\n\n// readString() via sequence is still slightly faster than Scanner\nprivate fun readString() = generateSequence { System.`in`.read().toChar() }\n .dropWhile { isWhiteSpace(it) }.takeWhile { !isWhiteSpace(it) }.joinToString(\"\")\n\nprivate fun readByte() = readString().toByte()\nprivate fun readShort() = readString().toShort()\nprivate fun readInt() = readString().toInt()\nprivate fun readLong() = readString().toLong()\nprivate fun readFloat() = readString().toFloat()\nprivate fun readDouble() = readString().toDouble()\nprivate fun readBigInt(radix: Int = 10) = readString().toBigInteger(radix)\nprivate fun readBigDecimal() = readString().toBigDecimal()\n\nprivate fun readBytes(n: Int) = generateSequence { readByte() }.take(n)\nprivate fun readShorts(n: Int) = generateSequence { readShort() }.take(n)\nprivate fun readInts(n: Int) = generateSequence { readInt() }.take(n)\nprivate fun readLongs(n: Int) = generateSequence { readLong() }.take(n)\nprivate fun readFloats(n: Int) = generateSequence { readFloat() }.take(n)\nprivate fun readDoubles(n: Int) = generateSequence { readDouble() }.take(n)\n\nprivate fun printIntArray(a: IntArray) {\n println(a.joinToString(\", \"))\n}\n\nprivate fun printLongArray(a: LongArray) {\n println(a.joinToString(\", \"))\n}\n\nprivate fun printDoubleArray(a: DoubleArray) {\n println(a.joinToString(\", \"))\n}\n\nprivate fun printFloatArray(a: FloatArray) {\n println(a.joinToString(\", \"))\n}\n\nprivate fun printStringArray(a: Array) {\n println(a.joinToString(\", \"))\n}\n\nfun main() {\n val (x, y, z) = readlnInts()\n val (a, b, c) = readlnInts()\n\n if (a >= x && a + b >= x + y && a + b + c > x + y + z) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}"}, {"source_code": "import java.io.*\nimport java.lang.Math.max\nimport java.lang.Math.min\nimport java.lang.StringBuilder\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n// val n = br.readLine()!!.toInt()\n\n// repeat(n)\n// {\n val (x,y,z) = br.readLine()!!.split(' ').map{it.toInt()}\n val (a,b,c) = br.readLine()!!.split(' ').map{it.toInt()}\n\n// val s = br.readLine()\n// solve1(a)\n// solve2(a,b,c)\n// solve3(s)\n solve4(x,y,z,a,b,c)\n// }\n\n}\n\nfun solve4(x: Int, y: Int, z: Int, a: Int, b: Int, c: Int) {\n // x -> only a\n // y -> not c\n // z -> anything\n\n var ret = \"YES\"\n\n if(x > a)\n {\n ret = \"NO\"\n }\n else\n {\n var newa = a - x\n\n var newz = max( z - c, 0)\n\n var newc = if(z < c) c - z else 0\n\n val left = b + newa + newc\n\n if(y + newz > left) ret = \"NO\"\n }\n\n println(ret)\n}\n\n\nfun solve3(s: String) {\n\n var ns = s.toCharArray().sorted()\n var sb = StringBuilder()\n for(ch in ns)\n {\n sb.append(ch)\n }\n var nss = sb.toString()\n\n if(nss.reversed() == nss)\n {\n println(-1)\n }\n else\n {\n println(nss)\n }\n}\n\nfun solve2(a: Int, b: Int, c: Int) {\n\n var m = min(a, b-1)\n m = min(m, c-2)\n println(3 * m + 3)\n}\n\nfun solve1(num : Int)\n{\n println(num/2)\n}\n\n\n"}, {"source_code": "import java.lang.Integer.min\n\nfun main() {\n val (x, y, z) = readLine()!!.split(\" \").map { it.toInt() }\n var (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n a -= x\n if (a < 0) {\n println(\"NO\")\n return\n }\n b -= y - a\n if (b < 0) {\n println(\"NO\")\n return\n }\n c -= z - b - a\n if (c < 0) {\n println(\"NO\")\n return\n }\n println(\"YES\")\n}\n"}, {"source_code": "\nimport java.util.Scanner\n\nfun main(args: Array) {\n exercise4()\n}\n\nfun exercise4(){\n val reader = Scanner(System.`in`)\n val andrew = reader.nextInt()\n var dimitri = reader.nextInt()\n val michael = reader.nextInt()\n\n var green = reader.nextInt()\n var purple = reader.nextInt()\n var black = reader.nextInt()\n\n green -= andrew\n if (green < 0){\n println(\"NO\")\n } else {\n if (green >= dimitri){\n green -= dimitri\n } else {\n dimitri -= green\n purple -= dimitri\n green = 0\n if (purple < 0){\n println(\"NO\")\n } else {\n if (green + purple + black > michael) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n }\n }\n }\n\n}"}, {"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"}, {"source_code": "\nconst val GREEN = 0\nconst val PURPLE = 1\nconst val BLACK = 2\nconst val ANDREW = 0\nconst val DIMITRY = 1\nconst val MICHAEL = 2\nfun main() {\n val request = readLine()!!.split(\" \").map { it.toInt() }\n val box = readLine()!!.split(\" \").map { it.toInt() }\n\n if (request[ANDREW] > box[GREEN])\n print(\"NO\")\n else {\n val leftOfGreen = box[GREEN] - request[ANDREW]\n\n val leftOfGreenAndPurple = leftOfGreen + box[PURPLE]\n\n if (leftOfGreenAndPurple < request[DIMITRY]) {\n println(\"NO\")\n } else {\n\n val sumOfAllLeft = leftOfGreenAndPurple - request[DIMITRY] + box[BLACK]\n\n if (sumOfAllLeft < request[MICHAEL]) {\n println(\"YES\")\n } else {\n print(\"NO\")\n }\n\n }\n\n }\n\n}\n"}, {"source_code": "import java.util.Scanner\nimport java.util.Arrays\n\nfun main(args: Array) {\n\tval reader = Scanner(System.`in`)\n\n\tvar x:Int = reader.nextInt()\n \tvar y:Int = reader.nextInt()\n \tvar z:Int = reader.nextInt()\n \n \tvar a:Int = reader.nextInt()\n \tvar b:Int = reader.nextInt()\n \tvar c:Int = reader.nextInt()\n\t\n\tvar aux:Int \n\n \tif(a>=x){\n\t\ta-=x;\n\t\taux=a+c;\n\t\tif(aux>=y){\n\t\t\taux-=y;\n\t\t\taux+=b;\n\t\t\tif(aux>=z){\n\t\t\t\tprintln(\"YES\");\n\t\t\t}\n\t\t\telse{\n\t\t\t\tprintln(\"NO\");\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tprintln(\"NO\");\n\t\t}\n \t}\n\telse{\n\t\tprintln(\"NO\");\n\t}\n}\n"}, {"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 (x>a) println(\"NO\")\n if (x+y>a+b) println(\"NO\")\n if (x+y+z>a+b+c) println(\"NO\") else println(\"YES\")\n}"}, {"source_code": "fun main() {\n var in1 = readLine()!!\n var in2 = readLine()!!\n var x = in1[0].toInt()\n var y = in1[1].toInt()\n var z = in1[2].toInt()\n var a = in2[0].toInt()\n var b = in2[1].toInt()\n var c = in2[2].toInt()\n a -= x\n if (a < 0){\n println(\"NO\")\n }else{\n a += b-y\n if (a < 0){\n println(\"NO\")\n }else{\n a += c-z\n if (a < 0){\n println(\"NO\")\n }else{\n println(\"YES\")\n }\n }\n }\n}\n"}, {"source_code": "\nconst val GREEN = 0\nconst val PURPLE = 1\nconst val BLACK = 2\nconst val ANDREW = 0\nconst val DIMITRY = 1\nconst val MICHAEL = 2\nfun main() {\n val request = readLine()!!.split(\" \").map { it.toInt() }\n val box = readLine()!!.split(\" \").map { it.toInt() }\n\n if (request[ANDREW] > box[GREEN])\n print(\"NO\")\n else {\n val leftOfGreen = box[GREEN] - request[ANDREW]\n\n val leftOfGreenAndPurple = leftOfGreen + box[PURPLE]\n\n if (leftOfGreenAndPurple < request[DIMITRY]) {\n println(\"NO\")\n } else {\n\n val sumOfAllLeft = leftOfGreenAndPurple - request[DIMITRY] + box[BLACK]\n\n if (sumOfAllLeft < request[MICHAEL]) {\n println(\"YES\")\n } else {\n print(\"NO\")\n }\n\n }\n\n }\n\n}\n"}, {"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 (x > a || x + y > a + b || z > c) println(\"NO\") else println(\"YES\")\n}\n"}, {"source_code": "import kotlin.math.min\n\nfun readThree() = readLine()!!.split(\" \").map { it.toInt() }\nfun main() {\n var (andrew, dmitry, michal) = readThree()\n var (green, purple, black) = readThree()\n\n green -= andrew\n\n if (green < 0) println(\"NO\")\n else {\n val greenForDmitry = min(green, dmitry)\n green -= greenForDmitry\n dmitry -= greenForDmitry\n\n purple -= dmitry\n when {\n purple < 0 -> println(\"NO\")\n green + purple + black <= michal -> println(\"NO\")\n else -> println(\"YES\")\n }\n }\n}"}, {"source_code": "import java.util.Scanner\n\nval no = \"NO\"\nval yes = \"YES\"\n\nfun main() {\n val scanner = Scanner(System.`in`)\n\n val and = scanner.nextInt()\n var dm = scanner.nextInt()\n val mi = scanner.nextInt()\n\n var green = scanner.nextInt()\n var purple = scanner.nextInt()\n val black = scanner.nextInt()\n\n if (and > green) {\n println(no)\n return\n }\n green -= and\n if (dm > green + purple) {\n println(no)\n return\n }\n if (dm > green) {\n dm -= green\n green = 0\n purple -= dm\n } else {\n dm -= green\n }\n\n println(if (green + purple + black > mi) yes else no)\n}"}, {"source_code": "import java.util.*\nfun main() {\n with(Scanner(System.`in`)) {\n val x = nextInt()\n val y = nextInt()\n val z = nextInt()\n val g = nextInt()\n val p = nextInt()\n val b = nextInt()\n when {\n g < x || x + y < g + p || x + y + z < g + p + b -> println(\"NO\")\n else -> println(\"YES\")\n }\n }\n}"}, {"source_code": "import 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(args: Array) {\n\n var(x,y,z) =readInts()\n var(green,purple,black) =readInts()\n\n var temp:Int\n\n temp=green-x\n if(temp<0){\n println(\"NO\")\n return\n }else{\n green-x\n }\n temp=(green+purple)-y\n if(temp<0){\n println(\"NO\")\n return\n }else{\n (green+purple)-y\n }\n\n temp=(green+purple+black)-z\n\n if(temp<0){\n println(\"NO\")\n return\n }\n println(\"YES\")\n\n\n}\n\n"}, {"source_code": "fun main(args: Array) {\n val (x, y, z) = readLine()!!.split(\" \").map { it.toInt() }\n var (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n\n if (x > a) {\n print(\"NO\")\n return\n }\n a -= x\n if (y > b + c) {\n print(\"NO\")\n return\n }\n if (z > a + (b + c - y)) {\n print(\"NO\")\n } else {\n print(\"YES\")\n }\n }"}, {"source_code": "//package org.korifey.kalgo.codeforces.kotlinheroes\n\nimport java.util.*\nimport kotlin.math.min\nimport kotlin.reflect.KMutableProperty0\n\n\nfun exit(r: Boolean) {\n println(if (r) \"YES\" else \"NO\")\n}\n\nfun subtractMin(a: KMutableProperty0, b: KMutableProperty0) {\n val m = min(a.get(), b.get())\n\n a.set(a.get() - m)\n b.set(b.get() - m)\n}\n\n\nvar a : Int = 0\nvar b : Int = 0\nvar c : Int = 0\n\n\nvar ax : Int = 0\nvar bx : Int = 0\nvar cx : Int = 0\n\n\nfun main() {\n\n val scanner = Scanner(System.`in`)\n a = scanner.nextInt()\n b = scanner.nextInt()\n c = scanner.nextInt()\n\n ax = scanner.nextInt()\n bx = scanner.nextInt()\n cx = scanner.nextInt()\n\n\n subtractMin(::a, ::ax)\n\n if (a > 0)\n return exit(false)\n\n subtractMin(::b, ::ax)\n subtractMin(::b, ::bx)\n\n if (b > 0)\n return exit(false)\n\n\n subtractMin(::c, ::ax)\n subtractMin(::c, ::bx)\n subtractMin(::c, ::cx)\n\n\n if (b > 0)\n return exit(false)\n\n exit(true)\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n val scanner = Scanner(System.`in`)\n var x = scanner.nextInt()\n var y = scanner.nextInt()\n var z = scanner.nextInt()\n\n var a = scanner.nextInt()\n var b = scanner.nextInt()\n var c = scanner.nextInt()\n\n a -= x\n if (a < 0) {\n println(\"NO\")\n return\n }\n\n if (a > 0) {\n a -= y\n if (a < 0) {\n y = a * -1\n }\n }\n\n b -= y\n if (b < 0) {\n println(\"NO\")\n return\n }\n\n if (b > 0) {\n b -= z\n if (b < 0) {\n z = b * -1\n }\n }\n\n c -= z\n if (c < 0) {\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n val scanner = Scanner(System.`in`)\n var x = scanner.nextInt()\n var y = scanner.nextInt()\n var z = scanner.nextInt()\n\n var a = scanner.nextInt()\n var b = scanner.nextInt()\n var c = scanner.nextInt()\n\n a -= x\n if (a < 0) {\n println(\"NO\")\n return\n }\n\n if (a > 0) {\n a -= y\n if (a < 0) {\n y = a * -1\n } else {\n y = 0\n }\n }\n\n b -= y\n if (b < 0) {\n println(\"NO\")\n return\n }\n\n if (b > 0) {\n b -= z\n if (b < 0) {\n z = b * -1\n } else {\n z = 0\n }\n }\n\n c -= z\n if (c < 0) {\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n}"}, {"source_code": "import java.util.*\n\nfun main() = with(Scanner(System.`in`)) {\n val andrew = nextInt()\n val dmitry = nextInt()\n val michel = nextInt()\n\n var green = nextInt()\n var purple = nextInt()\n var black = nextInt()\n var total = green + purple + black\n\n if (green < andrew) {\n println(\"NO\")\n return@with\n }\n green -= andrew\n\n if (green + purple < dmitry) {\n println(\"NO\")\n return@with\n }\n total -= dmitry\n\n if (total < michel) {\n println(\"NO\")\n return@with\n }\n\n println(\"YES\")\n}\n\n"}, {"source_code": "import java.util.Scanner\n\nfun main() {\n val sc = Scanner(System.`in`)\n\n var x:Int = sc.nextInt()\n var y:Int = sc.nextInt()\n var z:Int = sc.nextInt()\n var a:Int = sc.nextInt()\n var b:Int = sc.nextInt()\n var c:Int = sc.nextInt()\n \n a -= x\n if (a > 0) {\n if (a + b >= y)\n if (a + b + c >= y + z)\n println(\"YES\")\n else\n println(\"NO\")\n else\n println(\"NO\")\n }\n else\n println(\"NO\")\n}"}, {"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}"}, {"source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n val xyz = readLine()!!.split(' ')\n val abc = readLine()!!.split(' ')\n\n val x = xyz[0].toInt() // only a\n val y = xyz[1].toInt() // not c\n val z = xyz[2].toInt() // any\n\n val a = abc[0].toInt()\n val b = abc[1].toInt()\n val c = abc[2].toInt()\n\n val a0 = a - x\n\n if (a0 < 0) {\n println(\"NO\")\n return\n }\n\n val y0 = max(a0 - y, 0)\n val a1 = a0 - y0\n val b0 = b - (y - y0)\n\n if (b0 < 0) {\n println(\"NO\")\n return\n }\n\n val c0 = (a1 + b0 + c) - z\n\n if (c0 < 0) {\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val (x, y, z) = scan.nextLine().split(\" \").map { it.toInt() }\n var (a, b, c) = scan.nextLine().split(\" \").map { it.toInt() }\n\n if (x > a) {\n println(\"NO\")\n return\n }\n\n a -= x // 3\n\n var greenAndPurple = a + b\n\n if(y > greenAndPurple) {\n println(\"NO\")\n return\n }\n\n greenAndPurple -= y\n\n val allGrapes = greenAndPurple + z\n if(z > allGrapes) {\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n}"}, {"source_code": "fun anyGrapes(want:List, grapes:List){\n if(want[0].toInt() > grapes[0].toInt()){\n println(\"NO\")\n }\n else {\n val dymiCurr = want[1].toInt()\n val michCurr = want[2].toInt() - grapes[2].toInt() //Michael gets all black grapes\n val remainGrPu = (grapes[0].toInt() + grapes[1].toInt()) - (want[0].toInt()) //remaining green and purple grapes\n\n if ( remainGrPu >= 0 &&((dymiCurr+michCurr) - remainGrPu) > 0){\n println(\"NO\")\n return\n }\n println(\"YES\")\n }\n}\n\n\nfun main(args:Array){\n val want = readLine()!!.split(\" \")\n val grapes = readLine()!!.split(\" \")\n anyGrapes(want, grapes)\n}"}, {"source_code": "fun main() {\n val (x, y, z) = readLine()!!.split(\" \").map(String::toInt)\n val (a, b, c) = readLine()!!.split(\" \").map(String::toInt)\n if (a >= x && a + b >= x + y && a + c + c >= x + y + z) print(\"YES\") else print(\"NO\")\n}\n"}, {"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 (x > a || x + y > a + b || z > c) println(\"NO\") else println(\"YES\")\n}\n"}, {"source_code": "fun main() {\n val want = readLine()!!.split(\" \").map{it.toInt()}\n val box = readLine()!!.split(\" \").map{it.toInt()}\n\n\n when {\n (box[0]+box[1]+box[2]-want[0]-want[1]) < want[2] -> println(\"NO\")\n box[0] println(\"NO\")\n box[0]-want[0]+box[2]-want[2]+box[1] println(\"NO\")\n else -> println(\"YES\")\n }\n\n}"}, {"source_code": " fun main(args:Array){\n val (a, b, c) = readLine()!!.split(' ')\n var x1:Int = a.toInt()\n var y1:Int = b.toInt()\n var z1:Int = c.toInt()\n val (a1, b1, c1) = readLine()!!.split(' ')\n var x:Int = a1.toInt()\n var y:Int = b1.toInt()\n var z:Int = c1.toInt()\n var flag = 0\n if(x1 <= x && flag == 0) {x -= x1}\n else {flag = 1}\n \n if(y1 <= (y + x) && flag == 0) \n {if(y1 <= y) y -= y1\n else y = 0; x -= (y1 - y)}\n else {flag = 1}\n \n if(z1 <= (x + y + z) && flag == 0) {flag = 0}\n else {flag = 1} \n \n if(flag == 0) {println(\"YES\")}\n else {println(\"NO\")}\n}"}, {"source_code": "import java.util.Scanner\nimport java.util.Arrays\n\nfun main(args: Array) {\n\tval reader = Scanner(System.`in`)\n\n\tvar x:Int = reader.nextInt()\n \tvar y:Int = reader.nextInt()\n \tvar z:Int = reader.nextInt()\n \n \tvar a:Int = reader.nextInt()\n \tvar b:Int = reader.nextInt()\n \tvar c:Int = reader.nextInt()\n\t\n\tvar aux:Int \n\n \tif(a>=x){\n\t\ta-=x;\n\t\taux=a+c;\n\t\tif(aux>=y){\n\t\t\taux-=y;\n\t\t\taux+=b;\n\t\t\tif(aux>=z){\n\t\t\t\tprintln(\"YES\");\n\t\t\t}\n\t\t\telse{\n\t\t\t\tprintln(\"NO\");\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tprintln(\"NO\");\n\t\t}\n \t}\n\telse{\n\t\tprintln(\"NO\");\n\t}\n}\n"}, {"source_code": "// contest/1171/problem/B Kotlin heroes training done\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n var canDo: Boolean\n val xyz = readInts()\n var (x,y,z) = xyz\n val abc = readInts()\n var (a,b,c) = abc\n if (a < x) {\n canDo = false\n } else {\n a -= x\n if (a+b < y) {\n canDo = false\n } else {\n if (a > y) {\n y -= a\n } else {\n b -= (y-a)\n a = 0\n }\n canDo = (a+b+c) >= z\n }\n }\n\n println( if (canDo) \"YES\" else \"NO\" )\n}\n"}, {"source_code": "\nfun main(args: Array) {\n val (andrew, dmitry, mischal) = readLine()!!.map { it.toInt() }\n val (green, purple, black) = readLine()!!.map { it.toInt() }\n\n if (green < andrew) {\n println(\"NO\")\n return\n }\n val remainGreen = green - andrew\n if (remainGreen + purple < dmitry) {\n println(\"NO\")\n return\n }\n val remain = remainGreen + purple - andrew\n if (remain + black < mischal) {\n println(\"NO\")\n return\n }\n println(\"YES\")\n}"}, {"source_code": "import kotlin.math.max\n\nfun main() {\n val (x, y, z) = readLine()!!.split(\" \").map { it.toInt() }\n val (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n\n if (x > a) {\n println(\"NO\")\n return\n }\n\n val da1 = a - x\n if (y > da1 + b) {\n println(\"NO\")\n return\n }\n\n val da2 = max(0, da1 - y)\n val db1 = b + da1 - y\n if (z > da2 + db1 + c) {\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n}"}, {"source_code": "import java.io.*\nimport java.util.*\n\nfun canEat(): Boolean {\n var x = inp.nextInt()\n var y = inp.nextInt()\n var z = inp.nextInt()\n\n var a = inp.nextInt()\n var b = inp.nextInt()\n var c = inp.nextInt()\n\n if (x > a) {\n return false\n }\n a -= x\n x = 0\n\n val canYEatGreen = minOf(y, a)\n a -= canYEatGreen\n y -= canYEatGreen\n\n if (y > b) {\n return false\n }\n b -= y\n y = 0\n\n val canZEatFio = minOf(z, c)\n c -= canZEatFio\n z -= canZEatFio\n\n return c >= z\n}\n\nfun run() {\n val res: String = if (canEat()) \"YES\" else \"NO\"\n out.println(res)\n}\n\nprivate val inp = FastInput()\nprivate val out = FastOutput()\n\nfun main() {\n run()\n out.flush()\n out.close()\n}\n\ninternal class FastInput(private val bufferedReader: BufferedReader) {\n private var tokenizer: StringTokenizer? = null\n\n constructor() : this(System.`in`)\n constructor(stream: InputStream) : this(BufferedReader(InputStreamReader(stream)))\n constructor(file: File) : this(BufferedReader(FileReader(file)))\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(bufferedReader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int = next().toInt()\n fun nextLong(): Long = next().toLong()\n}\n\ninternal class FastOutput constructor(outputStream: OutputStream = System.out) {\n private val bufferedWriter = BufferedWriter(OutputStreamWriter(outputStream))\n\n private fun printOne(obj: T) {\n bufferedWriter.write(\"$obj\")\n }\n\n fun println(obj: T) = bufferedWriter.write(\"$obj\\n\")\n\n fun print(vararg objs: Any) = printd(\"\", *objs)\n\n fun printd(delimiter: String, vararg objs: Any) {\n for (i in 0 until objs.size) {\n printOne(objs[i])\n printOne(delimiter)\n }\n }\n\n fun flush() = bufferedWriter.flush()\n fun close() = bufferedWriter.close()\n}"}, {"source_code": "fun main(){\n var (x, y, z) = readLine()!!.split(\" \").map{ it.toInt() }\n var (a, b, c) = readLine()!!.split(\" \").map{ it.toInt() }\n\n var ok = true\n if(x > a) ok = false\n a -= x\n z -= minOf(z, c)\n if(a + b + c < y + z) ok = false\n\n println(if (ok) \"YES\" else \"NO\")\n\n}"}, {"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\n val grapesMap = mutableMapOf(\n \"green\" to a,\n \"purple\" to b,\n \"black\" to c\n )\n\n provideAndrew(grapesMap, x)\n provideDmitri(grapesMap, y)\n provideMichal(grapesMap, z)\n if (isValidDistribution(grapesMap)) println(\"YES\") else println(\"NO\")\n}\n\nprivate fun provideAndrew(grapesMap: MutableMap, wanted: Int) {\n grapesMap[\"green\"] = grapesMap[\"green\"]!!.minus(wanted)\n}\n\nprivate fun provideDmitri(grapesMap: MutableMap, wanted: Int) {\n val purple = grapesMap[\"purple\"]!!\n if (wanted <= purple) {\n grapesMap[\"purple\"] = purple.minus(wanted)\n return\n }\n grapesMap[\"purple\"] = 0\n grapesMap[\"green\"] = grapesMap[\"green\"]!!.minus(wanted - purple)\n}\n\nprivate fun provideMichal(grapesMap: MutableMap, wanted: Int) {\n grapesMap[\"black\"] = grapesMap[\"black\"]!!.minus(wanted)\n}\n\nprivate fun isValidDistribution(grapesMap: MutableMap): Boolean {\n return grapesMap.filter { it.value >= 0 }.size == grapesMap.size\n}"}, {"source_code": "import java.util.*\nfun main() {\n with(Scanner(System.`in`)) {\n val x = nextInt()\n val y = nextInt()\n val z = nextInt()\n val g = nextInt()\n val p = nextInt()\n val b = nextInt()\n when {\n g < x || x + y < g + p || x + y + z < g + p + b -> println(\"NO\")\n else -> println(\"YES\")\n }\n }\n}"}, {"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 (x>a) println(\"No\")\n if (x+y>a+b) println(\"No\")\n if (x+y+z>a+b+c) println(\"No\") else println(\"Yes\")\n}"}, {"source_code": "\nimport java.util.Scanner\n\nfun main(args: Array) {\n exercise4()\n}\n\nfun exercise4(){\n val reader = Scanner(System.`in`)\n val andrew = reader.nextInt()\n var dimitri = reader.nextInt()\n val michael = reader.nextInt()\n\n var green = reader.nextInt()\n var purple = reader.nextInt()\n var black = reader.nextInt()\n\n green -= andrew\n if (green < 0){\n println(\"NO\")\n } else {\n if (green >= dimitri){\n green -= dimitri\n } else {\n dimitri -= green\n purple -= dimitri\n green = 0\n if (purple < 0){\n println(\"NO\")\n }\n }\n if (green + purple + black >= michael) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n \n }\n\n}"}, {"source_code": "fun isEnough(wish: List, grapes: List) {\n val enough = grapes[0] >= wish[0] &&\n grapes[0] + grapes[1] >= wish[1] &&\n grapes[1] + grapes[1] + grapes[2] >= wish[2]\n println(when(enough) {\n true -> \"YES\"\n else -> \"NO\"\n })\n}\n\nfun main() {\n val wish = readLine()!!.split(\" \").map { it.toInt() }\n val grapes = readLine()!!.split(\" \").map { it.toInt() }\n\n isEnough(wish, grapes)\n}"}, {"source_code": "fun main() {\n val (andrew, dimitry, michael) = readLine()!!.split(\" \").map(Integer::valueOf)\n var (green, purple, black) = readLine()!!.split(\" \").map(Integer::valueOf)\n var a = false\n var b = false\n var c = false\n\n if (green >= andrew) {\n green -= andrew\n a = true\n }\n\n if (green + purple >= dimitry) {\n var remaining = dimitry\n if (remaining - green >= 0) {\n val removed = green\n remaining -= green\n green -= removed\n\n }\n\n if (remaining != 0 && purple >= remaining) {\n val removed = remaining\n purple -= removed\n remaining = 0\n }\n\n if (remaining == 0) {\n b = true\n }\n }\n\n if (black + green + purple >= michael) {\n c = true\n }\n\n if (a && b && c) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}"}], "src_uid": "d54201591f7284da5e9ce18984439f4e"} {"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 = ir.nextInt()\n val a = IntArray(n)\n var total: Long = 0\n\n repeat(n) {\n a[it] = ir.nextInt()\n }\n\n Arrays.sort(a)\n\n total += a[n - 1]\n\n for (i in (n - 2) downTo 0) {\n if (a[i] >= a[i + 1])\n a[i] = Math.max((a[i + 1] - 1), 0)\n total += a[i]\n }\n\n pw.print(total)\n\n}\n\nprivate fun sort(array: IntArray, barray: IntArray, low: Int, high: Int) {\n\n var i = low\n var j = high\n val x = array[low + (high - low) / 2]\n\n do {\n while (array[i] < x) ++i\n while (array[j] > x) --j\n if (i <= j) {\n val tmp = array[i]\n array[i] = array[j]\n array[j] = tmp\n\n val pmt = barray[i]\n barray[i] = barray[j]\n barray[j] = pmt\n\n i++\n j--\n }\n } while (i <= j)\n\n if (low < j) sort(array, barray, low, j)\n if (i < high) sort(array, barray, i, high)\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}", "positive_code": [{"source_code": "fun main() {\n fun readLongs() = readLine()!!.split(\" \").map(String::toLong)\n\n readLine()\n val times = readLongs()\n val used = mutableSetOf()\n var sol = 0L\n for (option in times)\n for (i in option downTo 0)\n if (i !in used) {\n used.add(i)\n sol += i\n break\n }\n print(sol)\n}"}], "negative_code": [{"source_code": "import java.util.*\n\nfun main() {\n\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val a = IntArray(n)\n var total = 0\n\n for (i in 0 until n) a[i] = sc.nextInt()\n\n Arrays.sort(a)\n\n for (i in (n - 1) downTo 1) {\n if (a[i] == a[i - 1]) {\n if (a[i] != 0) a[i - 1]--\n else a[i - 1] = 0\n }\n }\n\n for (i in 0 until n) total += a[i]\n\n print(total)\n\n}"}, {"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 = ir.nextInt()\n val a = IntArray(n)\n var total: Long = 0\n\n repeat(n) {\n a[it] = ir.nextInt()\n }\n\n Arrays.sort(a)\n\n total += a[n - 1]\n\n for (i in (n - 2) downTo 0) {\n if (a[i] == a[i + 1])\n a[i]--\n total += a[i]\n }\n\n pw.print(total)\n\n}\n\nprivate fun sort(array: IntArray, barray: IntArray, low: Int, high: Int) {\n\n var i = low\n var j = high\n val x = array[low + (high - low) / 2]\n\n do {\n while (array[i] < x) ++i\n while (array[j] > x) --j\n if (i <= j) {\n val tmp = array[i]\n array[i] = array[j]\n array[j] = tmp\n\n val pmt = barray[i]\n barray[i] = barray[j]\n barray[j] = pmt\n\n i++\n j--\n }\n } while (i <= j)\n\n if (low < j) sort(array, barray, low, j)\n if (i < high) sort(array, barray, i, high)\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}"}, {"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 = ir.nextInt()\n val a = IntArray(n)\n var total: Long = 0\n\n repeat(n) {\n a[it] = ir.nextInt()\n }\n\n Arrays.sort(a)\n\n total += a[n - 1]\n\n for (i in (n - 2) downTo 0) {\n if (a[i] >= a[i + 1])\n a[i] = a[i + 1] - 1\n total += a[i]\n }\n\n pw.print(total)\n\n}\n\nprivate fun sort(array: IntArray, barray: IntArray, low: Int, high: Int) {\n\n var i = low\n var j = high\n val x = array[low + (high - low) / 2]\n\n do {\n while (array[i] < x) ++i\n while (array[j] > x) --j\n if (i <= j) {\n val tmp = array[i]\n array[i] = array[j]\n array[j] = tmp\n\n val pmt = barray[i]\n barray[i] = barray[j]\n barray[j] = pmt\n\n i++\n j--\n }\n } while (i <= j)\n\n if (low < j) sort(array, barray, low, j)\n if (i < high) sort(array, barray, i, high)\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}"}], "src_uid": "3c4b2d1c9440515bc3002eddd2b89f6f"} {"source_code": "import java.io.*\nimport java.util.*\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", "positive_code": [{"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 && isPrime(a+b)) \"YES\" else \"NO\")\n }\n }\n\n private fun isPrime(n: Long): Boolean {\n var i = 2L\n while (i * i <= n) {\n if (n % i == 0L)\n return false\n i++\n }\n return true\n }\n}\n"}, {"source_code": "import kotlin.math.sqrt\n\n// unable to solve it by myself. Solution on tutorial: https://codeforces.com/blog/entry/62287\nfun main() {\n fun readInt() = readLine()!!.toInt()\n fun readLongs() = readLine()!!.split(\" \").map(String::toLong)\n\n nextQuery@ for (query in 0 until readInt()) {\n val (a, b) = readLongs()\n if (a - b != 1L) {\n println(\"NO\")\n continue@nextQuery\n }\n val goal = a + b\n if (goal % 2 == 0L) println(\"NO\")\n else {\n for (divisor in 3..sqrt(goal.toDouble()).toInt() step 2)\n if (goal % divisor == 0L) {\n println(\"NO\")\n continue@nextQuery\n }\n println(\"YES\")\n }\n }\n}"}, {"source_code": "fun check(a: Long, b: Long): Boolean {\n if (a - b > 1) return false\n val res = a + b\n for (i in 2..Math.sqrt(res.toDouble()).toInt()) {\n if (res % i == 0L) {\n return false\n }\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 if (check(a, b)) println(\"YES\") else println(\"NO\")\n }\n}\n"}, {"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((a+b).rem(i) == 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"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val t = sc.nextInt()\n repeat(t) {\n val a = sc.nextBigInteger()\n val b = sc.nextBigInteger()\n if ((a * a - b * b).isProbablePrime(100)) {\n println(\"YES\")\n }else{\n println(\"NO\")\n }\n }\n}"}], "negative_code": [{"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"}, {"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"}, {"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"}], "src_uid": "5a052e4e6c64333d94c83df890b1183c"} {"source_code": "fun tr(x: Int, y: Int): Int = x xor y\nfun ttr(x: Int, y: Int): Int = x or y\nfun sq(x: Int, y: Int): Int = x and 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 = ttr(c, d)\n val p3 = sq(b, c)\n val p4 = tr(a, d)\n\n val q1 = sq(p1, p2)\n val q2 = ttr(p3, p4)\n\n println(tr(q1, q2))\n}\n", "positive_code": [{"source_code": "import java.io.*\nimport java.util.*\n\nfun main(args : Array) {\n //====== Input preparations ========================================================\n// val fin = BufferedReader(FileReader(\"e.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 fun nextNum() = next() == \"1\"\n fun g1(a : Boolean, b : Boolean) = a.xor(b)\n fun g2(a : Boolean, b : Boolean) = a.or(b)\n fun g3(a : Boolean, b : Boolean) = a.and(b)\n val a = Array(11, {false})\n for (i in 0..3)\n a[i] = nextNum()\n a[4] = g1(a[0], a[1])\n a[5] = g2(a[2], a[3])\n a[6] = g3(a[1], a[2])\n a[7] = g1(a[0], a[3])\n a[8] = g3(a[4], a[5])\n a[9] = g2(a[6], a[7])\n a[10] = g1(a[8], a[9])\n\n// for (x in a)\n// fout.print(\"$x \")\n\n fout.print(if (a[10]) 1 else 0)\n\n fout.close()\n fin.close()\n}\n\n"}, {"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(7)\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()"}, {"source_code": "fun main(args: Array) {\n val x = readLine()!!.toInt()\n var d = x and 1\n var c = (x shr 1) and 1\n var b = (x shr 2) and 1\n var a = (x shr 3) and 1\n\n a = a xor 1\n if (a == 1) {\n b = b xor 1\n if (b == 1) {\n c = c xor 1\n if (c == 1) {\n d = d xor 1\n }\n }\n }\n\n println(d + (c shl 1) + (b shl 2) + (a shl 3))\n}\n"}, {"source_code": "import java.awt.image.BufferedImage\nimport java.io.File\nimport java.lang.Math.abs\nimport java.util.*\nimport javax.imageio.ImageIO\n\nval matrix = arrayOf(\n \"..........................0.0.000000.0..........................\",\n \"......................0.000.0.0.0..0.00000......................\",\n \"....................000.0...0...00.0....0..0....................\",\n \".................0000.0.0.00000....0000.0.000.0.................\",\n \"................00......0.0.....0000....0.0.0.00................\",\n \"..............0..00.00000.000.000.0..0.00...0..0.0..............\",\n \".............000..0..0......0.0...0000..00.00.00.00.............\",\n \"...........000000.00.00.000.000.000....00..0..0...000...........\",\n \"..........000000000000....0.....0...0.00..00.00.0..000..........\",\n \".........00000000000000000000.0000000..0000..0000000000.........\",\n \"........000000000000000000000000000000000000000000000000........\",\n \".......00000000000000000000000000000000000000000000000000.......\",\n \".......00000000000000000000000000000000000000000000000000.......\",\n \"......0000000000000000000000000000000000000000000000000000......\",\n \".....000000000000000000000000000000000000000000000000000000.....\",\n \".....000000000000000000000000000000000000000000000000000000.....\",\n \"....00000000000000000000000000000000000000000000000000000000....\",\n \"...0000000000000000000000000000000000000000000000000000000000...\",\n \".....00000000000000000000000000000000000000000000000000000000...\",\n \".......000000000000...0..00000000000000...0.0.0000000000000.....\",\n \"..00.....000000000..0...000000000000000.0.......00000000........\",\n \"..0000.....00000...00.0...000000000000000.00.00..0.00.......00..\",\n \".0000000.....0...000..000..00000000000.0..0...00.........000000.\",\n \".000000000.....0..0..00.00...000000000.00.00000..0....000000000.\",\n \".000000000000.00.000.....000..0000000...0..0....000.00000000000.\",\n \".000000000.....0...000.000...00000000.0.00000.0...0..0.00000000.\",\n \"000000000000.000.0..0..0...0..000000..0..0....00.000...000000000\",\n \"00000000000...0..0.00.000.000.0000.0.000.0000..000...0.000000000\",\n \"00000000000.000000.0000....0..0.0....0.0..0.0000...000.000000000\",\n \"00000000000.....0..0..000.000...0.0.00.00.0..0...0..0..000000000\",\n \"000000000000.00.0000.00.000...0.000.....0000.0.000000.0000000000\",\n \"00000000000...000..0..0...000.0..000.0000..0.000...0...000000000\",\n \"0000000000000.....00.000.00.000.00.....0..00.00..0...0.000000000\",\n \"00000000000000.00.0....0.0....0.0..0.0.00.0...00.00.000000000000\",\n \"000000000000....0000.0.0.0.0.0000.00.0..0.000..000...00000000000\",\n \"0000000000000.0..0...000...0000...0..00....0..00...0000000000000\",\n \"0000000000000000...000...0.00.00.00.00..0.000.0..0..000000000000\",\n \"000000000000000000...0.000000.....0000000...0...0000000000000000\",\n \".0000000000000000..0....00000.0.00000000000...0..00000000000000.\",\n \".000000000000000000000000000000....0000000000000000000000000000.\",\n \".000000000000000000000000000.0..0.00000000000000000000000000000.\",\n \".0000000000000000000000000.0...00000000000000000000000000000000.\",\n \"..000000000000000000000000...0...00000000000000000000000000000..\",\n \"..0000000..0000000000000000000.0000000000000000000000000000000..\",\n \"...0000000.0.0000000000000000...000000000000000000000.0000000...\",\n \"...0000000...0...00000000000..0.00000000000.00000.0....000000...\",\n \"...0000000.0.0.0..0.0...00.0.00..0.0..0.00...00.....0.0000000...\",\n \"....00000000...00.....0.......00...00......0.0..000.00000000....\",\n \".....0000000.0..0000.0000.000..000....000.00000.0.000000000.....\",\n \".....0000000000.0..0..0...0.0000.000.00.0.....0...000000000.....\",\n \"......00000000....00.00.0....0...0.0....000.0...0000000000......\",\n \".......000000000.00...00000.00.0.0...0.00...0000000000000.......\",\n \".......000000000..000..0.0...000...0.000..0...00000000000.......\",\n \"........000000000...0000...000.00.0000.0000.000000000000........\",\n \".........000000000.00....0.0......0....0.00000000000000.........\",\n \"..........000000000000.0.0000.00.00.0.00..000000000000..........\",\n \"...........0000000000000....0000....0....000000000000...........\",\n \".............00000000000000000000.00000000000000000.............\",\n \"..............000000000000000000000000000000000000..............\",\n \"................00000000000000000000000000000000................\",\n \".................000000000000000000000000000000.................\",\n \"....................000000000000000000000000....................\",\n \"......................00000000000000000000......................\",\n \"..........................000000000000..........................\"\n)\n\nfun main() {\n// val sc = Scanner(File(\"input-e.txt\"))\n val sc = Scanner(System.`in`)\n SolutionE().doSolve(sc)\n}\n\nclass SolutionE {\n fun doSolve(sc: Scanner) {\n val row = sc.nextInt()\n val col = sc.nextInt()\n\n val sym = matrix[row][col]\n if (sym == '.') {\n println(\"OUT\")\n } else {\n println(\"IN\")\n }\n }\n}"}, {"source_code": "fun main() {\n val ans = \"1111111111111111111111111101010000001011111111111111111111111111111111111111111111111101000101010110100000111111111111111111111111111111111111111111000101110111001011110110111111111111111111111111111111111111100001010100000111100001010001011111111111111111111111111111111100111111010111110000111101010100111111111111111111111111111111011001000001000100010110100111011010111111111111111111111111111000110110111111010111000011001001001001111111111111111111111110000001001001000100010001111001101101110001111111111111111111110000000000001111011111011101001100100101100011111111111111111110000000000000000000010000000110000110000000000111111111111111110000000000000000000000000000000000000000000000001111111111111110000000000000000000000000000000000000000000000000011111111111111000000000000000000000000000000000000000000000000001111111111111000000000000000000000000000000000000000000000000000011111111111000000000000000000000000000000000000000000000000000000111111111100000000000000000000000000000000000000000000000000000011111111100000000000000000000000000000000000000000000000000000000111111100000000000000000000000000000000000000000000000000000000001111111100000000000000000000000000000000000000000000000000000000111111111100000000000011101100000000000000111010100000000000001111111001111100000000011011100000000000000010111111100000000111111111100001111100000111001011100000000000000010010011010011111110011100000001111101110001100011000000000001011011100111111111000000110000000001111101101100100111000000000100100000110111100000000011000000000000100100011111000110000000111011011110001000000000001100000000011111011100010001110000000010100000101110110100000000100000000000010001011011011101100000011011011110010001110000000000000000000011101101001000100010000101000100001100011101000000000000000000001000000100001111011010111101011010000111000100000000000000000000111110110110001000111010100100101101110110110000000000000000000001001000010010001110100011111000010100000010000000000000000000001110001101101110001011000100001101000111011100000000000000000000001111100100010010001001111101100100110111010000000000000000000000010010111101011110101101010010111001001000000000000000000000000111100001010101010000100101101000110001110000000000000000000000001011011100011100001110110011110110011100000000000000000000000000000111000111010010010010011010001011011000000000000000000000000000000111010000001111100000001110111000000000000000010000000000000000110111100000101000000000001110110000000000000011000000000000000000000000000000111100000000000000000000000000001100000000000000000000000000010110100000000000000000000000000000110000000000000000000000000101110000000000000000000000000000000011100000000000000000000000011101110000000000000000000000000000011110000000110000000000000000000100000000000000000000000000000001111100000001010000000000000000111000000000000000000000100000001111110000000111011100000000000110100000000000100000101111000000111111000000010101011010111001010011010110100111001111101000000011111110000000011100111110111111100111001111110101100010000000011111111100000001011000010000100011000111100010000010100000000011111111110000000000101101101110100001000100101111101110000000001111111111100000000111100100101111011101011110001011100000000001111111111111000000000100111000001001010111010011100000000000001111111111111100000000011000110101110001110100011011100000000000111111111111111000000000111000011100010010000100001000000000000111111111111111110000000001001111010111111011110100000000000000111111111111111111100000000000010100001001001010011000000000000111111111111111111111000000000000011110000111101111000000000000111111111111111111111111000000000000000000001000000000000000001111111111111111111111111110000000000000000000000000000000000001111111111111111111111111111110000000000000000000000000000000011111111111111111111111111111111100000000000000000000000000000011111111111111111111111111111111111110000000000000000000000001111111111111111111111111111111111111111110000000000000000000011111111111111111111111111111111111111111111111100000000000011111111111111111111111111\"\n val (y, x) = readLine()!!.split(\" \").map(String::toInt)\n println(if (ans[y * 64 + x] == '1') \"OUT\" else \"IN\")\n}\n"}, {"source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.File\nimport java.io.PrintWriter\nimport java.util.Arrays\nimport javax.imageio.ImageIO\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 img = ImageIO.read(File(\"jordan.png\"))\n//\n// val f = 964.0 / 64\n// val A = Array(64) { r -> IntArray(64) { c ->\n// img.getRGB((f * (c + 0.5)).toInt() ,(f * (r + 0.5)).toInt()) and 1\n// } }\n//\n// for(ln in A) println(ln.joinToString(\"\"))\n\n val img = \"\"\"1111111111111111111111111101010000001011111111111111111111111111\n1111111111111111111111010001010101101000001111111111111111111111\n1111111111111111111100010111011100101111011011111111111111111111\n1111111111111111100001010100000111100001010001011111111111111111\n1111111111111111001111110101111100001111010101001111111111111111\n1111111111111101100100000100010001011010011101101011111111111111\n1111111111111000110110111111010111000011001001001001111111111111\n1111111111100000010010010001000100011110011011011100011111111111\n1111111111000000000000111101111101110100110010010110001111111111\n1111111110000000000000000000010000000110000110000000000111111111\n1111111100000000000000000000000000000000000000000000000011111111\n1111111000000000000000000000000000000000000000000000000001111111\n1111111000000000000000000000000000000000000000000000000001111111\n1111110000000000000000000000000000000000000000000000000000111111\n1111100000000000000000000000000000000000000000000000000000011111\n1111100000000000000000000000000000000000000000000000000000011111\n1111000000000000000000000000000000000000000000000000000000001111\n1110000000000000000000000000000000000000000000000000000000000111\n1111100000000000000000000000000000000000000000000000000000000111\n1111111000000000000111011000000000000001110101000000000000011111\n1100111110000000001101110000000000000001011111110000000011111111\n1100001111100000111001011100000000000000010010011010011111110011\n1000000011111011100011000110000000000010110111001111111110000001\n1000000000111110110110010011100000000010010000011011110000000001\n1000000000000100100011111000110000000111011011110001000000000001\n1000000000111110111000100011100000000101000001011101101000000001\n0000000000001000101101101110110000001101101111001000111000000000\n0000000000011101101001000100010000101000100001100011101000000000\n0000000000010000001000011110110101111010110100001110001000000000\n0000000000011111011011000100011101010010010110111011011000000000\n0000000000001001000010010001110100011111000010100000010000000000\n0000000000011100011011011100010110001000011010001110111000000000\n0000000000000111110010001001000100111110110010011011101000000000\n0000000000000010010111101011110101101010010111001001000000000000\n0000000000001111000010101010100001001011010001100011100000000000\n0000000000000101101110001110000111011001111011001110000000000000\n0000000000000000111000111010010010010011010001011011000000000000\n0000000000000000001110100000011111000000011101110000000000000000\n1000000000000000011011110000010100000000000111011000000000000001\n1000000000000000000000000000000111100000000000000000000000000001\n1000000000000000000000000000101101000000000000000000000000000001\n1000000000000000000000000010111000000000000000000000000000000001\n1100000000000000000000000011101110000000000000000000000000000011\n1100000001100000000000000000001000000000000000000000000000000011\n1110000000101000000000000000011100000000000000000000010000000111\n1110000000111011100000000000110100000000000100000101111000000111\n1110000000101010110101110010100110101101001110011111010000000111\n1111000000001110011111011111110011100111111010110001000000001111\n1111100000001011000010000100011000111100010000010100000000011111\n1111100000000001011011011101000010001001011111011100000000011111\n1111110000000011110010010111101110101111000101110000000000111111\n1111111000000000100111000001001010111010011100000000000001111111\n1111111000000000110001101011100011101000110111000000000001111111\n1111111100000000011100001110001001000010000100000000000011111111\n1111111110000000001001111010111111011110100000000000000111111111\n1111111111000000000000101000010010010100110000000000001111111111\n1111111111100000000000001111000011110111100000000000011111111111\n1111111111111000000000000000000001000000000000000001111111111111\n1111111111111100000000000000000000000000000000000011111111111111\n1111111111111111000000000000000000000000000000001111111111111111\n1111111111111111100000000000000000000000000000011111111111111111\n1111111111111111111100000000000000000000000011111111111111111111\n1111111111111111111111000000000000000000001111111111111111111111\n1111111111111111111111111100000000000011111111111111111111111111\"\"\".lines()\n\n val r = readInt()\n val c = readInt()\n\n val ans = if(img[r][c] == '0') \"IN\" else \"OUT\"\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 _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}"}, {"source_code": "val pole = listOf(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, 0, 1, 0, 0, 0, 0, 0, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 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, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 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, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 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, 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, 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, 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, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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)\n\nfun main() {\n val (x, y) = readLine()!!.split(\" \").map { it.toInt() }\n println(if (pole[x*64 + y] == 0) \"IN\" else \"OUT\")\n}"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 1)\n println(14)\n else if (x == 2)\n println(12)\n else if (x == 3)\n println(13)\n else if (x == 4)\n println(8)\n else if (x == 5)\n println(9)\n else if (x == 6)\n println(10)\n else if (x == 7)\n println(11)\n else if (x == 8)\n println(0)\n else if (x == 9)\n println(1)\n else if (x == 10)\n println(2)\n else if (x == 11)\n println(3)\n else if (x == 12)\n println(4)\n else if (x == 13)\n println(5)\n else if (x == 14)\n println(6)\n else if (x == 15)\n println(7)\n else if (x / 1 % 3 == 0)\n println('a')\n else if (x / 1 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.util.*\n\nval SMILEY = (\"0000000000000000000000000010101111110100000000000000000000000000\\n\" +\n \"0000000000000000000000101110101010010111110000000000000000000000\\n\" +\n \"0000000000000000000011101000100011010000100100000000000000000000\\n\" +\n \"0000000000000000011110101011111000011110101110100000000000000000\\n\" +\n \"0000000000000000110000001010000011110000101010110000000000000000\\n\" +\n \"0000000000000010011011111011101110100101100010010100000000000000\\n\" +\n \"0000000000000111001001000000101000111100110110110110000000000000\\n\" +\n \"0000000000011111101101101110111011100001100100100011100000000000\\n\" +\n \"0000000000111111111111000010000010001011001101101001110000000000\\n\" +\n \"0000000001111111111111111111101111111001111001111111111000000000\\n\" +\n \"0000000011111111111111111111111111111111111111111111111100000000\\n\" +\n \"0000000111111111111111111111111111111111111111111111111110000000\\n\" +\n \"0000000111111111111111111111111111111111111111111111111110000000\\n\" +\n \"0000001111111111111111111111111111111111111111111111111111000000\\n\" +\n \"0000011111111111111111111111111111111111111111111111111111100000\\n\" +\n \"0000011111111111111111111111111111111111111111111111111111100000\\n\" +\n \"0000111111111111111111111111111111111111111111111111111111110000\\n\" +\n \"0001111111111111111111111111111111111111111111111111111111111000\\n\" +\n \"0000011111111111111111111111111111111111111111111111111111111000\\n\" +\n \"0000000111111111111000100111111111111110001010111111111111100000\\n\" +\n \"0011000001111111110010001111111111111110100000001111111100000000\\n\" +\n \"0011110000011111000110100011111111111111101101100101100000001100\\n\" +\n \"0111111100000100011100111001111111111101001000110000000001111110\\n\" +\n \"0111111111000001001001101100011111111101101111100100001111111110\\n\" +\n \"0111111111111011011100000111001111111000100100001110111111111110\\n\" +\n \"0111111111000001000111011100011111111010111110100010010111111110\\n\" +\n \"1111111111110111010010010001001111110010010000110111000111111111\\n\" +\n \"1111111111100010010110111011101111010111011110011100010111111111\\n\" +\n \"1111111111101111110111100001001010000101001011110001110111111111\\n\" +\n \"1111111111100000100100111011100010101101101001000100100111111111\\n\" +\n \"1111111111110110111101101110001011100000111101011111101111111111\\n\" +\n \"1111111111100011100100100011101001110111100101110001000111111111\\n\" +\n \"1111111111111000001101110110111011000001001101100100010111111111\\n\" +\n \"1111111111111101101000010100001010010101101000110110111111111111\\n\" +\n \"1111111111110000111101010101011110110100101110011100011111111111\\n\" +\n \"1111111111111010010001110001111000100110000100110001111111111111\\n\" +\n \"1111111111111111000111000101101101101100101110100100111111111111\\n\" +\n \"1111111111111111110001011111100000111111100010001111111111111111\\n\" +\n \"0111111111111111100100001111101011111111111000100111111111111110\\n\" +\n \"0111111111111111111111111111111000011111111111111111111111111110\\n\" +\n \"0111111111111111111111111111010010111111111111111111111111111110\\n\" +\n \"0111111111111111111111111101000111111111111111111111111111111110\\n\" +\n \"0011111111111111111111111100010001111111111111111111111111111100\\n\" +\n \"0011111110011111111111111111110111111111111111111111111111111100\\n\" +\n \"0001111111010111111111111111100011111111111111111111101111111000\\n\" +\n \"0001111111000100011111111111001011111111111011111010000111111000\\n\" +\n \"0001111111010101001010001101011001010010110001100000101111111000\\n\" +\n \"0000111111110001100000100000001100011000000101001110111111110000\\n\" +\n \"0000011111110100111101111011100111000011101111101011111111100000\\n\" +\n \"0000011111111110100100100010111101110110100000100011111111100000\\n\" +\n \"0000001111111100001101101000010001010000111010001111111111000000\\n\" +\n \"0000000111111111011000111110110101000101100011111111111110000000\\n\" +\n \"0000000111111111001110010100011100010111001000111111111110000000\\n\" +\n \"0000000011111111100011110001110110111101111011111111111100000000\\n\" +\n \"0000000001111111110110000101000000100001011111111111111000000000\\n\" +\n \"0000000000111111111111010111101101101011001111111111110000000000\\n\" +\n \"0000000000011111111111110000111100001000011111111111100000000000\\n\" +\n \"0000000000000111111111111111111110111111111111111110000000000000\\n\" +\n \"0000000000000011111111111111111111111111111111111100000000000000\\n\" +\n \"0000000000000000111111111111111111111111111111110000000000000000\\n\" +\n \"0000000000000000011111111111111111111111111111100000000000000000\\n\" +\n \"0000000000000000000011111111111111111111111100000000000000000000\\n\" +\n \"0000000000000000000000111111111111111111110000000000000000000000\\n\" +\n \"0000000000000000000000000011111111111100000000000000000000000000\").split(\"\\n\")\n\nfun main() {\n val jin = Scanner(System.`in`)\n val y = jin.nextInt()\n val x = jin.nextInt()\n println(if (SMILEY[y][x] == '1') \"IN\" else \"OUT\")\n}"}, {"source_code": "fun main() {\n val (row, col) = System.`in`.bufferedReader().readLine().split(' ').map(String::toInt)\n val out = when (row) {\n 0 -> {\n when (col) {\n 26, 28, in 30..35, 37 -> false\n else -> true\n }\n }\n 1 -> {\n when (col) {\n 22, in 24..26, 28, 30, 32, 35, in 37..41 -> false\n else -> true\n }\n }\n 2 -> {\n when (col) {\n in 20..22, 24, 28, in 32..33, 35, 40, 43 -> false\n else -> true\n }\n }\n 3 -> {\n when (col) {\n in 17..20, 22, 24, in 26..30, in 35..38, 40, in 42..44, 46 -> false\n else -> true\n }\n }\n 4 -> {\n when (col) {\n in 16..17, 24, 26, in 32..35, 40, 42, 44, in 46..47 -> false\n else -> true\n }\n }\n 5 -> {\n when (col) {\n 14, in 17..18, in 20..24, in 26..28, in 30..32, 34, 37, in 39..40, 44, 47, 49 -> false\n else -> true\n }\n }\n 6 -> {\n when (col) {\n in 13..15, 18, 21, 28, 30, in 34..37, in 40..41, in 43..44, in 46..47, in 49..50 -> false\n else -> true\n }\n }\n 7 -> {\n when (col) {\n in 11..16, in 18..19, in 21..22, in 24..26, in 28..30, in 32..34, in 39..40, 43, 46, in 50..52 -> false\n else -> true\n }\n }\n 8 -> {\n when (col) {\n in 10..21, 26, 32, 36, in 38..39, in 42..43, in 45..46, 48, in 51..53 -> false\n else -> true\n }\n }\n 9 -> {\n when (col) {\n in 9..28, in 30..36, in 39..42, in 45..54 -> false\n else -> true\n }\n }\n 10 -> {\n when (col) {\n in 8..55 -> false\n else -> true\n }\n }\n 11, 12 -> {\n when (col) {\n in 7..56 -> false\n else -> true\n }\n }\n 13 -> {\n when (col) {\n in 6..57 -> false\n else -> true\n }\n }\n 14, 15 -> {\n when (col) {\n in 5..58 -> false\n else -> true\n }\n }\n 16 -> {\n when (col) {\n in 4..59 -> false\n else -> true\n }\n }\n 17 -> {\n when (col) {\n in 3..60 -> false\n else -> true\n }\n }\n 18 -> {\n when (col) {\n in 5..60 -> false\n else -> true\n }\n }\n 19 -> {\n when (col) {\n in 7..18, 22, in 25..38, 42, 44, in 46..58 -> false\n else -> true\n }\n }\n 20 -> {\n when (col) {\n in 2..3, in 9..17, 20, in 24..38, 40, in 48..55 -> false\n else -> true\n }\n }\n 21 -> {\n when (col) {\n in 2..5, in 11..15, in 19..20, 22, in 26..40, in 42..43, in 45..46, 49, in 51..52, in 60..61 -> false\n else -> true\n }\n }\n 22 -> {\n when (col) {\n in 1..7, 13, in 17..19, in 22..24, in 27..37, 39, 42, in 46..47, in 57..62 -> false\n else -> true\n }\n }\n 23 -> {\n when (col) {\n in 1..9, 15, 18, in 21..22, in 24..25, in 29..37, in 39..40, in 42..46, 49, in 54..62 -> false\n else -> true\n }\n }\n 24 -> {\n when (col) {\n in 1..12, in 14..15, in 17..19, in 25..27, in 30..36, 40, 43, in 48..50, in 52..62 -> false\n else -> true\n }\n }\n 25 -> {\n when (col) {\n in 1..9, 15, in 19..21, in 23..25, in 29..36, 38, in 40..44, 46, 50, 53, in 55..62 -> false\n else -> true\n }\n }\n 26 -> {\n when (col) {\n in 0..11, in 13..15, 17, 20, 23, 27, in 30..35, 38, 41, in 46..47, in 49..51, in 55..63 -> false\n else -> true\n }\n }\n 27 -> {\n when (col) {\n in 0..10, 14, 17, in 19..20, in 21..24, in 26..28, in 30..33, 35, in 37..39, in 41..44, in 47..49, 53, in 55..63 -> false\n else -> true\n }\n }\n 28 -> {\n when (col) {\n in 0..10, in 12..17, in 19..22, 27, 30, 32, 37, 39, 42, in 44..47, in 51..53, in 55..63 -> false\n else -> true\n }\n }\n 29 -> {\n when (col) {\n in 0..10, 16, 19, in 22..24, in 26..28, 32, 34, in 36..37, in 39..40, 42, 45, 49, 52, in 55..63 -> false\n else -> true\n }\n }\n 30 -> {\n when (col) {\n in 0..11, in 13..14, in 16..19, in 21..22, in 24..26, 30, in 32..34, in 40..43, 45, in 47..52, in 54..63 -> false\n else -> true\n }\n }\n 31 -> {\n when (col) {\n in 0..10, in 14..16, 19, 22, in 26..28, 30, in 33..35, in 37..40, 43, in 45..47, 51, in 55..63 -> false\n else -> true\n }\n }\n 32 -> {\n when (col) {\n in 0..12, in 18..19, in 21..23, in 25..26, in 28..30, in 32..33, 39, in 42..43, in 45..46, 49, 53, in 55..63 -> false\n else -> true\n }\n }\n 33 -> {\n when (col) {\n in 0..13, in 15..16, 18, 23, 25, 30, 32, 35, 37, in 39..40, 42, in 46..47, in 49..50, in 52..63 -> false\n else -> true\n }\n }\n 34 -> {\n when (col) {\n in 0..11, in 16..19, 21, 23, 25, 27, in 29..32, in 34..35, 37, 40, in 42..44, in 47..49, in 53..63 -> false\n else -> true\n }\n }\n 35 -> {\n when (col) {\n in 0..12, 14, 17, in 21..23, in 27..30, 34, in 37..38, 43, in 46..47, in 51..63 -> false\n else -> true\n }\n }\n 36 -> {\n when (col) {\n in 0..15, in 19..21, 25, in 27..28, in 30..31, in 33..34, in 36..37, 40, in 42..44, 46, 49, in 52..63 -> false\n else -> true\n }\n }\n 37 -> {\n when (col) {\n in 0..17, 21, in 23..28, in 34..40, 44, in 48..63 -> false\n else -> true\n }\n }\n 38 -> {\n when (col) {\n in 1..16, 19, in 24..28, 30, in 32..42, 46, in 49..62 -> false\n else -> true\n }\n }\n 39 -> {\n when (col) {\n in 1..30, in 35..62 -> false\n else -> true\n }\n }\n 40 -> {\n when(col){\n in 1..27, 29, 32, in 34..62 -> false\n else -> true\n }\n }\n 41 -> {\n when (col) {\n in 1..25, 27, in 31..62 -> false\n else -> true\n }\n }\n 42 -> {\n when (col) {\n in 2..25, 29, in 33..61 -> false\n else -> true\n }\n }\n 43 -> {\n when (col) {\n in 2..8, in 11..29, in 31..61 -> false\n else -> true\n }\n }\n 44 -> {\n when (col) {\n in 3..9, 11, in 13..28, in 32..52, in 54..60 -> false\n else -> true\n }\n }\n 45 -> {\n when (col) {\n in 3..9, 13, in 17..27, 30, in 32..42, in 44..48, 50, in 55..60 -> false\n else -> true\n }\n }\n 46 -> {\n when (col) {\n in 3..9, 11, 13, 15, 18, 20, in 24..25, 27, in 29..30, 33, 35, 38, in 40..41, in 45..46, 52, in 54..60 -> false\n else -> true\n }\n }\n 47 -> {\n when (col) {\n in 4..11, in 15..16, 22, in 30..31, in 35..36, 43, 45, in 48..50, in 52..59 -> false\n else -> true\n }\n }\n 48 -> {\n when (col) {\n in 5..11, 13, in 16..19, in 21..24, in 26..28, in 31..33, in 38..40, in 42..46, 48, in 50..58 -> false\n else -> true\n }\n }\n 49 -> {\n when (col) {\n in 5..14, 16, 19, 22, 26, in 28..31, in 33..35, in 37..38, 40, 46, in 50..58 -> false\n else -> true\n }\n }\n 50 -> {\n when (col) {\n in 6..13, in 18..19, in 21..22, 24, 29, 33, 35, in 40..42, 44, in 48..57 -> false\n else -> true\n }\n }\n 51 -> {\n when (col) {\n in 7..15, in 17..18, in 22..26, in 28..29, 31, 33, 37, in 39..40, in 44..56 -> false\n else -> true\n }\n }\n 52 -> {\n when (col) {\n in 7..15, in 18..20, 23, 25, in 29..31, 35, in 37..39, 42, in 46..56 -> false\n else -> true\n }\n }\n 53 -> {\n when (col) {\n in 8..16, in 20..23, in 27..29, in 31..32, in 34..37, in 39..42, in 44..55 -> false\n else -> true\n }\n }\n 54 -> {\n when (col) {\n in 9..17, in 19..20, 25, 27, 34, 39, in 41..54 -> false\n else -> true\n }\n }\n 55 -> {\n when (col) {\n in 10..21, 23, in 25..28, in 30..31, in 33..34, 36, in 38..39, in 42..53 -> false\n else -> true\n }\n }\n 56 -> {\n when (col) {\n in 11..23, in 28..31, 36, in 41..52 -> false\n else -> true\n }\n }\n 57 -> {\n when (col) {\n in 13..32, in 34..50 -> false\n else -> true\n }\n }\n 58 -> {\n when (col) {\n in 14..49 -> false\n else -> true\n }\n }\n 59 -> {\n when (col) {\n in 16..47 -> false\n else -> true\n }\n }\n 60 -> {\n when (col) {\n in 17..46 -> false\n else -> true\n }\n }\n 61 -> {\n when (col) {\n in 20..43 -> false\n else -> true\n }\n }\n 62 -> {\n when (col) {\n in 22..41 -> false\n else -> true\n }\n }\n 63 -> {\n when (col) {\n in 26..37 -> false\n else -> true\n }\n }\n else -> true\n }\n\n if(out){\n print(\"OUT\")\n } else {\n print(\"IN\")\n }\n}"}], "negative_code": [{"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}"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 3)\n println(13)\n else if (x % 3 == 0)\n println('a')\n else if (x % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(13)\n else if (x == 3)\n println(13)\n else if (x / 3 % 3 == 0)\n println('a')\n else if (x / 3 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(-1)\n else if (x == 3)\n println(13)\n else if (x / 3 % 3 == 0)\n println('a')\n else if (x / 3 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = 2\n val c = 13 - a * 3 * 3 - b * 3\n print(a * x * x + b * x + c)\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 1\n val b = 2\n val c = 13 - a * 3 * 3 - b * 3\n print(a * x * x + b * x + c)\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(4)\n else if (x == 3)\n println(13)\n else if (x / 3 % 3 == 0)\n println('a')\n else if (x / 3 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(1)\n else if (x == 3)\n println(13)\n else if (x / 3 % 3 == 0)\n println('a')\n else if (x / 3 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(0)\n else if (x == 3)\n println(13)\n else if (x / 3 % 3 == 0)\n println('a')\n else if (x / 3 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 a = sc.nextInt()\n print(a * (a+1) + 1)\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 1)\n println(14)\n else if (x == 2)\n println(12)\n else if (x == 3)\n println(13)\n else if (x == 4)\n println(10)\n else if (x / 1 % 3 == 0)\n println('a')\n else if (x / 1 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 3)\n println(13)\n else if (x / 3 % 3 == 0)\n println('a')\n else if (x / 3 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\nimport kotlin.math.max\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(5)\n\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()"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\nimport kotlin.math.max\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}\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()"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\nimport kotlin.math.max\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(7)\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()"}, {"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()"}, {"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}\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()"}, {"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}\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()"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\nimport kotlin.math.max\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}\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()"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\nimport kotlin.math.max\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)\nfun tanosSort(a: IntArray): Int {\n if (a.contentEquals(a.sorted().toIntArray())) return a.size\n val first = a.slice(0 until a.size / 2).toIntArray()\n val second = a.slice(a.size / 2 until a.size).toIntArray()\n return max(tanosSort(first), tanosSort(second))\n}\n\nfun main() {\n val n = nextInt()\n println(n * n + 4)\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()"}, {"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}\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()"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\nimport kotlin.math.max\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(4)\n\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()"}, {"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}\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()"}, {"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}\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()"}, {"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(3)\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()"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\nimport kotlin.math.max\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)\nfun tanosSort(a: IntArray): Int {\n if (a.contentEquals(a.sorted().toIntArray())) return a.size\n val first = a.slice(0 until a.size / 2).toIntArray()\n val second = a.slice(a.size / 2 until a.size).toIntArray()\n return max(tanosSort(first), tanosSort(second))\n}\n\nfun main() {\n val n = nextInt()\n println((n + 1) * (n + 1) - n)\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()"}, {"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}\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()"}, {"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(1)\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()"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\nimport kotlin.math.max\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(6)\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()"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\nimport kotlin.math.max\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(7)\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()"}, {"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(2)\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()"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 1)\n println(14)\n else if (x == 2)\n println(12)\n else if (x == 3)\n println(13)\n else if (x == 4)\n println(8)\n else if (x == 5)\n println(9)\n else if (x == 6)\n println(11)\n else if (x / 1 % 3 == 0)\n println('a')\n else if (x / 1 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 3)\n println(13)\n else if (x / 3 % 3 == 0)\n println('a')\n else if (x / 3 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 1)\n println(14)\n else if (x == 2)\n println(12)\n else if (x == 3)\n println(13)\n else if (x == 4)\n println(8)\n else if (x == 5)\n println(9)\n else if (x / 1 % 3 == 0)\n println('a')\n else if (x / 1 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 a = sc.nextInt()\n print(a * a + 4)\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 1)\n println(14)\n else if (x == 2)\n println(14)\n else if (x == 3)\n println(13)\n else if (x / 1 % 3 == 0)\n println('a')\n else if (x / 1 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = 1\n val c = 13 - a * 3 * 3 - b * 3\n print(a * x * x + b * x + c)\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n print(a * x * x + b * x + c)\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 a = sc.nextInt()\n print(a * a - a + 7)\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 1)\n println(14)\n else if (x == 2)\n println(12)\n else if (x == 3)\n println(13)\n else if (x == 4)\n println(8)\n else if (x == 5)\n println(9)\n else if (x == 6)\n println(10)\n else if (x == 7)\n println(11)\n else if (x == 8)\n println(4)\n else if (x / 1 % 3 == 0)\n println('a')\n else if (x / 1 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 1)\n println(14)\n else if (x == 2)\n println(12)\n else if (x == 3)\n println(13)\n else if (x == 4)\n println(8)\n else if (x == 5)\n println(9)\n else if (x == 6)\n println(10)\n else if (x == 7)\n println(11)\n else if (x == 8)\n println(5)\n else if (x / 1 % 3 == 0)\n println('a')\n else if (x / 1 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 1)\n println(14)\n else if (x == 2)\n println(12)\n else if (x == 3)\n println(13)\n else if (x == 4)\n println(11)\n else if (x / 1 % 3 == 0)\n println('a')\n else if (x / 1 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 1)\n println(14)\n else if (x == 2)\n println(13)\n else if (x == 3)\n println(13)\n else if (x / 1 % 3 == 0)\n println('a')\n else if (x / 1 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 1)\n println(14)\n else if (x == 2)\n println(12)\n else if (x == 3)\n println(13)\n else if (x == 4)\n println(9)\n else if (x / 1 % 3 == 0)\n println('a')\n else if (x / 1 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 1\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n print(a * x * x + b * x + c)\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 1)\n println(14)\n else if (x == 2)\n println(12)\n else if (x == 3)\n println(13)\n else if (x == 4)\n println(8)\n else if (x == 5)\n println(9)\n else if (x == 6)\n println(10)\n else if (x == 7)\n println(11)\n else if (x == 8)\n println(7)\n else if (x / 1 % 3 == 0)\n println('a')\n else if (x / 1 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = 0\n val c = 13 - a * 3 * 3 - b * 3\n print(a * x * x + b * x + c)\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -1\n val c = 13 - a * 3 * 3 - b * 3\n print(a * x * x + b * x + c)\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(5)\n else if (x == 3)\n println(13)\n else if (x / 3 % 3 == 0)\n println('a')\n else if (x / 3 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(2)\n else if (x == 3)\n println(13)\n else if (x / 3 % 3 == 0)\n println('a')\n else if (x / 3 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(3)\n else if (x == 3)\n println(13)\n else if (x / 3 % 3 == 0)\n println('a')\n else if (x / 3 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 1)\n println(14)\n else if (x == 2)\n println(12)\n else if (x == 3)\n println(13)\n else if (x == 4)\n println(8)\n else if (x == 5)\n println(9)\n else if (x == 6)\n println(10)\n else if (x == 7)\n println(11)\n else if (x == 8)\n println(0)\n else if (x / 1 % 3 == 0)\n println('a')\n else if (x / 1 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\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 x = sc.nextInt()\n val a = 2\n val b = -2\n val c = 13 - a * 3 * 3 - b * 3\n if (x == 0)\n println(15)\n else if (x == 1)\n println(14)\n else if (x == 2)\n println(12)\n else if (x == 3)\n println(13)\n else if (x == 4)\n println(8)\n else if (x == 5)\n println(9)\n else if (x == 6)\n println(10)\n else if (x == 7)\n println(11)\n else if (x == 8)\n println(6)\n else if (x / 1 % 3 == 0)\n println('a')\n else if (x / 1 % 3 == 1)\n while(true) {}\n else\n throw RuntimeException()\n }\n}\n"}, {"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"}], "src_uid": "879ac20ae5d3e7f1002afe907d9887df"} {"source_code": "import 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\nfun readLn() = readLine()!!\nfun readLong() = readLn().toLong()\nfun readLongs() = readLn().split(\" \").map{it.toLong()}\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 solve() {\n val cin = Scanner(System.`in`)\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 a=readLong();\n\n var check=one;\n\n while (check==one) {\n a=a+1;\n var map=hashMapOf();\n\n var q=a;\n var check1=one;\n while (q!=nul) {\n map[q%10]=map.getOrDefault(q%10,0)+1;\n if (map.getOrDefault(q%10,0)>one) check1=nul;\n q/=10; }\n if (check1==one) {check=two; print(a); }\n }\n\n /* --------- */\n\n}\n\nfun main() {\n val cin = Scanner(System.`in`)\n\n var T=one;\n //T=readLine()!!.toLong();\n for (i55555 in 1..T) solve()\n}\n", "positive_code": [{"source_code": "fun main() {\n\n var year = readLine()!!.toInt()\n\n while (true) {\n if (isBeautifulYear(++year)) {\n print(year)\n break\n }\n }\n}\n\nfun isBeautifulYear(x: Int): Boolean {\n\n val digitList = ArrayList()\n var year = x\n var digit: Int\n\n while (year > 0) {\n\n digit = year % 10\n if (digitList.contains(digit))\n return false\n digitList.add(digit)\n year /= 10\n }\n return true\n}\n\n\n"}, {"source_code": "import java.util.regex.Pattern\n\nfun main() {\n var line1 = readLine()!!.toInt()\n line1++\n while(true){\n var set = (\"\"+line1).toCharArray().toSet()\n if(set.size == (\"\"+line1).length){\n println(line1)\n return\n }\n line1++\n }\n}"}, {"source_code": "fun main(args: Array) {\n val prev = readLine()!!.toInt()\n val reg = \"^(?:([0-9])(?!.*\\\\1))*\\$\".toRegex()\n\n for(i in prev+1 .. 9012){\n if (reg.matches(i.toString())) {\n println(i)\n return\n }\n }\n}"}, {"source_code": "fun main() {\n var input = Integer.parseInt(readLine().orEmpty()) + 1\n while (true) {\n if (checkNum(input)) {\n println(input)\n return\n }\n input+=1\n }\n}\n\nfun checkNum(i: Int): Boolean {\n var result = true\n val mas = i.toString().toCharArray().map { n -> Integer.valueOf(n.toString()) }\n for (ii in mas.indices) {\n for (j in ii + 1 until mas.size) {\n if (mas[ii] == mas[j]) {\n result = false\n break\n }\n }\n }\n return result\n}\n"}, {"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 Int.isDistinct(): Boolean {\n return toString().let { it.length == it.toList().distinct().size }\n}\n\nfun main() {\n val year = readInt()\n var newYear = year + 1\n\n while (!newYear.isDistinct()) {\n ++newYear\n }\n\n println(newYear)\n}\n"}, {"source_code": "fun main(args: Array) {\n var year = readLine()!!.toInt()\n while (true) {\n year++\n val s = year.toString().toSet()\n if (s.size == 4) {\n println(year)\n return\n }\n }\n}\n\n"}, {"source_code": "fun main() {\n var x = readLine()!!.toInt()\n while (x++ < Integer.MAX_VALUE) {\n if (x.toString().split(\"\").distinct().count() == 5) {\n print(x)\n break\n }\n }\n}"}, {"source_code": "fun main(args:Array){\n var year = readLine()!!.toInt()\n\n do{\n year++\n }\n while (!isDigitsDifferent(year))\n\n print(year)\n}\n\nfun isDigitsDifferent(year:Int) : Boolean {\n val yearAsString = year.toString()\n var isDifferent = true;\n for (i in 0 until yearAsString.lastIndex){\n for (j in i+1..yearAsString.lastIndex){\n if(yearAsString[i] == yearAsString[j]){\n isDifferent = false\n }\n }\n }\n return isDifferent\n}"}, {"source_code": "fun solve(a: Int): Boolean {\n val used = mutableListOf()\n var mA = a\n\n for (i in 0 until 10) {\n used.add(0)\n }\n\n while (mA > 0) {\n if (used[mA % 10] > 0) {\n return false\n }\n used[mA % 10] = 1\n mA /= 10\n }\n \n return true\n}\n\nfun main() {\n var y = readLine()!!.toInt()\n\n while (true) {\n y++\n if (solve(y)) {\n println(y)\n return\n }\n }\n}"}, {"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\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}"}, {"source_code": "fun readInt(): Int = readLine()!!.toInt()\nfun isBeautiful(year: Int): Boolean {\n val resultList = year.toString().flatMap {\n listOf(it to 1)\n }\n val resultSet = resultList.toSet()\n if(resultSet.size == resultList.size)\n {\n return true\n }\n return false\n}\nfun findNumber(startYear: Int): Int{\n var copyStartYear = startYear + 1\n while (!isBeautiful(copyStartYear)){\n copyStartYear++\n }\n return copyStartYear\n}\n\nfun main(){\n val inputValue = readInt()\n print(findNumber(inputValue))\n}"}, {"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 inputYear = input.nextInt()\n\n var year = inputYear + 1\n\n while (year.toString().let { it.toSet().size != it.length }) year++\n\n output.print(year)\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}"}, {"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) = 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 fun check(y: Int): Boolean {\n val s = y.toString()\n return s.length == s.toSet().size\n }\n\n val io = ProblemIO.console()\n val n = io.readInt()\n for (y in n + 1 .. Integer.MAX_VALUE) {\n if (check(y)) {\n io.println(y)\n break\n }\n }\n io.close()\n}\n\nfun main(args: Array) {\n Thread({ solve() }).start()\n}\n"}, {"source_code": "fun main()\n{\n var year = readLine()!!.toInt()\n while(true)\n {\n year ++\n if (year.toString().toCharArray().toSet().size == 4)\n {\n println(year)\n break\n }\n }\n}"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val n1 = r.readLine()!!.toInt()\n var n2 = n1+1\n fun dis(int: Int)= int.toString().split(\"\").filter { it.length>0 }.toSet().size\n while (dis(n2)!=4){\n n2++\n }\n println(n2)\n}"}, {"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 main(){\n var x=readInt()\n var y=x+1\n while(true){\n var st=ArrayList()\n var tmp=y\n while(tmp>0){\n st.add(tmp%10)\n tmp/=10\n }\n st.sort()\n var ok=true\n for(i in 1 until st.size){\n if(st[i]==st[i-1])ok=false\n }\n if(ok)break\n y++\n }\n printLine(\"$y\")\n output()\n}"}, {"source_code": "fun Int.isAllDifferent() = this.toString().toSet().size == this.toString().length\n\nfun main() {\n\tvar input = readLine()!!.toInt()\n\tdo { input++ }\n\twhile (!input.isAllDifferent())\n\tprintln(input)\n}\n"}, {"source_code": "fun main() {\n var y = readLine()!!.toInt()\n\n for (i in 1000 until 9001) {\n y++\n if (y.toString().split(\"\").distinct().size == 5)\n break\n }\n\n print(y)\n}"}, {"source_code": "\nfun 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 9013) {\n x = solve(i)\n if(x==1){\n println(i)\n break\n }\n\n\n }\n\n\n}"}, {"source_code": "fun main() {\n var x = readLine()!!.toInt()\n while (true){\n x += 1\n val a: Int = x / 1000\n val b: Int = x / 100 % 10\n val c: Int = x / 10 % 10\n val d: Int = x % 10\n if (a != b && a != c && a != d && b != c && b != d && c != d) {\n break\n }\n }\n print(x)\n}"}, {"source_code": "fun main() {\n var x = readLine()!!.toInt()\n for(i in x until 9015){\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}"}, {"source_code": "fun check(n : Int) : Boolean {\n return n.toString().length == n.toString().toSet().size\n}\n\nfun main(args : Array) {\n var n = readLine()!!.toInt() + 1\n while(!check(n)) n++\n \n println(n)\n}"}, {"source_code": "fun main(args: Array) = println(generateSequence(readLine()!!.toInt() + 1) { it + 1 }.first { it.toString().toCharArray().toSet().size == 4 })"}, {"source_code": "fun main(args: Array) {\n val s = readLine()!!\n var n = s.toInt()\n while (true) {\n n++\n if (n.toString().toSet().size == 4) {\n println(n)\n break\n }\n }\n}"}, {"source_code": "// package codeforces\n\nfun main() {\n var y = readLine()!!.toInt() + 1\n while (y.toString().toSet().size < 4) {\n y++\n }\n println(y)\n}"}, {"source_code": "import java.util.*\nfun main(args: Array) {\n var sc = Scanner(System.`in`)\n var year = sc.nextInt()\n while(true){\n year++\n if (year.toString().length == year.toString().toSet().size){\n println(year)\n break\n }\n }\n}"}, {"source_code": "fun main(args : Array) {\n var num = readLine()!!.toInt()\n var distinc = false\n while (distinc == false){\n distinc = true\n num ++\n var s = (num.toString()).toCharArray()\n s.sort()\n for (i in 1..(s.size-1)) {\n if (s[i-1] == s[i]) {\n distinc = false\n }\n }\n }\n println(num)\n}"}, {"source_code": "// https://codeforces.com/problemset/problem/271/A\n\nfun main(args: Array) {\n val date = readLn()\n var dateInt = date.toInt()\n val actualSet = mutableSetOf()\n\n while (actualSet.size != 4) {\n dateInt++\n actualSet.clear()\n actualSet.addAll(dateInt.toString().toList())\n\n }\n\n print(dateInt)\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"}, {"source_code": "//package problem271A\n\nfun isUniqueYear(currentYear: Int): Boolean {\n val digits = BooleanArray(10)\n var year = currentYear\n\n while (year > 0) {\n val currentDigit = year % 10\n if (digits[currentDigit]) {\n return false\n }\n digits[currentDigit] = true\n year /= 10\n }\n return true\n}\n\nfun nextUniqueYear(startingYear: Int): Int {\n var currentYear = startingYear + 1\n\n while (!isUniqueYear(currentYear)) {\n ++currentYear\n }\n return currentYear\n}\n\nfun main() {\n val startingYear = readLine()!!.toInt()\n\n println(nextUniqueYear(startingYear))\n}\n"}, {"source_code": "import java.lang.reflect.Array\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nfun check(year : Int) : Boolean\n{\n var array = Array(10 , {0})\n var str = year.toString()\n for(i in 0 until str.length)\n {\n if(array[str[i].toInt()-48] >= 1)\n {\n return false\n }\n array[str[i].toInt()-48]++\n }\n return true\n}\nfun main() {\n var scanner = Scanner(System.`in`)\n var year = scanner.nextInt()\n year++\n while(check(year) == false) year++\n println(year)\n}\n\n"}, {"source_code": "fun main(args: Array) {\n var a = readLine()!!.toInt()\n\n while(true){\n a++\n if(check(a.toString().toCharArray())){\n print(a)\n return\n }\n }\n\n}\n\nfun check(elements : CharArray) : Boolean {\n return elements.toHashSet().size == elements.size\n}"}, {"source_code": "import java.util.*\nfun main() {\n val s = Scanner(System.`in`)\n var r = s.next()\n var x: Int = r.toInt()\n while (true){\n x++;\n r = x.toString()\n var n = r.length\n var q: Boolean = false\n var mp = hashMapOf()\n for (i in r) {\n if (mp[i] == 1) {\n q = true;\n } else\n mp[i] = 1\n }\n if (!q) {\n print(r)\n break\n }\n}\n}\n"}, {"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 .. 10000) {\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}"}, {"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 a = scanner.nextInt() + 1\n val arr = IntArray(10)\n while (true) {\n var flag = false\n for (i in a.toString()) {\n if (arr[i - '0'] == a) {\n flag = true\n break\n }\n arr[i - '0'] = a\n }\n a++\n if (flag)\n continue\n println(a - 1)\n return\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//}"}, {"source_code": "fun main(args: Array) {\n var year = readLine()!!.toInt()\n do {\n year++\n if (year.toString().toCharArray().toSet().size == 4) {\n println(year)\n break\n }\n } while (true)\n}\n"}, {"source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun main(args: Array){\n val scan = Scanner(System.`in`)\n var startYear = scan.nextInt() + 1\n\n fun checkYear(yea: Int): Boolean{\n var year = yea\n val arr = ArrayList()\n while (year != 0){\n arr.add(year % 10)\n year /= 10\n }\n var bool = false\n for (i in 0 until arr.size){\n for (j in i+1 until arr.size) if (arr[i] == arr[j]) bool = true\n }\n return bool\n }\n while (checkYear(startYear)){\n startYear++\n }\n print(startYear)\n}"}, {"source_code": "fun check(a: Int): Boolean {\n return a.toString().length == a.toString().toSet().size\n}\n\nfun main() {\n var a = readLine()!!.toInt()\n do {\n a += 1\n } while (!check(a))\n println(a)\n}"}, {"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 var n = readInt()\n while (!isUnique(++n)){}\n println(n)\n\n}\n\nfun isUnique(x: Int): Boolean {\n val s = x.toString()\n return s.toCharArray().distinct().size == s.length\n}"}, {"source_code": "fun main() {\n var year = readLine()!!.toInt() + 1\n\n while (true) {\n val str = year.toString()\n if (str.toCharArray().toSet().size == str.length) {\n println(year)\n break\n }\n year++\n }\n}"}, {"source_code": "import java.util.*\nfun checkyear(year:Int):Boolean\n{\n return year.toString().length==year.toString().toSet().size\n}\n\nfun main (args:Array)\n{\nvar year= readLine()!!.toInt()\n do\n {\n year++\n }while(!checkyear(year))\n print(year)\n}\n"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nval unique = { year: Int ->\n year.toString().toSet().size == 4\n}\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n var year = reader.readLine().toInt()\n while (!unique(++year));\n println(year)\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n var y = readLine()!!.toInt() + 1\n while(true) {\n var bitset = BitSet(10)\n var tmp = y\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(y)\n break\n }\n y++;\n }\n}"}, {"source_code": "fun main() {\n var year = readLine()!!\n var intYear = year.toInt()\n year = (++intYear).toString()\n while (true) {\n if (year.toSet().size == 4) {\n break\n } else {\n year = (++intYear).toString()\n }\n }\n println(intYear)\n}"}, {"source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n n++\n while (true) {\n var s: MutableSet = mutableSetOf()\n val str = n.toString()\n for (c in str) {\n s.add(c)\n }\n if (s.size == 4)\n break\n n++\n }\n print(\"$n\\n\")\n}\n"}, {"source_code": "fun main(args: Array) {\n println(\n generateSequence(readLine()!!.toInt() + 1, Int::inc)\n .first {\n val string = it.toString()\n string.toSet().size == string.length\n }\n )\n}\n"}], "negative_code": [{"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}"}, {"source_code": "fun main(args: Array) = println(generateSequence(readLine()!!.toInt()) { it + 1 }.first { it.toString().toCharArray().toSet().size == 4 })"}, {"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}"}, {"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}"}, {"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}"}, {"source_code": "fun main(args: Array) {\n val prev = readLine()!!.toInt()\n val reg = \"^(?:([0-9])(?!.*\\\\1))*\\$\".toRegex()\n for (next in prev + 1 .. 9000){\n if (reg.matches(next.toString())) {\n println(next)\n break\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n val prev = readLine()!!.toInt()\n val reg = \"^(?:([0-9])(?!.*\\\\1))*\\$\".toRegex()\n (prev + 1 until 9000).forEach{\n if (reg.matches(it.toString())) {\n println(it)\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n val prev = readLine()!!.toInt()\n val reg = \"^(?:([0-9])(?!.*\\\\1))*\\$\".toRegex()\n (prev + 1 until 9000).forEach{\n if (reg.matches(it.toString())) {\n println(it)\n return\n }\n }\n}"}, {"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 (i > 9000) return\n if (reg.matches(i.toString())) {\n println(i)\n return\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n val prev = readLine()!!.toInt()\n val reg = \"^(?:([0-9])(?!.*\\\\1))*\\$\".toRegex()\n\n for(i in prev+1 .. 9000){\n if (i <9000 && reg.matches(i.toString())) {\n println(i)\n return\n }\n }\n}"}, {"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}"}, {"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 (i == 9000) return\n if (reg.matches(i.toString())) {\n println(i)\n return\n }\n }\n}"}, {"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}"}, {"source_code": "fun main() {\n var x = readLine()!!.toInt()\n while (x++ < 0x2328) {\n if (x.toString().split(\"\").distinct().count()==5){\n print(x)\n break\n }\n }\n}"}, {"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}"}, {"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}"}], "src_uid": "d62dabfbec52675b7ed7b582ad133acd"} {"source_code": "import java.io.*\nimport java.util.StringTokenizer\n\nval err = System.err\nval bf = BufferedReader(InputStreamReader(System.`in`))\nvar st = StringTokenizer(\"\")\n\nfun nxtstring(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(bf.readLine())\n return st.nextToken()\n}\n\nfun nxtint() = nxtstring().toInt()\n\nfun genyear(leap: Boolean) = intArrayOf(\n 31, 28 + if (leap) 1 else 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31\n)\n\nfun main(args: Array) {\n val n = nxtint()\n val a = IntArray(n)\n for (i in 0 until n) a[i] = nxtint()\n val dat = IntArray(12 * 8)\n var day = 0\n for (year in 0 until 8) {\n for (i in genyear(year == 3)) {\n dat[day++] = i\n //err.printf(\"%d \", i)\n }\n //err.println()\n }\n for (i in 0 until dat.size - n) {\n val b = dat.copyOfRange(i, i + n)\n //for (y in b) err.printf(\"%d \", y)\n //err.println()\n if (b contentEquals a) {\n println(\"YES\")\n System.exit(0)\n }\n }\n println(\"NO\")\n}\n", "positive_code": [{"source_code": "import java.util.*\nimport java.util.Arrays\nimport java.util.Collections.indexOfSubList\nimport java.util.Collections.addAll\nimport java.util.ArrayList\n\n\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n\n val n = nextInt()\n val a = arrayOfNulls(n)\n for (i in 0 until n) {\n a[i] = nextInt()\n }\n val leap = arrayOf(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)\n val nonLeap = arrayOf(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)\n val l = ArrayList()\n l.addAll(Arrays.asList(*nonLeap))\n l.addAll(Arrays.asList(*nonLeap))\n l.addAll(Arrays.asList(*leap))\n l.addAll(Arrays.asList(*nonLeap))\n l.addAll(Arrays.asList(*nonLeap))\n val index = Collections.indexOfSubList(l, Arrays.asList(*a))\n if (index != -1) {\n println(\"Yes\")\n } else {\n println(\"No\")\n }\n}"}, {"source_code": "fun main() {\n var s = \"\"\n for (j in 0..15) {\n if (j == 0 || j == 4 || j == 12) {\n s += \"dbdcdcddcdcd\"\n } else {\n s += \"dadcdcddcdcd\"\n }\n }\n readLine()\n val t = readLine()!!.split(\" \").map { \"abcd\"[it.toInt() - 28] }.joinToString(\"\")\n println(if (s.contains(t)) \"yEs\" else \"nO\")\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\n\nval months0 = arrayListOf(\n 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,\n 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,\n 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,\n 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,\n 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,\n 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,\n 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,\n 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,\n 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,\n 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)\n\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val count = reader.readLine().toInt()\n val days = reader.readLine().split(' ').map { it.toInt() }\n val result = contains(months0.toIntArray(), days.toIntArray())\n println(if (result) \"YES\" else \"NO\")\n}\n\nfun contains(set1: IntArray, set2: IntArray): Boolean {\n if (set1.size < set2.size) {\n return false\n }\n var numMatched = 0\n while (numMatched < set2.size && set1[numMatched] == set2[numMatched]) {\n numMatched++\n }\n\n if (numMatched == set2.size) {\n return true\n } else {\n val subset = Arrays.copyOfRange(set1, 1, set1.size)\n return contains(subset, set2)\n }\n}\n"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val ms = readLine()!!.split(\" \").map {\n when (it) {\n \"28\" -> \"a\"\n \"29\" -> \"b\"\n \"30\" -> \"c\"\n \"31\" -> \"d\"\n else -> null!!\n }\n }.reduce { c1, c2 -> \"$c1$c2\" }\n\n val y = listOf(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)\n val x = listOf(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)\n val aaa = y + y + x + y + y\n val bbb = aaa.map {\n when (it) {\n 28 -> \"a\"\n 29 -> \"b\"\n 30 -> \"c\"\n 31 -> \"d\"\n else -> null!!\n }\n }.reduce { c1, c2 -> \"$c1$c2\" }\n\n print(if (ms in bbb) \"YES\" else \"NO\")\n}"}, {"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 d = Array(n) { sc.nextInt() }\n\n val year = listOf(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)\n val vis = listOf(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)\n\n\n if (check(year + year + year + vis, d) ||\n check(year + year + vis + year, d) ||\n check(year + vis + year + year, d) ||\n check(vis + year + year + year, d) ||\n check(year + year + year + year, d)) {\n println(\"YES\")\n }\n else {\n println(\"NO\")\n }\n\n\n}\n\nfun check(list: List, d: Array): Boolean {\n for(i in 0 until list.size){\n if(i + d.size > list.size) break\n\n if(list.subList(i, i + d.size) == d.toList()) return true\n }\n return false\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"}, {"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 d = Array(n) { sc.nextInt() }\n\n val year = listOf(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)\n val vis = listOf(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)\n\n if (check(year + year + year + vis + year + year + year + year, d)) println(\"YES\")\n else println(\"NO\")\n}\n\nfun check(list: List, d: Array) = (0 until list.size)\n .takeWhile { it + d.size <= list.size }\n .any { list.subList(it, it + d.size) == d.toList() }\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"}, {"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 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}"}], "negative_code": [{"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}"}], "src_uid": "d60c8895cebcc5d0c6459238edbdb945"} {"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\n for (i in 1 until input.length) {\n val nextChar = input[i]\n currentCarry++\n\n if (firstChar != nextChar) {\n firstChar = nextChar\n currentCarry = 1\n }\n\n if (currentCarry == 1) {\n result++\n }\n\n if (currentCarry == maxCarry) {\n currentCarry = 0\n }\n }\n\n println(result)\n}", "positive_code": [{"source_code": "fun main() {\n val s = readLine()!!\n var current = 'a'\n var count = 0\n var sol = 0\n for (c in s) {\n if (c == current && count < 5) count++\n else {\n sol++\n current = c\n count = 1\n }\n }\n print(sol)\n}"}], "negative_code": [{"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}"}], "src_uid": "5257f6b50f5a610a17c35a47b3a0da11"} {"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 b = readLine()!!.split(\" \").map(String::toInt)\n\n if (k > 1) {\n println(\"YES\")\n } else {\n (0..a.lastIndex)\n .filter { a[it] == 0 }\n .forEach { a[it] = b[0] }\n val yes = (1..a.lastIndex).any { a[it] < a[it - 1] }\n println(if (yes) \"YES\" else \"NO\")\n }\n\n}", "positive_code": [{"source_code": "import java.io.InputStream\nimport java.math.BigDecimal\nimport java.math.BigInteger\n\nfun main(args: Array) = input.run {\n val n = nextInt()\n val k = nextInt()\n val a = nextInts(n)\n val b = nextInts(k)\n b.sort()\n b.reverse()\n val ans = solve(a, b)\n println(if (ans) \"Yes\" else \"No\")\n}\n\nfun solve(a: IntArray, b: IntArray): Boolean {\n var i = 0\n a.indices.forEach {\n if (a[it] == 0) {\n a[it] = b[i++]\n }\n }\n return (1 until a.size).any {\n a[it] < a[it - 1]\n }\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"}, {"source_code": "import java.io.File\nimport java.io.InputStream\nimport java.util.*\n\nfun solve(inp: InputReader) {\n val (n, k) = readLine()!!.split(\" \").map(String::toInt)\n val seqA = readLine()!!.split(\" \").map(String::toInt).toMutableList()\n val seqB = readLine()!!.split(\" \").map(String::toInt).toMutableList()\n\n if (k > 1) {\n println(\"Yes\")\n } else {\n seqA[seqA.indexOf(0)] = seqB[0]\n val isAscending = (1..n-1).all { i -> seqA[i] > seqA[i - 1] }\n println(if (isAscending) \"No\" else \"Yes\")\n }\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"}, {"source_code": "import java.util.*\n\n/**\n * Created by Administrator on 2017/6/8.\n */\nfun isSort(a: Array, b: Int): Boolean {\n\n var last = 0\n for (i in 0..a.size-1){\n if(a[i]==0)\n a[i] = b\n if (0 == i){\n last = a[i]\n }else {\n \n if (a[i]) {\n\n var out = Scanner(System.`in`)\n var aLen = out.nextInt()\n var bLen = out.nextInt()\n var a = Array(aLen,{out.nextInt()})\n var b = Array(bLen,{out.nextInt()})\n // println(b[0])\n if (bLen>=2){\n println(\"Yes\")\n }else if (isSort(a,b[0])){\n println(\"No\")\n }else{\n println(\"Yes\")\n }\n\n}\n"}, {"source_code": "import java.util.*\n\nfun main(vararg args: String) {\n\n // TODO: KEEP\n// naturalOrder()\n fun IntArray.isOrdered() = if (size <= 1) true else (1 until size).all { this[it - 1] <= this[it] }\n\n with(Scanner(System.`in`)) {\n val n = nextInt()\n val k = nextInt()\n val a = IntArray(n) { nextInt() }\n val b = IntArray(k) { nextInt() }\n var r = k > 1\n if (!r) {\n a[a.indices.find { a[it] == 0 }!!] = b[0]\n r = !a.isOrdered()\n }\n println(if (r) \"Yes\" else \"No\")\n }\n}\n"}, {"source_code": "import java.io.*\nimport java.util.*\n\nval LOCAL_MODE = true\n\nfun main(args: Array) {\n val input: InputReader\n val output: PrintWriter\n if (false) {\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 Solver(input, output).run()\n input.close()\n output.close()\n}\n\nfun debug(x: Any) {\n if (LOCAL_MODE) {\n System.err.println(x)\n }\n}\n\nclass Solver(val input: InputReader, val output: PrintWriter) {\n\n companion object {\n val MOD = (1e9 + 7).toInt()\n }\n\n fun run() {\n if (true) {\n read()\n// output.println(solve())\n } else {\n for (stress in generateSequence({ 1 }, { it + 1 })) {\n debug(\"Stress #$stress\")\n generateStress()\n printStress()\n val my = solve()\n val slow = slow()\n// require(my == slow, { \"$my != $slow\" })\n }\n }\n\n }\n\n private fun printStress() {\n }\n\n private fun generateStress() {\n }\n\n private var n: Int = 0\n private var k: Int = 0\n\n private fun read() {\n n = input.nextInt()\n k = input.nextInt()\n val a = (1..n).map { input.nextInt() }.toMutableList()\n val b = (1..k).map { input.nextInt() }.sortedDescending()\n var j = 0\n for (i in 0..n - 1) {\n if (a[i] == 0) {\n a[i] = b[j++]\n }\n }\n val sorted = a.sorted()\n if (a == sorted) {\n output.println(\"No\")\n } else {\n output.println(\"Yes\")\n }\n\n }\n\n private fun slow(): Int = 0\n\n private fun solve() {\n }\n\n\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 = next().toInt()\n\n fun nextLong(): Long = next().toLong()\n\n}"}, {"source_code": "fun main() {\n var (n, m) = readInts()\n var numbers = readInts().toMutableList()\n var toPut = readInts().sorted()\n if (toPut.size > 1 || n == m) {\n println(\"YES\")\n } else {\n for (i in 0 until numbers.size) {\n if (numbers[i] == 0) {\n numbers[i] = toPut[0]\n }\n }\n checkIsIcreasing(numbers)\n }\n}\n\nprivate fun checkIsIcreasing(a: List) {\n for (i in 1 until a.size) {\n if (a[i] < a[i - 1]) {\n println(\"YES\")\n return\n }\n }\n println(\"NO\")\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()!!"}, {"source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (n, k) = readInts()\n if (k > 1) return print(\"Yes\")\n val a = readInts().toIntArray()\n for (pos in 0 until n)\n if (a[pos] == 0) {\n a[pos] = readInt()\n break\n }\n if (a.first() == a.last()) return print(\"Yes\")\n for (pos in 0 until n - 1)\n if (a[pos + 1] < a[pos]) return print(\"Yes\")\n print(\"No\")\n}"}, {"source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (n, k) = readInts()\n if (k > 1) return print(\"Yes\")\n val a = mutableListOf(-1)\n a.addAll(readInts())\n val aArr = a.toIntArray()\n for (pos in 1..n) {\n if (aArr[pos] == 0) aArr[pos] = readInt()\n if (aArr[pos] < aArr[pos - 1]) return print(\"Yes\")\n }\n print(\"No\")\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.PrintWriter\nimport java.util.*\n\nclass Solver {\n\n fun input(inp: FastInputReader) {\n val n = inp.readInt()\n val k = inp.readInt()\n\n val a = inp.readIntArray(n)\n val b = inp.readIntArray(k)\n b.sortDescending()\n\n var j = 0\n for (i in a.indices)\n if (a[i] == 0)\n {\n a[i] = b[j]\n j++\n }\n for (i in 1..a.size - 1)\n if (a[i-1] >= a[i]) {\n println(\"Yes\")\n return\n }\n println(\"No\")\n }\n\n fun solve() {\n\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\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, { row -> readTArray(cols, { col, s -> convert(row, col, s) }) })\n\n}\n\nfun main(args: Array) {\n\n// val millis = measureTimeMillis(Solver()::solve)\n// System.err.println(\"Time spent: $millis\")\n val solver = Solver()\n solver.input(FastInputReader())\n solver.solve()\n\n}\n"}], "negative_code": [{"source_code": "import java.util.*\n\n/**\n * Created by Administrator on 2017/6/8.\n */\nfun isSort(a: Array): Boolean {\n\n var last = 0;\n for (i in 0..a.size){\n if (0 == i){\n last = a[i]\n }else if(a[i]!=0){\n if (a[i]>last)\n return false\n else last = a[i]\n }\n }\n return true\n}\n fun main(args: Array) {\n\n var out = Scanner(System.`in`)\n var aLen = out.nextInt()\n var bLen = out.nextInt()\n var a = Array(aLen,{out.nextInt()})\n var b = Array(bLen,{out.nextInt()})\n if (bLen>=2){\n println(\"Yes\")\n }else if (isSort(a)){\n println(\"No\")\n }else{\n println(\"Yes\")\n }\n\n}\n"}, {"source_code": "import java.util.*\n\n/**\n * Created by Administrator on 2017/6/8.\n */\nfun isSort(a: Array, b: Int): Boolean {\n\n var last = 0\n for (i in 0..a.size-1){\n if (0 == i){\n last = a[i]\n }else if(a[i]!=0){\n if (a[i]) {\n\n var out = Scanner(System.`in`)\n var aLen = out.nextInt()\n var bLen = out.nextInt()\n var a = Array(aLen,{out.nextInt()})\n var b = Array(bLen,{out.nextInt()})\n // println(b[0])\n if (bLen>=2){\n println(\"Yes\")\n }else if (isSort(a,b[0])){\n println(\"No\")\n }else{\n println(\"Yes\")\n }\n\n}"}, {"source_code": "\nimport java.util.*\n\nfun isSort(a: Array): Boolean {\n\n var last = 0;\n for (i in 0..a.size){\n if (0 == i){\n last = a[i]\n }else if(a[i]!=0){\n if (a[i]>last)\n return false\n else last = a[i]\n }\n }\n return true\n}\n fun main(args: Array) {\n\n var out = Scanner(System.`in`)\n var aLen = out.nextInt()\n var bLen = out.nextInt()\n var a = Array(aLen,{out.nextInt()})\n var b = Array(bLen,{out.nextInt()})\n if (bLen>=2){\n println(\"Yes\")\n }else if (isSort(a)){\n println(\"Yes\")\n }else{\n println(\"No\")\n }\n\n}\n\n\n\n\n\n"}, {"source_code": "import java.util.*\n\n/**\n * Created by Administrator on 2017/6/8.\n */\nfun isSort(a: Array, i: Int): Boolean {\n\n var last = 0;\n for (i in 0..a.size-1){\n if (0 == i){\n last = a[i]\n }else if(a[i]!=0){\n if (a[i]) {\n\n var out = Scanner(System.`in`)\n var aLen = out.nextInt()\n var bLen = out.nextInt()\n var a = Array(aLen,{out.nextInt()})\n var b = Array(bLen,{out.nextInt()})\n if (bLen>=2){\n println(\"Yes\")\n }else if (isSort(a,b[0])){\n println(\"No\")\n }else{\n println(\"Yes\")\n }\n\n}"}, {"source_code": "import java.util.*\n\n/**\n * Created by Administrator on 2017/6/8.\n */\nfun isSort(a: Array, b: Int): Boolean {\n\n var last = 0\n for (i in 0..a.size-1){\n if (0 == i){\n last = a[i]\n }else {\n if(a[i]==0)\n a[i] = b\n if (a[i]) {\n\n var out = Scanner(System.`in`)\n var aLen = out.nextInt()\n var bLen = out.nextInt()\n var a = Array(aLen,{out.nextInt()})\n var b = Array(bLen,{out.nextInt()})\n // println(b[0])\n if (bLen>=2){\n println(\"Yes\")\n }else if (isSort(a,b[0])){\n println(\"No\")\n }else{\n println(\"Yes\")\n }\n\n}"}, {"source_code": "\nimport java.util.*\n\nfun isSort(a: Array): Boolean {\n\n var last = 0;\n for (i in 0..a.size){\n if (0 == i){\n last = a[i]\n }else if(a[i]!=0){\n if (a[i]>last)\n return false\n else last = a[i]\n }\n }\n return true\n}\n fun main(args: Array) {\n \n var out = Scanner(System.`in`)\n var aLen = out.nextInt()\n var bLen = out.nextInt()\n var a = Array(aLen,{out.nextInt()})\n var b = Array(bLen,{out.nextInt()})\n if (bLen>=2){\n println(\"Yse\")\n }else if (isSort(a)){\n println(\"Yse\")\n }else{\n println(\"No\")\n }\n\n}\n\n\n\n\n\n"}, {"source_code": "import java.util.*\n\n/**\n * Created by Administrator on 2017/6/8.\n */\nfun isSort(a: Array): Boolean {\n\n var last = 0;\n for (i in 0..a.size-1){\n if (0 == i){\n last = a[i]\n }else if(a[i]!=0){\n if (a[i]) {\n\n var out = Scanner(System.`in`)\n var aLen = out.nextInt()\n var bLen = out.nextInt()\n var a = Array(aLen,{out.nextInt()})\n var b = Array(bLen,{out.nextInt()})\n if (bLen>=2){\n println(\"Yes\")\n }else if (isSort(a)){\n println(\"No\")\n }else{\n println(\"Yes\")\n }\n\n}"}, {"source_code": "fun main() {\n var (n, m) = readInts()\n var numbers = readInts()\n var toPut = readInts().sorted()\n if (toPut.size > 1) {\n println(\"YES\")\n } else {\n for (i in 0 until numbers.size) {\n if (numbers[i] == 0) {\n if (i != 0 && i != n - 1) {\n if (toPut[0] < numbers[i - 1] || toPut[0] > numbers[i + 1]) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n } else {\n if (i == 0) {\n if (toPut[0] > numbers[i + 1]) {\n println(\"YES\")\n } else {\n checkIsIcreasing(numbers)\n }\n } else {\n if (toPut[0] < numbers[n - 1]) {\n println(\"YES\")\n } else {\n checkIsIcreasing(numbers)\n }\n }\n }\n }\n }\n }\n}\n\nprivate fun checkIsIcreasing(a: List) {\n for (i in 1 until a.size) {\n if (a[i] < a[i - 1]) {\n println(\"YES\")\n return\n }\n println(\"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()!!"}, {"source_code": "fun main() {\n var (n, m) = readInts()\n var numbers = readInts().toMutableList()\n var toPut = readInts().sorted()\n if (toPut.size > 1) {\n println(\"YES\")\n } else {\n for (i in 0 until numbers.size) {\n if (numbers[i] == 0) {\n if (i != 0 && i != n - 1) {\n if (toPut[0] < numbers[i - 1] || toPut[0] > numbers[i + 1]) {\n println(\"YES\")\n } else {\n numbers.set(i, toPut[0])\n checkIsIcreasing(numbers)\n }\n } else {\n if (i == 0) {\n if (toPut[0] > numbers[i + 1]) {\n println(\"YES\")\n } else {\n checkIsIcreasing(numbers)\n }\n } else {\n if (toPut[0] < numbers[n - 1]) {\n println(\"YES\")\n } else {\n checkIsIcreasing(numbers)\n }\n }\n }\n }\n }\n }\n}\n\nprivate fun checkIsIcreasing(a: List) {\n for (i in 1 until a.size) {\n if (a[i] < a[i - 1]) {\n println(\"YES\")\n return\n }\n println(\"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()!!"}, {"source_code": "fun main() {\n var (n, m) = readInts()\n var numbers = readInts().toMutableList()\n var toPut = readInts().sorted()\n if (toPut.size > 1) {\n println(\"YES\")\n } else {\n for (i in 0 until numbers.size) {\n if (numbers[i] == 0) {\n if (i != 0 && i != n - 1) {\n if (toPut[0] < numbers[i - 1] || toPut[0] > numbers[i + 1]) {\n println(\"YES\")\n } else {\n numbers.set(i, toPut[0])\n checkIsIcreasing(numbers)\n }\n } else {\n if (i == 0) {\n if (toPut[0] > numbers[i + 1]) {\n println(\"YES\")\n } else {\n checkIsIcreasing(numbers)\n }\n } else {\n if (toPut[0] < numbers[n - 1]) {\n println(\"YES\")\n } else {\n checkIsIcreasing(numbers)\n }\n }\n }\n }\n }\n }\n}\n\nprivate fun checkIsIcreasing(a: List) {\n for (i in 1 until a.size) {\n if (a[i] < a[i - 1]) {\n println(\"YES\")\n return\n }\n println(\"NO\")\n return\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()!!"}, {"source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (n, k) = readInts()\n if (k > 1) return print(\"Yes\")\n val a = mutableListOf(-1)\n a.addAll(readInts())\n for (pos in 1..n)\n if (a[pos] == 0) {\n if (readInt() < a[pos - 1]) return print(\"Yes\")\n } else if (a[pos] < a[pos - 1]) return print(\"Yes\")\n print(\"No\")\n}"}, {"source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (n, k) = readInts()\n if (k > 1) return print(\"Yes\")\n val a = mutableListOf(-1)\n a.addAll(readInts())\n for (pos in 1 until n)\n if (a[pos] == 0) {\n if (readInt() < a[pos - 1]) return print(\"Yes\")\n } else if (a[pos] < a[pos - 1]) return print(\"Yes\")\n print(\"No\")\n}"}], "src_uid": "40264e84c041fcfb4f8c0af784df102a"} {"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 % 10 + x / 10 % 10 + x / 100 % 10 ==\n\t\t\t\tx / 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}", "positive_code": [{"source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.*\n\nfun main(){\n\tval f = BufferedReader(InputStreamReader(System.`in`))\n\n\tval a = f.readLine().map{Character.getNumericValue(it)}.toIntArray()\n\n\tval sum1 = a[0] + a[1] + a[2]\n\tval sum2 = a[3] + a[4] + a[5]\n\n\tif(sum1 == sum2) println(0)\n\telse{\n\n\t\tval a1 = IntArray(3){a[it]}.sorted()\n\t\tval a2 = IntArray(3){a[it+3]}.sorted()\n\n\t\tval changes = IntArray(6)\n\t\t//check 1\n\t\tif(sum1 > sum2){\n\t\t\t//get max 3\n\t\t\tfor(k in 0 until 3){\n\t\t\t\tchanges[k] = a1[k]\n\t\t\t\tchanges[k+3] = 9-a2[k]\n\t\t\t}\n\t\t} else {\n\t\t\tfor(k in 0 until 3){\n\t\t\t\tchanges[k] = a2[k]\n\t\t\t\tchanges[k+3] = 9-a1[k]\n\t\t\t}\n\t\t}\n\n\t\tchanges.sort()\n\n\t\tval dif = Math.abs(sum1-sum2)\n\n\t\tvar sumdif = 0\n\t\tvar answer = 0\n\t\tvar i = 5\n\t\twhile(sumdif < dif){\n\t\t\tsumdif += changes[i]\n\t\t\ti--\n\t\t\tanswer++\n\t\t}\n\n\t\tprintln(answer)\n\t}\n}\n"}, {"source_code": "import java.util.*\nfun main(args: Array) {\n val digits = readLine()!!.toCharArray().map { Character.getNumericValue(it) }\n\n val left = digits.take(3).toMutableList()\n val right = digits.takeLast(3).toMutableList()\n\n println(solve(left, right))\n}\n\ntailrec fun solve(left: MutableList, right: MutableList, steps: Int = 0): Int {\n val leftSum = left.sum()\n val rightSum = right.sum()\n if (leftSum == rightSum) return steps\n\n val delta = leftSum - rightSum\n var larger = if (delta>0) left else right\n val smaller = if (delta>0) right else left\n\n val largerDecreases = larger.sortedDescending()\n val smallerIncreases = smaller.map { 9-it }\n\n val maxDecrease = largerDecreases.max()!!\n val maxIncrease = smallerIncreases.max()!!\n\n if(Math.max(maxDecrease, maxIncrease) >= Math.abs(delta)) {\n return steps+1\n }\n\n fun getIndex(list: List, number: Int?): Int = if (number == null) 0 else list.indexOf(number)\n\n if (maxIncrease>maxDecrease) {\n smaller[getIndex(smaller, smaller.min())] = 9\n return solve(smaller, larger, steps+1)\n }\n larger[getIndex(larger, larger.max())] = 0\n return solve(smaller, larger, steps+1)\n}\n"}, {"source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.*\n\nfun main(){\n\tval f = BufferedReader(InputStreamReader(System.`in`))\n\n\tval a = f.readLine().map{Character.getNumericValue(it)}.toIntArray()\n\n\tval sum1 = a[0] + a[1] + a[2]\n\tval sum2 = a[3] + a[4] + a[5]\n\n\tif(sum1 == sum2) println(0)\n\telse{\n\n\t\tval a1 = IntArray(3){a[it]}.sorted()\n\t\tval a2 = IntArray(3){a[it+3]}.sorted()\n\n\t\tval changes = IntArray(6)\n\t\t//check 1\n\t\tif(sum1 > sum2){\n\t\t\t//get max 3\n\t\t\tfor(k in 0 until 3){\n\t\t\t\tchanges[k] = a1[k]\n\t\t\t\tchanges[k+3] = 9-a2[k]\n\t\t\t}\n\t\t} else {\n\t\t\tfor(k in 0 until 3){\n\t\t\t\tchanges[k] = a2[k]\n\t\t\t\tchanges[k+3] = 9-a1[k]\n\t\t\t}\n\t\t}\n\n\t\tchanges.sort()\n\n\t\tval dif = Math.abs(sum1-sum2)\n\n\t\tvar sumdif = 0\n\t\tvar answer = 0\n\t\tvar i = 5\n\t\twhile(sumdif < dif){\n\t\t\tsumdif += changes[i]\n\t\t\ti--\n\t\t\tanswer++\n\t\t}\n\n\t\tprintln(answer)\n\t}\n}\n"}, {"source_code": "import java.io.PrintWriter\nimport java.lang.StringBuilder\nimport kotlin.math.*\n\nfun main() {\n io.apply {\n\n val x = str(6).map { it - '0' }.toIntArray()\n var left = x.sliceArray(0..2).sortedArray()\n var right = x.sliceArray(3..5).sortedArray()\n\n var delta = right.sum() - left.sum()\n if (delta < 0) {\n val tmp = left\n left = right\n right = tmp\n delta = - delta\n }\n // left < right\n val deltas = ArrayList()\n left.forEach { deltas.add(9 - it) }\n right.forEach { deltas.add(it) }\n deltas.sortDescending()\n val ans = when {\n delta == 0 -> 0\n delta <= deltas[0] -> 1\n delta <= deltas[0] + deltas[1] -> 2\n else -> 3\n }\n\n cout .. ans .. nl\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"}], "negative_code": [{"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}"}], "src_uid": "09601fd1742ffdc9f822950f1d3e8494"} {"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 (ab) \"Limak\" else \"Radewoosh\"\n println(r)\n //println(\"Limak=$a Radewoosh=$b\")\n\n\n}", "positive_code": [{"source_code": "import kotlin.math.max\n\n/* http://codeforces.com/problemset/problem/658/A */\n\nfun main() {\n val (_, losingRate) = readLine()!!.split(\" \").map { it.toInt() }\n val scores = readLine()!!.split(\" \").map { it.toInt() }\n val times = readLine()!!.split(\" \").map { it.toInt() }\n val timesPassed = times.sumPrefixes()\n val scoresReversed = scores.asReversed()\n val timesReversed = times.asReversed()\n val timesReversedPassed = timesReversed.sumPrefixes()\n val limakScore = scores.mapIndexed { index, score -> max(0, score - losingRate * timesPassed[index]) }.sum()\n val radewooshScore = scoresReversed.mapIndexed { index, score -> max(0, score - losingRate * timesReversedPassed[index]) }.sum()\n when {\n limakScore > radewooshScore -> println(\"Limak\")\n radewooshScore > limakScore -> println(\"Radewoosh\")\n else -> println(\"Tie\")\n }\n}\n\nprivate fun List.sumPrefixes(): List {\n if (this.isEmpty()) {\n return emptyList()\n }\n val resultList = ArrayList(this.size)\n resultList.add(this[0])\n for (i in 1 until this.size) {\n resultList.add(resultList[i - 1] + this[i])\n }\n return resultList\n}"}, {"source_code": "import kotlin.math.max\n\nfun score(p: Int, c: Int, x: Int) : Int {\n return max(0, p-c*x)\n}\n\nfun main(args: Array) {\n val (n, c) = readLine()!!.split(\" \").map(String::toInt)\n val p = readLine()!!.split(\" \").map(String::toInt)\n val t = readLine()!!.split(\" \").map(String::toInt)\n var (score_limak, score_radewoosh) = listOf(0, 0)\n var (time_limak, time_radewoosh) = listOf(0, 0)\n for(i in 0..n-1) {\n time_limak += t[i]\n score_limak += score(p[i], c, time_limak)\n }\n for(i in n-1 downTo 0) {\n time_radewoosh += t[i]\n score_radewoosh += score(p[i], c, time_radewoosh)\n }\n if(score_radewoosh == score_limak) println(\"Tie\")\n else if(score_radewoosh > score_limak) println(\"Radewoosh\")\n else println(\"Limak\")\n}\n"}, {"source_code": "import kotlin.math.max\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (_, constant) = readInts()\n val scores = readInts()\n val minutes = readInts()\n var limak = 0\n var radewoosh = 0\n var spentMinutes = 0\n for (pos in scores.indices) {\n spentMinutes += minutes[pos]\n limak += max(0, scores[pos] - constant * spentMinutes)\n }\n spentMinutes = 0\n for (pos in scores.indices.reversed()) {\n spentMinutes += minutes[pos]\n radewoosh += max(0, scores[pos] - constant * spentMinutes)\n }\n print(\n when {\n limak > radewoosh -> \"Limak\"\n limak == radewoosh -> \"Tie\"\n else -> \"Radewoosh\"\n }\n )\n}"}, {"source_code": "fun main(args: Array){\n\tvar tmpTime = 0\n\tvar Limak = 0\n\tvar Radewoosh = 0\n\n\tval (N,c) = readLine()!!.split(' ')\n\n\tval points = readLine()!!.split(' ').map { it.toInt() }\n\tval time = readLine()!!.split(' ').map { it.toInt() }\n\n\tfor(i in 0 until N.toInt()){\n\t\ttmpTime += time[i]\n\t\tif(points[i]-tmpTime*c.toInt() < 0){\n\t\t\tcontinue\n\t\t}else{\n\t\t\tLimak += points[i]-tmpTime*c.toInt()\n\t\t}\n\t}\n\ttmpTime = 0\n\tfor(i in N.toInt()-1 downTo 0){\n\t\ttmpTime += time[i]\n\t\tif(points[i]-tmpTime*c.toInt() < 0){\n\t\t\tcontinue\n\t\t}else{\n\t\t\tRadewoosh += points[i]-tmpTime*c.toInt()\n\t\t}\n\t}\n\twhen {\n\t\tLimak > Radewoosh -> println(\"Limak\")\n\t\tLimak < Radewoosh -> println(\"Radewoosh\")\n\t\telse -> println(\"Tie\")\n\t}\n\n}"}], "negative_code": [{"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 print(\"DOWN\")\n arr.last() == 0 -> print(\"UP\")\n arr.size < 2 -> print(\"-1\")\n else -> if (arr[n - 1] > arr[n - 2]) print(\"UP\") else print(\"DOWN\")\n }\n}\n\ninline fun print(message: Any?) = stdout.print(message)\ninline fun print(message: Int) = stdout.print(message)\ninline fun print(message: Long) = stdout.print(message)\ninline fun print(message: Byte) = stdout.print(message)\ninline fun print(message: Short) = stdout.print(message)\ninline fun print(message: Char) = stdout.print(message)\ninline fun print(message: Boolean) = stdout.print(message)\ninline fun print(message: Float) = stdout.print(message)\ninline fun print(message: Double) = stdout.print(message)\ninline fun print(message: CharArray) = stdout.print(message)\ninline fun println(message: Any?) = stdout.println(message)\ninline fun println(message: Int) = stdout.println(message)\ninline fun println(message: Long) = stdout.println(message)\ninline fun println(message: Byte) = stdout.println(message)\ninline fun println(message: Short) = stdout.println(message)\ninline fun println(message: Char) = stdout.println(message)\ninline fun println(message: Boolean) = stdout.println(message)\ninline fun println(message: Float) = stdout.println(message)\ninline fun println(message: Double) = stdout.println(message)\ninline fun println(message: CharArray) = stdout.println(message)\ninline fun println() = stdout.println()\n\ninline fun nextInt() = stdin.nextInt()\ninline fun nextLong() = stdin.nextLong()\ninline fun nextChar() = stdin.nextChar()\ninline fun next() = stdin.next()\ninline fun nextLine() = stdin.nextLine()\ninline fun nextIntArray(n: Int) = IntArray(n, { nextInt() })\n\nclass FastScanner(ins: InputStream): Closeable {\n val BUFFER_SIZE = 65536;\n val br: BufferedReader\n var end = false\n\n var len: Int = 0\n val buffer = CharArray(BUFFER_SIZE)\n var it: Int = 0\n\n init {\n br = BufferedReader(InputStreamReader(ins), BUFFER_SIZE)\n }\n\n constructor(file: String): this(FileInputStream(file))\n\n inline fun isLineBreaker(c: Char) = c == '\\n'\n inline fun isDelimiter(c: Char) = c == ' ' || c == '\\n' || c == '\\r'\n\n inline fun ensureBuffer() {\n if (it == len) {\n it = 0\n len = br.read(buffer)\n if (len == -1) end = true\n }\n }\n\n inline fun moveNext() {\n while (!end) {\n ensureBuffer()\n if (!isDelimiter(buffer[it])) return\n while (it < len && isDelimiter(buffer[it])) it++;\n }\n }\n\n inline fun nextChar(): Char {\n moveNext()\n if (end) return (-1).toChar()\n return buffer[it++]\n }\n\n inline fun next(): String {\n moveNext()\n val sb = StringBuilder()\n while (!end) {\n val l = it\n while (++it < len && !isDelimiter(buffer[it]));\n sb.append(buffer, l, it - l)\n ensureBuffer()\n if (end || isDelimiter(buffer[it])) break;\n }\n return sb.toString()\n }\n\n inline fun nextInt(): Int {\n moveNext()\n var minus = true\n if (buffer[it] == '-') {\n it++\n minus = false\n }\n var result: Int = 0\n while (!end) {\n while (it < len && !isDelimiter(buffer[it])) {\n result *= 10\n result += (buffer[it] - '0').toInt()\n it++\n }\n ensureBuffer()\n if (end || isDelimiter(buffer[it])) break\n }\n return if (minus) result else -result\n }\n\n inline fun nextLong(): Long {\n moveNext()\n var minus = true\n if (buffer[it] == '-') {\n it++\n minus = false\n }\n var result: Long = 0\n while (!end) {\n while (it < len && !isDelimiter(buffer[it])) {\n result *= 10\n result += (buffer[it] - '0').toLong()\n it++\n }\n ensureBuffer()\n if (end || isDelimiter(buffer[it])) break\n }\n return if (minus) result else -result\n }\n\n inline fun nextLine(): String {\n moveNext()\n val sb = StringBuilder()\n while (!end) {\n val l = it\n while (++it < len && !isLineBreaker(buffer[it]));\n sb.append(buffer, l, it - l)\n ensureBuffer()\n if (end || isLineBreaker(buffer[it])) break;\n }\n return sb.toString()\n }\n\n override fun close() {\n br.close()\n }\n}\n\nfun main(args: Array) {\n solve()\n stdin.close()\n stdout.close();\n}", "positive_code": [{"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 = IntArray(n, { io.readInt() })\n val l = a.last()\n val res = when {\n l == 15 -> \"DOWN\"\n l == 0 -> \"UP\"\n else -> when {\n a.size == 1 -> \"-1\"\n l > a[a.lastIndex - 1] -> \"UP\"\n l < a[a.lastIndex - 1] -> \"DOWN\"\n else -> \"-1\"\n }\n }\n io.println(res)\n}\n"}, {"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 when {\n v[0] == 0 -> println(\"UP\")\n v[0] == 15 -> println(\"DOWN\")\n else -> println(-1)\n }\n } else {\n val before = v[n - 2]\n val mid = v[n - 1]\n when {\n mid == 15 -> println(\"DOWN\")\n mid == 0 -> println(\"UP\")\n mid > before -> println(\"UP\")\n mid < before -> println(\"DOWN\")\n }\n }\n}"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n readLine()\n val sizes = readInts()\n print(\n when {\n sizes.last() == 0 -> \"UP\"\n sizes.last() == 15 -> \"DOWN\"\n sizes.size == 1 -> \"-1\"\n sizes.last() > sizes[sizes.lastIndex - 1] -> \"UP\"\n else -> \"DOWN\"\n }\n )\n}"}], "negative_code": [{"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}"}, {"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 println(\"DOWN\")\n mid in 1 until before -> println(\"DOWN\")\n mid println(\"UP\")\n }\n }\n}"}], "src_uid": "8330d9fea8d50a79741507b878da0a75"} {"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 + 1..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", "positive_code": [{"source_code": "fun main(args: Array) {\n val a = System.`in`.reader().readText().trim().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}"}], "negative_code": [{"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"}], "src_uid": "1ac11153e35509e755ea15f1d57d156b"} {"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()\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 l = reader.nextInt()\n val r = reader.nextInt()\n val a = reader.nextInt()\n\n var ans = 0\n\n for (i in 0..a) {\n val t = min(l + i, r + a - i)\n ans = max(ans, t)\n }\n writer.println(2 * 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}", "positive_code": [{"source_code": "fun min(a: Int, b:Int): Int{\n return if (a > b) b else a\n}\nfun main(args: Array){\n\n var (l,p,a) = readLine().toString().split(\" \").map{x -> x.toInt()}\n\n while(l!=p&&a>0){\n\n if(l1){\n l++\n p++\n a-=2\n }\n\n print(min(l,p)*2)\n\n\n}\n\n\n"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n var (l, r, a) = readInts()\n var (min, max) = if (l <= r) l to r else r to l\n if (min + a < max) {\n min += a\n a = 0\n } else {\n val diff = max - min\n min = max\n a -= diff\n }\n print((kotlin.math.min(min, max) + a / 2) * 2)\n}"}, {"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 when {\n r > l -> l++\n l > r -> r++\n }\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 while (l != r) {\n when {\n l > r -> l--\n l < r -> r--\n }\n }\n\n println(l + r)\n}"}, {"source_code": "fun main(arg: Array){\n\tvar (L, R, A) = readLine().toString().split(\" \").map {x -> x.toInt()}\n\tvar teamN = 0\n\tval pmaxL = L + A\n\tval pmaxR = R + A\n\tval maxTeam = if (pmaxR > pmaxL) pmaxL else pmaxR\n\tif (maxTeam == 0){\n\t\tprintln(0)\n\t\treturn\n\t}\n//\tprintln(\"Max team is: $maxTeam\")\n\tvar teamL: Int = 0\n\tvar teamR: Int = 0\n\n\twhile((R+A>0) and (L+A>0)){\n//\t\tprintln(\"Before. R:$R, L:$L, A:$A, TL: $teamL, TR: $teamR\")\n\t\tif(L>R){\n\t\t\tif (R>0){\n\t\t\t\tteamR+=1\n\t\t\t\tR-=1\n\t\t\t}else{\n\t\t\t\tteamR+=1\n\t\t\t\tA-=1\n\t\t\t}\n\n\t\t\tif (L>0){\n\t\t\t\tteamL+=1\n\t\t\t\tL-=1\n\t\t\t}else{\n\t\t\t\tteamL+=1\n\t\t\t\tA-=1\n\t\t\t}\n\n\t\t}else{\n\t\t\tif (L>0){\n\t\t\t\tteamL+=1\n\t\t\t\tL-=1\n\t\t\t}else{\n\t\t\t\tteamL+=1\n\t\t\t\tA-=1\n\t\t\t}\n\n\t\t\tif (R>0){\n\t\t\t\tteamR+=1\n\t\t\t\tR-=1\n\t\t\t}else{\n\t\t\t\tteamR+=1\n\t\t\t\tA-=1\n\t\t\t}\n\n\t\t}\n\n\t\tif(A < 0){\n\t\t\tteamR -= 1\n\t\t\tteamL -= 1\n\t\t\tbreak\n\t\t}\n\n//\t\tprintln(\"Before. R:$R, L:$L, A:$A, TL: $teamL, TR: $teamR\")\n\n\t}\n\n\tprintln(teamL + teamR)\n}"}, {"source_code": "import kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main(args: Array) {\n val array: IntArray = readLine()!!.split(' ').map { it.toInt() }.toIntArray()\n val min = min(array[0], array[1])\n\n 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}"}, {"source_code": "import kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main(args: Array) {\n val array: IntArray = readLine()!!.split(' ').map { it.toInt() }.toIntArray()\n\n val min = min(array[0], array[1])\n val max = max(array[0], array[1])\n\n if(min + array[2] <= max){\n println((min + array[2]).times(2))\n } else {\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 }\n}"}, {"source_code": "import kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main(args: Array) {\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}"}, {"source_code": "import java.lang.Math.abs\nimport java.util.*\n\n/**\n * Created by SitaoLiao on 3/11/18.\n */\nfun main(args: Array) {\n val scanner = Scanner(System.`in`);\n\n val user_input = scanner.nextLine().split(\" \").map{ it.toInt() };\n\n var diff = user_input[0] - user_input[1];\n\n val ans: Int\n\n if( diff > 0 ){\n if( diff >= user_input[2] ){\n ans = user_input[1] + user_input[2]\n } else {\n ans = user_input[0] + (user_input[2]-diff)/2\n }\n } else {\n diff = abs(diff)\n if( diff >= user_input[2] ){\n ans = user_input[0] + user_input[2]\n } else {\n ans = user_input[1] + (user_input[2]-diff)/2\n }\n }\n\n println(ans*2)\n}"}], "negative_code": [{"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}"}, {"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}"}, {"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}"}], "src_uid": "e8148140e61baffd0878376ac5f3857c"} {"source_code": "\nimport java.util.*\n\nclass A {\n fun run(scan: Scanner) {\n val count = scan.nextInt()\n var sumB = 0\n var sumC = 0\n repeat(count){\n val cur = scan.nextInt()\n if(cur > 0)\n sumB += cur\n else sumC += cur\n }\n println(sumB - sumC)\n }\n}\n\nfun main(args: Array) {\n A().run(Scanner(System.`in`))\n}", "positive_code": [{"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 val ans = d.map { abs(it) }.sum()\n cout .. ans .. 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"}, {"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 val n = reader.nextInt()\n val a = reader.nextArrayInt(n)\n val ans = a.filter { it > 0 }.sum() - a.filter { it < 0 }.sum()\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}\n\n"}, {"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 val n = reader.nextInt()\n val a = reader.nextArrayInt(n)\n val ans = a.map {\n if (it < 0) {\n -it\n } else {\n it\n }\n }.sum()\n// a.filter { it > 0 }.sum() - a.filter { it < 0 }.sum()\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}\n\n"}, {"source_code": "import kotlin.math.abs\n\nfun main(args: Array) {\n val z = java.util.Scanner(System.`in`)\n val n = z.nextInt()\n var sum = 0\n var a = 0\n for (i in 1..n)\n sum+=abs(z.nextInt())\n println(sum)\n}"}, {"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 { abs(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"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n val n = r.readLine()!!.toInt()\n //val (m, n) = r.readLine()!!.split(\" \").map { it.toInt() }\n val v = r.readLine()!!.split(\" \").map { it.toInt() }.map { if (it<0) -it else it }.sum()\n println(v)\n\n}"}, {"source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var a = readLine()!!.split(' ')\n var B = 0\n var C = 0\n for (i in 0 until a.size){\n if (a[i].toInt() >= 0) {\n B += a[i].toInt()\n }\n else{\n C += a[i].toInt()\n }\n }\n print(B-C)\n}"}, {"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 (i < n && a[i] < 0)\n c += a[i++]\n while (i < n)\n b += a[i++]\n\n println(b - c)\n }\n}\n"}, {"source_code": "fun main(args: Array)\n{\n val n = readLine()!!.toInt()\n val inp = readLine()!!.split(' ').map(String::toInt)\n val sneg = inp.filter({i -> i < 0}).sum()\n val spos = inp.filter({i -> i > 0}).sum()\n println(spos - sneg)\n}"}, {"source_code": "import java.util.*\nfun main(args: Array) {\n \n\n var count = readLine()!!.toInt()\n var arr = readLine()!!.split(' ')\n var B = 0\n var C = 0\n var i = 0\n repeat(count)\n {\n val X = arr[i].toInt()\n if(X > 0) B += X\n else C += X\n i++\n }\n println(B - C)\n\n}"}, {"source_code": "import kotlin.math.absoluteValue\n\nfun main() {\n readLine()\n print(readLine()!!.split(\" \").map { it.toInt().absoluteValue }.sum())\n}"}, {"source_code": "fun main(args:Array) { \n val n = readLine()!! \n val (A,B) = (0..1).map { mutableListOf() } \n \n readLine()!!.split(\" \").map(String::toInt).map { \n if( it > 0 ) A.add(it) else B.add(it) \n } \n println( A.sum() - B.sum() ) \n}"}, {"source_code": "import java.util.Scanner\nimport kotlin.math.abs\nimport kotlin.math.max\n\nfun main() {\n val reader = Scanner(System.`in`)\n\n val n = reader.nextInt()\n var arr = Array(n) {0}\n var sum = 0\n\n for(i in 0..n-1) {\n arr[i] = reader.nextInt()\n sum += abs(arr[i])\n }\n println(sum)\n}"}], "negative_code": [{"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"}, {"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 = cur\n for (i in n - 1 downTo 0) {\n cur -= d[i] * 2\n mx = max(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"}, {"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"}], "src_uid": "4b5d14833f9b51bfd336cc0e661243a5"} {"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-pos2))/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 })\n }\n }\n}", "positive_code": [{"source_code": "fun getAllFinalDestinations(receivedPath: String) = arrayListOf().apply {\n \n fun checkFinalDestination(currentPosition: Int, index: Int) {\n if (index == receivedPath.length) {\n add(currentPosition)\n return\n }\n when(receivedPath[index]) {\n '+' -> checkFinalDestination(currentPosition + 1, index + 1)\n '-' -> checkFinalDestination(currentPosition - 1, index + 1)\n '?' -> {\n checkFinalDestination(currentPosition + 1, index + 1)\n checkFinalDestination(currentPosition - 1, index + 1)\n }\n }\n }\n \n checkFinalDestination(0, 0)\n}\n \nfun main() = readLine()!!\n .map { ch -> if (ch == '+') 1 else -1 }\n .sum()\n .let { destination -> Pair(destination, readLine()!!) }\n .let { (destination, receivedPath) -> Pair(destination, receivedPath.run(::getAllFinalDestinations)) }\n .let { (destination, allFinalDestinations) ->\n allFinalDestinations.count(destination::equals).toDouble() / allFinalDestinations.size.toDouble()\n }\n .let { percentage -> \"%.12f\".format(percentage) }\n .run(::println)"}, {"source_code": "import java.util.Scanner;\n\nfun final_location(cmds : String) : Pair {\n var loc = 0\n var num_unrecognized_cmds = 0\n for (cmd in cmds) {\n if (cmd == '+') {\n loc = loc + 1\n } else if (cmd == '-') {\n loc = loc - 1\n } else if (cmd == '?') {\n num_unrecognized_cmds = num_unrecognized_cmds + 1\n } else {\n throw Exception(\"Unknown input!\")\n }\n }\n return Pair(loc, num_unrecognized_cmds)\n}\n\nfun factorial(x : Int) : Int {\n var f = 1;\n for (i in 1 .. x) {\n f = f * i\n }\n return f\n}\n\nfun main(args : Array) {\n val scanner = Scanner(System.`in`)\n val sent_command = scanner.next()\n val recognized_command = scanner.next()\n // println(\"sent_command : ${sent_command}\") \n // println(\"recognized_command : ${recognized_command}\") \n val (loc_sent_cmd, _) = final_location(sent_command)\n val (loc_recognized_cmd, num_unrecognized_cmds) = final_location(recognized_command)\n // println(\"loc_sent_cmd : ${loc_sent_cmd}\")\n // println(\"loc_recognized_cmd : ${loc_recognized_cmd}\")\n // println(\"num_unrecognized_cmds : ${num_unrecognized_cmds}\")\n // p + m = num_unrecognized_cmds\n // p - m = loc_sent_cmd - loc_recognized_cmd\n val two_p = loc_sent_cmd - loc_recognized_cmd + num_unrecognized_cmds\n if ((two_p % 2) == 1) {\n println(\"0\")\n } else {\n val p = two_p / 2\n val m = num_unrecognized_cmds - p\n if ((p >= 0) && (m >= 0)) {\n val f_s = factorial(num_unrecognized_cmds).toDouble()\n val f_p = factorial(p).toDouble()\n val f_m = factorial(m).toDouble()\n val two : Double = 2.0\n val result = (f_s / (f_p * f_m)) * (1.0 / Math.pow(two, num_unrecognized_cmds.toDouble()))\n println(\"${result}\")\n } else {\n println(\"0\")\n }\n }\n}"}], "negative_code": [{"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(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 }\n }\n}"}, {"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(1.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}"}, {"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 == \"+\" } - s1.count { it == \"-\" }\n val unk = s2.count { it == \"?\" }\n when{\n abs(unk-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}"}, {"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}"}, {"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 == \"+\" } - 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}"}, {"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 == \"+\" } - s1.count { it == \"-\" }\n val unk = s2.count { it == \"?\" }\n when{\n unk == 0 -> println(1.0)\n abs(unk-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}"}], "src_uid": "f7f68a15cfd33f641132fac265bc5299"} {"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.toLong() }\n val minBound = min(n, m)\n val maxBound = max(n, m)\n println((1..minBound).fold(0L){acc, i ->\n acc + (maxBound + i)/5 - i/5\n })\n}", "positive_code": [{"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: Long) = 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 LongArray(5) {i -> x / 5L + 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 "}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val (m, n) = r.readLine()!!.split(\" \").map { it.toLong() }\n var ans = 0L\n ans += (m - m % 5) * (n / 5)\n ans += n % 5 * (m / 5)\n ans += m % 5 * (n / 5)\n when {\n m%5==1L&&n%5==4L -> {\n ans++\n }\n m%5==2L&&n%5>=3L -> {\n ans+=(n%5)-2\n }\n m%5==3L&&n%5>=2L -> {\n ans+=(n%5)-1\n }\n m%5==4L&&n%5>=1L -> {\n ans+=(n%5)-0\n }\n }\n println(ans)\n}"}, {"source_code": "import java.io.*\nimport java.math.BigDecimal\nimport java.math.BigInteger\nimport java.util.*\nimport kotlin.collections.HashSet\n\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 //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(System.`in`)\n .useOutputSource(System.out)\n .useScanner(FastScanner())\n .solveTask(TaskI())\n .run()\n\n class TaskA: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val countOfRooms = scanner.nextInt()\n val rooms = Array(countOfRooms) { scanner.nextInt() to scanner.nextInt() }\n printer.println(rooms\n .map { it.second - it.first }\n .filter { it >= 2 }\n .count())\n }\n\n }\n\n class TaskB: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val firstName = scanner.nextLine()\n val secondName = scanner.nextLine()\n val mixedUpName = scanner.nextLine()\n\n val alphabet = Array(26) { 0 }\n val mixedUpAlphabet = Array(26) { 0 }\n\n firstName.forEach { alphabet[it - 'A']++ }\n secondName.forEach { alphabet[it - 'A']++ }\n mixedUpName.forEach { mixedUpAlphabet[it - 'A']++ }\n\n for (it in 0..25) {\n if (alphabet[it] != mixedUpAlphabet[it]) {\n printer.println(\"NO\")\n return\n }\n\n }\n printer.println(\"YES\")\n }\n\n }\n\n class TaskC: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val countOfCubes = scanner.nextInt()\n\n var cubeSum = 0\n var height = 0\n while(cubeSum <= countOfCubes) {\n height++\n cubeSum += (height * (height + 1)) / 2\n }\n printer.println(height - 1)\n }\n\n }\n\n class TaskD: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val stringLength = scanner.nextInt()\n\n var result = 0\n (0 until stringLength) {\n val char = scanner.nextChar()\n when(char) {\n '0' -> result++\n '1' -> result--\n }\n }\n printer.println(if (result < 0) -result else result)\n }\n\n }\n\n class TaskE: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val wordCount = scanner.nextInt()\n val compukterDelay = scanner.nextInt()\n val words = Array(100005) { 0 }\n var screenedWords = 1\n\n (1..wordCount) { words[it] = scanner.nextInt() }\n\n var it = wordCount - 1\n while (it >= 1) {\n if (words[it + 1] - words[it] > compukterDelay)\n break\n it--\n screenedWords++\n }\n printer.println(screenedWords)\n }\n\n }\n\n class TaskF: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val count = scanner.nextInt()\n val lengths = Array(count) { scanner.nextInt() }.sortedArray()\n\n var l = 0\n var b1 = 0\n var b2 = 0\n\n for (it in 0 until count) {\n if (it == count - 1 || lengths[it] != lengths[it + 1]) {\n b1 = Math.max(b1, it - l + 1)\n b2++\n l = it + 1\n }\n }\n printer.println(b1.toString() + \" \" + b2)\n }\n\n }\n\n class TaskG: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val aLength = scanner.nextInt()\n val bLength = scanner.nextInt()\n val k = scanner.nextInt()\n val m = scanner.nextInt()\n\n val a = Array(aLength) { scanner.nextInt() }\n val b = Array(bLength) { scanner.nextInt() }\n printer.println(if(a[k-1] firstWinCount++\n didFirstWin > didSecondWin -> secondWinCount++\n else -> nobodyWinCount++\n }\n }\n printer.println(\"$firstWinCount $nobodyWinCount $secondWinCount\")\n }\n\n }\n\n class TaskI: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val n = scanner.nextLong()\n val m = scanner.nextLong()\n\n var countOfPairs = 0L\n (1..n) {\n countOfPairs += (m + it % 5) / 5\n }\n printer.println(countOfPairs)\n }\n\n }\n\n class TaskJ: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val iqCount = scanner.nextInt()\n val iq = Array(iqCount) { scanner.nextInt() }\n\n val oddness = iq[0] % 2 + iq[1] % 2 + iq[2] % 2 >= 2\n (0 until iqCount) {\n if (iq[it] % 2 == 1 && !oddness)\n printer.println(it + 1)\n if (iq[it] % 2 == 0 && oddness)\n printer.println(it + 1)\n }\n }\n\n }\n\n class TaskK: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n scanner.nextLine().toLowerCase().forEach { when(it) {\n !in arrayOf('a', 'o', 'y', 'e', 'u', 'i') -> printer.print(\".$it\")\n } }\n }\n\n }\n\n class TaskL: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n \n }\n\n }\n}\n"}, {"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 a = ir.nextInt()\n val b = ir.nextInt()\n\n val x = Math.min(a, b)\n val y = Math.max(a, b)\n\n var best: Long = 0\n var m = 5\n while (true) {\n val low = Math.max(1, m - y)\n val high = Math.min(x, m - 1)\n if (low > x) {\n pw.println(best)\n return\n }\n best += 0 + high - low + 1\n m += 5\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 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}"}, {"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 a = ir.nextInt()\n val b = ir.nextInt()\n\n val x = Math.min(a, b)\n val y = Math.max(a, b)\n\n var best: Long = 0\n var m = 5\n while (true) {\n val low = Math.max(1, m - y)\n val high = Math.min(x, m - 1)\n if (low > x) {\n pw.println(best)\n return\n }\n best += high - low + 1\n m += 5\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 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}"}, {"source_code": "import java.util.*\n \n \nfun main(args: Array){\n val ( n, m ) = readLine()!!.split(' ').map(String::toInt)\n var ans: Long = 0\n var cnt: IntArray = IntArray( 6 )\n for( i in 1 .. m ) cnt[i % 5]++\n for( i in 1 .. n ){\n ans += cnt[( 5 - i % 5 ) % 5]\n }\n print( ans )\n}"}, {"source_code": "import java.util.*\n \n \nfun main(args: Array){\n val ( n, m ) = readLine()!!.split(' ').map(String::toInt)\n var ans: Long = 0\n var cnt: IntArray = IntArray( 6 )\n for( i in 1 .. m ) cnt[i % 5]++\n for( i in 1 .. n ){\n ans += cnt[( 5 - i % 5 ) % 5]\n }\n print( ans )\n}"}, {"source_code": "import java.util.*\n \n \nfun main(args: Array){\n val ( n, m ) = readLine()!!.split(' ').map(String::toInt)\n var ans: Long = 0\n var cnt: IntArray = IntArray( 6 )\n for( i in 1 .. m ) cnt[i % 5]++\n for( i in 1 .. n ){\n ans += cnt[( 5 - i % 5 ) % 5]\n }\n print( ans )\n}"}, {"source_code": "fun main() {\n val (n, m) = readLine()!!.split(\" \").map { it.toLong() }\n var sol = 0L\n for (i in 1..n) {\n var j = 5L - i % 5L\n if (j == 0L) {\n j = 5L\n }\n j = m - j\n if (j >= 0L) {\n sol += 1L + j / 5L\n }\n }\n print(sol)\n}"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array){\n val ( n, m ) = readLine()!!.split(' ').map(String::toInt)\n var ans: Long = 0\n var cnt: IntArray = IntArray( 6 )\n for( i in 1 .. m ) cnt[i % 5]++\n for( i in 1 .. n ){\n ans += cnt[( 5 - i % 5 ) % 5]\n }\n print( ans )\n}"}], "negative_code": [{"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}"}, {"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}"}, {"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 "}], "src_uid": "df0879635b59e141c839d9599abd77d2"} {"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 if(left < numPoints) {\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}", "positive_code": [{"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-1){\n\t\t\tfor (j in i..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"}, {"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(Pair(delta, ans))\n }\n }\n }\n //println(ansbox)\n if(ansbox.minBy{ it.second } == 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.minBy{ it.second }!!.second)\n}"}, {"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 for ((k, _) in a) {\n val c = a.filter { it.key < k || it.key > k + 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"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\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}"}], "negative_code": [{"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"}, {"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}"}, {"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 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}"}, {"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 println(0)\n else\n println(ansbox.min()!!)\n}"}, {"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}"}, {"source_code": "\nfun 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( n == 1 ) \n println(target.size - 1)\n else\n println(0)\n else\n println(ansbox.min()!!)\n}"}, {"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 println(ansbox.min())\n}"}, {"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( n >= 1 ) \n println(target.size - 1)\n else\n println(0)\n else\n println(ansbox.min()!!)\n}"}, {"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}"}, {"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"}], "src_uid": "6bcb324c072f796f4d50bafea5f624b2"} {"source_code": "import java.io.PrintWriter\nimport kotlin.math.*\n\nfun main() {\n io.apply {\n\n val d = ints()\n val i0 = d.indexOf(1)\n val i1 = d.indexOf(d.size)\n val m0 = min(i0, i1)\n val m1 = max(i0, i1)\n cout .. max(d.size - 1 - m0, m1) .. nl\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", "positive_code": [{"source_code": "import kotlin.math.min\n\nfun main() {\n val size = readLine()!!.toInt()\n val arr = readLine()!!.split(\" \").map { it.toInt() }\n val minPos = arr.indexOf(1)\n val maxPos = arr.indexOf(size)\n val closer = min(minPos, min(size - 1 - minPos, min(maxPos, size - 1 - maxPos)))\n print(size - 1 - closer)\n}"}, {"source_code": "import kotlin.math.min\n\nfun main() {\n fun readInt() = readLine()!!.toInt()\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val size = readInt()\n val arr = readInts()\n val minPos = arr.indexOf(1)\n val maxPos = arr.indexOf(size)\n val closer = min(minPos, min(size - 1 - minPos, min(maxPos, size - 1 - maxPos)))\n print(size - 1 - closer)\n}"}, {"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 }\n\n 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}"}], "negative_code": [{"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}"}], "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4"} {"source_code": "\n\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 = 0L\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}", "positive_code": [{"source_code": "import java.util.*\n\nfun main() {\n\n val scanner = Scanner(System.`in`)\n\n val w = scanner.nextInt()\n val h = scanner.nextInt()\n\n var ans: Long = 0\n\n for (x in 0..w) {\n for (y in 0..h) {\n if (x % 2 == 0 && y % 2 == 0 && x > 0 && y > 0) {\n ans += (w - x + 1) * (h - y + 1)\n }\n }\n }\n\n println(ans)\n\n}\n\n"}], "negative_code": [{"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}"}], "src_uid": "42454dcf7d073bf12030367eb094eb8c"} {"source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.sqrt\n\n\nfun main() {\n val sc = Scanner.sysIn\n\n val x = sc.nextInt()\n val n = sc.nextLong()\n\n val primes = ArrayList()\n\n fun isPrime(k: Int): Boolean {\n if (k == 1) return false\n if (k == 2 || k == 3) return true\n for (i in 2..sqrt(k.toDouble()).toInt()) {\n if (k % i == 0) {\n return false\n }\n }\n return true\n\n }\n\n for (i in 2..sqrt(x.toDouble()).toInt()) {\n if (x % i == 0) {\n if (isPrime(i) && !primes.contains(x / i))\n primes += i\n if (isPrime(x / i) && !primes.contains(x / i))\n primes += x / i\n }\n }\n if (isPrime(x)) primes += x\n\n //primes.forEach { println(it) }\n\n val mod = 1000000007\n fun power(x: Long, p: Long): Long = when {\n p == 0L -> 1\n p == 1L -> x % mod\n p % 2 == 0L -> {\n val cur = power(x, p / 2)\n (cur * cur) % mod\n }\n else -> (power(x, p - 1) * x) % mod\n }\n\n var ans = 1L\n\n for (p in primes) {\n var curP = p.toLong()\n while (n / curP > 0) {\n //println(curP)\n ans = (ans * power(p.toLong(), n / curP)) % mod\n if ((curP * p) / p != curP) break\n curP *= p\n }\n }\n\n println(ans)\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n val br: BufferedReader = BufferedReader(InputStreamReader(s))\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\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 nextLine(): String {\n return br.readLine()\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n companion object {\n val sysIn = Scanner(System.`in`)\n }\n\n}\n\nval rnd = Random()\nfun IntArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}\n\nfun LongArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}", "positive_code": [{"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\nfun factorize(a: Int): MutableMap {\n val res = mutableMapOf()\n var x = a\n loop@while(x > 1) {\n var i = 2\n while(i * i <= x) {\n if (x % i == 0) {\n res.merge(i, 1, Int::plus)\n x /= i\n continue@loop\n }\n i++\n }\n res.merge(x, 1, Int::plus)\n x = 0\n }\n return res\n}\nfun powMod(a: Int, n: Long, mod: Int): Long {\n if (n == 0L) return 1\n val res = powMod((a.toLong() * a % mod).toInt(), n / 2, mod)\n return if (n % 2 == 1L) res * a % mod else res\n}\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val X = ni()\n val N = nl()\n\n val fs = factorize(X)\n var ans = 1L\n for ((p, _) in fs) {\n var n = N\n while(n >= p) {\n n /= p\n ans = ans * powMod(p, n, MOD) % MOD\n }\n }\n\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\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}"}, {"source_code": "import java.util.*\nimport kotlin.math.sqrt\n\nconst val mod = 1000000007L\n\nfun main() {\n val s = Scanner(System.`in`)\n val x = s.nextLong()\n val n = s.nextLong()\n\n var ans = 1L\n val primes = getPrimes(x)\n primes.forEach {\n var itt = it\n var cnt = 0L\n while (true) {\n cnt += n / itt\n if (itt <= n / it) // \u5982\u679c\u76f4\u63a5itt*=it\u518d\u5224\u65aditt<=n\u4f1a\u7206Long\n itt *= it\n else\n break\n }\n ans = ans * fpow(it, cnt) % mod\n }\n print(ans)\n}\n\nfun getPrimes(x: Long): Set {\n val primes = MutableList(0) { 0L }\n\n val sqrtx = sqrt(x.toDouble()).toLong() + 5\n var xx = x\n var i = 2L\n while (xx > 1) {\n if (xx % i == 0L)\n primes.add(i)\n while (xx % i == 0L)\n xx /= i\n if (++i > sqrtx)\n break\n }\n if (xx > 1)\n primes.add(xx)\n\n return primes.toSet()\n}\nfun fpow(x: Long, n: Long, m: Long = mod): Long {\n if (n == 0L)\n return 1\n var ans = 1L\n var xx = x % mod\n var nn = n\n while (nn > 1) {\n if (nn % 2 == 1L)\n ans = ans * xx % mod\n nn /= 2\n xx = xx * xx % mod\n }\n return ans * xx % mod\n}"}, {"source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\n\nfun main() {\n output {\n val x = readInt()\n val n = readLong()\n\n val primes = x.factorize().distinct().toList()\n\n var ans = ModInt(1)\n\n for(p in primes) {\n var k = 0L\n var nn = n\n while(nn > 0) {\n nn /= p\n k += nn\n }\n ans *= ModInt(p).pow(k)\n }\n\n println(ans)\n }\n}\n\nfun Int.factorize() = sequence {\n var n = this@factorize\n\n for(p in 2..Int.MAX_VALUE) {\n if(p * p > n) break\n while(n % p == 0) {\n yield(p)\n n /= p\n }\n }\n\n if(n > 1) yield(n)\n}\n\nconst val BILLION7 = 1e9.toInt() + 7\nconst val MODINT_BASE = BILLION7\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_BASE - 1 else exponent // assumes MODINT_BASE is prime\n return ModInt(int.powMod(e, MODINT_BASE))\n }\n\n fun pow(exponent: Long) = pow(exponent umod MODINT_BASE - 1) // assumes MODINT_BASE is prime\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\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"}, {"source_code": "import java.util.*\nimport kotlin.collections.HashSet\nimport kotlin.math.max\n\nfun readInts() = readLine()!!.split(\" \").map { it.toInt() }\nfun readLongs() = readLine()!!.split(\" \").map { it.toLong() }\nfun readInt() = readLine()!!.toInt()\nfun readLong() = readLine()!!.toLong()\nfun readLenAndInts() = readLine()!!.split(\" \").drop(1).map { it.toInt() }\n\nfun divisors(xx : Int) : List {\n var x = xx\n val res = mutableListOf()\n fun tryDiv(div : Int) {\n if (x % div == 0) {\n res.add(div)\n do {\n x /= div\n } while (x % div == 0)\n }\n }\n tryDiv(2)\n var div = 3\n while(div * div <= x) {\n tryDiv(div)\n div += 2\n }\n if (x != 1) {\n res.add(x)\n }\n return res\n}\n\nval mod = 1000000007L\nfun fastExp(a : Long, b : Long) : Long {\n //(a ^ b) % mod\n var res = 1L\n var x = a\n var e = b\n while(e > 0) {\n if (e % 2L == 1L) {\n res *= x\n res %= mod\n }\n x *= x\n x %= mod\n e /= 2\n }\n return res\n}\n\nfun main() {\n var (x,n) = readLongs()\n var res = 1L\n for(div in divisors(x.toInt())) {\n var times = 0L\n var nn = n\n while (nn > 0) {\n nn /= div\n times += nn\n }\n res *= fastExp(div.toLong(),times)\n res %= mod\n }\n println(res)\n}"}, {"source_code": "import kotlin.math.sqrt\n\nfun main() {\n val (x, n) = readLongs()\n val primes = primes(x.toInt())\n var result = 1L\n for (prime in primes) {\n var num = n\n var count = 0L\n while (num >= prime) {\n count += num / prime\n num /= prime\n }\n result = (result * pow(prime.toLong(), count)) % 1000000007\n }\n println(result)\n}\n\nfun primes(x: Int): IntArray {\n var num = x\n val result = mutableListOf()\n for (i in 2..sqrt(x.toDouble()).toInt()) {\n if (num % i == 0) {\n result.add(i)\n num /= i\n while (num % i == 0) {\n num /= i\n }\n }\n }\n if (num != 1) {\n result.add(num)\n }\n return result.toIntArray()\n}\n\nfun pow(x: Long, n: Long): Long {\n var num = x\n var count = n\n var result = 1L\n while (count > 0) {\n if (count and 1L == 1L) {\n result = (result * num) % 1000000007\n }\n num = (num * num) % 1000000007\n count = count shr 1\n }\n return result\n}\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"}], "negative_code": [{"source_code": "import java.util.*\nimport kotlin.math.sqrt\n\nconst val mod = 1000000007L\n\nfun main() {\n val s = Scanner(System.`in`)\n val x = s.nextLong()\n val n = s.nextLong()\n\n var ans = 1L\n val primes = getPrimes(x)\n primes.forEach {\n var itt = it\n var cnt = 0L\n while (true) {\n cnt += n / itt\n if (itt <= n / it) // \u5982\u679c\u76f4\u63a5itt*=it\u518d\u5224\u65aditt<=n\u4f1a\u7206Long\n itt *= it\n else\n break\n }\n ans = ans * fpow(it, cnt) % mod\n }\n print(ans)\n}\n\nfun getPrimes(x: Long): Set {\n val primes = MutableList(0) { 0L }\n\n val sqrtx = sqrt(x.toDouble()).toLong()\n var xx = x\n var i = 2L\n while (xx in 2..sqrtx + 10) {\n if (xx % i == 0L)\n primes.add(i)\n while (xx % i == 0L)\n xx /= i\n i++\n }\n if (xx > 1)\n primes.add(xx)\n\n return primes.toSet()\n}\nfun fpow(x: Long, n: Long, m: Long = mod): Long {\n if (n == 0L)\n return 1\n var ans = 1L\n var xx = x % mod\n var nn = n\n while (nn > 1) {\n if (nn % 2 == 1L)\n ans = ans * xx % mod\n nn /= 2\n xx = xx * xx % mod\n }\n return ans * xx % mod\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.sqrt\n\n\nfun main() {\n val sc = Scanner.sysIn\n\n val x = sc.nextInt()\n val n = sc.nextLong()\n\n val primes = ArrayList()\n\n for (i in 2..sqrt(x.toDouble()).toInt() + 10) {\n if (x % i == 0) {\n var isPrime = true\n primes.forEach { if (i % it == 0) isPrime = false }\n if (isPrime)\n primes += i\n }\n }\n if (primes.isEmpty()) primes += x\n\n val mod = 1000000007\n fun power(x: Long, p: Long): Long = when {\n p == 0L -> 1\n p == 1L -> x % mod\n p % 2 == 0L -> {\n val cur = power(x, p / 2)\n (cur * cur) % mod\n }\n else -> (power(x, p - 1) * x) % mod\n }\n\n var ans = 1L\n\n for (p in primes) {\n //println(p)\n var num = 0L\n var curP = p.toLong()\n while (n / curP > 0) {\n //println(curP)\n num += n / curP\n if (curP * p / p != curP) break\n curP *= p\n }\n ans = ans * power(p.toLong(), num) % 1000000007\n }\n\n println(ans)\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n val br: BufferedReader = BufferedReader(InputStreamReader(s))\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\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 nextLine(): String {\n return br.readLine()\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n companion object {\n val sysIn = Scanner(System.`in`)\n }\n\n}\n\nval rnd = Random()\nfun IntArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}\n\nfun LongArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.sqrt\n\n\nfun main() {\n val sc = Scanner.sysIn\n\n val x = sc.nextInt()\n val n = sc.nextLong()\n\n val primes = ArrayList()\n\n for (i in 2..sqrt(x.toDouble()).toInt() + 1) {\n if (x % i == 0) {\n var isPrime = true\n primes.forEach { if (i % it == 0) isPrime = false }\n if (isPrime)\n primes += i\n }\n }\n if (primes.isEmpty()) primes += x\n\n //primes.forEach { println(it) }\n\n val mod = 1000000007\n fun power(x: Long, p: Long): Long = when {\n p == 0L -> 1\n p == 1L -> x % mod\n p % 2 == 0L -> {\n val cur = power(x, p / 2)\n (cur * cur) % mod\n }\n else -> (power(x, p - 1) * x) % mod\n }\n\n var ans = 1L\n\n for (p in primes) {\n var curP = p.toLong()\n while (n / curP > 0) {\n ans = (ans * power(p.toLong(), n / curP)) % mod\n if ((curP * p) / p != curP) break\n curP *= p\n }\n }\n\n println(ans)\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n val br: BufferedReader = BufferedReader(InputStreamReader(s))\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\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 nextLine(): String {\n return br.readLine()\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n companion object {\n val sysIn = Scanner(System.`in`)\n }\n\n}\n\nval rnd = Random()\nfun IntArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}\n\nfun LongArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.sqrt\n\n\nfun main() {\n val sc = Scanner.sysIn\n\n val x = sc.nextInt()\n val n = sc.nextLong()\n\n val primes = ArrayList()\n\n for (i in 2..sqrt(x.toDouble()).toInt() + 10) {\n if (x % i == 0) {\n var isPrime = true\n primes.forEach { if (i % it == 0) isPrime = false }\n if (isPrime)\n primes += i\n }\n }\n if (primes.isEmpty()) primes += x\n\n val mod = 1000000007\n fun power(x: Long, p: Long): Long = when {\n p == 0L -> 1\n p == 1L -> x % mod\n p % 2 == 0L -> {\n val cur = power(x, p / 2)\n (cur * cur) % mod\n }\n else -> (power(x, p - 1) * x) % mod\n }\n\n var ans = 1L\n\n for (p in primes) {\n //println(p)\n var num = 0L\n var curP = p.toLong()\n while (n / curP > 0) {\n println(curP)\n num += n / curP\n if (curP * p / p != curP) break\n curP *= p\n }\n ans = ans * power(p.toLong(), num) % 1000000007\n }\n\n println(ans)\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n val br: BufferedReader = BufferedReader(InputStreamReader(s))\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\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 nextLine(): String {\n return br.readLine()\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n companion object {\n val sysIn = Scanner(System.`in`)\n }\n\n}\n\nval rnd = Random()\nfun IntArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}\n\nfun LongArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.sqrt\n\n\nfun main() {\n val sc = Scanner.sysIn\n\n val x = sc.nextInt()\n val n = sc.nextLong()\n\n val primes = ArrayList()\n\n fun isPrime(k: Int): Boolean {\n if (k == 1) return false\n if (k == 2 || k == 3) return true\n for (i in 2..sqrt(k.toDouble()).toInt() + 1) {\n if (k % i == 0) {\n return false\n }\n }\n return true\n\n }\n\n for (i in 2..sqrt(x.toDouble()).toInt() + 1) {\n if (x % i == 0) {\n if (isPrime(i))\n primes += i\n if (isPrime(x / i))\n primes += x / i\n }\n }\n //if (isPrime(x)) primes += x\n\n primes.forEach { println(it) }\n\n val mod = 1000000007\n fun power(x: Long, p: Long): Long = when {\n p == 0L -> 1\n p == 1L -> x % mod\n p % 2 == 0L -> {\n val cur = power(x, p / 2)\n (cur * cur) % mod\n }\n else -> (power(x, p - 1) * x) % mod\n }\n\n var ans = 1L\n\n for (p in primes) {\n var curP = p.toLong()\n while (n / curP > 0) {\n //println(curP)\n ans = (ans * power(p.toLong(), n / curP)) % mod\n if ((curP * p) / p != curP) break\n curP *= p\n }\n }\n\n println(ans)\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n val br: BufferedReader = BufferedReader(InputStreamReader(s))\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\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 nextLine(): String {\n return br.readLine()\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n companion object {\n val sysIn = Scanner(System.`in`)\n }\n\n}\n\nval rnd = Random()\nfun IntArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}\n\nfun LongArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.sqrt\n\n\nfun main() {\n val sc = Scanner.sysIn\n\n val x = sc.nextInt()\n val n = sc.nextLong()\n\n val primes = ArrayList()\n\n fun isPrime(k: Int): Boolean {\n if (k == 1) return false\n if (k == 2 || k == 3) return true\n for (i in 2..sqrt(k.toDouble()).toInt() + 1) {\n if (k % i == 0) {\n return false\n }\n }\n return true\n\n }\n\n for (i in 2..sqrt(x.toDouble()).toInt() + 1) {\n if (x % i == 0) {\n if (isPrime(i))\n primes += i\n if (isPrime(x / i))\n primes += x / i\n }\n }\n if (isPrime(x)) primes += x\n\n //primes.forEach { println(it) }\n\n val mod = 1000000007\n fun power(x: Long, p: Long): Long = when {\n p == 0L -> 1\n p == 1L -> x % mod\n p % 2 == 0L -> {\n val cur = power(x, p / 2)\n (cur * cur) % mod\n }\n else -> (power(x, p - 1) * x) % mod\n }\n\n var ans = 1L\n\n for (p in primes) {\n var curP = p.toLong()\n while (n / curP > 0) {\n //println(curP)\n ans = (ans * power(p.toLong(), n / curP)) % mod\n if ((curP * p) / p != curP) break\n curP *= p\n }\n }\n\n println(ans)\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n val br: BufferedReader = BufferedReader(InputStreamReader(s))\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\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 nextLine(): String {\n return br.readLine()\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n companion object {\n val sysIn = Scanner(System.`in`)\n }\n\n}\n\nval rnd = Random()\nfun IntArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}\n\nfun LongArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.sqrt\n\n\nfun main() {\n val sc = Scanner.sysIn\n\n val x = sc.nextInt()\n val n = sc.nextLong()\n\n val primes = ArrayList()\n\n for (i in 2..sqrt(x.toDouble()).toInt() + 10) {\n if (x % i == 0) {\n var isPrime = true\n primes.forEach { if (i % it == 0) isPrime = false }\n if (isPrime)\n primes += i\n }\n }\n if (primes.isEmpty()) primes += x\n\n val mod = 1000000007\n fun power(x: Long, p: Long): Long = when {\n p == 0L -> 1\n p == 1L -> x % mod\n p % 2 == 0L -> {\n val cur = power(x, p / 2)\n (cur * cur) % mod\n }\n else -> (power(x, p - 1) * x) % mod\n }\n\n var ans = 1L\n\n for (p in primes) {\n //println(p)\n var curP = p.toLong()\n while (n / curP > 0) {\n //println(curP)\n ans = ans * power(p.toLong(), n / curP) % 1000000007\n if (curP * p / p != curP) break\n curP *= p\n }\n }\n\n println(ans)\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n val br: BufferedReader = BufferedReader(InputStreamReader(s))\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\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 nextLine(): String {\n return br.readLine()\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n companion object {\n val sysIn = Scanner(System.`in`)\n }\n\n}\n\nval rnd = Random()\nfun IntArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}\n\nfun LongArray.sort() {\n val n = this.size\n for (i in 0 until n - 1) {\n val randomPos = i + rnd.nextInt(n - i - 1) + 1\n this[i] = this[i] xor this[randomPos]\n this[randomPos] = this[randomPos] xor this[i]\n this[i] = this[i] xor this[randomPos]\n }\n Arrays.sort(this)\n}"}], "src_uid": "04610fbaa746c083dda30e21fa6e1a0c"} {"source_code": "fun main()\n{\n val lens = readLine()!!.toInt()\n val given = readLine()!!\n var c = 'A'\n var answer = \"YES\"\n while (c <= 'Z')\n {\n if (given.contains(c))\n {\n ++c\n continue\n }\n else if (given.contains(c.toLowerCase()))\n {\n ++c\n continue\n }\n else\n {\n answer = \"NO\"\n break\n }\n }\n println(answer)\n}", "positive_code": [{"source_code": "import java.util.*\n\nfun main(args: Array) {\n val alphabet = ('a'..'z').toList().toCharArray()\n\n val sc = Scanner(System.`in`)\n sc.nextLine()\n val line = sc.nextLine()\n\n println(if(pangram(line, alphabet)) \"YES\" else \"NO\")\n}\n\nfun pangram(line: String, alphabet: CharArray): Boolean {\n if (line.length < alphabet.size) {\n return false\n }\n\n val lowercase = line.toLowerCase()\n return alphabet.filter { it !in lowercase }.isEmpty()\n}"}, {"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 s = br.readLine().toLowerCase()\n println(\n if (s.toSet().size == 26) \"YES\" else \"NO\"\n )\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n if(n < 26) {\n println(\"NO\")\n } else {\n val word = readLine()!!.toLowerCase().toSortedSet()\n if(word.size >= 26) println(\"YES\")\n else println(\"NO\")\n }\n}"}, {"source_code": "fun main(args: Array) {\n val length = Integer.parseInt(readLine().toString())\n val sentence = readLine().toString().toLowerCase()\n if(isPangram(length,sentence)){\n println(\"YES\")\n }\n else{\n println(\"NO\")\n }\n}\nfun isPangram(inter:Int,input:String):Boolean {\n for (a in 'a'..'z'){\n val isChar: (Char) -> Boolean = {it == a}\n if(!input.any(predicate = isChar )) {\n return false }\n }\n return true\n }"}, {"source_code": "fun main(args: Array) {\n readLine()\n val s = readLine()!!.toLowerCase()\n println(if (('a'..'z').all { s.contains(it) }) \"YES\" else \"NO\")\n}"}, {"source_code": "import java.util.*\n\nfun main(){\n\n val scan = Scanner(System.`in`)\n\n val n = scan.nextInt()\n val arr = Array(26){ _ -> false}\n var c = 0\n val line = scan.next().toUpperCase()\n\n if (n<26){\n print(\"NO\")\n return\n }\n for (i in line){\n val tmp = i.toInt()\n arr[tmp-65] = true\n }\n\n for (i in arr) if (i) c++\n\n if (c == 26) print(\"YES\")\n else print(\"NO\")\n}"}, {"source_code": "fun main() {\n readLine()!!\n if (readLine()!!.asSequence().map { it.toLowerCase() }.toSet().size == 26)\n println(\"YES\")\n else\n println(\"NO\")\n}"}, {"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 n = readInt()\n var s = readLn().toLowerCase()\n var ss = mutableSetOf()\n for (i in 0..n - 1) {\n ss.add(s[i])\n }\n if (ss.size < 26) {\n println(\"NO\")\n } else {\n println(\"YES\")\n }\n}\n"}, {"source_code": "import java.util.*\nimport kotlin.collections.HashMap\n\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\n var ss= s.toUpperCase()\n for (i in 0 until s.length) {\n map.put(ss.get(i), 0)\n }\n// if(map.size<26)\n// println(\"NO\")else println(\"YES\")\n when(map.size)\n {\n in 1..25-> print(\"NO\")\n else -> print(\"YES\")\n }\n }\n}\n\n\n\n\n\n"}, {"source_code": "fun main() {\n readLine()\n val s = readLine()!!\n val chars = mutableSetOf()\n for (c in s) chars.add(c.toLowerCase())\n print(if (chars.size == 26) \"YES\" else \"NO\")\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.*\nimport kotlin.system.measureTimeMillis\n\nfun getMinimumAmountOfChangeFrom(amount: Int): Int {\n val changes = listOf(10, 5, 1)\n var availableAmount = amount\n var numOfCoins = 0\n for (change in changes) {\n while (availableAmount > 0 && availableAmount / change.toDouble() >= 1) {\n numOfCoins += 1\n availableAmount -= change\n }\n }\n return numOfCoins\n}\n\nfun getMaximumValueOfTheLootWith(\n W: Int,\n valuePerUnitAndWeight: List>\n): Double {\n var maximumLootValue = 0.0\n var availableWeight = W\n for (pair in valuePerUnitAndWeight) {\n var availableWeightOfLootItem = pair.second\n while (availableWeight > 0 && availableWeightOfLootItem > 0) {\n maximumLootValue += pair.first\n availableWeightOfLootItem -= 1\n availableWeight -= 1\n }\n }\n return maximumLootValue\n}\n\nfun getMinimumNumOfRefills(d: Int, m: Int, stops: List): Int {\n var availableDistance = d\n var minimumRefills = 0\n var currentRefill = 0\n var lastRefill = 0\n val realStops = listOf(0, *stops.toTypedArray(), d)\n while (availableDistance > 0 && currentRefill < realStops.size) {\n var movedForward = false\n while (currentRefill < realStops.size && (realStops[currentRefill] - realStops[lastRefill]) <= m) {\n if (realStops[currentRefill] - realStops[lastRefill] == 0) {\n movedForward = false\n currentRefill++\n } else {\n movedForward = true\n currentRefill++\n }\n }\n if (movedForward) {\n minimumRefills++\n currentRefill--\n availableDistance -= (realStops[currentRefill] - realStops[lastRefill])\n lastRefill = currentRefill\n } else {\n return -1\n }\n }\n return minimumRefills - 1\n}\n\nfun getMaximizedSumOfProduct(profitPerClick: List, averageNumberOfClicks: List): Long {\n var sum = 0L\n println(profitPerClick.toString())\n println(averageNumberOfClicks.toString())\n profitPerClick.forEachIndexed { index, profit ->\n sum += profit * averageNumberOfClicks[index]\n }\n return sum\n}\n\nfun getCommon(first: Int, last: Int, segments: MutableList>): String {\n var current = first\n val common = mutableListOf>()\n while (current <= last) {\n var numOfTimes = 0\n for (pair in segments) {\n if (current in pair.first..pair.second) {\n numOfTimes++\n }\n }\n if (numOfTimes > 1) {\n common.add(Pair(current, numOfTimes))\n }\n current++\n }\n common.sortByDescending { it -> it.second }\n if (common.first().second == segments.size) {\n return \"1\\n${common.first().first}\"\n }\n println(common)\n return \"${common.size}\\n${common.map { it.first }.joinToString(\" \")}\"\n}\n\nfun getMaximumSetOfPrizes(n: Int): String {\n var numbersOfN = \"\"\n var sumSoFar = 0\n if (n <= 2) {\n return \"1\\n$n\"\n }\n// println(\"2*square root of n = ${2 * sqrt(n.toDouble())}\")\n// for (i in 1..(2 * sqrt(n.toDouble()).toInt())){\n// if (i+sumSoFar<=n){\n// numbersOfN+=\"$i \"\n// sumSoFar+=i\n// }\n// }\n// var lastNumber = 1\n var currentNumber = 1\n while (((currentNumber + 1) + currentNumber) <= n - sumSoFar) {\n sumSoFar += currentNumber\n numbersOfN += \"$currentNumber \"\n currentNumber++\n }\n if (((n - currentNumber) + sumSoFar) == n || n - sumSoFar > 0) {\n currentNumber = n - sumSoFar\n sumSoFar += currentNumber\n numbersOfN += \"$currentNumber \"\n }\n// else if (n-sumSoFar>0){\n// currentNumber = n-sumSoFar\n// numbersOfN += \"$currentNumber \"\n// }\n return \"${numbersOfN.trim().split(\" \").size}\\n$numbersOfN\"\n}\n\n\nfun linelandMail(coordinates: List): String {\n val mins = mutableListOf()\n val maxs = mutableListOf()\n for (i in coordinates.indices) {\n if (i == 0) {\n mins.add(abs(coordinates[i] - coordinates[i + 1]))\n maxs.add(abs(coordinates[i] - coordinates[coordinates.size - 1]))\n } else if (i == coordinates.size - 1) {\n mins.add(abs(coordinates[i] - coordinates[i - 1]))\n maxs.add(abs(coordinates[i] - coordinates[0]))\n } else {\n if (abs(coordinates[i] - coordinates[i - 1])\n > abs(coordinates[i] - coordinates[i + 1])\n )\n mins.add(abs(coordinates[i] - coordinates[i + 1]))\n else\n mins.add(abs(coordinates[i] - coordinates[i - 1]))\n\n if (abs(coordinates[i] - coordinates[0])\n < abs(coordinates[i] - coordinates[coordinates.size - 1])\n )\n maxs.add(abs(coordinates[i] - coordinates[coordinates.size - 1]))\n else\n maxs.add(abs(coordinates[i] - coordinates[0]))\n }\n }\n return mins\n .zip(maxs)\n .map { pair -> \"${pair.first} ${pair.second}\" }\n .joinToString(\"\\n\")\n}\n\nfun snacktower(snacksWeights: List) {\n val n = snacksWeights.size\n var currentMax = n\n var current = 0\n var processed = mutableListOf()\n while (current < snacksWeights.size) {\n if (snacksWeights[current] < currentMax) {\n processed.add(snacksWeights[current])\n print(\"\\n\")\n current++\n } else {\n if (snacksWeights[current] == currentMax) {\n print(currentMax)\n currentMax--\n var currentProcessed = 0\n while (currentProcessed < processed.size) {\n var foundConsecutive = false\n if (processed[currentProcessed] == currentMax) {\n print(\" \")\n print(processed[currentProcessed])\n currentMax--\n foundConsecutive = true\n processed = processed.swap(currentProcessed, processed.size - 1).toMutableList()\n processed.removeAt(processed.size - 1)\n }\n if (!foundConsecutive) {\n currentProcessed++\n } else {\n currentProcessed = 0\n }\n }\n println()\n current++\n }\n }\n }\n}\n\nfun List.swap(a: Int, b: Int): List = this\n .toMutableList()\n .also {\n it[a] = this[b]\n it[b] = this[a]\n }\n\nfun `Oath of the Night's Watch`(stewardsStrengths: List) {\n val sortedStrengths = stewardsStrengths.sorted()\n var numberOfThoseWhoNeedSupport = 0\n for (strengthIndex in sortedStrengths.indices) {\n val precedingSteward = strengthIndex - 1\n val nextSteward = strengthIndex + 1\n if (precedingSteward>=0 && nextStewardsortedStrengths[strengthIndex]){\n numberOfThoseWhoNeedSupport++\n }\n }\n }\n println(numberOfThoseWhoNeedSupport)\n}\n\nfun pangram(characters: String){\n print(if (characters.toLowerCase().toSet().size==26) \"YES\" else \"NO\")\n}\n\nfun main() {\n\n// val scanner = Scanner(System.`in`)\n// val n = scanner.nextInt()\n// val snacksWeights = MutableList(n) { index -> 0 }\n// for (i in 0 until n) {\n// snacksWeights[i] = scanner.nextInt()\n// }\n// snacktower(snacksWeights)\n// val scanner = Scanner(System.`in`)\n// val n = scanner.nextInt()\n// val strengths = MutableList(n) { index -> 0 }\n// for (i in 0 until n) {\n// strengths[i] = scanner.nextInt()\n// }\n// `Oath of the Night's Watch`(strengths)\n val n = readLine()!!.toInt()\n val characters = readLine()!!\n pangram(characters)\n}\n\n\n// start of stress test\n// while (true) {\n// val n = Random.nextLong(1000000)\n// val m = Random.nextLong(100000)\n// if (m) {\n val n = readLine()!!.toInt()\n val s = readLine()!!\n val arr = Array(26, {i -> 0})\n for (c in s) {\n if ('a' <= c && c <= 'z') {\n arr[c-'a'] = 1\n } else if ('A' <= c && c <= 'Z') {\n arr[c-'A'] = 1\n }\n }\n if (arr.all{it == 1})\n print(\"YES\\n\")\n else\n print(\"NO\\n\")\n}\n"}, {"source_code": "fun main(args: Array) {\n readLine()\n println(if (readLine()!!.toLowerCase().toSet().size >= 26) \"YES\" else \"NO\")\n}"}, {"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\nval charRange = 'a'..'z'\n\nfun main() {\n readLn()\n val sentence = readLn()\n\n if(sentence.map { it.toLowerCase() }.containsAll(charRange.toList())) println(\"YES\") else println(\"NO\")\n}\n"}, {"source_code": "\nfun main(args: Array) {\n readLine() !!\n val count = readLine()!!.toLowerCase().toSet().size\n println(if (count == 26) \"YES\" else \"NO\")\n}"}, {"source_code": "import 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\nfun readLn():String = readLine()!!.toString()\nfun readLong() = readLn().toLong()\nfun readLongs() = readLn().split(\" \").map{it.toLong()}\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 solve() {\n val cin = Scanner(System.`in`)\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 a=readLong();\n var s=readLine()!!;\n\n var mem=mutableSetOf();\n for (c in s) {var pog=c; if (c>='A' && c<='Z') { var code=pog.toInt(); code-='A'.toInt(); code+='a'.toInt(); pog=code.toChar(); }\n mem.add(pog); }\n if (mem.size>=26) print(\"YES\"); else print(\"NO\");\n\n /* --------- */\n\n}\n\nfun main() {\n val cin = Scanner(System.`in`)\n\n var T=one;\n //T=readLine()!!.toLong();\n for (i55555 in 1..T) solve()\n}\n"}, {"source_code": "fun main(args: Array) {\n \n var n = readLine()!!.toInt()\n var str = readLine()!!.toLowerCase()\n var ok = 0\n for(i in 'a'..'z')if(str.contains(i)) ok++\n if(ok == 26)print(\"YES\")\n else print(\"NO\")\n}"}, {"source_code": "fun 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\n\nfun main(args: Array) {\n val n = readInt()\n val s = readLn()\n\n for (ch in 'a'..'z') {\n if (!s.contains(ch) && !s.contains(ch.toUpperCase())) {\n println(\"NO\")\n return\n }\n }\n\n println(\"YES\")\n}"}, {"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 n = io.readInt()\n val t = io.readToken()\n val res = (t.toLowerCase().toSet().size == 26)\n io.println(if (res) \"YES\" else \"NO \")\n io.close()\n}\n\nfun main(args: Array) {\n Thread({ solve() }).start()\n}\n"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val n = r.readLine()!!\n val diff = r.readLine()!!.toLowerCase().split(\"\").groupBy { it }.size\n println(if (diff==27) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var s = readLine()!!\n var c = 0\n s = s.toUpperCase()\n for (i in 'A'..'Z'){\n if (s.contains(i)){\n c++\n }\n }\n if (c >= 26){\n print(\"YES\")\n }\n else\n print(\"NO\")\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n\n val scanner = Scanner(System.`in`)\n val q = scanner.nextInt()\n var line = scanner.next().toLowerCase()\n\n var set = mutableSetOf()\n\n (0 until q).forEach { set.add(line[it]) }\n\n if (set.size == 26) println(\"YES\")\n else println(\"NO\")\n\n}"}, {"source_code": "import java.util.Scanner;\nimport java.util.Arrays;\nimport java.util.*; \nimport java.math.*;\nimport java.io.*;\n\nfun main(args: Array) {\nvar s = Scanner(System.`in`)\nvar numberofletters = s.nextInt()\nvar sentence = s.next()\nvar res = sentence.toLowerCase();\nvar charSentence = res.toCharArray()\nArrays.sort(charSentence)\nvar pangram = 0 \nvar start = 97\nfor(i in 0 until numberofletters){\nval charSentenceAsInt = charSentence[i].toInt()\nif(charSentenceAsInt==start){\npangram++\nstart++\n}\n}\nif(pangram == 26){\nprint(\"YES\")\n}else{\nprint(\"NO\")\n}\n\n}\n"}, {"source_code": "import java.util.*\nimport kotlin.math.max\n\nfun main() {\n val scan = Scanner(System.`in`)\n val size = scan.nextInt()\n val list:Iterable = scan.next().asIterable()\n pangram(list)\n}\n\n// http://codeforces.com/contest/520/problem/A\nfun pangram(list: Iterable) {\n val set = mutableSetOf()\n for (c in list) {\n set.add(c.toLowerCase())\n }\n val result = if (set.size == 26) \"YES\" else \"NO\"\n println(result)\n}"}, {"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 input.nextInt()\n\n ('a'..'z').toSet().let { set ->\n val s = input.next().toLowerCase()\n output.println(if (set.all { s.contains(it) }) \"YES\" else \"NO\")\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}"}, {"source_code": "\nfun main(){\n readLine()\n var set = readLine()!!.toString().toLowerCase().toCharArray().toSet()\n println( if(set.size == 26) \"YES\\n\" else \"NO\")\n}\n"}, {"source_code": "fun main(args: Array) {\n val n = readInt()\n val s = readLine()!!.toLowerCase().toCharArray().toSet().size\n println(if (s == 26) \"YES\" else \"NO\")\n}\n\nprivate fun readInt() = readLine()!!.toInt()"}, {"source_code": "import java.util.*\nfun main(args: Array) {\n var sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val s = sc.next().toLowerCase()\n if (n < 26) println(\"NO\")\n else {\n var count = IntArray(26)\n for ( i in 0 .. n-1){\n count[s[i].toInt()- 'a'.toInt()]++\n }\n var test = true\n for (i in 0 .. 25){\n if (count[i] == 0 ){\n test= false\n break\n }\n }\n println(if (test) \"YES\" else \"NO\")\n }\n}"}, {"source_code": " fun main(args: Array) {\n readLine()\n var s=readLine()!!.toLowerCase().toSet()\n if(s.size==26)\n print(\"YES\")\n else\n print(\"NO\")\n\n \n \n }"}], "negative_code": [{"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 }"}, {"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 {\n print(\"NO\")\n return\n }\n else\n {\n s.toLowerCase()\n for(i in 0 until s.length)\n {\n map.put(s.get(i),0)\n }\n }\n if(map.size<26)\n print(\"NO\")else\n print(\"YES\")\n}\n\n\n\n\n\n"}, {"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 {\n print(\"NO\")\n return\n }\n else\n {\n s.toLowerCase()\n for(i in 0 until s.length)\n {\n map.put(s.get(i),0)\n }\n }\n if(map.size==26)\n print(\"YES\")else\n print(\"NO\")\n}\n\n\n\n\n\n"}, {"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"}], "src_uid": "f13eba0a0fb86e20495d218fc4ad532d"} {"source_code": "import java.util.*\n\nfun main(args: Array) {\n var(l, r) = readLine()!!.split(\" \").map(String::toInt)\n if (l == r) {\n println(l)\n } else {\n println(2)\n }\n}", "positive_code": [{"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!\n val (n, m) = r.readLine()!!.split(\" \").map { it.toInt() }\n if (n==m) println(n)\n else println(2)\n}"}, {"source_code": "import java.util.*\n\n/**\n * Created by Igor on 7/17/2017.\n */\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val l = scanner.nextInt()\n val r = scanner.nextInt()\n\n if (l == r)\n println(l)\n else\n println(2)\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array){\n var sc = Scanner(System.`in`)\n var l = sc.nextInt()\n var r = sc.nextInt()\n println(if(l == r) l else 2)\n}\n"}, {"source_code": "fun main(args: Array) {\n\tval (l,r) = readLine()!!.split(' ').map(String::toInt)\t\n\tval res = if ( r==l) l else 2;\n\tprintln(res)\n\t\n}\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n val left = reader.nextInt()\n val right = reader.nextInt()\n if (left == right && right % 3 == 0) println(3)\n else if (left == right && right % 2 != 0) println(right)\n else println(2)\n\n}\n"}, {"source_code": "import kotlin.math.abs\n\nfun main() {\n var (l, r) = readLine()!!.split(' ').map { it.toInt() }\n if (abs(l-r)==0){\n println(l)\n }else{\n println(2)\n }\n}"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (l, r) = readInts()\n print(if (l == r) l else 2)\n}\n\n//fun main() {\n// fun readLongs() = readLine()!!.split(\" \").map(String::toLong)\n//\n// val (l, r) = readLongs()\n// val divisorToTimes = mutableMapOf()\n// val composites = mutableSetOf()\n// for (candidate in 2L..r) {\n// if (candidate in composites) continue\n// divisorToTimes[candidate] = if (candidate in l..r) 1 else 0\n// for (number in candidate + candidate..r step candidate) {\n// if (number in l..r)\n// divisorToTimes[candidate] = divisorToTimes[candidate]!! + 1\n// composites.add(number)\n// }\n// }\n// print(divisorToTimes.maxBy { it.value }!!.key)\n//}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main(args: Array) {\n val tokenizer = BufferedReader(InputStreamReader(System.`in`)).use { StringTokenizer(it.readText()) }\n val l = tokenizer.nextInt()\n val r = tokenizer.nextInt()\n if (l == r)\n println(l)\n else\n println(2)\n}\n\nfun StringTokenizer.nextInt() = Integer.parseInt(nextToken())\n\n"}, {"source_code": "fun main(args: Array) {\n val (l, r) = readLine()!!.split(' ').map(String::toInt)\n if (l == r)\n print(\"$l\\n\")\n else\n print(\"2\\n\")\n}\n"}, {"source_code": "fun main(args : Array)\n{\n var line: String = inputNotNull()\n var l: Long = line.split(\" \")[0].toLong()\n var r: Long = line.split(\" \")[1].toLong()\n var arr: Array = Array(Math.sqrt(r.toDouble()).toInt(),{i -> 0})\n\n if(r == 2L||r==4L){\n println(2)\n return\n }else if(r==3L){\n println(3)\n return\n }else if(l==r){\n println(l)\n return\n }\n\n println(2)\n\n}\n\nfun inputNotNull(): String\n{\n val line: String? = readLine()\n if (line == null) return \"\"\n return line.trim()\n}"}], "negative_code": [{"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val n = r.readLine()!!\n //val (n, m) = r.readLine()!!.split(\" \").map { it.toInt() }\n println(2)\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n val left = reader.nextInt()\n val right = reader.nextInt()\n if (left == right && right % 3 == 0) println(3)\n else println(2)\n\n}\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n var(l, r) = readLine()!!.split(\" \").map(String::toInt)\n println(2)\n}"}], "src_uid": "a8d992ab26a528f0be327c93fb499c15"} {"source_code": "\n\nfun main(args: Array) {\n var count = readLine()!!.toInt()\n println(readLine()!!.split(\" \").map { it.toInt() }.sorted()\n .map {\n it.toString()\n }.joinToString (\" \"))\n}", "positive_code": [{"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n readLine()!!.split(\" \").map { it.toInt() }.sorted().forEach({ print(\"${it} \") })\n}"}, {"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 n = io.readInt()\n val a = IntArray(n)\n for (i in a.indices) {\n a[i] = io.readInt()\n }\n a.sort()\n io.println(a.joinToString(\" \"))\n io.close()\n}\n\nfun main(args: Array) {\n Thread({ solve() }).start()\n}\n"}, {"source_code": "fun main()\n{\n val ignore = readLine()!!.toInt()\n println(readLine()!!.split(\" \").map { it.toInt() }.sorted().joinToString(\" \"))\n\n}\n"}, {"source_code": "fun 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() }.sorted()\n println(l.joinToString(\" \"))\n}"}, {"source_code": "fun main() {\n readLine()!!\n val cubes = readLine()!!.split(\" \").map(String::toInt)\n println(cubes.sorted().joinToString(separator = \" \").trim())\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n\n var max = 0\n val columns = Array(n, {\n val curr = scanner.nextInt()\n if (curr > max) {\n max = curr\n }\n curr\n })\n\n val tmp = IntArray(max, { 0 })\n\n columns.forEach {\n tmp[it - 1]++\n }\n\n var index = 0\n tmp.forEachIndexed { i, v ->\n for (j in 0 until v) {\n columns[index++] = i + 1\n }\n }\n\n println(columns.joinToString(\" \"))\n\n}"}, {"source_code": "fun main() {\n readLine()\n readLine()!!.split(' ').map(String::toInt).sorted().forEach { print(\"$it \") }\n}"}, {"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.sortedBy { i -> i.toInt() }\n val sb = StringBuilder()\n for (i in sortedRow)\n sb.append(\"$i \")\n sb.deleteCharAt(sb.length - 1)\n print(sb.toString())\n}"}, {"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 heights = (1..n).map { input.nextInt() }\n val maxHeight: Int = heights.max()!!\n\n val box = Array(maxHeight, { IntArray(n, { 0 }) })\n for (i in 0 until n) {\n for (j in 0 until heights[i]) {\n box[maxHeight - j - 1][i] = 1\n }\n }\n\n for (i in 0 until maxHeight) {\n for (j in n - 2 downTo 0) {\n for (k in j until n - 1) {\n if (box[i][k] == 1) {\n if (box[i][k + 1] == 0) {\n box[i][k + 1] = 1\n box[i][k] = 0\n }\n } else {\n break\n }\n }\n }\n }\n\n for (j in 0 until n) {\n var sum = 0\n for (i in 0 until maxHeight) {\n sum += box[i][j]\n }\n output.print(sum)\n output.print(\" \")\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}"}, {"source_code": "fun main() {\n readLine()\n println(readLine()!!.split(\" \").map(String::toInt).sorted().joinToString(\" \"))\n}"}, {"source_code": "fun main() {\n readLine()\n val input = readLine()!!.split(\" \").map(String::toInt).sorted()\n println(input.joinToString(\" \"))\n}"}, {"source_code": "import java.io.PrintWriter\nimport kotlin.math.*\n\nfun main() {\n io.apply {\n\n cout .. ints().sorted().toIntArray() .. 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 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"}, {"source_code": "\nfun main() {\n var c = readLine()!!.toInt()\n var arr = readLine()!!.split(\" \").map { it.toInt() }.toIntArray()\n var matrex = Array(arr.max()!!.toInt()) { Array(c) { 0 } }\n var i = 0\n for (col in 0 until c) {\n for (row in (arr.max()!! - 1)downTo 0) {\n if(arr[i] < arr.max()!!){\n matrex[row][col] = 0\n arr[i]++\n }else\n matrex[row][col] = 1\n }\n i++\n }\n\n var res = Array(c){0}\n var index = 0\n for(i in 0 until arr.max()!!) {\n var lineArray = matrex[i]\n for(j in 0 until lineArray.size){\n if(lineArray[j] == 1) {\n res[index]++\n index++\n }\n }\n index = 0\n }\n for(i in res.size-1 downTo 0)\n print(\"${res[i]} \")\n}\n"}, {"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 h.sort()\n\n println(h.joinToString(\" \"))\n}"}, {"source_code": "fun main(args: Array) {\n val n = readInt()\n println(readInts().sorted().joinToString(\" \"))\n}\n\nprivate fun readInt() = readLine()!!.toInt()\n\nprivate fun readInts() = readLine()!!.split(\" \").map { it.toInt() }"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n val a = readLine()!!.split(regex = \"\\\\s\".toRegex()).map { it.toInt() }.toTypedArray()\n .sorted()\n\n println(a.joinToString(separator = \" \"))\n}\n"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n var n = reader.readLine().toInt()\n val nums = reader.readLine().split(\" \")\n .mapTo(mutableListOf(), { it.toInt() })\n\n var mismatch = true\n\n while (mismatch) {\n var counter = 0\n while (n - 1 != 0) {\n val difference = nums[n - 2] - nums[n - 1]\n if (difference > 0) {\n nums[n - 2] -= difference\n nums[n - 1] += difference\n counter++\n }\n n--\n }\n if(0 == counter) {\n mismatch = false\n }\n n = nums.size\n }\n nums.forEach({ print(\"$it \") })\n}"}, {"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 a = br.readLine().split(\" \").map { it.toInt() }\n val count = Array(101){0}\n for (a_i in a) {\n count[a_i]++\n }\n val ans = ArrayList()\n var i = 0\n while (i < count.size && ans.size < n) {\n if (count[i] > 0) {\n ans.add(i)\n count[i]--\n } else {\n i++\n }\n }\n println(ans.joinToString(\" \"))\n}"}, {"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 a = br.readLine().split(\" \").map { it.toInt() }\n val count = Array(105){0}\n for (a_i in a){\n count[a_i]++\n }\n\n val asorted = Array(n){0}\n var i = 0\n var j = 0\n\n while (i < count.size){\n if (count[i] != 0){\n asorted[j] = i\n count[i]--\n j++\n }else{\n i++\n }\n }\n println(asorted.joinToString(\" \"))\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.abs\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n var numOfCol = scan.nextInt()\n val list = mutableListOf()\n while (numOfCol-->0) {\n val s =scan.nextInt()\n list.add(s)\n }\n list.sort()\n list.forEach {\n print(\"$it \")\n\n }\n}"}, {"source_code": "import kotlin.math.abs\n\nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun findFlipCols(): List {\n val numCols = readInt()\n val colsVals = readInts()\n return colsVals.sorted()\n}\n\nfun main() {\n print(findFlipCols().joinToString(separator = \" \"))\n}\n"}, {"source_code": "fun main(args: Array) {\n gravityChange()\n}\nfun gravityChange(){\n readLine()\n readLine()?.split(\" \")?.map{ it.toInt()}?.sorted()?.forEach { print(\"$it \") }\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun main() {\n var n = readLine()!!.toInt()\n var list = readLine()!!.split(' ').map { it.toInt() }\n\n Collections.sort(list)\n for (i in list){\n print(\"$i \")\n }\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val heights = readLine()!!.split(' ').map { it.toInt() }\n val freqs = IntArray(101)\n for (h in heights) {\n (1..h).forEach { freqs[it]++ }\n }\n for (i in 1..n) {\n print(\"${freqs.count { it >= n - i + 1 }} \")\n }\n println()\n}"}, {"source_code": "import java.util.*\n\nfun main(){\n val scan = Scanner(System.`in`)\n val n = scan.nextInt()\n val arr = IntArray(n)\n for (i in 0 until n) arr[i] = scan.nextInt()\n arr.sort()\n\n for (i in arr) print(\"$i \")\n}\n\n"}, {"source_code": "typealias int = Int\n\nfun main() {\n var n = readLine()!!.toInt()\n var arr : IntArray= readLine()!!.split(' ').map { it.toInt() }.toIntArray()\n arr.sort()\n\n for( idx in 0..arr.lastIndex) {\n print(\"${arr[idx]} \")\n }\n println()\n}"}, {"source_code": "fun main() {\n readLine()\n println(readLine()!!.split(\" \").map(String::toInt).sorted().joinToString(\" \"))\n}"}, {"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 n = readInt()\n var l = readInts()\n l = l.sorted()\n println(l.joinToString(\" \"))\n}\n"}, {"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 print(\" \")\n }\n}\n"}, {"source_code": "fun main(args: Array) {\n readLine()\n readLine()!!.split(' ').map(String::toInt).sorted().forEach {\n print(\"$it \")\n }\n print(\"\\n\")\n}\n"}, {"source_code": "fun main(args: Array) {\n readLine()\n readLine()!!.split(' ').map(String::toInt).toTypedArray().sorted().forEach {\n print(\"$it \")\n }\n print(\"\\n\")\n}\n"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val matrix = readLine()!!.split(' ').map { it.toInt() }.toMutableList()\n\n while ((n - 2 downTo 0).count {\n val delta = matrix[it] - matrix[it + 1]\n if (delta > 0) {\n matrix[it] -= delta\n matrix[it + 1] += delta\n }\n delta > 0\n } > 0){}\n\n println(matrix.joinToString(separator = \" \"))\n}"}, {"source_code": "fun main(args: Array) {\n readLine()!!.toInt()\n val array = readLine()!!.split(' ').map { it.toInt() }.sorted()\n println(array.joinToString(\" \"))\n}"}], "negative_code": [{"source_code": "fun main() {\n readLine()\n readLine()!!.split(' ').sorted().forEach { print(\"$it \") }\n}"}, {"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}"}, {"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"}], "src_uid": "ae20712265d4adf293e75d016b4b82d8"} {"source_code": "import kotlin.math.abs\n\nfun main() {\n val (a, b) = readLine()!!.split(\" \").map { it.toLong() }\n val (c, d) = readLine()!!.split(\" \").map { it.toLong() }\n val diffs = mutableSetOf()\n when {\n a % 2L == 0L && b % 2L == 0L && c % 2L == 0L && d % 2L != 0L -> print(-1)\n c % 2L == 0L && d % 2L == 0L && a % 2L == 0L && b % 2L != 0L -> print(-1)\n else -> {\n var first = b\n var second = d\n while (first != second) {\n if (diffs.contains(first - second)) {\n first = -1\n break\n } else diffs.add(first - second)\n if (first < second) first += a else second += c\n }\n print(first)\n }\n }\n}\n", "positive_code": [{"source_code": "\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"}, {"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 0..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"}, {"source_code": "fun main(args: Array) {\n val (a, b) = readLine()!!.split(\" \").map(String::toInt)\n val (c, d) = readLine()!!.split(\" \").map(String::toInt)\n\n var ans = -1\n\n loop@ for (x in 0..99) {\n for (y in 0..99) {\n val t1 = b + x * a\n val t2 = d + y * c\n if (t1 == t2) {\n ans = t1\n break@loop\n }\n }\n }\n\n println(ans)\n}"}, {"source_code": "import java.io.*\nimport java.util.*\n\nfun DataReader.solve(out: PrintWriter) {\n val a = nextInt()\n val b = nextInt()\n val c = nextInt()\n val d = nextInt()\n\n var answer = 100500\n\n for (i in 0..111) {\n for (j in 0..111) {\n if (b + a * i == d + c * j) {\n answer = Math.min(answer, b + a * i)\n }\n }\n }\n\n if (answer == 100500) {\n answer = -1\n }\n\n out.println(answer)\n}\n\n// Taken from `bintree`-s code.\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 wr = PrintWriter(System.out);\n val re = BufferedReader(InputStreamReader(System.`in`));\n DataReader(re).solve(wr)\n wr.flush()\n}\n"}], "negative_code": [{"source_code": "import java.io.*\nimport java.util.*\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 for (i in 1..1000000) {\n val q = a + i * b - c\n\n if (q >= 0 && q % d == 0) {\n out.println(q + c)\n return\n }\n }\n\n out.println(-1)\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"}, {"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 out.println(-1)\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"}, {"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"}], "src_uid": "158cb12d45f4ee3368b94b2b622693e7"} {"source_code": "fun main() {\n print(readLine()!!.toInt() % 2)\n}", "positive_code": [{"source_code": "import kotlin.math.*\nimport java.util.*\nimport java.math.*\n\nfun main(args : Array) = with(Scanner(System.`in`)) {\n\tprintln(nextInt() % 2)\n}\n"}, {"source_code": "import java.util.Scanner\n\nfun main(args: Array){\n val leer = Scanner(System.`in`)\n val a:Int = leer.nextInt()\n println(((a shr 1) shl 1) xor a)\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n println(n%2)\n}"}, {"source_code": "fun main() {\n println(readInt() and 1)\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 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() }"}, {"source_code": "fun main(vararg args: String) {\n val a = readLine()!!.toInt()\n println(if (a % 2 == 0) 0 else 1)\n}\n"}, {"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(0)\n } else {\n print(1)\n }\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n if (n%2 == 0 ) println(0) else println(1)\n}"}, {"source_code": "\nfun main(args: Array) {\n val x = readLine()!!.toInt()\n\n if (x % 2 == 0) {\n print(0)\n } else {\n print(1)\n }\n}"}, {"source_code": "fun main(args: Array) {\n print(if (readLine()!!.toInt() % 2 == 0) 0 else 1)\n}"}, {"source_code": "\n\nimport java.io.*\nimport java.util.*\n\nfun main(args: Array) {\n solve(Scanner(System.`in`))\n}\n\nfun solve(scanner: Scanner) {\n val num = scanner.nextInt()\n\n if (num % 2 == 0) {\n print(0)\n } else {\n print(1)\n }\n}\n\nclass Scanner(`in`: InputStream) {\n val reader: BufferedReader = BufferedReader(InputStreamReader(`in`), 32768)\n var tokenizer: StringTokenizer = StringTokenizer(\"\")\n\n fun next(): String {\n while (!tokenizer.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n}"}, {"source_code": "import java.util.* ;\n\nfun main (args: Array) {\n val sc = Scanner(System.`in`) ;\n var t = sc.nextInt() ;\n println(t % 2) ;\n}"}, {"source_code": "fun main(args: Array) {\n val a = readLine()!!.toInt()\n println(if (a % 2 == 0) 0 else 1)\n}"}, {"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 a = sc.nextInt()\n println(a%2)\n pw.close()\n}\n"}], "negative_code": [{"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}"}, {"source_code": "fun main() {\n print(0)\n}"}, {"source_code": "fun main(args: Array) {\n print(if (readLine()!!.toInt() % 2 == 0) 1 else 0)\n}"}], "src_uid": "78e64fdbf59c5ce89d0f0a1d0591f795"} {"source_code": "fun main(args: Array) {\n val s = readLine()!!\n\n print(if (s.contains(\"H\") || s.contains(\"Q\") || s.contains(\"9\")) \"YES\" else \"NO\")\n}", "positive_code": [{"source_code": "import java.util.regex.Pattern\n\nfun main(){\n if(Pattern.compile(\"[QH9]\").matcher(readLine()).find()) println(\"YES\") else println(\"NO\")\n}\n"}, {"source_code": "fun main(args: Array) {\n val p = readLine()\n if (p!!.contains('H')||p!!.contains('Q')||p!!.contains('9')){\n println(\"YES\")\n }\n else{\n println(\"NO\")\n\n }\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val s: Scanner = Scanner(System.`in`)\n val str: String = s.next()\n print(if (str.contains(\"H\") || str.contains(\"Q\") || str.contains(\"9\")) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main(args: Array) {\n\n readLine()!!.toString()\n .toCharArray()\n .filter {\n it == 'H' || it == 'Q' || it == '9'\n }\n .run {\n print(if (iterator().hasNext()) \"YES\" else \"NO\")\n }\n}"}, {"source_code": "fun main() {\n val s = readLine()!!\n println(if (\"[HQ9]+\".toRegex().containsMatchIn(s)) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main() {\n val i = setOf('H', 'Q', '9')\n println( if(readLine()!!.any { it in i }) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main(args : Array) {\n var line = readLine()!!\n if (line.contains('H') || line.contains('Q') || line.contains('9'))\n println(\"YES\")\n else\n println(\"NO\")\n}"}, {"source_code": "import java.util.*\n\n fun main(){\n var input = Scanner(System.`in`)\n var inputString = input.nextLine()\n var array = intArrayOf(0,0,0,0)\n inputString.toCharArray().forEach {\n if(it == 'H'){\n array[0]++\n }\n\n if(it == 'Q'){\n array[1]++\n }\n if(it == '9'){\n array[2]++\n }\n\n }\n\n if(array[0] > 0 || array[1] > 0 || array[2] > 0){\n print(\"YES\")\n }else{\n print(\"NO\")\n }\n }\n\n\n\n\n\n\n\n\n"}, {"source_code": "fun main() {\n val prg = readLn()\n val ans = prg.any { it in \"HQ9\" }\n\n println(if(ans) \"YES\" else \"NO\")\n}\n\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readStrings() = readLn().split(' ')\nfun readInts() = readStrings().map { it.toInt() }"}, {"source_code": "\n// https://codeforces.com/problemset/problem/133/A\n\nfun main(args: Array) {\n val code = readLn()\n val emptySet = setOf('H', 'Q', '9')\n\n var printCode = false\n for (character in code) {\n if (character in emptySet) {\n printCode = true\n break\n }\n }\n if (printCode)\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"}, {"source_code": "//package problem133A\n\nfun main() {\n val program = readLine()!!\n\n println(if ('H' in program || 'Q' in program || '9' in program) \"YES\" else \"NO\")\n}\n"}, {"source_code": "/**\n * Created by Ahmed Ehab Hussein on 14/08/2017.\n */\n\nfun main (args:Array){\n var p = readLine()!!\n var flag:Int = 0\n for (ch in p)\n if(ch == 'H' || ch == 'Q' || ch == '9')\n flag += 1\n\n if(flag > 0){\n println(\"YES\")\n }else{\n println(\"NO\")\n }\n}"}, {"source_code": "fun main() {\n val s = readLine()!!\n println(if ('H' in s || 'Q' in s || '9' in s) \"YES\" else \"NO\")\n}\n"}, {"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' )\n flag = true\n }\n if(flag)\n println(\"YES\")\n else\n println(\"NO\")\n}"}, {"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 if(str.any { it == 'H' || it == 'Q' ||it == '9' })\n println(\"YES\")\n else\n println(\"NO\")\n}"}, {"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 || \"9\" in s){\n print(\"YES\")\n }\n else{\n print(\"NO\")\n }\n}"}, {"source_code": "fun main(args: Array) {\n val a = readLine()!!\n if (a.contains( \"H\") || a.contains( \"Q\") || a.contains( \"9\")){\n print(\"YES\")\n }\n else{\n print(\"NO\")\n }\n}\n"}, {"source_code": "fun main(args: Array) {\n val line = readLine()!!\n if (line.any { it in arrayOf('H', 'Q', '9') }) println(\"YES\") else println(\"NO\")\n}"}, {"source_code": "fun main() {\n var word: String? = readLine()\n var found=0;\n for (ch in word!!)\n {\n when(ch){\n 'H','Q','9'-> {\n found++;\n }\n }\n }\n\n if (found>0)\n println(\"YES\")\n else\n println(\"NO\")\n}"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array){\n val scan = Scanner(System.`in`)\n val b = scan.next().toCharArray()\n if (b.contains('H') or b.contains('Q') or b.contains('9')) print(\"YES\")\n else print(\"NO\")\n}"}, {"source_code": "fun main(args: Array) {\n val regex = \"[HQ9]\"\n println(if (Regex(regex).containsMatchIn(readLine()!!)) \"YES\" else \"NO\")\n}"}, {"source_code": "import java.util.*\nfun main(args: Array) {\n var s = Scanner(System.`in`).next()\n if (s.contains(\"H\") || s.contains(\"Q\") || s.contains(\"9\")) print(\"YES\")\n else print(\"NO\")\n}"}, {"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(ok(input)) print(\"YES\")\n else print(\"NO\")\n\n}\n\nfun ok(string: String): Boolean{\n for (c in string){\n if(c == 'H' || c == 'Q' || c == '9') return true\n }\n return false\n}"}, {"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}"}, {"source_code": "fun main(args: Array) {\n\n val input = readLine()!!\n\n if (input.indexOf(\"H\") != -1 || input.indexOf(\"Q\") != -1 || input.indexOf(\"9\") != -1 ){\n println(\"YES\")\n }else{\n println(\"NO\")\n }\n\n}"}, {"source_code": "import java.util.*\n\nprivate val scan = Scanner(System.`in`)\n\nfun main(args: Array) {\n println(if (scan.next().contains(Regex(\"[HQ9]\"))) \"YES\" else \"NO\")\n}\n"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val bufferedReader = BufferedReader(InputStreamReader(System.`in`))\n val line = bufferedReader.readLine()\n val contains = line.contains(Regex(\"[HQ9]\"))\n println(if (contains) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main() {\n if(readLine()!!.toCharArray().indexOfFirst{ c -> c == 'H' || c == 'Q' || c == '9' } >= 0)\n println(\"YES\")\n else\n println(\"NO\")\n}"}, {"source_code": "fun main(args: Array) {\n println(\n if (readLine()!!.contains(Regex(\"[HQ9]\")))\n \"YES\"\n else\n \"NO\"\n )\n}\n"}, {"source_code": "fun main (args : Array){\n println(if (Regex(\"[HQ9]\").containsMatchIn(readLine()!!)) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main(args: Array) {\n if (readLine()!!.any { it == 'H' || it == 'Q' || it == '9' }) {\n println(\"YES\")\n }\n else {\n println(\"NO\")\n }\n\n}\n"}, {"source_code": "fun main() {\n print(if (readLine()!!.split(\"\").any { \"H,Q,9\".split(\",\").contains(it) }) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main(args: Array) {\n val p: String? = readLine()\n val list = listOf('H', 'Q', '9')\n var res = \"NO\"\n for (element in list) {\n if (p?.contains(element)!!) {\n res = \"YES\"\n break\n }\n }\n println(res)\n}"}, {"source_code": "import java.util.Scanner\nimport kotlin.io.*\nfun main(args:Array)=with (Scanner(System.`in`)){\n val reader = Scanner(System.`in`)\n var a : String?\n a = readLine();\n var b:Boolean = false;\n for(ch in a!!.toCharArray()){\n if(ch == 'H')b=true;\n if(ch == 'Q')b=true;\n if(ch == '9')b=true;\n }\n if(b)println(\"YES\")\n else println(\"NO\")\n}"}, {"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"}, {"source_code": "fun main () {\n var str: String? = readLine()\n var isPrint: Boolean = false\n\n if(str == null) return\n\n str.forEach { n ->\n when(n){\n 'H','Q','9' -> {\n println(\"YES\")\n isPrint = true\n return\n }\n }\n }\n\n if(!isPrint) println(\"NO\")\n\n}"}, {"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) = 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 t = io.readToken()\n var res = false\n for (ch in t) {\n when (ch) {\n 'H', 'Q', '9' -> res = true\n }\n }\n io.println(if (res) \"YES\" else \"NO\")\n io.close()\n}\n\nfun main(args: Array) {\n Thread({ solve() }).start()\n}\n"}, {"source_code": "fun main()\n{\n val given = readLine()!!\n println( if (given.any() { \"HQ9\".contains(it)} ) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n var str = r.readLine()!!\n val list = listOf('H', 'Q', '9')\n var has = false\n str.forEach {\n if (it in list) has = true\n }\n println(if (has) \"YES\" else \"NO\")\n}"}, {"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 main(){\n var str=readLn()\n var ok=str.contains('H')||str.contains('Q')||str.contains('9')\n printLine(if(ok)\"YES\" else \"NO\")\n output()\n}"}, {"source_code": "fun main() {\n\tval commands = listOf('H', 'Q', '9')\n\tprintln(if (readLine()!!.any { it in commands }) \"YES\" else \"NO\")\n}\n"}, {"source_code": "fun main(args: Array){readLine()?.let{it.forEach{if(it=='H'||it=='Q'||it=='9'){println(\"YES\");return;}}};println(\"NO\")}\n"}, {"source_code": "\nfun main(args: Array)\n{\n\n var text = readLine()!!\n\n if(text.contains(\"[HQ9]+\".toRegex()))\n {\n print(\"YES\")\n }\n else\n {\n print(\"NO\")\n }\n}"}, {"source_code": "fun main(args: Array) {\n val input = readLine()!!\n val commands = listOf('H', 'Q', '9')\n for (i in 0 until input.length){\n val char = input[i]\n if (char in commands){\n print(\"YES\")\n return\n }\n }\n print(\"NO\")\n}"}, {"source_code": "fun main() {\n val a = readLine()\n for (i in 0 until a?.length!!) {\n if (a.get(i).equals('H') || a.get(i).equals('Q') || a.get(i).equals('9') ) {\n print(\"YES\")\n return\n }\n }\n print(\"NO\")\n}"}, {"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 for (symbol in input.next()) {\n if (symbol == 'H' || symbol == 'Q' || symbol == '9') {\n output.print(\"YES\")\n return\n }\n }\n\n output.print(\"NO\")\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}"}, {"source_code": "fun main() {\n val hasOutput = readLine()!!\n .any {\n when (it) {\n 'H','Q','9' -> true\n else -> false\n }\n }\n val answer = if (hasOutput) \"YES\" else \"NO\"\n println(answer)\n}"}], "negative_code": [{"source_code": "fun main()\n{\n val given = readLine()!!\n println( if (given.any() { \"HQ9+\".contains(it)} ) \"YES\" else \"NO\")\n}"}, {"source_code": "\nfun main(args: Array)\n{\n\n var text = readLine()!!\n\n if(text.contains(\"[HQ9+]+\".toRegex()))\n {\n print(\"YES\")\n }\n else\n {\n print(\"NO\")\n }\n}"}, {"source_code": "import java.util.regex.Pattern\n\nfun main(){\n if(Pattern.compile(\"[QH]\").matcher(readLine()).find()) println(\"YES\") else println(\"NO\")\n}\n"}, {"source_code": "fun main(args: Array) {\n val p = readLine()\n if (p!!.contains('H')||p!!.contains('Q')||p!!.contains('9')||p!!.contains('+')){\n println(\"YES\")\n }\n else{\n println(\"NO\")\n\n }\n}"}, {"source_code": "fun main(args: Array) {\n val p = readLine()\n if (p!!.contains('H')||p!!.contains('Q')||p!!.contains('9')||p!!.contains('+')){\n println(\"Yes\")\n }\n else{\n println(\"NO\")\n\n }\n}"}, {"source_code": "fun main(args: Array) {\n\n readLine()!!.toString()\n .toCharArray()\n .filter {\n it == 'H' || it == 'Q' || it == '9' || it == '+'\n }\n .run {\n print(if (iterator().hasNext()) \"YES\" else \"NO\")\n }\n}"}, {"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}"}, {"source_code": "import java.util.*\n\n fun main(){\n var input = Scanner(System.`in`)\n var inputString = input.nextLine()\n if(inputString.toCharArray().filter { it == 'H' || it == 'Q' || it == '9' || it == '+' }.isNotEmpty()){\n print(\"YES\")\n }else{\n print(\"NO\")\n }\n }\n\n\n\n\n\n\n\n\n"}, {"source_code": "import java.util.*\n\n fun main(){\n var input = Scanner(System.`in`)\n var inputString = input.nextLine()\n if(inputString.contains(\"H\") || inputString.contains(\"Q\") || inputString.contains(\"9\") || inputString.contains(\"+\")){\n print(\"YES\")\n }else{\n print(\"NO\")\n }\n }\n\n\n\n\n\n\n\n\n"}, {"source_code": "// https://codeforces.com/problemset/problem/133/A\n\nfun main(args: Array) {\n val code = readLn()\n val emptySet = setOf('H', 'Q', '9', '+')\n\n var printCode = false\n for (character in code) {\n if (character in emptySet) {\n printCode = true\n break\n }\n }\n if (printCode)\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"}, {"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"}, {"source_code": "/**\n * Created by Ahmed Ehab Hussein on 14/08/2017.\n */\n\nfun main (args:Array){\n var p = readLine()!!\n var flag:Int = 0\n for (ch in p)\n if(ch == 'H' || ch == 'Q' || ch == '9' || ch == '+')\n flag += 1\n\n if(flag > 0){\n println(\"YES\")\n }else{\n println(\"NO\")\n }\n}"}, {"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 if(str.any { it == 'H' || it == 'Q' || it == '9' || it == '+' })\n println(\"YES\")\n else\n println(\"NO\")\n}"}, {"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}"}, {"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}"}, {"source_code": "import java.util.*\nfun main() {\n val sc = Scanner(System.`in`)\n val s = sc.nextLine()\n if(s.contains(\"H\") || s.contains(\"Q\") || s.contains(\"+\")||s.contains(\"9\")){\n print(\"YES\")\n }\n else{\n print(\"NO\")\n }\n}"}, {"source_code": "import java.util.*\nfun main() {\n val sc = Scanner(System.`in`)\n val s = sc.nextLine()\n if(\"HQ9+\" in s ){\n print(\"YES\")\n }\n else{\n print(\"NO\")\n }\n}"}, {"source_code": "import java.util.*\nfun main() {\n val sc = Scanner(System.`in`)\n val s = sc.nextLine()\n if(s.contains(\"H\") || s.contains(\"H\") || s.contains(\"H\")||s.contains(\"H\")){\n print(\"YES\")\n }\n else{\n print(\"NO\")\n }\n}"}, {"source_code": "import java.util.*\n\n\nfun main(args: Array){\n val scan = Scanner(System.`in`)\n val b = scan.next().toCharArray()\n if (b.contains('H') or b.contains('Q') or b.contains('9') or b.contains('+')) print(\"YES\")\n else print(\"NO\")\n}"}, {"source_code": "fun main(args: Array) {\n val regex = \"[HG9+]\"\n println(if (Regex(regex).containsMatchIn(readLine()!!)) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main(args: Array) {\n val regex = \"[HG9]\"\n println(if (Regex(regex).containsMatchIn(readLine()!!)) \"YES\" else \"NO\")\n}"}, {"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}"}, {"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}"}, {"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"}], "src_uid": "1baf894c1c7d5aeea01129c7900d3c12"} {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (numPeople, numPlanesEach, numPlanesPerSheet, numSheetsPerPack) = readInts()\n val sheetsPerPerson = numPlanesEach / numPlanesPerSheet + if (numPlanesEach % numPlanesPerSheet == 0) 0 else 1\n val totalSheets = sheetsPerPerson * numPeople\n print(totalSheets / numSheetsPerPack + if (totalSheets % numSheetsPerPack == 0) 0 else 1)\n}", "positive_code": [{"source_code": "import java.util.*\n\nfun main(args: Array) {\n val inp = Scanner(System.`in`)\n\n val k = inp.nextInt()\n val n = inp.nextInt()\n val s = inp.nextInt()\n val p = inp.nextInt()\n\n val parersRequiredForPerson = Math.ceil(n.toDouble() / s.toDouble()).toInt()\n val allRequired = parersRequiredForPerson * k\n\n var curPaperBlocks = 0\n while (curPaperBlocks * p < allRequired) {\n curPaperBlocks++\n }\n print(curPaperBlocks)\n}"}, {"source_code": "\n\nfun main(args: Array) {\n val (k, n, s, p) = readLine()!!.split(\" \").map { a -> a.toDouble() }\n println(Math.ceil(Math.ceil(n / s) * k / p).toLong())\n\n}"}, {"source_code": "fun main(args: Array) {\n val (k, n, s, p) = readLine()!!.split(' ').map { it.toLong() }\n\n val sheets = (n + if (n % s == 0L) 0 else s) / s\n println((k * sheets + if ((k * sheets) % p == 0L) 0 else p ) / p)\n}"}, {"source_code": "import kotlin.math.*\nfun main(args: Array){\n\tval (k, n, s, p) = readLine().toString().split(\" \").map{it.toInt()}\n\tval sheetspp = ceil(n.toFloat()/s.toFloat())\n\t//val sol = ((n * k)/s)/p\n\tprintln(ceil(k.toFloat() * sheetspp/p.toFloat()).toInt())\n}"}], "negative_code": [], "src_uid": "73f0c7cfc06a9b04e4766d6aa61fc780"} {"source_code": "import java.io.*\nimport java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val pw = PrintWriter(System.out)\n val n = sc.nextLong()\n val sum = n * (n + 1) / 2\n if (sum % 2 == 0L) {\n println(0)\n }else{\n println(1)\n }\n\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\n}", "positive_code": [{"source_code": "private fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\n\nfun main() {\n\n val n = readInt()\n\n val cost = when (n % 4) {\n 1 -> 1\n 2 -> 1\n 3 -> 0\n else -> 0\n }\n println(\"$cost\")\n\n}\n\n"}, {"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 var k = 0\n\n if(n%2==0){\n while(n!=0){\n n=n-2\n k++\n }\n }\n else {\n while(n!=1){\n n=n-2\n k++\n }\n }\n if(n%2==0 && k%2==0) {\n println(0)\n }\n else if(n%2==0 && k%2==1){\n println(1)\n }\n else if(n%2==1 && k%2==0) {\n println(1)\n }\n else if(n%2==1 && k%2==1){\n println(0)\n }\n}\n"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val n = r.readLine()!!.toInt()\n //val day = r.readLine()!!.split(\" \").map { it.toInt() }\n when(n%4){\n 0, 3 -> println(0)\n else -> println(1)\n }\n}"}, {"source_code": "import java.io.*\nimport java.util.*\n\n/**\n * Solution\n */\nfun main() {\n\n val n = nextInt()\n println(if (n % 4 == 0 || (n+1) % 4 == 0) 0 else 1)\n\n}\n\nprivate var st = StringTokenizer(\"\")\n\nprivate fun hasNext(): Boolean {\n while (!st.hasMoreTokens()) {\n st = StringTokenizer(input.readLine() ?: return false)\n }\n return true\n}\nprivate fun next() = if (hasNext()) st.nextToken()!! else throw RuntimeException(\"No tokens\")\nprivate fun nextInt() = next().toInt()\nprivate fun nextLong() = next().toLong()\nprivate fun nextDouble() = next().toDouble()\nprivate fun nextArray(n: Int) = IntArray(n) { nextInt() }\nprivate fun nextLine() = if (hasNext()) st.nextToken(\"\\n\")!! else throw RuntimeException(\"No tokens\")\n\nprivate val ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\nprivate var input = when (ONLINE_JUDGE) {\n true -> BufferedReader(InputStreamReader(System.`in`), 32768)\n else -> BufferedReader(FileReader(\"in.txt\"))\n}\n"}, {"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 == 1){\n println(1)\n return\n }\n if(n % 2 == 1) n -= 3;\n n /= 2;\n if(n % 2 == 1) println(1)\n else println(0)\n\n}"}, {"source_code": "fun main(args: Array){\n\tval n = readLine()!!.toLong()\n\tif (n > 0) println(((1 + n) * n / 2) % 2) else println(\"0\")\n}"}, {"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 = ((n+1) / 2) % 2\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}"}, {"source_code": "import java.util.*\n\nfun main() {\n var n = readLine()!!.toLong()\n\n if (n == 1L || n == 2L) {\n println(1)\n } else {\n\n if (n % 4L == 1L || n % 4 == 2L) {\n println(1)\n } else if (n % 4 == 0L || n % 4 == 3L) {\n println(0)\n }\n }\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n println(if (n % 4 == 3 || n % 4 == 0) 0 else 1)\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n println(if (n % 4 == 3 || n % 4 == 0) 0 else 1)\n}"}, {"source_code": "fun main() {\n val cases = intArrayOf(0, 1, 1, 0)\n println(cases[readLine()!!.toInt() % 4])\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toLong()\n print((n * (n + 1) / 2) % 2)\n}"}, {"source_code": "import java.util.*\nimport java.math.*\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\nfun main(args: Array){\n\tvar n = readInt();\n\tif(n%4 in 1..2) println(\"1\");\n\telse println(\"0\");\n}\n"}, {"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 solve() {\n val n = sc!!.readLong();\n val sum = (1 + n) * n / 2;\n out!!.println(sum % 2)\n}\n\nvar sc : FastScanner? = null\nvar out : PrintWriter? = null\n\nfun init() {\n sc = FastScanner(System.`in`)\n out = PrintWriter(System.out)\n}\n\nfun main(args: Array) {\n init();\n solve();\n out!!.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 readInt() = next().toInt()\n fun readLong() = next().toLong()\n}"}, {"source_code": "fun main(arg: Array){\n\tval n = readLine()!!.toInt()\n\tval r = if ((n.rem(4)==0) or (n.rem(4)==3)) 0 else 1\n\tprintln(r)\n}"}, {"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 n = readLine()!!.toInt();\n if(n * (n + 1) % 4 == 0)\n println(0)\n else\n println(1)\n\n\n\n}\n\n\n"}], "negative_code": [{"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}"}, {"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}"}, {"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}"}, {"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}"}, {"source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n\n val n = readInt()\n print((n * (n + 1) / 2) % 2)\n}"}], "src_uid": "fa163c5b619d3892e33e1fb9c22043a9"} {"source_code": "private fun readLn() = readLine()!! // string line\r\nprivate fun readInt() = readLn().toInt() // single int\r\nprivate fun readLong() = readLn().toLong() // single long\r\nprivate fun readDouble() = readLn().toDouble() // single double\r\nprivate fun readStrings() = readLn().split(\" \") // list of strings\r\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\r\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\r\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\r\nprivate fun readLis() = readInts().toMutableList()\r\n\r\n//println(res.joinToString(\" \")) - > focus ( \" \" )\r\n//var a1 = readLongs().toMutableList()\r\n//val st = mutableSetOf() -> var find = st.elementAt(i)\r\n//var ar1 = LongArray(3) {100000}\r\n//f2.sortDescending() sort IntArray\r\n//var c = 'a' + i ( from 'a' --> 'z' )\r\n\r\n\r\nfun solve() {\r\n var n = readInt()\r\n var s = readLine()!!.toString()\r\n if (n == 1) {\r\n println(\"0\")\r\n return\r\n }\r\n var ans = 0\r\n var st = -1\r\n for (i in 0 until n) {\r\n if (s[i] == '0') {\r\n st = i\r\n break\r\n }\r\n }\r\n if (st == -1) {\r\n println(\"0\")\r\n return\r\n }\r\n var one = 0\r\n while (true) {\r\n var end = 0\r\n var ok = 0\r\n for (i in st + 1 until n) {\r\n if (s[i] == '0') {\r\n st = i\r\n if (one >= 2) {\r\n one = 0\r\n } else {\r\n ans += 2 - one\r\n one = 0\r\n }\r\n ok = 1\r\n break\r\n } else {\r\n one++\r\n }\r\n }\r\n if (st >= n - 1 || ok == 0) {\r\n break\r\n }\r\n }\r\n\r\n println(ans)\r\n}\r\n\r\nfun main() {\r\n val n = readInt()\r\n val arr = Array(n){CharArray(n)}\r\n for(i in 0 until n){\r\n val s = readLine()!!.toString()\r\n for(j in 0 until n){\r\n arr[i][j] = s[j]\r\n }\r\n }\r\n var ok = false\r\n for(i in 0 until n){\r\n for(j in 0 until n){\r\n if(i < n - 7){\r\n var cur = \"\"\r\n for(k in 0 until 7){\r\n cur += arr[i + k][j]\r\n }\r\n if(cur == \"theseus\"){\r\n ok = true\r\n }\r\n }\r\n if(j < n - 7){\r\n var cur = \"\"\r\n for(k in 0 until 7){\r\n cur += arr[i][j + k]\r\n }\r\n if(cur == \"theseus\"){\r\n ok = true\r\n }\r\n }\r\n if(i < n - 7 && j < n - 7){\r\n var cur = \"\"\r\n for(k in 0 until 7){\r\n cur += arr[i + k][j + k]\r\n }\r\n if(cur == \"theseus\"){\r\n ok = true\r\n }\r\n }\r\n }\r\n }\r\n if(ok){\r\n println(\"YES\")\r\n }else{\r\n println(\"NO\")\r\n }\r\n}", "positive_code": [{"source_code": " private fun readLn() = readLine()!! // string line\n private fun readInt() = readLn().toInt() // single int\n private fun readLong() = readLn().toLong() // single long\n private fun readDouble() = readLn().toDouble() // single double\n private fun readStrings() = readLn().split(\" \") // list of strings\n private fun readInts() = readStrings().map { it.toInt() } // list of ints\n private fun readLongs() = readStrings().map { it.toLong() } // list of longs\n private fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n private fun readLis() = readInts().toMutableList()\n \n //println(res.joinToString(\" \")) - > focus ( \" \" )\n //var a1 = readLongs().toMutableList()\n //val st = mutableSetOf() -> var find = st.elementAt(i)\n //var ar1 = LongArray(3) {100000}\n //f2.sortDescending() sort IntArray\n //var c = 'a' + i ( from 'a' --> 'z' )\n \n \n private fun solve() {\n var n = readInt()\n var s = readLine()!!.toString()\n if (n == 1) {\n println(\"0\")\n return\n }\n var ans = 0\n var st = -1\n for (i in 0 until n) {\n if (s[i] == '0') {\n st = i\n break\n }\n }\n if (st == -1) {\n println(\"0\")\n return\n }\n var one = 0\n while (true) {\n var end = 0\n var ok = 0\n for (i in st + 1 until n) {\n if (s[i] == '0') {\n st = i\n if (one >= 2) {\n one = 0\n } else {\n ans += 2 - one\n one = 0\n }\n ok = 1\n break\n } else {\n one++\n }\n }\n if (st >= n - 1 || ok == 0) {\n break\n }\n }\n \n println(ans)\n }\n \n fun main() {\n val n = readInt()\n val arr = Array(n){CharArray(n)}\n for(i in 0 until n){\n val s = readLine()!!.toString()\n for(j in 0 until n){\n arr[i][j] = s[j]\n }\n }\n var ok = false\n for(i in 0 until n){\n for(j in 0 until n){\n if(i < n - 7){\n var cur = \"\"\n for(k in 0 until 7){\n cur += arr[i + k][j]\n }\n if(cur == \"theseus\"){\n ok = true\n }\n }\n if(j < n - 7){\n var cur = \"\"\n for(k in 0 until 7){\n cur += arr[i][j + k]\n }\n if(cur == \"theseus\"){\n ok = true\n }\n }\n if(i < n - 7 && j < n - 7){\n var cur = \"\"\n for(k in 0 until 7){\n cur += arr[i + k][j + k]\n }\n if(cur == \"theseus\"){\n ok = true\n }\n }\n }\n }\n if(ok){\n println(\"YES\")\n }else{\n println(\"NO\")\n }\n }"}], "negative_code": [{"source_code": "private fun readLn() = readLine()!! // string line\r\nprivate fun readInt() = readLn().toInt() // single int\r\nprivate fun readLong() = readLn().toLong() // single long\r\nprivate fun readDouble() = readLn().toDouble() // single double\r\nprivate fun readStrings() = readLn().split(\" \") // list of strings\r\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\r\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\r\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\r\nprivate fun readLis() = readInts().toMutableList()\r\n\r\n//println(res.joinToString(\" \")) - > focus ( \" \" )\r\n//var a1 = readLongs().toMutableList()\r\n//val st = mutableSetOf() -> var find = st.elementAt(i)\r\n//var ar1 = LongArray(3) {100000}\r\n//f2.sortDescending() sort IntArray\r\n//var c = 'a' + i ( from 'a' --> 'z' )\r\n\r\n\r\nfun solve() {\r\n var n = readInt()\r\n var s = readLine()!!.toString()\r\n if (n == 1) {\r\n println(\"0\")\r\n return\r\n }\r\n var ans = 0\r\n var st = -1\r\n for (i in 0 until n) {\r\n if (s[i] == '0') {\r\n st = i\r\n break\r\n }\r\n }\r\n if (st == -1) {\r\n println(\"0\")\r\n return\r\n }\r\n var one = 0\r\n while (true) {\r\n var end = 0\r\n var ok = 0\r\n for (i in st + 1 until n) {\r\n if (s[i] == '0') {\r\n st = i\r\n if (one >= 2) {\r\n one = 0\r\n } else {\r\n ans += 2 - one\r\n one = 0\r\n }\r\n ok = 1\r\n break\r\n } else {\r\n one++\r\n }\r\n }\r\n if (st >= n - 1 || ok == 0) {\r\n break\r\n }\r\n }\r\n\r\n println(ans)\r\n}\r\n\r\nfun main() {\r\n val n = readInt()\r\n var ok = false\r\n val list = mutableListOf()\r\n for(i in 0 until n){\r\n val s = readLine()!!.toString()\r\n list.add(s)\r\n if (s.contains(\"theseus\")){\r\n ok = true\r\n }\r\n }\r\n if(ok){\r\n println(\"YES\")\r\n }else{\r\n for(i in 0 until n){\r\n var s = \"\"\r\n for(j in 0 until n){\r\n s += list[j][i]\r\n }\r\n if(s.contains(\"theseus\")){\r\n ok = true\r\n break\r\n }\r\n }\r\n if(ok){\r\n println(\"YES\")\r\n }else{\r\n println(\"NO\")\r\n }\r\n }\r\n}"}, {"source_code": "private fun readLn() = readLine()!! // string line\r\nprivate fun readInt() = readLn().toInt() // single int\r\nprivate fun readLong() = readLn().toLong() // single long\r\nprivate fun readDouble() = readLn().toDouble() // single double\r\nprivate fun readStrings() = readLn().split(\" \") // list of strings\r\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\r\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\r\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\r\nprivate fun readLis() = readInts().toMutableList()\r\n\r\n//println(res.joinToString(\" \")) - > focus ( \" \" )\r\n//var a1 = readLongs().toMutableList()\r\n//val st = mutableSetOf() -> var find = st.elementAt(i)\r\n//var ar1 = LongArray(3) {100000}\r\n//f2.sortDescending() sort IntArray\r\n//var c = 'a' + i ( from 'a' --> 'z' )\r\n\r\n\r\nfun solve() {\r\n var n = readInt()\r\n var s = readLine()!!.toString()\r\n if (n == 1) {\r\n println(\"0\")\r\n return\r\n }\r\n var ans = 0\r\n var st = -1\r\n for (i in 0 until n) {\r\n if (s[i] == '0') {\r\n st = i\r\n break\r\n }\r\n }\r\n if (st == -1) {\r\n println(\"0\")\r\n return\r\n }\r\n var one = 0\r\n while (true) {\r\n var end = 0\r\n var ok = 0\r\n for (i in st + 1 until n) {\r\n if (s[i] == '0') {\r\n st = i\r\n if (one >= 2) {\r\n one = 0\r\n } else {\r\n ans += 2 - one\r\n one = 0\r\n }\r\n ok = 1\r\n break\r\n } else {\r\n one++\r\n }\r\n }\r\n if (st >= n - 1 || ok == 0) {\r\n break\r\n }\r\n }\r\n\r\n println(ans)\r\n}\r\n\r\nfun main() {\r\n val n = readInt()\r\n var ok = false\r\n for(i in 0 until n){\r\n val s = readLine()!!.toString()\r\n if (s.contains(\"theseus\")){\r\n ok = true\r\n }\r\n }\r\n if(ok){\r\n println(\"YES\")\r\n }else{\r\n println(\"NO\")\r\n }\r\n}"}, {"source_code": "private fun readLn() = readLine()!! // string line\r\nprivate fun readInt() = readLn().toInt() // single int\r\nprivate fun readLong() = readLn().toLong() // single long\r\nprivate fun readDouble() = readLn().toDouble() // single double\r\nprivate fun readStrings() = readLn().split(\" \") // list of strings\r\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\r\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\r\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\r\nprivate fun readLis() = readInts().toMutableList()\r\n\r\n//println(res.joinToString(\" \")) - > focus ( \" \" )\r\n//var a1 = readLongs().toMutableList()\r\n//val st = mutableSetOf() -> var find = st.elementAt(i)\r\n//var ar1 = LongArray(3) {100000}\r\n//f2.sortDescending() sort IntArray\r\n//var c = 'a' + i ( from 'a' --> 'z' )\r\n\r\n\r\nfun solve() {\r\n var n = readInt()\r\n var s = readLine()!!.toString()\r\n if (n == 1) {\r\n println(\"0\")\r\n return\r\n }\r\n var ans = 0\r\n var st = -1\r\n for (i in 0 until n) {\r\n if (s[i] == '0') {\r\n st = i\r\n break\r\n }\r\n }\r\n if (st == -1) {\r\n println(\"0\")\r\n return\r\n }\r\n var one = 0\r\n while (true) {\r\n var end = 0\r\n var ok = 0\r\n for (i in st + 1 until n) {\r\n if (s[i] == '0') {\r\n st = i\r\n if (one >= 2) {\r\n one = 0\r\n } else {\r\n ans += 2 - one\r\n one = 0\r\n }\r\n ok = 1\r\n break\r\n } else {\r\n one++\r\n }\r\n }\r\n if (st >= n - 1 || ok == 0) {\r\n break\r\n }\r\n }\r\n\r\n println(ans)\r\n}\r\n\r\nfun main() {\r\n val n = readInt()\r\n var ok = false\r\n for(i in 0 until n){\r\n val s = readLine()!!.toString()\r\n if (s.contains(\"thesus\")){\r\n ok = true\r\n }\r\n }\r\n if(ok){\r\n println(\"YES\")\r\n }else{\r\n println(\"NO\")\r\n }\r\n}"}], "src_uid": "efb72baf6759f7bc5ac0f3099b7177d0"} {"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 var a = reader.getNextInt()\n val simples = getSimpleNumbersUpTo(a)\n val answer = mutableListOf()\n while (a != 1) {\n for (simpleNim in simples) {\n while (a % simpleNim == 0) {\n answer.add(simpleNim)\n a /= simpleNim\n }\n }\n }\n stringBuilder.append(answer.sorted().take(2).joinToString(\"\"))\n}\n\nfun getSimpleNumbersUpTo(a : Int) : List {\n val answer = mutableListOf()\n val numbers = (2..a).toList().toIntArray()\n for ((index, num) in numbers.withIndex()) {\n if (num != 0) {\n answer.add(num)\n numbers[index] = 0\n\n var localIndex = index + num\n while (localIndex < a - 1) {\n numbers[localIndex] = 0\n localIndex += num\n }\n }\n }\n return answer\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\"", "positive_code": [{"source_code": "fun main() {\n val num = System.`in`.bufferedReader().readLine().toInt()\n for(i in 2 until num){\n var temp = num\n while(temp%i == 0){\n print(i)\n temp /= i\n }\n }\n}"}, {"source_code": "import java.util.*\n\nfun main(args : Array) {\n val input = Scanner(System.`in`)\n val x = readLine()!!.toInt()\n\n for (i in 2..x) {\n if (x % i == 0) {\n println(\"$i${x/i}\")\n break\n }\n }\n}"}, {"source_code": "fun main(){\n var a = readLine()!!.toInt()\n while(a > 1){\n for(i in 2..a) if(a % i == 0){\n print(i)\n a /= i\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n val input = readLine()!!\n\n val n = input.toInt()\n (2..n/2).forEach {\n if (n % it == 0) {\n print(\"$it${n/it}\")\n return\n }\n }\n}"}, {"source_code": "fun prime(x: Int): Boolean {\n if (x < 2) return false\n if (x < 4) return true\n var i = 4\n while (i * i <= x) {\n if (x % i == 0) return false\n i++\n }\n return true\n}\nfun main() {\n val n = readLine()!!.toInt()\n val b = BooleanArray(1001) { i -> prime(i) }\n for (i in 2..n) {\n if (n % i == 0 && b[i] && b[n / i]) {\n println(\"$i${n/i}\")\n return\n }\n }\n}\n"}, {"source_code": "import java.util.*\nimport kotlin.collections.HashSet\nimport kotlin.math.sqrt\n\nfun main() {\n val prime = LinkedList()\n\n for (i in 2 until 1000) {\n if ((2 until sqrt(i.toDouble()).toInt()).all { it % i != 0 }) {\n prime += i\n }\n }\n\n var x = readLine()!!.toInt()\n val factor = LinkedList()\n while (x > 1) {\n for (i in prime) {\n while (x % i == 0) {\n x /= i\n factor += i\n }\n }\n }\n\n factor.sorted().forEach {\n print(it)\n }\n}"}, {"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\n val ans = n.factorize().take(2).joinToString(\"\")\n\n println(ans)\n}\n\nfun Int.factorize() = sequence {\n var n = this@factorize\n\n for(p in 2..Int.MAX_VALUE) {\n if(p * p > n) break\n while(n % p == 0) {\n yield(p)\n n /= p\n }\n }\n\n if(n > 1) yield(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 _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}"}, {"source_code": "fun main() {\n var x = readLine()!!.toInt()\n var i = 2\n while (x > 1) {\n if (x % i == 0) {\n print(i.toString())\n x /= i\n } else i++\n }\n println()\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n for (p in 2..n) {\n if (n % p == 0) {\n print(p)\n println(n / p)\n return\n }\n }\n}"}], "negative_code": [{"source_code": "fun main(args: Array) {\n val input = readLine()!!\n \n val n = input.toInt()\n (2 until n/2).forEach {\n if (n % it == 0) {\n print(it)\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n val input = readLine()!!\n \n val n = input.toInt()\n (2 .. n/2).forEach {\n if (n % it == 0) {\n print(it)\n }\n }\n}"}, {"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\""}, {"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 val b = when(a){\n 35 -> 57\n 57 -> 319\n 391 -> 1723\n else -> 4\n }\n stringBuilder.append(b)\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\""}, {"source_code": "import java.util.*\nimport kotlin.collections.HashSet\nimport kotlin.math.sqrt\n\nfun main() {\n val prime = LinkedList()\n\n for (i in 2 until 1000) {\n if ((2 until sqrt(i.toDouble()).toInt()).all { it % i != 0 }) {\n prime += i\n }\n }\n\n var x = readLine()!!.toInt()\n val factor = HashSet()\n while (x > 1) {\n for (i in prime) {\n while (x % i == 0) {\n x /= i\n factor += i\n }\n }\n }\n\n factor.sorted().forEach {\n print(it)\n }\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.HashSet\n\nfun main() {\n val prime = LinkedList()\n val marked = BooleanArray(1000)\n val prev = IntArray(1000)\n\n marked[1] = true\n for (i in 2 until 1000) {\n if (!marked[i])\n prime.add(i)\n for (j in prime) {\n if (i * j >= 1000)\n break\n marked[i * j] = true\n prev[i * j] = j\n if (i % j == 0)\n break\n }\n }\n\n var x = readLine()!!.toInt()\n val factor = HashSet()\n while(prev[x] != 0) {\n factor.add(prev[x])\n x /= prev[x]\n }\n factor.add(x)\n\n factor.sorted().forEach {\n print(it)\n }\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.HashSet\n\nfun main() {\n val prime = LinkedList()\n val marked = BooleanArray(1000)\n val prev = IntArray(1000)\n\n marked[1] = true\n for (i in 2 until 1000) {\n if (!marked[i])\n prime.add(i)\n for (j in prime) {\n if (i * j >= 1000)\n break\n marked[i * j] = true\n prev[i * j] = j\n if (i % j == 0)\n break\n }\n }\n\n var x = readLine()!!.toInt()\n val factor = HashSet()\n while(prev[x] != 0) {\n factor.add(prev[x])\n x /= prev[x]\n }\n if (x > 1)\n factor.add(x)\n\n factor.sorted().forEach {\n print(it)\n }\n}"}, {"source_code": "fun main() {\n val num = System.`in`.bufferedReader().readLine().toInt()\n for(i in 2 until num){\n if(num%i == 0){\n print(i)\n }\n }\n}"}, {"source_code": "fun main() {\n val num = System.`in`.bufferedReader().readLine().toInt()\n print(1)\n print(num)\n}"}, {"source_code": "fun main() {\n val num = System.`in`.bufferedReader().readLine().toInt()\n for(i in 2 until num/2){\n if(num%i == 0){\n print(i)\n }\n }\n}"}], "src_uid": "7220f2da5081547a12118595bbeda4f6"} {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n println(2*(n/3)+(n%3+1)/2)\n}", "positive_code": [{"source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n\n val n = readInt()\n print(2 * (n / 3) + if (n % 3 == 0) 0 else 1)\n}"}], "negative_code": [], "src_uid": "a993069e35b35ae158d35d6fe166aaef"} {"source_code": "import java.util.*\nval reader = Scanner(System.`in`)\nvar l = 0\nvar r = 0\nfun main(args: Array){\n val n = reader.nextInt()\n\n val arr = Array(n, { i -> Pair(reader.nextInt(),reader.nextInt()) })\n\n for(i in arr)\n {\n if(i.first % 2 != 0) l++\n if(i.second % 2 != 0) r++\n }\n\n if(l%2 == 0 && r%2 == 0)\n {\n print(0)\n }\n else if(l%2 == 0 || r%2 == 0)\n {\n print(-1)\n }\n else\n {\n for(i in arr)\n {\n if((i.first % 2 == 0 && i.second % 2 != 0) || (i.first % 2 != 0 && i.second % 2 == 0))\n {\n print(1)\n return\n }\n }\n print(-1)\n }\n}\n", "positive_code": [{"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\n\nfun main(args : Array) {\n Thread { run() }.start()\n}\n\nfun run() {\n\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n var up = 0\n var down = 0\n var q = false\n for (i in 0 until n) {\n val a = scanner.nextInt()\n val b = scanner.nextInt()\n up += a\n down += b\n if ((a % 2) != (b % 2))\n q = true\n }\n if (up % 2 == 0 && down % 2 == 0)\n println(0)\n else if (up % 2 == 1 && down % 2 == 1) {\n if (q)\n println(1)\n else\n println(-1)\n }\n else {\n println(-1)\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\nfun IntArray.print() {\n println(Arrays.toString(this))\n}\n\nfun Array.print() {\n for (i in this)\n i.print()\n}"}, {"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 if (leftOdd % 2 == 1 && rightOdd % 2 == 1) {\n println(1)\n return\n }\n else{\n println(-1)\n return\n }\n}\n"}], "negative_code": [{"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 }\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"}, {"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"}], "src_uid": "f9bc04aed2b84c7dd288749ac264bb43"} {"source_code": "fun main() {\n val (n, m) = readLine()!!.split(\" \").map { it.toInt() }\n var ans = 0\n var a = -1\n while (++a * a <= n) {\n val b = n - a * a\n if (a + b * b == m) ans++\n }\n println(ans)\n}", "positive_code": [{"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (n, m) = readInts()\n var sol = 0\n var a = -1\n while (++a * a <= n) {\n val b = n - a * a\n if (a + b * b == m) sol++\n }\n print(sol)\n}"}, {"source_code": "import java.util.*\nimport java.math.*\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\nfun main(args: Array){\n\tvar inp = readInts();\n\tvar n = inp[0];\n\tvar m = inp[1];\n\tvar ans = 0;\n\tfor(a in 0..100){\n\t\tfor(b in 0..100){\n\t\t\tif(b + a*a == n && a + b*b == m) ans++;\n\t\t}\n\t}\n\tprintln(ans);\n}\n"}, {"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() }.sorted()\n var ans = 0\n for (i in 0..1000){\n for (j in 0..1000){\n if (i*i+j==m&&i+j*j==n) ans++\n }\n }\n println(ans)\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n var (n, m) = readLine()!!.split(\" \").map { it.toLong() }\n var a = 0\n var ans = 0\n while (a*a<=n){\n var b = n-a*a\n if (a+b*b==m){\n ans++\n }\n a++\n }\n println(ans)\n}"}], "negative_code": [], "src_uid": "03caf4ddf07c1783e42e9f9085cc6efd"} {"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 val n = scanner.nextLong()\n val m = scanner.nextLong()\n var q = scanner.nextLong()\n if (q < n) {\n println(\"${q + 1} 1\")\n return\n }\n q -= n;\n val r = n - (q / (m - 1))\n if ((n - r) % 2 == 0L)\n println(\"$r ${2 + (q % (m - 1))}\")\n else\n println(\"$r ${m - (q % (m - 1))}\")\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}", "positive_code": [{"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} ${2+t1}\")\n } else {\n println(\"${n-t0} ${1+m-1-t1}\")\n }\n }\n }\n}"}], "negative_code": [{"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}"}], "src_uid": "e88bb7621c7124c54e75109a00f96301"} {"source_code": "\nfun main() {\n solve()\n}\n\nprivate fun solve() {\n var (n, b, p) = readInts()\n\n val noOfTowelRequired = p * n\n\n var totalBottlesRequired = 0\n while (n > 1) {\n\n var m = 1\n\n for (i in 0..n) {\n val result = m * 2\n if (result > n) {\n break\n } else {\n m = result\n }\n }\n totalBottlesRequired += (b * m) + (m / 2)\n n -= m / 2\n }\n println(\"$totalBottlesRequired $noOfTowelRequired\")\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() } // li\nprivate fun readLongs() = readStrings().map { it.toLong() } // li", "positive_code": [{"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n var (numParticipants, numBottles, numTowels) = readInts()\n val totalTowels = numParticipants * numTowels\n var totalBottles = 0\n while(numParticipants > 1) {\n var playing = 2\n while (playing * 2 <= numParticipants) playing *= 2\n val matches = playing / 2\n totalBottles += matches * (2 * numBottles + 1)\n numParticipants = matches + numParticipants - playing\n }\n print(\"$totalBottles $totalTowels\")\n}"}], "negative_code": [], "src_uid": "eb815f35e9f29793a120d120968cfe34"} {"source_code": "fun main(vararg args: String) {\n val (a, b) = readLine()!!.split(' ').map(String::toInt)\n println(if (!(a == 0 && b == 0) && Math.abs(a - b) <= 1) \"YES\" else \"NO\")\n}\n", "positive_code": [{"source_code": "import java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val a = input.nextInt()\n val b = input.nextInt()\n\n if((a == b || a - 1 == b || b - 1 == a) && (a != 0 || b != 0)) {\n print(\"YES\")\n } else {\n print(\"NO\")\n }\n}"}, {"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 % 2 == 0) even++ else odd++\n }\n if (even == a && odd == b) {\n println(\"YES\")\n return;\n }\n }\n }\n println(\"NO\")\n}"}, {"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 println(\"NO\")\n return\n }\n var ans = abs(a-b)\n if (ans<=1){\n println(\"YES\")\n }else{\n println(\"NO\")\n }\n}"}, {"source_code": "fun main() {\n val (a, b) = readLine()!!.split(\" \").map(String::toInt)\n if (a == 0 && b == 0) print(\"NO\") else print(if (a - b in -1..1) \"YES\" else \"NO\")\n}"}, {"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&&a+b>=1) println(\"YES\") else println(\"NO\")\n}"}, {"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 (even == 0 && odd == 0) {\n println(\"NO\")\n return\n }\n if (Math.abs(even - odd) > 1) println(\"NO\") else println(\"YES\")\n}\n"}, {"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 val even = scanner.nextInt()\n val odd = scanner.nextInt()\n\n if (Math.abs(even - odd) > 1 || (even == 0) && (odd == 0)) {\n out.println(\"NO\")\n } else {\n out.println(\"YES\")\n }\n}\n\n\n"}], "negative_code": [{"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 if (b-a<=1) println(\"YES\") else println(\"NO\")\n}"}, {"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 if (b-a<=1&&b>=a) println(\"YES\") else println(\"NO\")\n}"}, {"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"}, {"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"}, {"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"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val a = input.nextInt()\n val b = input.nextInt()\n\n if(a == b || a - 1 == b || b - 1 == a) {\n print(\"YES\")\n } else {\n print(\"NO\")\n }\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val a = input.nextInt()\n val b = input.nextInt()\n\n if((a == b || a - 1 == b || b - 1 == a) && (a != 0 && b != 0)) {\n print(\"YES\")\n } else {\n print(\"NO\")\n }\n}"}, {"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}"}, {"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}"}], "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037"} {"source_code": "import java.io.File\nimport java.lang.Exception\nimport java.util.*\n\nprivate const val MODULO = 1000000007L\n\nfun main() {\n// val scanner = Scanner(File(\"input.txt\"))\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val l = scanner.nextInt()\n val r = scanner.nextInt()\n\n// val optionCount = when {\n// r - l >= 2 -> calculateAllPossible(n, l, r)\n// r - l == 1 -> calculateTwoNumbers(n, l, r)\n// r - l == 0 -> calculateOneNumber(n, l)\n// else -> throw Exception(\"Impossible\")\n// }\n println(calculateAllPossible(n, l, r))\n// println(optionCount)\n}\n\nprivate fun calculateAllPossible(n: Int, l: Int, r: Int): Int {\n val zeroOptions: Long = (r / 3 - (l - 1) / 3).toLong()\n val oneOptions = ((r + 2) / 3 + 1 - (l + 1) / 3 - 1).toLong()\n val twoOptions = ((r + 1) / 3 + 1 - (l) / 3 - 1).toLong()\n\n var zeroTotal: Long = 1L\n var oneTotal: Long = 0L\n var twoTotal: Long = 0L\n\n for (i in (0 until n)) {\n val nextOneTotal = zeroTotal * oneOptions + twoTotal * twoOptions + oneTotal * zeroOptions\n val nextTwoTotal = oneTotal * oneOptions + twoTotal * zeroOptions + zeroTotal * twoOptions\n val nextZeroTotal = oneTotal * twoOptions + twoTotal * oneOptions + zeroTotal * zeroOptions\n\n oneTotal = nextOneTotal\n twoTotal = nextTwoTotal\n zeroTotal = nextZeroTotal\n\n oneTotal %= MODULO\n twoTotal %= MODULO\n zeroTotal %= MODULO\n }\n// val numbers = r - l + 1\n// return ((pow(numbers, n - 1).toLong() * countThreeDividers(l, r).toLong()) % MODULO).toInt()\n return zeroTotal.toInt()\n}\n\nprivate fun calculateTwoNumbers(n: Int, l: Int, r: Int): Int {\n return when {\n n == 1 -> if (r % 3 == 0 || l % 3 == 0) 1 else 0\n n > 1 -> pow(2, n - 2)\n else -> throw Exception(\"Impossible\")\n }\n}\n\nprivate fun calculateOneNumber(n: Int, l: Int): Int {\n return when {\n l % 3 == 0 -> 1\n n % 3 == 0 -> 1\n else -> 0\n }\n}\n\nprivate fun countThreeDividers(l: Int, r: Int): Int {\n val size = r - l + 1\n return when (size % 3) {\n 0 -> size / 3\n 1 -> size / 3 + (if (r % 3 == 0) 1 else 0)\n 2 -> size / 3 + (if (l % 3 == 0) 1 else 0) + (if ((r - 1) % 3 == 0) 1 else 0)\n else -> throw Exception(\"Impossible\")\n }\n}\n\nprivate fun pow(value: Int, power: Int): Int {\n var result = 1L\n for (i in (0L until power.toLong())) {\n result = (result * value) % MODULO\n }\n return result.toInt()\n}", "positive_code": [{"source_code": "import java.lang.ArithmeticException\n\nfun main() {\n val (n, l, r) = readInts()\n\n // number of possible elements for each modulo 3\n val ele = run {\n val sz = r - l + 1\n val quot = sz / 3\n val rem = sz - quot * 3\n IntArray(3) {\n quot + if((it - l) umod 3 < rem) 1 else 0\n }\n }\n\n\n var d = List(3) { ele[it].toModInt() }\n\n repeat(n-1) {\n val nd = List(3) { i ->\n d[i] * ele[0] +\n d[(i+1)%3] * ele[2] +\n d[(i+2)%3] * ele[1]\n }\n d = nd\n }\n\n println(d[0])\n}\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.modInv(base: Int): Int {\n var s = 0\n var os = 1\n var r = base\n var or = this\n\n while(r != 0) {\n val q = or / r\n or = r.also { r = or - q * r }\n os = s.also { s = os - q * s }\n }\n\n return if(or != 1) throw ArithmeticException(\"$this has no modulo inverse in base $base\")\n else os.let { if(it >= 0) it else it + base }\n}\n\n/** modint inline class, requires hardcoded mod base **/\nconst val MODBASE = 1_000_000_007\n\n@Suppress(\"DEPRECATION\")\ninline fun Int.toModInt() = ModInt(this umod MODBASE)\n@Suppress(\"DEPRECATION\")\ninline fun Long.toModInt() = ModInt((this umod MODBASE).toInt())\n\ninline class ModInt\n@Deprecated(\"use toModInt instead\") constructor(val int: Int) {\n operator fun plus(other: ModInt) = plus(other.int) // MODBASE < 2^30\n operator fun plus(other: Int) = (int + other).toModInt() // careful of possible overflow\n operator fun inc() = plus(1)\n\n operator fun minus(other: ModInt) = minus(other.int)\n operator fun minus(other: Int) = (int - other).toModInt()\n operator fun dec() = minus(1)\n\n operator fun times(other: ModInt) = times(other.int)\n operator fun times(other: Int) = (int.toLong() * other).toModInt()\n\n @Suppress(\"DEPRECATION\")\n fun inv() = ModInt(int.modInv(MODBASE))\n\n operator fun div(other: ModInt) = div(other.int)\n operator fun div(other: Int) = times(other.modInv(MODBASE))\n\n override fun toString() = int.toString()\n}\n\ninline class ModIntArray(val intArray: IntArray) {\n @Suppress(\"DEPRECATION\")\n operator fun get(i: Int) = ModInt(intArray[i])\n operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }\n}\nfun ModIntArray(capacity: Int) = ModIntArray(IntArray(capacity))\ninline fun ModIntArray(capacity: Int, init: (Int) -> ModInt) = ModIntArray(capacity).apply {\n repeat(capacity) { this[it] = init(it) }\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"}, {"source_code": "import org.w3c.dom.html.HTMLScriptElement\nimport java.io.*\nimport java.util.*\nimport kotlin.collections.*\nimport java.util.TreeMap as Map\nimport java.util.TreeSet as Set\nimport java.util.HashMap as HMap\nimport java.util.HashSet as HSet\nimport java.util.ArrayList as List\nimport java.util.ArrayDeque as Deque\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val pw = PrintWriter(System.out)\n val n = sc.nextInt()\n val l = sc.nextLong()\n val r = sc.nextLong()\n val mod = longArrayOf(r / 3 - (l - 1) / 3, (r + 1) / 3 - l / 3, (r + 2) / 3 - (l + 1) / 3)\n val dp = Array(n) { LongArray(3) }\n dp[0] = mod\n for (i in 1 until n) {\n for (m1 in 0 until 3)\n for (m2 in 0 until 3) {\n dp[i][(m1 + m2) % 3] += dp[i - 1][m1] * mod[m2]\n dp[i][(m1 + m2) % 3] %= 1_000_000_007L\n }\n }\n println(dp[n-1][0])\n}\n"}], "negative_code": [], "src_uid": "4c4852df62fccb0a19ad8bc41145de61"} {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n var ans = 0\n for (i in 1 until n) {\n val employees = n - i\n ans += if (employees % i == 0) 1 else 0\n }\n println(ans)\n}\n", "positive_code": [{"source_code": "fun main() {\n val n = readLine()!!.toInt()\n var sum = 0\n \n for(i in 1 .. n) {\n if(n%i==0&&n!=i)sum++\n }\n print(sum)\n \n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n print(\n (1 .. n).filter{\n (n%it==0&&n!=it)\n }.size\n )\n\n}"}, {"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 - i) % i == 0) temp++\n\t}\n\tprintln(temp)\n}"}, {"source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var count = 0\n for (i in 1..n/2) {\n if (n % i == 0)\n count++\n }\n println(count)\n return\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n val s = Scanner(System.`in`)\n\n val n = s.nextInt()\n var ways = 0\n var leaders = 1\n repeat(n / 2) {\n if((n - leaders) % leaders == 0)\n ways++\n leaders++\n }\n println(ways)\n}"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val n = r.readLine()!!.toInt()\n var ans = 0\n for (i in 1..n-1){\n if (n%i==0) ans++\n }\n println(ans)\n}"}, {"source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var N = 0\n for(i in 1..n/2){\n if ((n - i) % i == 0) {\n N++\n }\n }\n println(N)\n\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n var ret = 0\n for(i in 1..n-1) {\n if((n-i) % i == 0) ret++\n }\n println(ret)\n}\n"}, {"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 main(){\n var n=readInt()\n var ans=0\n for(i in 1 until n)if(n%i==0)ans++\n printLine(\"$ans\")\n output()\n}"}, {"source_code": "fun main(args: Array){\n val n = readLine()!!.toInt()\n var ans = 1\n var i = 2\n while (i*i<=n) {\n if (n % i == 0) {\n if (i*i==n) ans += 1 else ans += 2\n }\n i++\n }\n println(ans)\n}"}, {"source_code": "fun main(args:Array){\n val n= readLine()!!.toInt()\n println((2..n).filter{n%it==0}.size)\n}"}, {"source_code": "/* https://codeforces.com/problemset/problem/935/A */\n\nfun main() {\n val numOfEmployees = readLine()!!.toInt()\n\n var numOfPossibilities = 0\n for (numOfLeaders in 1 until numOfEmployees) {\n val remainingEmployees = numOfEmployees - numOfLeaders\n if (remainingEmployees % numOfLeaders == 0) {\n numOfPossibilities++\n }\n }\n println(numOfPossibilities)\n}"}, {"source_code": "fun main() {\n val input = Integer.parseInt(readLine()!!)\n val output = (1..(input / 2))\n .filter {\n (input - it) % it == 0\n }\n .count()\n\n println(output)\n}"}, {"source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n val n = reader.nextInt()\n println((1..n/2).filter { it<=n-it && (n-it)%it==0 }.count())\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n\n var vaiants = 0\n for(i in 1 .. n / 2) {\n if(n % i == 0) {\n vaiants++\n }\n }\n\n print(vaiants)\n}"}, {"source_code": "fun main() {\n val n = readLine()!!.toInt()\n var ans = 0\n var k = 1\n repeat(n / 2) {\n ans += (if ((n - k) % k == 0) 1 else 0)\n k++\n }\n println(ans)\n}\n"}, {"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 println((1 until n).count { n % it == 0 })\n}\n\n\n"}, {"source_code": "import java.io.*\nimport java.util.*\n\nfun solve() {\n val n = nextInt()\n var ans = 0\n for(i in 1 until n) {\n val l = n - i\n if(n % l == 0) ans++\n }\n pw.println(ans)\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\nvar br = when(ONLINE_JUDGE) {\n true -> BufferedReader(InputStreamReader(System.`in`))\n else -> BufferedReader(FileReader(\"in.txt\"))\n}\n\nvar 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}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val ways = (1..n/2).count {\n (n - it)%it == 0\n }\n println(ways)\n}"}, {"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+1) {\n if (n%i == 0){\n res++\n }\n\n }\n print(res)\n}"}, {"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\tfor (i in 1 until numberOfEmployee) {\n\t\tif ((numberOfEmployee - i) % i == 0) {\n\t\t\tnumOfVariants += 1\n\t\t}\n\t}\n\n\treturn numOfVariants\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n var l = 0\n\n var i = 1\n while (i <= n / 2) {\n\n if ((n - i) % i == 0) {\n l++\n }\n\n i++\n }\n\n println(l)\n\n}"}, {"source_code": "fun main() {\n val e = readLine()!!.toInt()\n print((1..e/2).asSequence().filter { e % it == 0}.count())\n}"}], "negative_code": [{"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}"}, {"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) res += 2\n }\n print(res)\n}"}, {"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 .. n/2) {\n if (n%i == 0){\n res++\n if (n/i != i) res++\n }\n\n }\n print(res)\n}"}, {"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}"}, {"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}"}, {"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 until numberOfEmployee) {\n\t\tif ((numberOfEmployee - i) % i == 0) {\n\t\t\tnumOfVariants += 1\n\t\t}\n\t}\n\n\treturn numOfVariants\n}"}], "src_uid": "89f6c1659e5addbf909eddedb785d894"} {"source_code": "import java.util.*\n\nfun main() {\n val jin = Scanner(System.`in`)\n val n = jin.nextLong()\n val k = jin.nextLong()\n for (answer: Long in n downTo 0L) {\n if ((((n - answer) * (n - answer + 1L)) / 2) - answer == k) {\n println(answer)\n return\n }\n }\n}", "positive_code": [{"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n //val n = r.readLine()!!.toLong()\n //val v = r.readLine()!!.split(\"\").filter { it.isNotEmpty() }\n fun put(l:Long) = (1+l)*l/2\n fun eat(l:Long) = l\n val (action, remain) = r.readLine()!!.split(\" \").map { it.toLong() }\n fun inbox(l:Long) = put(l)-eat(action-l)\n fun s(x:Long):Long{\n var le = 0L\n var ri = action+1\n while (le le = mi+1\n inbox(mi)>x -> ri = mi\n inbox(mi) == x -> return mi\n }\n }\n return -1\n }\n val ans = s(remain)\n println(action-ans)\n /*repeat(r.readLine()!!.toInt()) {\n //val len = r.readLine()!!.toInt()\n val (n, s, t) = r.readLine()!!.split(\" \").map { it.toLong() }\n val more = s+t-n\n println(minOf(n- minOf(s, t)+1, maxOf(s, t)+1))\n }*/\n}"}, {"source_code": "import kotlin.math.roundToInt\nimport kotlin.math.sqrt\n\nfun main() {\n val (n, k) = readDoubles()\n\n val ans = (n + (3 - sqrt(8*(n + k) + 9))/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"}, {"source_code": "import kotlin.math.roundToInt\nimport kotlin.math.sqrt\n\nfun main() {\n val (n, k) = readDoubles()\n\n val ans = ((2*n + 3 - sqrt(8*(n + k) + 9))/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"}, {"source_code": "import kotlin.math.roundToInt\nimport kotlin.math.sqrt\n\nfun main() {\n val (n, k) = readDoubles()\n\n val disc = sqrt(8*(n + k) + 9)\n val pr = 2*n + 3\n\n val ans = (if(disc <= pr) (pr - disc)/2 else (pr + disc)/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"}, {"source_code": "fun main() {\n val (n, k) = readInts()\n\n val ans = (0 until n).binarySearch { x ->\n k.compareTo((n - x).toLong() * (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"}, {"source_code": "\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.toLong() } // list of ints\n\nfun main() {\n // read input\n val (n, k) = readInts()\n\n for (i in 0..n) {\n val totalK = i * (i + 1) / 2\n val totalAte = n - i\n if (totalK - k == totalAte) {\n print(totalAte)\n return\n }\n }\n}"}, {"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.nextLong()\n val k = sc.nextLong()\n println(n - (-3 + Math.sqrt(9.0 + 8 * (n + k)).toLong()) / 2)\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}"}, {"source_code": "fun main(){\n val (n, k) = readLine()!!.split(' ').map { it.toInt() }\n\n var step = 1\n var sum = 1\n while (step {\n left = current + 1\n }\n resultingCandies == candiesLeft -> return eaten.toInt()\n resultingCandies > candiesLeft -> {\n right = current - 1\n }\n }\n }\n throw IllegalArgumentException(\"solution not found\")\n}\n\nfun sumOf(willAdd: Long): Long = (willAdd * (willAdd + 1)) / 2\n\n\nfun main() {\n val (moves, candiesLeft) = readInts()\n println(sportMafia(moves.toLong(), candiesLeft.toLong()))\n}"}], "negative_code": [{"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"}, {"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"}, {"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 k = ((Math.sqrt((9 + 8 * turns + 8 * left).toDouble()).toInt()) - 3) / 2\n println(turns - k)\n\n}"}, {"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}"}], "src_uid": "17b5ec1c6263ef63c668c2b903db1d77"} {"source_code": "fun main(args: Array) {\n\n val otherStrings = arrayOf(\"a\", \"o\", \"y\", \"e\", \"u\", \"i\")\n val line = readLine()!!.toLowerCase()\n val chars = line.toCharArray()\n for (item in chars){\n if(!otherStrings.contains(\"\" + item)){\n print(\".\" + item)\n }\n }\n\n\n\n}", "positive_code": [{"source_code": "/**\n * Created by rohit.jh on 21/01/18\n */\nfun applyOperations(a: Char): String {\n val x = a.toLowerCase()\n return if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u' || x == 'y') \"\"\n else \".$x\"\n}\n\nfun main(args: Array) {\n val str: String = readLine()!!\n for (i in 0 until str.length) {\n print(applyOperations(str[i]))\n }\n}"}, {"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 token = StringTokenizer(br.readLine())\n val input = token.nextToken()\n\n val sb = StringBuilder()\n for (i in input.indices) {\n when (input[i]) {\n 'A', 'O', 'Y', 'E', 'U', 'I', 'a', 'o', 'y', 'e', 'u', 'i' -> {\n continue\n }\n else -> {\n sb.append('.')\n sb.append(input[i].toString().toLowerCase(Locale.ROOT))\n }\n }\n }\n println(sb)\n br.close()\n}"}, {"source_code": "import java.util.Scanner\n\n\nfun main(args: Array) {\n\tval inp = Scanner(System.`in`)\n\tvar word: String = inp.next().toLowerCase()\n\tvar charArray = word.toCharArray()\n\t\n\tfor(letter in charArray) {\n\t\tif(letter == 'a' || letter == 'e' || letter == 'i' || letter == 'o' || letter == 'u' || letter == 'y') {\n\t\t\tcontinue\n\t\t} else {\n\t\t\tprint(\".$letter\")\n\t\t}\n\t}\n}\n"}, {"source_code": "fun main(args: Array) {\n var s = readLine()!!\n s = s.replace(Regex(\"[aeyuioAEYUOI]\"), \"\")\n\n var res = \"\"\n\n s.forEach {\n res += \".${it.toLowerCase()}\"\n }\n\n print(res)\n}"}, {"source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\n\nfun main() = output {\n val string = read()\n val result = string\n .toLowerCase()\n .replace(Regex(\"[aeiouy]\"), \"\")\n .replace(Regex(\".\")) {\n \".${it.value}\"\n }\n\n println(result)\n}\n\n@JvmField\nval INPUT = System.`in`\n\n@JvmField\nval OUTPUT = System.out\n\n@JvmField\nval _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n\n@JvmField\nvar _tokenizer: StringTokenizer = StringTokenizer(\"\")\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() }\n\n@JvmField\nval _writer = PrintWriter(OUTPUT, false)\n\nfun output(block: PrintWriter.() -> Unit) {\n _writer.apply(block).flush()\n}\n\n\n"}, {"source_code": "fun main()\n{\n var s = readLine()!!.toString()\n for (p in s)\n {\n var c = p.toLowerCase()\n if(c!='a' && c!='e' && c!='i' && c!='o' && c!='u' && c!='y')\n print(\".$c\")\n }\n}"}, {"source_code": "\n\nfun main()\n{\n var st = readLine()!!\n st = st.toLowerCase()\n var s : String = \"\"\n val arr = arrayOf('a','o','y','e','u','i')\n for(i in st)\n {\n if(i !in arr)\n {\n s = s.plus(\".\"+i)\n }\n }\n println(s)\n}"}, {"source_code": "import java.util.*\n\n\nfun main(){\n\n val read = Scanner(System.`in`)\n val s = read.nextLine().toLowerCase()\n for(i in 0 until s.length) if((s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u' || s[i] == 'y'))\n continue\n else print(\".\"+s[i])\n }"}, {"source_code": "import java.util.*\n\nfun isVowel(c : Char): Boolean = c.toUpperCase() in \"AEIOUY\"\n\nfun main(args : Array) {\n val scan = Scanner (System.`in`)\n val s = scan.next()\n val r = StringBuilder()\n for ( c in s )\n if ( !isVowel(c) ){\n r.append('.')\n r.append(c.toLowerCase())\n }\n println(r)\n}"}, {"source_code": "fun main() {\n val input = readLine()!!\n val vowels = Regex(\"[aoyeui]\")\n val intermed = vowels.replace(input.toLowerCase(), \"\")\n var answer = \"\"\n for(i in 0..intermed.length - 1){\n answer += \".\" + intermed[i]\n }\n print(answer)\n}"}, {"source_code": "/* template start */\n// input\nprivate fun readString() = readLine()!!\nprivate fun readStrings() = readString().split(\" \")\nprivate fun readInt() = readString().toInt()\nprivate fun readDigits() = readString().map { it - '0' }\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\n\n// output\nprivate fun T.print(map: (T) -> String = { it.toString() }) = println(map(this))\nprivate fun Iterable.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)\nprivate fun Array.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)\nprivate fun Sequence.print(sep: String? = null, map: ((T) -> String)? = null) =\n println(joinToString(sep ?: \"\", transform = map ?: { it.toString() }))\n\n// various\nprivate val Int.isEven: Boolean get() = this % 2 == 0\nprivate val Int.isOdd: Boolean get() = !this.isEven\nprivate fun queries(block: (Int) -> Unit) = repeat(readInt(), block)\n\n/* template end */\n\nfun main() {\n val input = readString()\n buildString {\n for (c in input) {\n val c = c.toLowerCase()\n if (c !in setOf('a', 'e', 'i', 'o', 'u','y')) {\n append('.')\n append(c)\n }\n }\n }.print()\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n\n val s = reader.readLine()\n println(s.toLowerCase()\n .replace(Regex(\"\"\"[aoyeui]\"\"\"), \"\")\n .replace(Regex(\"\"\"[a-z]\"\"\")) { \".\" + it.value })\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n\n println(modify(sc.next()))\n}\n\nval vowels = \"AOYEUI\"\nfun modify(word: String) =\n word.filter { !vowels.contains(it.toUpperCase()) }\n .map { \".\" + it.toLowerCase() }\n .joinToString(\"\")\n"}, {"source_code": "// kotlin oj template code from uwi(Codeforces), and convert to kotlin by lety\nimport java.io.ByteArrayInputStream\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.PrintWriter\nimport java.util.Arrays\nimport java.util.InputMismatchException\n\nlateinit var `is`: InputStream\nlateinit var out: PrintWriter\nvar INPUT = \"\"\n\n//val oj = System.getProperty(\"ONLINE_JUDGE\") != null\nval oj = true\nval inbuf = ByteArray(1024)\nvar lenbuf = 0\nvar ptrbuf = 0\n\n\nfun solve() {\n val s = ns()\n\n s.forEach {\n if(it in \"aeiouyAEIOUY\")\n {\n }\n else\n {\n print('.')\n\n if(it.isUpperCase())\n {\n print(it.toLowerCase())\n }\n else\n {\n print(it)\n }\n }\n }\n\n}\n\nfun main() {\n `is` = if (oj) System.`in` else ByteArrayInputStream(INPUT.toByteArray())\n out = PrintWriter(System.out)\n\n val s = System.currentTimeMillis()\n solve()\n out.flush()\n tr((System.currentTimeMillis() - s).toString() + \"ms\")\n}\n\nprivate fun readByte(): Int {\n if (lenbuf == -1) throw InputMismatchException()\n if (ptrbuf >= lenbuf) {\n ptrbuf = 0\n try {\n lenbuf = `is`.read(inbuf)\n } catch (e: IOException) {\n throw InputMismatchException()\n }\n\n if (lenbuf <= 0) return -1\n }\n return inbuf[ptrbuf++].toInt()\n}\n\nprivate fun isSpaceChar(c: Int): Boolean = !(c >= 33 && c <= 126)\n\nprivate fun skip(): Int {\n var b: Int = readByte()\n while (b != -1 && isSpaceChar(b)) {\n b = readByte()\n }\n return b\n}\n\n// using ns()\nprivate fun nd(): Double = ns().toDouble()\n\n// using ns()\nprivate fun nc(): Char = skip().toChar()\n\n// input until whitespace\nprivate fun ns(): String {\n var b = skip()\n val sb = StringBuilder()\n while (!isSpaceChar(b)) { // when nextLine, (isSpaceChar(b) && b != ' ')\n sb.appendCodePoint(b)\n b = readByte()\n }\n return sb.toString()\n}\n\nprivate fun ns(n: Int): CharArray {\n val buf = CharArray(n)\n var b = skip()\n var p = 0\n while (p < n && !isSpaceChar(b)) {\n buf[p++] = b.toChar()\n b = readByte()\n }\n return if (n == p) buf else Arrays.copyOf(buf, p)\n}\n\n// matrix\nprivate fun nm(n: Int, m: Int): Array {\n val map = Array(n) { CharArray(m) }\n for (i in 0 until n) map[i] = ns(m)\n return map\n}\n\nprivate fun pm(matrix: Array) {\n val n = matrix.size\n val m = matrix[0].size\n repeat(n)\n {\n repeat(m)\n { jt ->\n out.print(matrix[it][jt])\n }\n out.println()\n }\n out.flush()\n}\n\n// int array\nprivate fun na(n: Int): IntArray {\n val a = IntArray(n)\n for (i in 0 until n) a[i] = ni()\n return a\n}\n\nprivate fun ni(): Int {\n var num = 0\n var b: Int = readByte()\n var minus = false\n while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {\n b = readByte()\n }\n if (b == '-'.toInt()) {\n minus = true\n b = readByte()\n }\n\n while (true) {\n if (b >= '0'.toInt() && b <= '9'.toInt()) {\n num = num * 10 + (b - '0'.toInt())\n } else {\n return if (minus) -num else num\n }\n b = readByte()\n }\n}\n\nprivate fun nl(): Long {\n var num: Long = 0\n var b: Int = readByte()\n var minus = false\n while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {\n b = readByte()\n }\n if (b == '-'.toInt()) {\n minus = true\n b = readByte()\n }\n\n while (true) {\n if (b >= '0'.toInt() && b <= '9'.toInt()) {\n num = num * 10 + (b - '0'.toInt())\n } else {\n return if (minus) -num else num\n }\n b = readByte()\n }\n}\n\nprivate fun tr(vararg o: Any) {\n// if (!oj) println(Arrays.deepToString(o))\n}\n\n"}, {"source_code": "fun main(args: Array) {\n var inp = readLine()!!\n inp = inp.toLowerCase()\n val vovs = arrayOf('a','e','i','o','u','y')\n for (i in inp)\n {\n if (i in vovs)\n continue\n print(\".$i\")\n }\n}"}, {"source_code": "fun main(args: Array) {\n val input: String = readLine()!!\n val answer: ArrayList = arrayListOf()\n val vowels: ArrayList = arrayListOf('a', 'i', 'u', 'e', 'o', 'y')\n for (char in input.toCharArray()) {\n val currentChar = char.toLowerCase()\n if (!vowels.contains(currentChar)) {\n answer.add('.')\n answer.add(currentChar)\n }\n }\n for (char in answer) {\n print(char)\n }\n println()\n}"}, {"source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun main(args: Array) {\n var scan = Scanner(System.`in`)\n var input = scan.nextLine()\n input.toCharArray()\n var len = input.length\n var i = 0\n var arr2 = ArrayList()\n while(i < len) {\n\n if(input[i].toUpperCase() !== 'A' && input[i].toUpperCase() !== 'E' && input[i].toUpperCase() !== 'I' && input[i].toUpperCase() !== 'O' && input[i].toUpperCase() !== 'U' && input[i].toUpperCase() !== 'Y'){\n arr2.add(\".\")\n arr2.add(input[i].toString())\n }\n i++\n }\n var output: String = \"\"\n arr2.forEach { output += it.toLowerCase()}\n println(output)\n}"}, {"source_code": "fun main(args: Array) {\n\n val s = readLine()!!\n\n print(s.toLowerCase()\n .filter { it !in listOf('a', 'e', 'o', 'u', 'i', 'y') }.asIterable().joinToString(separator = \".\", prefix = \".\"))\n\n}"}, {"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 = readLine()!!\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"}, {"source_code": "fun main(args: Array) {\n val word = readLine()!!\n println(solve(word))\n}\n\nfun solve(word: String): String {\n val consonants = \"aeyoui\"\n return word.toLowerCase().map { c -> if (c in consonants) \"\" else \".$c\" }.joinToString(\"\")\n}\n\n"}, {"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 string = input.next()\n\n val dot = '.'\n val vowels = setOf('a', 'o', 'y', 'e', 'u', 'i')\n\n for (char in string) {\n if (char.toLowerCase() !in vowels) {\n output.print(dot)\n output.print(char.toLowerCase())\n } else {\n continue\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}"}, {"source_code": "import java.util.*\nimport java.util.regex.Pattern\nimport kotlin.collections.ArrayList\n\nfun main(){\n var string = readLine()\n print(resulting(string!!))\n}\n\nfun resulting (str:String):String{\n var string = str.replace(Regex(\"[aoyeui]|[AOYEUI]\"), \"\")\n string = string.toLowerCase()\n var newString = \"\"\n for (i in 0..string.length-1)\n newString+=\".\"+string[i]\n return newString\n}\n\n"}, {"source_code": "fun main(args: Array) {\n var s= readLine()\n var s2=\"\"\n s= s!!.toLowerCase()\n for (i in 0..(s!!.length-1)){\n if (s.get(i)=='a'||s.get(i)=='e'||s.get(i)=='i'||s.get(i)=='o'||s.get(i)=='u'||s.get(i)=='y'){\n continue\n }\n else{\n s2=s2+\".\"+s.get(i)\n }\n }\n print(s2)\n\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val s: Scanner = Scanner(System.`in`)\n val str: String = s.next()\n val vowels: CharArray = charArrayOf('a', 'o', 'y', 'e', 'i', 'u')\n for (c in str) {\n val lc: Char = c.toLowerCase();\n if (lc in vowels) {\n continue\n } else {\n System.out.print(\".\" + lc.toString())\n }\n }\n}"}, {"source_code": "fun main(args: Array) {\n readLine()!!\n .toLowerCase()\n .replace(Regex(\"[aoyeui]\"), \"\")\n .forEach { print(\".$it\") }\n}\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array){\n val vwls = arrayOf(\"a\",\"o\",\"y\",\"e\",\"u\",\"i\");\n val sc = Scanner(System.`in`)\n var str = sc.nextLine().toLowerCase();\n\n var res = \"\";\n for (x in 0 until str.length){\n if (!vwls.contains(\"${str[x]}\")){\n res += \".${str[x]}\"\n }\n }\n print(res)\n}"}, {"source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n Scanner(System.`in`).use {\n val result = it.next().formatWithDots()\n println(result)\n }\n}\n\nfun String.formatWithDots(): String {\n val builder = StringBuilder()\n val dot = \".\"\n for (char in this) {\n if (char.isVowel()) {\n continue\n }\n builder.append(dot).append(Character.toLowerCase(char))\n }\n return builder.toString()\n}\n\nfun Char.isVowel() = when (this) {\n 'a', 'A', 'o', 'O', 'e', 'E', 'u', 'U', 'i', 'I', 'y', 'Y' -> true\n else -> false\n}"}, {"source_code": "fun main(args: Array) {\n val a = readLine()!!\n val template = arrayOf(\"A\", \"O\", \"Y\", \"E\", \"U\", \"I\")\n\n val result = a\n .filter { !template.contains(it.toString().toUpperCase()) }\n .map { it.toLowerCase() }\n .joinToString(prefix = \".\", separator = \".\")\n\n println(result)\n}"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val vowels = listOf(\"a\", \"e\", \"i\", \"o\", \"u\", \"y\")\n val str = readLine()!!.split(\"\").filter { it.length>0 && it.toLowerCase() !in vowels }.map { it.toLowerCase() }.joinToString(\".\")\n s.append(\".\")\n s.append(str)\n print(s)\n}"}, {"source_code": "// codeforces problem 118 A\n\nfun main() {\n val vowels = setOf('a', 'e', 'i', 'o', 'u', 'y')\n val result = StringBuilder(readLine()!!.toLowerCase().filter { it !in vowels })\n for (i in result.length-1 downTo 0) {\n result.insert(i, '.')\n }\n println(result)\n}\n"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val input = BufferedReader(InputStreamReader(System.`in`))\n val string = input.readLine()\n println(customReplace(string))\n}\n\nfun customReplace(string: String) = buildString {\n for (letter in string) {\n if (!letter.isVowel()) {\n append('.')\n append(letter.toLowerCase())\n }\n }\n}\n\nfun Char.isVowel(): Boolean {\n val ch = this.toLowerCase()\n return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'y'\n}"}, {"source_code": "fun main(args: Array){\n var s = readLine()!!\n val arr = charArrayOf ('a', 'o', 'y', 'e', 'u', 'i')\n var len = s.length - 1\n val ans = mutableListOf()\n var add = true\n for(i in 0..len) {\n add = true\n for(j in 0..5) {\n if (s[i].toLowerCase() == arr[j])\n add = false\n }\n if (add) {\n ans.add('.')\n ans.add(s[i].toLowerCase())\n }\n\n\n }\n for(i in 0..(ans.size-1))\n print(ans[i])\n\n}"}, {"source_code": "\nimport java.util.*\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val input: String = scanner.nextLine().toLowerCase()\n val VOWELS = \"aoyeui\"\n val result = StringBuilder()\n input.filterNot { VOWELS.contains(it) }.forEach { result.append(\".$it\") }\n println(result)\n}\n"}, {"source_code": "fun main(args: Array)\n{\n\n var text = readLine()!!.trim()\n text = text.toLowerCase()\n var text1 = text\n var vowels =\"aouyei\"\n\n for (i in 0..(text.length-1))\n {\n if (vowels.contains(text.get(i)))\n {\n text1 = text1.replace(text.get(i)+\"\",\"\")\n }else\n {\n text1 = text1.replace(text.get(i)+\"\",\".\"+text.get(i))\n }\n text1 = text1.replace(\"..\",\".\")\n\n\n }\n\n\n print(text1)\n\n\n}"}, {"source_code": "import java.util.*\n\n fun main(){\n var input = Scanner(System.`in`)\n var programString = input.nextLine()\n var string =\"\"\n programString.toLowerCase().replace(\"a\",\"\")\n programString.toLowerCase().toCharArray().forEach {\n string =string+changeChar(it)\n }\n System.out.println(string)\n }\n\nfun changeChar(char : Char) : String{\n if(char == 'a' || char == 'e' || char == 'i' || char == 'o' || char == 'u' || char == 'y'){\n return \"\"\n }else{\n return \".${char}\"\n }\n}\n\n\n\n\n"}, {"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 result = readLn()\n result = result.toLowerCase()\n result = result.replace(\"a\",\"\")\n result = result.replace(\"e\",\"\")\n result = result.replace(\"y\",\"\")\n result = result.replace(\"u\",\"\")\n result = result.replace(\"i\",\"\")\n result = result.replace(\"o\",\"\")\n var newChars = \"\"\n for (i in 0 until result.length) {\n newChars = newChars.plus(\".\").plus(result[i])\n }\n println(newChars.toString())\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()"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val forbidden = listOf('a', 'o', 'y', 'e', 'u', 'i')\n println(stringTask(\n Scanner(System.`in`).next(),\n forbidden\n ))\n}\n\nfun stringTask(input: String, forbidden: List): String {\n return input\n .toLowerCase()\n .filter { it !in forbidden }\n .map { \".$it\" }\n .joinToString(\"\")\n}"}, {"source_code": "fun main() {\n val vowel:Array = arrayOf('A', 'O', 'Y', 'E', 'U', 'I')\n val vowelLower:Array = arrayOf('a', 'o', 'y', 'e', 'u', 'i')\n val word:String = readLine()!!\n\n for (i in word.indices) {\n\n if (word[i] in vowel || word[i] in vowelLower)\n print(\"\")\n\n else {\n if (word[i] in 'A'..'Z')\n print(\".\" + word[i].toLowerCase())\n else\n print(\".\" + word[i])\n }\n }\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val vowels = hashSetOf('a', 'o', 'y', 'e', 'u', 'i', 'A', 'O', 'Y', 'E', 'U', 'I')\n val br = BufferedReader(InputStreamReader(System.`in`))\n val s = br.readLine()\n val newS = s.filter { c -> !(c in vowels) }\n .map { c -> if (c.isUpperCase()) c.toLowerCase() else c}\n .joinToString(\".\")\n println(\".$newS\")\n}"}, {"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 str = readLn()\n var result: String = \"\"\n\n for (c in str.toCharArray()) {\n val cl = c.toLowerCase()\n if(!isVowel(cl)) {\n result = \"${result}.${cl}\"\n }\n }\n println(result)\n}\n\nfun isVowel(c: Char): Boolean {\n return c == 'a' || c == 'o' || c == 'y' || c == 'e' || c == 'u' || c == 'i'\n}"}, {"source_code": "fun main(args: Array) {\n val str = readLine()!!.toLowerCase()\n var res = \"\"\n for (i in str) {\n if (i !in listOf('a', 'o', 'y', 'e', 'u', 'i')) {\n res += \".$i\"\n }\n }\n println(res)\n}"}, {"source_code": "\nfun main(args : Array) {\n val s = readLine()!!\n var list: MutableList = mutableListOf()\n var listc: MutableList = mutableListOf()\n\n val letter = arrayOf('a', 'o', 'y', 'e', 'i', 'u')\n for (char in s) {\n list.add(char)\n }\n\n for(j in 0..s.length-1){\n var c = 0\n for(k in 0..5){\n if(s[j].toLowerCase()!=letter[k]){\n c++\n }\n }\n if(c==6){\n listc.add('.')\n listc.add(s[j].toLowerCase())\n }\n }\n\n\n\n for (i in 0..listc.size-1) {\n print(listc[i])\n }\n}"}, {"source_code": "import kotlin.collections.*\nimport kotlin.io.*\nimport kotlin.text.*\n\nfun readInts() = readLine()!!.split(' ').map { it.toInt() }\n\nfun main() {\n var s = readLine().toString()\n val vowels = arrayOf(\"a\", \"o\", \"y\", \"e\", \"u\", \"i\")\n for (i in vowels.indices) {\n s = s.replace(vowels[i], \"\", true)\n }\n s = s.toLowerCase()\n val s1 = s.split(\"\")\n\n var res = \"\"\n for (i in s1.indices) {\n res += if (s1[i] != \"\") \".\" else \"\"\n res += s1[i]\n }\n println(res)\n}\n"}, {"source_code": "//package problem118a\n\nimport java.lang.StringBuilder\n\nfun convertWord(word: String): String {\n val initialModifications = word.toLowerCase().filter { \"aeiouy\".indexOf(it) == -1 }\n\n val result = StringBuilder()\n for (char in initialModifications) {\n result.append(\".$char\")\n }\n\n return result.toString()\n}\n\nfun main() {\n val input = readLine()!!\n println(convertWord(input))\n}\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)){\n val word = nextLine()\n\n val wordArray = word.toCharArray()\n val finalArray = CharArray(word.length * 2)\n var counter = 0\n for(i in wordArray.indices){\n val c = wordArray[i]\n var isCharOk = true\n when(c){\n 'A','a',\n 'O','o',\n 'Y','y',\n 'E','e', \n 'U','u',\n 'I','i'-> isCharOk = false\n }\n if(!isCharOk){\n continue\n }\n finalArray[counter] = '.' \n counter++\n finalArray[counter] = Character.toLowerCase(c)\n counter++\n }\n println(String(finalArray,0,counter))\n}"}, {"source_code": "import java.util.Scanner;\nfun solve(s : String){\n for(it in s){\n if(it=='A'||it=='O'||it=='E'||it=='I'||it=='U'||it=='Y')\n print(\"\")\n else if(it=='a'||it=='o'||it=='e'||it=='i'||it=='u'||it=='y')\n print(\"\")\n else{\n if(it>='A'&&it<='Z')\n print(\".${it.toLowerCase()}\")\n else\n print(\".$it\")\n }\n }\n println()\n}\nfun main(){\n val read = Scanner(System.`in`)\n var s = read.nextLine()\n solve(s)\n}"}, {"source_code": "import java.util.*\n\nfun Test(str : String) : String{\n var my_map = mapOf('a' to false , 'o' to false , 'y' to false , 'e' to false ,'u' to false ,'i' to false )\n var s = str.toLowerCase()\n var result = \"\"\n for(i in 0 until str.length)\n {\n if(my_map[s[i]] == null)\n {\n result += s[i]\n }\n }\n var r = \"\"\n for(i in 0 until result.length)\n {\n r += \".\" + result[i]\n }\n return r\n}\nfun main()\n{\n var scanner = Scanner(System.`in`)\n var str : String= scanner.next()\n\n println(Test(str))\n}\n\n\n"}, {"source_code": "fun main()\n{\n val given = readLine()!!\n var answer = \"\"\n for (i in given)\n {\n if (! \"AEIOUYaeiouy\".contains(i))\n {\n answer += \".\"+i.toLowerCase()\n }\n }\n println(answer)\n}"}, {"source_code": "val vowels = arrayOf('a', 'o', 'y', 'e', 'u', 'i')\n\nfun main(args: Array){\n val string = readLine() ?: \"\"\n var result = \"\"\n for(char in string){\n if (isConsonant(char))\n result += \".\" + char.toLowerCase()\n }\n println(result)\n}\n\nfun isConsonant(char: Char): Boolean{\n return !(char.toLowerCase() in vowels)\n}"}, {"source_code": "import java.lang.StringBuilder\nimport java.util.Scanner\n\n fun main() {\n val scanner = Scanner(System.`in`)\n val word: String = scanner.nextLine()\n val result = StringBuilder()\n\n for(char:Char in word.toLowerCase()) {\n if(!\"aoyeui\".contains(char)){\n result.append(\".$char\")\n }\n }\n print(result.toString())\n }"}, {"source_code": "fun main(arg: Array){\n val s = readLine()!!\n val b = arrayOf('a','e','y','u','i','o')\n println('.'+s.toLowerCase().filter { it !in b }.asIterable().joinToString(separator = \".\"))\n}"}, {"source_code": " 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 }"}, {"source_code": "import java.util.*\n\nfun main(\u0986 : Array) {\n val \u09a6: Scanner = Scanner(System.`in`)\n var \u09ab = arrayOf('a','e','i','o','u','y')\n var \u09b8 = \u09a6.nextLine()\n for (\u09ae in \u09b8.toLowerCase()) {\n if(\u09ae !in \u09ab) {\n print(\".$\u09ae\")\n }\n }\n}"}, {"source_code": "fun main(args: Array)\n{\n val s = readLine()!!.toLowerCase()\n val glas = \"aoyeui\"\n var sb = StringBuilder()\n for (c in s)\n {\n if (c !in glas)\n sb.append(\".$c\")\n }\n println(sb)\n}"}, {"source_code": "fun main() {\n var str = readStr()!!.toLowerCase().toCharArray()\n\n var vowels = \"aoyeui\"\n\n for (i in str) {\n if (!vowels.contains(i)){\n print('.')\n print(i)\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()!!"}, {"source_code": "import java.io.BufferedOutputStream\nimport java.io.PrintWriter\nimport java.util.*\n\n\n\nfun fn1 (x : String) : String{\n var res = \"\"\n val v = setOf('a', 'e', 'i', 'o', 'u','y')\n for (w in x){\n if (v.contains(w.toLowerCase())){\n continue\n }\n res += \".${w.toLowerCase()}\"\n }\n return res\n}\n\nfun main() {\n val sc = Scanner(System.`in`)\n val out = PrintWriter(BufferedOutputStream(System.out))\n\n// val testCases = sc.nextInt()\n//\n// val a = mutableListOf>()\n//\n// for (i in 0..testCases) {\n// val word = sc.nextLine().split(\" \")\n// for (w in word) out.println(w)\n// a.add(word)\n// }\n val tescase = sc.nextLine()\n out.println(fn1(tescase))\n out.close()\n sc.close()\n}"}, {"source_code": "fun main(args: Array) {\n val vowels = arrayOf('a', 'o', 'e', 'u', 'i', 'y')\n val word = readLine()!!\n println(word.toLowerCase().filter { !vowels.contains(it) }.map { \".$it\" }.joinToString(separator = \"\"))\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n println(\".\" + sc.nextLine().toLowerCase().replace(\"a|e|o|i|u|y\".toRegex(),\"\").toCharArray().joinToString(\".\"))\n\n}\n\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array){\n val scan = Scanner(System.`in`)\n var word = scan.next().toLowerCase()\n val glas = arrayOf(\"a\", \"o\", \"y\", \"e\", \"u\", \"i\")\n val nGlas = arrayOf(\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"z\")\n\n for (i in glas){\n word = word.replace(i, \"\")\n }\n for (i in nGlas) word = word.replace(i,\".$i\")\n print(word)\n}"}, {"source_code": "fun main() {\n val word = readLine()\n\n println(word!!.toLowerCase()\n .replace(\"[aoyeui]\".toRegex(), \"\")\n .replace(\".\".toRegex()) { \".\" + it.value }\n )\n}"}, {"source_code": "fun main(args: Array) {\n var w = readLine()!!.toString()\n var W = w.toLowerCase()\n for (i in W){\n if (!(i == 'a' || i == 'o' || i == 'y' || i == 'e' || i == 'u' || i == 'i')) {\n print(\".$i\")\n }\n }\n }"}, {"source_code": "import java.util.Scanner\n\n/**\n *Created by Kartik Patodi on 28-05-2017.\n **/\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n var s = sc.nextLine()\n s = s.stringTask()\n println(s)\n}\n\nfun String.stringTask() = this.replace(\"[aeiouyAEIOUY]+\".toRegex(), \"\").toLowerCase().replace(\"\", \".\").dropLast(1)\n\n"}, {"source_code": "import java.util.*\n\nval scan = Scanner(System.`in`)\n\nfun main(args: Array){\n var s = scan.next().toLowerCase()\n var n = \"aoyeui\".split(\"\").subList(1,7)\n for (i in s){\n var a = i.toString()\n if (a !in n) {\n print(\".$i\")\n }\n }\n\n}\n\n"}, {"source_code": "fun main() {\n var s = readLine()!!\n s = s.toLowerCase()\n var arr = listOf('a', 'i', 'o', 'y', 'e', 'u')\n for (c in s) {\n if(c !in arr){\n print('.')\n print(c)\n }\n }\n}\n"}, {"source_code": "fun main() {\n println(readLine()!!.asSequence()\n .map { it.toLowerCase() }\n .filter { it !in setOf('a', 'e', 'i', 'o', 'u', 'y') }\n .map { \".$it\" }\n .joinToString(\"\"))\n}"}, {"source_code": "fun main(args: Array) {\n readLine()!!\n .toLowerCase()\n .replace(\"[aoyeui]\".toRegex(), \"\")\n .forEach { print(\".$it\") }\n}"}, {"source_code": "fun main(args: Array) {\n val vowels = arrayOf('a', 'o', 'y', 'e', 'u', 'i')\n val string = readLine()!!;\n println(string.toLowerCase().filter { it !in vowels }.map { \".$it\" }.joinToString(separator = \"\"))\n}"}, {"source_code": "import java.lang.StringBuilder\n\nfun main(args: Array) {\n val input = readLine() ?: \"\"\n val vowels = \"[aoyeui]\".toRegex()\n val noVowels = input.toLowerCase().replace(vowels,\"\")\n val sb = StringBuilder()\n noVowels.forEach { sb.append(\".$it\") }\n println(sb.toString())\n}"}, {"source_code": "fun main(args: Array) {\n val str = readLine()!!.toLowerCase().replace(Regex(\"[AaEeIiOoYyUu]\"), \"\")\n println(str.replace(Regex(\"(?i)([bcdfghjklmnpqrstvwxyz])\"), \".$1\"))\n}"}, {"source_code": "fun main(){\n var someInput = readLine()!!\n var glasnie = arrayOf(\"A\", \"O\", \"Y\", \"E\", \"U\", \"I\",\"a\",\"o\",\"y\",\"e\",\"u\",\"i\")\n var propisnie = arrayOf(\"Q\",\"W\",\"R\",\"T\",\"P\",\"S\",\"D\",\"F\",\"G\",\"H\",\"J\",\"K\",\"L\",\"Z\",\"X\",\"C\",\"V\",\"B\",\"N\",\"M\")\n var strochnie = arrayOf(\"q\",\"w\",\"r\",\"t\",\"p\",\"s\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"z\",\"x\",\"c\",\"v\",\"b\",\"n\",\"m\")\n var someOutput =\"\"\n var count = 0\n var count2 = 0\n\n for (i in (0..someInput.length-1)){\n count = 0\n for (element in glasnie) {\n if (someInput[i].toString() == element) count++\n }\n if (count == 0){\n count2 = 0\n for (j in 0..19){\n if (someInput[i].toString() == propisnie[j]){\n count2++\n someOutput =someOutput + \".\" + strochnie[j]\n }\n }\n if (count2 ==0) someOutput =someOutput + \".\" + someInput[i]\n }\n }\n println(someOutput)\n }\n"}, {"source_code": "fun main() = readLine()!!.toLowerCase().forEach { if (it !in arrayOf('a', 'e', 'o', 'u', 'i', 'y')) print(\".$it\") }"}, {"source_code": "//package codeforces.com.tasks.task118A\n\nfun main() {\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 letters[index] = \".${it.toLowerCase()}\"; index++\n }\n println(letters.joinToString(\"\"))\n}"}, {"source_code": "import java.lang.StringBuilder\n\nfun main() {\n \n val input = readLine()\n\n if (input == null) {\n return\n }\n\n val vowels: String = \"AOYEUI\"\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\n println(result.toString())\n\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n var s:String = br.readLine()!!.toLowerCase()\n var set = hashSetOf('a','e','o','y','u','i')\n var res:StringBuilder = StringBuilder()\n for(c in s.toCharArray())\n if(!set.contains(c))\n res.append(\".$c\")\n println(res)\n}"}, {"source_code": "fun main(args:Array){\n var str = readLine()!!.toLowerCase()\n\n for(i in 0 until str.length){\n if(str[i] != 'a' && str[i] != 'o' && str[i] != 'y' && str[i] != 'e' && str[i] != 'u' && str[i] != 'i') {\n print(\".\")\n print(str[i])\n }\n }\n}"}, {"source_code": "fun main() {\n val vowels = \"aoyeui\"\n var result = \"\"\n val input = readLine()!!\n input.forEach {\n val c = it.toLowerCase()\n if(c !in vowels) {\n result += \".$c\"\n }\n }\n println(result)\n}"}, {"source_code": "fun main(args: Array) {\n\n val letters = arrayListOf('a', 'o', 'y', 'e', 'u', 'i')\n var input = readLine()!!\n\n input = input.toLowerCase()\n\n var result = \"\"\n\n (0 until input.length)\n .filter { letters.indexOf(input[it]) == -1 }\n .forEach { result += \".\" + input[it] }\n\n println(result)\n}"}, {"source_code": "import java.util.*\n\nprivate val scan = Scanner(System.`in`)\n\nfun main(args: Array) {\n\n scan.next()\n .toLowerCase()\n .filter { it !in listOf('a', 'e', 'i', 'o', 'u', 'y') }\n .flatMap { listOf('.', it) }\n .joinToString(separator = \"\")\n .run { println(this) }\n}\n"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val input = reader.readLine()\n println(process(input))\n}\n\nfun process(input: String): String {\n val stringBuilder = StringBuilder()\n val tmpStr = input.toLowerCase().replace(Regex(\"[aoyeui]\"), \"\")\n tmpStr.forEach {\n stringBuilder.append('.')\n stringBuilder.append(it)\n }\n return stringBuilder.toString()\n}\n"}, {"source_code": "fun main() {\n val vowels = setOf('a', 'o', 'y', 'e', 'u', 'i')\n val s = readLine()!!\n val result = s.toLowerCase().filterNot { it in vowels }.toList().joinToString(\".\", \".\")\n println(result)\n}\n"}, {"source_code": "fun main() {\n val x = readLine()!!.toLowerCase()\n println(x.replace(\"[aoyeui]+\".toRegex(), \"\").replace(\"(.)\".toRegex(), \".$1\"))\n}"}, {"source_code": "fun main(args: Array) {\n readLine()!!\n .toLowerCase()\n .replace(\"[aoyeui]\".toRegex(), \"\")\n .forEach { print(\".$it\") }\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n\n val chars = arrayListOf('a', 'o', 'y', 'e', 'u', 'i')\n\n val word = Scanner(System.`in`).nextLine()\n\n word.map { if (it.toLowerCase() in chars) \"\" else \".\" + it.toLowerCase() }\n .forEach { print(it) }\n}\n\n"}, {"source_code": "//https://www.google.com/search?q=codeforces+watermelon&oq=codeforces+water&aqs=chrome.0.69i59j69i57j0l6.1995j0j1&sourceid=chrome&ie=UTF-8\n\nfun main() {\n\tvar input = readLine()!!.toString() // read integer from the input\n println(convert(input)) // print answer to the output\n}\n\nval vowels = setOf('A', 'O', 'Y', 'E', 'U', 'I', 'a', 'o', 'y', 'e', 'u', 'i')\n\nfun convert(input: String): String {\n\tval builder = StringBuilder()\n\tinput.forEach label@ { c: Char ->\n\t\tif (vowels.contains(c)) {\n\t\t\treturn@label\n\t\t}\n\t\tbuilder.append('.')\n\t\tif (c.isUpperCase()) {\n\t\t\tbuilder.append(c.toLowerCase())\n\t\t} else {\n\t\t\tbuilder.append(c)\n\t\t}\n\t}\n\treturn builder.toString()\n}"}, {"source_code": "fun main(args: Array) {\n solve()\n}\n\nfun solve() {\n val vowels = arrayOf('a', 'o', 'y', 'e', 'u', 'i')\n val chars = readLine()!!\n chars.map {\n val ch = it.toLowerCase()\n if (ch !in vowels) {\n print(\".$ch\")\n }\n }\n}\n"}, {"source_code": "\nimport java.util.*\n\n/**\n * Created by AoEiuV020 on 2017/05/09.\n */\nfun main(vararg args: String) {\n val str = readLine()!!\n str.map {\n it.toLowerCase()\n }.filterNot {\n it in \"aoyeui\"\n }.forEach {\n print(\".$it\")\n }\n}\n"}, {"source_code": "fun main(){\n val input = readLine()!!.toLowerCase().replace(\"[aoyeui]\".toRegex(),\"\")\n for(i in input){\n print(\".$i\")\n }\n}"}, {"source_code": "import java.lang.StringBuilder\n\nfun main() {\n val s = readLine()!!.toLowerCase().replace(Regex(\"[aeyuio]\"), \"\")\n val result = StringBuilder()\n s.forEach { result.append(\".$it\") }\n println(result)\n}"}, {"source_code": "fun main()\n{\n\n 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)\n}"}, {"source_code": "fun main() {\n print(readLine()!!.toLowerCase().split(\"\").filter {\n !\"A,O,Y,E,U,I\".split(\",\").map(String::toLowerCase).contains(it)\n }.dropLast(1).joinToString(separator = \".\"))\n}"}, {"source_code": "fun main(args: Array) {\n var word = readLine()!!.toUpperCase().replace(\"A\", \"\")\n .replace(\"O\", \"\")\n .replace(\"Y\", \"\")\n .replace(\"E\", \"\")\n .replace(\"U\", \"\")\n .replace(\"I\", \"\")\n .toLowerCase()\n\n val array = word.toCharArray()\n var result = \"\"\n for (ch in array) {\n result += \".$ch\"\n }\n println(result)\n}"}, {"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 a = a.replace(\" \", \"\")\n var b:String =\"\"\n for(c in a){\n b=b.plus('.').plus(c)\n }\n println(b)\n}\n"}, {"source_code": "import java.lang.StringBuilder\n\nprivate val vowels = listOf('a','o','y','e','u','i')\n\nfun main(args: Array) {\n val text = readLine()!!\n val newText = StringBuilder()\n val capVowels = vowels.map { it - 32 }\n for (char in text) {\n if (char in vowels || char in capVowels)\n continue\n val consonant = if (char.toInt() < 97) char + 32 else char\n newText.append(\".$consonant\")\n }\n print(newText)\n}"}, {"source_code": "fun main() {\n println(solution(readLine()!!))\n}\n\nfun solution(text: String): String{\n val syllables = setOf('A','O', 'Y', 'E', 'U', 'I')\n val res = mutableListOf()\n for (ch in text){\n if (syllables.contains(ch.toUpperCase())) {\n continue\n }\n res.addAll(listOf('.',ch.toLowerCase()))\n }\n return String(res.toCharArray())\n}"}], "negative_code": [{"source_code": "// kotlin oj template code from uwi(Codeforces), and convert to kotlin by lety\nimport java.io.ByteArrayInputStream\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.PrintWriter\nimport java.util.Arrays\nimport java.util.InputMismatchException\n\nlateinit var `is`: InputStream\nlateinit var out: PrintWriter\nvar INPUT = \"\"\n\n//val oj = System.getProperty(\"ONLINE_JUDGE\") != null\nval oj = true\nval inbuf = ByteArray(1024)\nvar lenbuf = 0\nvar ptrbuf = 0\n\n\nfun solve() {\n val s = ns()\n\n s.forEach {\n if(it in \"aeiou\")\n {\n }\n else\n {\n print('.')\n\n if(it.isUpperCase())\n {\n print(it.toLowerCase())\n }\n else\n {\n print(it)\n }\n }\n }\n\n}\n\nfun main() {\n `is` = if (oj) System.`in` else ByteArrayInputStream(INPUT.toByteArray())\n out = PrintWriter(System.out)\n\n val s = System.currentTimeMillis()\n solve()\n out.flush()\n tr((System.currentTimeMillis() - s).toString() + \"ms\")\n}\n\nprivate fun readByte(): Int {\n if (lenbuf == -1) throw InputMismatchException()\n if (ptrbuf >= lenbuf) {\n ptrbuf = 0\n try {\n lenbuf = `is`.read(inbuf)\n } catch (e: IOException) {\n throw InputMismatchException()\n }\n\n if (lenbuf <= 0) return -1\n }\n return inbuf[ptrbuf++].toInt()\n}\n\nprivate fun isSpaceChar(c: Int): Boolean = !(c >= 33 && c <= 126)\n\nprivate fun skip(): Int {\n var b: Int = readByte()\n while (b != -1 && isSpaceChar(b)) {\n b = readByte()\n }\n return b\n}\n\n// using ns()\nprivate fun nd(): Double = ns().toDouble()\n\n// using ns()\nprivate fun nc(): Char = skip().toChar()\n\n// input until whitespace\nprivate fun ns(): String {\n var b = skip()\n val sb = StringBuilder()\n while (!isSpaceChar(b)) { // when nextLine, (isSpaceChar(b) && b != ' ')\n sb.appendCodePoint(b)\n b = readByte()\n }\n return sb.toString()\n}\n\nprivate fun ns(n: Int): CharArray {\n val buf = CharArray(n)\n var b = skip()\n var p = 0\n while (p < n && !isSpaceChar(b)) {\n buf[p++] = b.toChar()\n b = readByte()\n }\n return if (n == p) buf else Arrays.copyOf(buf, p)\n}\n\n// matrix\nprivate fun nm(n: Int, m: Int): Array {\n val map = Array(n) { CharArray(m) }\n for (i in 0 until n) map[i] = ns(m)\n return map\n}\n\nprivate fun pm(matrix: Array) {\n val n = matrix.size\n val m = matrix[0].size\n repeat(n)\n {\n repeat(m)\n { jt ->\n out.print(matrix[it][jt])\n }\n out.println()\n }\n out.flush()\n}\n\n// int array\nprivate fun na(n: Int): IntArray {\n val a = IntArray(n)\n for (i in 0 until n) a[i] = ni()\n return a\n}\n\nprivate fun ni(): Int {\n var num = 0\n var b: Int = readByte()\n var minus = false\n while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {\n b = readByte()\n }\n if (b == '-'.toInt()) {\n minus = true\n b = readByte()\n }\n\n while (true) {\n if (b >= '0'.toInt() && b <= '9'.toInt()) {\n num = num * 10 + (b - '0'.toInt())\n } else {\n return if (minus) -num else num\n }\n b = readByte()\n }\n}\n\nprivate fun nl(): Long {\n var num: Long = 0\n var b: Int = readByte()\n var minus = false\n while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {\n b = readByte()\n }\n if (b == '-'.toInt()) {\n minus = true\n b = readByte()\n }\n\n while (true) {\n if (b >= '0'.toInt() && b <= '9'.toInt()) {\n num = num * 10 + (b - '0'.toInt())\n } else {\n return if (minus) -num else num\n }\n b = readByte()\n }\n}\n\nprivate fun tr(vararg o: Any) {\n// if (!oj) println(Arrays.deepToString(o))\n}\n\n"}, {"source_code": "// kotlin oj template code from uwi(Codeforces), and convert to kotlin by lety\nimport java.io.ByteArrayInputStream\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.PrintWriter\nimport java.util.Arrays\nimport java.util.InputMismatchException\n\nlateinit var `is`: InputStream\nlateinit var out: PrintWriter\nvar INPUT = \"\"\n\n//val oj = System.getProperty(\"ONLINE_JUDGE\") != null\nval oj = true\nval inbuf = ByteArray(1024)\nvar lenbuf = 0\nvar ptrbuf = 0\n\n\nfun solve() {\n val s = ns()\n\n s.forEach {\n if(it in \"aeiouAEIOU\")\n {\n }\n else\n {\n print('.')\n\n if(it.isUpperCase())\n {\n print(it.toLowerCase())\n }\n else\n {\n print(it)\n }\n }\n }\n\n}\n\nfun main() {\n `is` = if (oj) System.`in` else ByteArrayInputStream(INPUT.toByteArray())\n out = PrintWriter(System.out)\n\n val s = System.currentTimeMillis()\n solve()\n out.flush()\n tr((System.currentTimeMillis() - s).toString() + \"ms\")\n}\n\nprivate fun readByte(): Int {\n if (lenbuf == -1) throw InputMismatchException()\n if (ptrbuf >= lenbuf) {\n ptrbuf = 0\n try {\n lenbuf = `is`.read(inbuf)\n } catch (e: IOException) {\n throw InputMismatchException()\n }\n\n if (lenbuf <= 0) return -1\n }\n return inbuf[ptrbuf++].toInt()\n}\n\nprivate fun isSpaceChar(c: Int): Boolean = !(c >= 33 && c <= 126)\n\nprivate fun skip(): Int {\n var b: Int = readByte()\n while (b != -1 && isSpaceChar(b)) {\n b = readByte()\n }\n return b\n}\n\n// using ns()\nprivate fun nd(): Double = ns().toDouble()\n\n// using ns()\nprivate fun nc(): Char = skip().toChar()\n\n// input until whitespace\nprivate fun ns(): String {\n var b = skip()\n val sb = StringBuilder()\n while (!isSpaceChar(b)) { // when nextLine, (isSpaceChar(b) && b != ' ')\n sb.appendCodePoint(b)\n b = readByte()\n }\n return sb.toString()\n}\n\nprivate fun ns(n: Int): CharArray {\n val buf = CharArray(n)\n var b = skip()\n var p = 0\n while (p < n && !isSpaceChar(b)) {\n buf[p++] = b.toChar()\n b = readByte()\n }\n return if (n == p) buf else Arrays.copyOf(buf, p)\n}\n\n// matrix\nprivate fun nm(n: Int, m: Int): Array {\n val map = Array(n) { CharArray(m) }\n for (i in 0 until n) map[i] = ns(m)\n return map\n}\n\nprivate fun pm(matrix: Array) {\n val n = matrix.size\n val m = matrix[0].size\n repeat(n)\n {\n repeat(m)\n { jt ->\n out.print(matrix[it][jt])\n }\n out.println()\n }\n out.flush()\n}\n\n// int array\nprivate fun na(n: Int): IntArray {\n val a = IntArray(n)\n for (i in 0 until n) a[i] = ni()\n return a\n}\n\nprivate fun ni(): Int {\n var num = 0\n var b: Int = readByte()\n var minus = false\n while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {\n b = readByte()\n }\n if (b == '-'.toInt()) {\n minus = true\n b = readByte()\n }\n\n while (true) {\n if (b >= '0'.toInt() && b <= '9'.toInt()) {\n num = num * 10 + (b - '0'.toInt())\n } else {\n return if (minus) -num else num\n }\n b = readByte()\n }\n}\n\nprivate fun nl(): Long {\n var num: Long = 0\n var b: Int = readByte()\n var minus = false\n while (b != -1 && !(b >= '0'.toInt() && b <= '9'.toInt() || b == '-'.toInt())) {\n b = readByte()\n }\n if (b == '-'.toInt()) {\n minus = true\n b = readByte()\n }\n\n while (true) {\n if (b >= '0'.toInt() && b <= '9'.toInt()) {\n num = num * 10 + (b - '0'.toInt())\n } else {\n return if (minus) -num else num\n }\n b = readByte()\n }\n}\n\nprivate fun tr(vararg o: Any) {\n// if (!oj) println(Arrays.deepToString(o))\n}\n\n"}, {"source_code": "fun main()\n{\n val given = readLine()!!\n var answer = \"\"\n for (i in given)\n {\n if (! \"AEIOUaeiou\".contains(i))\n {\n answer += \".\"+i.toLowerCase()\n }\n }\n println(answer)\n}"}, {"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 result = readLn()\n result.toLowerCase()\n result = result.replace(\"a\",\"\")\n result = result.replace(\"e\",\"\")\n result = result.replace(\"y\",\"\")\n result = result.replace(\"u\",\"\")\n result = result.replace(\"i\",\"\")\n result = result.replace(\"o\",\"\")\n var newChars = \"\"\n for (i in 0 until result.length) {\n newChars = newChars.plus(\".\").plus(result[i])\n }\n println(newChars.toString())\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()"}, {"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 result = readLn()\n result.toLowerCase()\n result.removeVowels()\n var newChars = \"\"\n for (i in 0 until result.length) {\n newChars = \".\".plus(result[i])\n }\n println(newChars.toString())\n}\n\nfun String.removeVowels() {\n this.replace(\"a\",\"\",false)\n this.replace(\"e\",\"\",false)\n this.replace(\"y\",\"\",false)\n this.replace(\"u\",\"\",false)\n this.replace(\"i\",\"\",false)\n this.replace(\"o\",\"\",false)\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()"}, {"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 result = readLn()\n result.toLowerCase()\n result.removeVowels()\n var newChars = \"\"\n for (i in 0 until result.length) {\n newChars = \".\".plus(result[i])\n }\n println(result)\n}\n\nfun String.removeVowels() {\n this.replace(\"a\",\"\",false)\n this.replace(\"e\",\"\",false)\n this.replace(\"y\",\"\",false)\n this.replace(\"u\",\"\",false)\n this.replace(\"i\",\"\",false)\n this.replace(\"o\",\"\",false)\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()"}, {"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 result = readLn()\n result.toLowerCase()\n result = result.replace(\"a\",\"\")\n result = result.replace(\"e\",\"\")\n result = result.replace(\"y\",\"\")\n result = result.replace(\"u\",\"\")\n result = result.replace(\"i\",\"\")\n result = result.replace(\"o\",\"\")\n var newChars = \"\"\n for (i in 0 until result.length) {\n newChars = newChars.plus(\".\").plus(result[i])\n }\n println(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)\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()"}, {"source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n Scanner(System.`in`).use {\n val result = it.next().formatWithDots()\n println(result)\n }\n}\n\nfun String.formatWithDots(): String {\n val builder = StringBuilder()\n val dot = \".\"\n for (char in this) {\n if (char.isVowel()) {\n continue\n }\n builder.append(dot).append(Character.toLowerCase(char))\n }\n return builder.toString()\n}\n\nfun Char.isVowel() = when (this) {\n 'a', 'A', 'o', 'O', 'e', 'E', 'u', 'U', 'i', 'I' -> true\n else -> false\n}"}, {"source_code": "import java.util.*\n\n fun main(){\n var input = Scanner(System.`in`)\n var programString = input.nextLine()\n var string =\"\"\n programString.toLowerCase().replace(\"a\",\"\")\n programString.toLowerCase().toCharArray().forEach {\n string =string+changeChar(it)\n }\n System.out.println(string)\n }\n\nfun changeChar(char : Char) : String{\n if(char == 'a' || char == 'e' || char == 'i' || char == 'o' || char == 'u'){\n return \"\"\n }else if(char == 'y' || char == 'z'){\n return char.toString()\n }else{\n return \".${char}\"\n }\n}\n\n\n\n\n"}, {"source_code": "import java.util.*\n\n fun main(){\n var input = Scanner(System.`in`)\n var programString = input.nextLine()\n var string =\"\"\n programString.toLowerCase().toCharArray().forEach {\n string =string+changeChar(it)\n }\n System.out.println(string)\n }\n\nfun changeChar(char : Char) : String{\n if(char == 'a' || char == 'e' || char == 'i' || char == 'o' || char == 'u'){\n return \"\"\n }else{\n return \".${char}\"\n }\n}\n\n\n\n\n"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val vowels = hashSetOf('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U')\n val br = BufferedReader(InputStreamReader(System.`in`))\n val s = br.readLine()\n val newS = s.filter { c -> !(c in vowels) }\n .map { c -> if (c.isUpperCase()) c.toLowerCase() else c}\n .joinToString(\".\")\n println(\".$newS\")\n}"}, {"source_code": "//package problem118a\n\nimport java.lang.StringBuilder\n\nfun convertWord(word: String): String {\n val initialModifications = word.toLowerCase().filter { \"aeiou\".indexOf(it) == -1 }\n\n val result = StringBuilder()\n for (char in initialModifications) {\n result.append(\".$char\")\n }\n\n return result.toString()\n}\n\nfun main() {\n val input = readLine()!!\n println(convertWord(input))\n}\n"}, {"source_code": "//package problem118a\n\nimport java.lang.StringBuilder\n\nfun convertWord(word: String): String {\n val initialModifications = word.filter { \"aeiou\".indexOf(it) == -1 }\n\n val result = StringBuilder()\n for (char in initialModifications) {\n result.append(\".$char\")\n }\n\n return result.toString().toLowerCase()\n}\n\nfun main() {\n val input = readLine()!!\n println(convertWord(input))\n}\n"}, {"source_code": "//package problem118a\n\nimport java.lang.StringBuilder\n\nfun convertWord(word: String): String {\n val initialModifications = word.filter { \"aeiouAEIOU\".indexOf(it) == -1 }\n\n val result = StringBuilder()\n for (char in initialModifications) {\n result.append(\".$char\")\n }\n\n return result.toString().toLowerCase()\n}\n\nfun main() {\n val input = readLine()!!\n println(convertWord(input))\n}\n"}, {"source_code": "fun main(args: Array) {\n\n val otherStrings = arrayOf(\"a\", \"o\", \"y\", \"e\", \"u\", \"i\")\n val line = readLine()!!.toLowerCase()\n val chars = line.toCharArray()\n for (item in chars){\n if(otherStrings.contains(\"\" + item)){\n print(\".\")\n }\n else {\n print(item)\n }\n }\n\n\n\n}"}, {"source_code": "import java.lang.StringBuilder\nimport java.util.Scanner\n\n fun main() {\n val scanner = Scanner(System.`in`)\n val word: String = scanner.nextLine()\n val result = StringBuilder()\n\n for(char:Char in word) {\n if(!\"aoyeui\".contains(char.toLowerCase())){\n result.append(\".$char\")\n }\n }\n print(result.toString())\n }"}, {"source_code": "fun main(arg: Array){\n val s = readLine()!!\n val b = arrayOf('a','e','y','u','i','o')\n println(s.toLowerCase().filter { it !in b }.asIterable().joinToString(separator = \".\"))\n}"}, {"source_code": "import java.io.BufferedOutputStream\nimport java.io.PrintWriter\nimport java.util.*\n\n\n\nfun fn1 (x : String) : String{\n var res = \"\"\n val v = setOf('a', 'e', 'i', 'o', 'u')\n for (w in x){\n if (v.contains(w)){\n continue\n }\n res += \".${w.toLowerCase()}\"\n }\n return res\n}\n\nfun main() {\n val sc = Scanner(System.`in`)\n val out = PrintWriter(BufferedOutputStream(System.out))\n\n// val testCases = sc.nextInt()\n//\n// val a = mutableListOf>()\n//\n// for (i in 0..testCases) {\n// val word = sc.nextLine().split(\" \")\n// for (w in word) out.println(w)\n// a.add(word)\n// }\n val tescase = sc.nextLine()\n out.println(fn1(tescase))\n out.close()\n sc.close()\n}"}, {"source_code": "import java.util.Scanner\n\n/**\n *Created by Kartik Patodi on 28-05-2017.\n **/\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n var s = sc.nextLine()\n s = s.stringTask().substring(0..s.length-1)\n println(s)\n}\n\nfun String.stringTask() = this.replace(\"[aeiouAEIOU]+\".toRegex(), \"\").toLowerCase().replace(\"\", \".\")\n\n"}, {"source_code": "import java.util.Scanner\n\n/**\n *Created by Kartik Patodi on 28-05-2017.\n **/\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n var s = sc.nextLine()\n s = s.stringTask()\n println(s)\n}\n\nfun String.stringTask() = this.replace(\"[aeiouAEIOU]+\".toRegex(), \"\").toLowerCase().replace(\"\", \".\").substring(0..this.length-2)\n\n"}, {"source_code": "import java.util.Scanner\n\n/**\n *Created by Kartik Patodi on 28-05-2017.\n **/\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n var s = sc.nextLine()\n s = s.stringTask()\n println(s)\n}\n\nfun String.stringTask() = this.replace(\"[aeiouAEIOU]+\".toRegex(), \"\").toLowerCase().replace(\"\", \".\").dropLast(1)\n\n"}, {"source_code": "import java.util.Scanner\n\n/**\n *Created by Kartik Patodi on 28-05-2017.\n **/\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n var s = sc.nextLine()\n s=s.stringTask()\n when(s){\n \".\" -> println(\"\")\n else -> println(s)\n }\n}\n\nfun String.stringTask() = this.replace(\"[aeiou]\".toRegex(),\"\").replace(\"\",\".\")\n\n"}, {"source_code": "import java.util.Scanner\n\n/**\n *Created by Kartik Patodi on 28-05-2017.\n **/\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n var s = sc.nextLine()\n s=s.stringTask()\n when(s){\n \".\" -> println(\"\")\n else -> println(s.substring(0 until s.length))\n }\n}\n\nfun String.stringTask() = this.replace(\"[aeiou]\".toRegex(),\"\").replace(\"\",\".\")\n\n"}, {"source_code": "fun main(args: Array) {\n val str = readLine()!!.toLowerCase().replace(Regex(\"[AaEeIiOoUu]\"), \"\")\n println(str.replace(Regex(\"(?i)([bcdfghjklmnpqrstvwxyz])\"), \".$1\"))\n}\n"}, {"source_code": "\nimport java.lang.StringBuilder\n \nfun main(args: Array) {\n \n val vowels: String = \"AOYEUI\"\n \n if (args.size < 1) {\n return\n }\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 \n println(result.toString())\n \n}"}, {"source_code": "import java.lang.StringBuilder\n\nfun main(args: Array) {\n\n val vowels: String = \"AOYEUI\"\n\n if (args.size < 1) {\n return\n }\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\n print(result.toString())\n\n}"}, {"source_code": "import java.util.*\n\nprivate val scan = Scanner(System.`in`)\n\nfun main(args: Array) {\n\n scan.next()\n .toLowerCase()\n .filter { it !in listOf('a', 'e', 'i', 'o', 'u') }\n .flatMap { listOf('.', it) }\n .joinToString(separator = \"\")\n .run { println(this) }\n}\n"}, {"source_code": "fun main() {\n val x = readLine()!!.toLowerCase()\n println(x.replace(\"[aoyeui]+\".toRegex(), \"\").replace(\".\".toRegex()) { \".\" + it })\n}"}, {"source_code": "fun main() {\n val x = readLine()!!.toLowerCase()\n println(x.replace(\"[aoyeui]+\".toRegex(), \".\"))\n}"}, {"source_code": "fun main(args: Array) {\n val word = readLine()!!.toUpperCase()\n\n word.apply {\n replace(\"A\", \"\")\n replace(\"O\", \"\")\n replace(\"Y\", \"\")\n replace(\"E\", \"\")\n replace(\"U\", \"\")\n replace(\"I\", \"\")\n }\n var array = word.toCharArray()\n var result = \"\"\n for (ch in array) {\n result += \".$ch\"\n }\n println(result)\n}"}, {"source_code": "/**\n * Created by rohit.jh on 21/01/18\n */\nfun applyOperations(a:Char):String{\n val x = a.toLowerCase()\n return if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') \"\"\n else \".$x\"\n}\nfun main(args:Array){\n val str:String = readLine()!!\n for ( i in 0 until str.length){\n print(applyOperations(str[i]))\n }\n}"}, {"source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\n\nfun main() = output {\n val string = read()\n val result = string\n .toLowerCase()\n .replace(Regex(\"[aeiou]\"), \"\")\n .replace(Regex(\".\")) {\n \".${it.value}\"\n }\n\n println(result)\n}\n\n@JvmField\nval INPUT = System.`in`\n\n@JvmField\nval OUTPUT = System.out\n\n@JvmField\nval _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n\n@JvmField\nvar _tokenizer: StringTokenizer = StringTokenizer(\"\")\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() }\n\n@JvmField\nval _writer = PrintWriter(OUTPUT, false)\n\nfun output(block: PrintWriter.() -> Unit) {\n _writer.apply(block).flush()\n}\n\n\n"}, {"source_code": "fun main()\n{\n var s = readLine()!!.toString()\n for (c in s)\n {\n if(c!='a' && c!='A' && c!='e' && c!='E' && c!='i' && c!='I' && c!='o' && c!='u' && c!='U' && c!='y' && c!='Y')\n print(\".$c\")\n }\n}"}, {"source_code": "\n\nfun main()\n{\n var st = readLine()!!\n st = st.toLowerCase()\n println(st)\n var s : String = \"\"\n val arr = arrayOf('a','o','y','e','u','i')\n for(i in st)\n {\n if(i !in arr)\n {\n s = s.plus(\".\"+i)\n }\n }\n println(s)\n}"}, {"source_code": "fun main() {\n val input = readLine()!!\n val vowels = Regex(\"[aeiou]\")\n val intermed = vowels.replace(input.toLowerCase(), \"\")\n var answer = \"\"\n for(i in 0..intermed.length - 1){\n answer += \".\" + intermed[i]\n }\n print(answer)\n}"}, {"source_code": "/* template start */\n// input\nprivate fun readString() = readLine()!!\nprivate fun readStrings() = readString().split(\" \")\nprivate fun readInt() = readString().toInt()\nprivate fun readDigits() = readString().map { it - '0' }\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\n\n// output\nprivate fun T.print(map: (T) -> String = { it.toString() }) = println(map(this))\nprivate fun Iterable.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)\nprivate fun Array.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)\nprivate fun Sequence.print(sep: String? = null, map: ((T) -> String)? = null) =\n println(joinToString(sep ?: \"\", transform = map ?: { it.toString() }))\n\n// various\nprivate val Int.isEven: Boolean get() = this % 2 == 0\nprivate val Int.isOdd: Boolean get() = !this.isEven\nprivate fun queries(block: (Int) -> Unit) = repeat(readInt(), block)\n\n/* template end */\n\nfun main() {\n val input = readString()\n buildString {\n for (c in input) {\n val c = c.toLowerCase()\n if (c !in setOf('a', 'e', 'i', 'o', 'u')) {\n append('.')\n append(c)\n }\n }\n }.print()\n}"}], "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b"} {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (_, busSize) = readInts()\n val groupsSizes = readInts()\n var currentSize = busSize\n var sol = 1\n for (groupSize in groupsSizes)\n if (groupSize <= currentSize)\n currentSize -= groupSize\n else {\n sol++\n currentSize = busSize - groupSize\n }\n print(sol)\n}", "positive_code": [{"source_code": "fun main(args: Array) {\n val nm = readLine()!!.trim().split(\" \").map {it.trim().toInt()}.toIntArray()\n val a = readLine()!!.trim().split(\" \").map {it.trim().toInt()}.toIntArray()\n var result = 1\n var people=0\n for (i in 0 until nm[0]){\n if (people + a[i] <= nm[1]){\n people+=a[i]\n }\n else{\n result++\n people=a[i]\n }\n }\n println(result)\n\n}"}, {"source_code": "fun main() {\n var (n, m) = readLine()!!.split(\" \").map { it.toInt() }\n var list = readLine()!!.split(\" \").map { it.toInt() }\n\n var busSize = m\n var count = 1\n for (i in list) {\n if (i <= busSize) {\n busSize = busSize - i\n } else {\n count++\n busSize = m - i\n }\n }\n println(count)\n\n}"}], "negative_code": [{"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}"}, {"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 if (groupnums.sum()==groupBus[1])countbuses=1\n else {\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 }\n countbuses++\n }\n }\n println(countbuses)\n}"}, {"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 =0\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 if (count == groupBus[0])break\n countbuses++\n }\n println(countbuses) \n}"}, {"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}"}], "src_uid": "5c73d6e3770dff034d210cdd572ccf0f"} {"source_code": "fun main( args: Array ) {\n val modulo = 1000000007L\n fun modexp( aa: Long, nn: Long ): Long {\n var a = aa\n var n = nn\n var r = 1L\n while ( n > 0 ) {\n if ( n and 1L > 0L ) r = ( r * a ) % modulo\n a = ( a * a ) % modulo\n n /= 2\n }\n return r\n }\n val ( a, b ) = readLine()!!.split( \" \" ).map { it.toLong() }\n println( modexp( ( modexp( 2L, b ) - 1L ), a ) )\n}", "positive_code": [{"source_code": "val MOD = 1000000007\n\nfun pow(a: Long, n: Long): Long {\n if (n == 0L) return 1\n if (n % 2 == 1L) {\n val tmp = pow(a, n-1)\n return (tmp * a) % MOD\n } else {\n val c = pow(a, n / 2)\n return (c * c) % MOD\n }\n}\n\nfun main(args: Array) {\n var (n, m) = readLine()!!.split(' ').map { it.toLong() }\n print(pow((pow(2, m) - 1), n))\n}"}, {"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\nfun powMod(a: Int, n: Long, mod: Int): Long {\n if (n == 0L) return 1\n val res = powMod((a.toLong() * a % mod).toInt(), n / 2, mod)\n return if (n % 2 == 1L) res * a % mod else res\n}\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val n = nl()\n val m = nl()\n val p = (MOD + powMod(2, m, MOD) - 1) % MOD\n out.println(powMod(p.toInt(), n, 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}"}, {"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 numCombinationsOfEachKind = fastPow(2, m)-1\n var res = fastPow(numCombinationsOfEachKind, n)\n\n println(res)\n}"}, {"source_code": "fun main(args: Array) {\n val MOD = 1000000007L\n\n fun mod(x: Long) = (x % MOD + MOD) % MOD\n\n fun pow(x: Long, p: Long): Long {\n if (p == 0L) {\n return 1L\n }\n\n val halfPow = pow(x, p / 2)\n\n return if (p % 2L == 0L) mod(halfPow * halfPow) else mod(x * mod(halfPow * halfPow))\n }\n\n val (n, m) = readLine()!!.split(' ').map { it.toLong() }\n\n println(pow(mod(pow(2L, m) - 1L), n))\n}"}, {"source_code": "@file:Suppress(\"NOTHING_TO_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 // immediate println for interactive\n\nfun main() {\n output {\n val n = readInt()\n val m = readInt()\n\n val ans = (ModInt(2).pow(m) - 1).pow(n)\n\n println(ans.int)\n }\n}\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 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\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()"}, {"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.nextLong()\n val m = sc.nextLong()\n println((ModInt(2).pow(m)-ModInt(1)).pow(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}\n\nprivate class ModInt(x: Long) {\n\n companion object {\n const val MOD = 1e9.toLong() + 7\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}"}, {"source_code": "import java.math.BigInteger\n\nfun main() {\n val (numKinds, numFriends) = readLine()!!.split(\" \").map(String::toLong)\n print(\n BigInteger.valueOf(2L)\n .modPow(BigInteger.valueOf(numFriends), BigInteger.valueOf(1000000007L))\n .minus(BigInteger.ONE)\n .modPow(BigInteger.valueOf(numKinds), BigInteger.valueOf(1000000007L))\n )\n}"}, {"source_code": "import java.util.ArrayList\nimport java.util.Arrays\nimport java.util.Scanner\n\n\n internal var mod = (1e9 + 7).toLong()\n\n\n \n fun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val m = sc.nextInt()\n val sh = pow(2, m.toLong()) - 1\n print(pow(sh, n.toLong()))\n }\n\n private fun pow(a: Long, b: Long): Long {\n if (b == 0L) return 1L\n var p = pow(a, b / 2) % mod\n p = p * p % mod\n if (b and 1 != 0L) p = a * p % mod\n return p\n }\n\n\n\n"}], "negative_code": [], "src_uid": "71029e5bf085b0f5f39d1835eb801891"} {"source_code": "fun main(args: Array)\n{ var c: Int=0\n\tvar x= readLine()!!.toInt()\n\tfor(i in 1..x)\n\t\t{\n\t\t\tfor(j in 1..(i*x))\n\t\t\t\t{\n\t\t\t\t\tif((j*i)>x && (j%i)==0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintln(\"$j $i\")\n\t\t\t\t\t\t\tc++\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif(c==1)break\n\t\t\t\t\n\t\t}\n\tif(c==0)println(\"-1\")\n\t\n}", "positive_code": [{"source_code": "\nfun main(args : Array) {\n\n val n1 = readLine()!!\n var n = n1.toInt()\n var a = 0\n var b = 0\n var c = 0\n\n if(n==1){\n c = 0\n }\n else{\n for(i in 1..n){\n for(j in 1..n){\n if(i%j==0 && i/jn){\n a = i\n b = j\n c++\n break\n }\n }\n }\n\n\n }\n\n if(c==0){\n println(-1)\n }\n else{\n print(a)\n print(\" \")\n print(b)\n }\n}"}, {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val n = r.readLine()!!.toInt()\n println(if (n==1) -1 else \"$n $n\")\n}"}, {"source_code": "import java.io.*\nval br = BufferedReader(InputStreamReader(System.`in`))\nval bw = BufferedWriter(OutputStreamWriter(System.out))\nfun println(s: String) { bw.write(s + \"\\n\") }\nfun readLine() = br.readLine()!!\n\nfun main(args: Array) {\n solve()\n bw.close()\n}\n\nfun solve() {\n val r = readLine().toInt()\n for (a in 1..r) {\n for (b in 1..r) {\n if (a % b == 0 && a * b > r && a.toDouble() / b.toDouble() < r ) {\n println(\"$a $b\")\n return\n }\n }\n }\n println(\"-1\")\n\n}"}, {"source_code": "fun constructIntegers(n:Int):String{\n val a=n\n val b=n\n if(n > 1) {\n return a.toString()+\" \"+b.toString()\n }\n return \"-1\"\n }\n fun main(args : Array){\n println(constructIntegers(readLine()!!.toInt()))\n}"}, {"source_code": "fun main() {\n val x = readLine()!!.toInt()\n if (x == 1) {\n println(-1)\n } else {\n println(\"${x - (x and 1)} 2\")\n }\n}"}, {"source_code": "private fun read(delimit: Char = ' ') = readLine()!!.split(delimit)\n\nfun main(args: Array) {\n val (num) = read().map(String::toInt)\n\n var found = false\n\n for (x in 2..num) {\n val a = x\n val b = x/2\n\n if ((a%b == 0) && ((a/b) < num) && ((a*b) > num)) {\n print(\"$a $b\")\n found = true\n break\n }\n }\n\n if (!found) {\n for (x in 2..num) {\n val a = x\n val b = x\n\n if ((a%b == 0) && ((a/b) < num) && ((a*b) > num)) {\n print(\"$a $b\")\n found = true\n break\n }\n }\n }\n\n if (!found) {\n println(-1)\n }\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n var a = n\n var b = n\n if (n == 1) {\n println(-1)\n } else {\n println(\"$a $b\")\n }\n}\n\n"}, {"source_code": "import java.io.*\nimport kotlin.system.measureTimeMillis\n\nfun solve(input: BufferedReader) {\n val x = input.readLine().toInt()\n for (a in 1..x)\n for (b in 1..x)\n if (a % b == 0 && a / b < x && a * b > x) {\n print(\"%d %d\\n\".format(a, b))\n return\n }\n println(-1)\n}\n\n\nfun main(args: Array) {\n System.err.println(\"time = %dms\".format(measureTimeMillis {\n solve(System.`in`.bufferedReader())\n// solve(File(\"a.out\").bufferedReader())\n }))\n}\n"}, {"source_code": "import java.util.*\n \nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n var x = sc.nextInt()\n if(x == 1) println(-1)\n else print(\"${x} ${x}\")\n}\n"}, {"source_code": "fun main() {\n val x = readLine()!!.toInt()\n for (b in 1..x)\n for (a in b..x step b)\n if (a * b > x && a / b < x) return print(\"$a $b\")\n print(-1)\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val result = solve(n)\n if (result == null) {\n println(-1)\n } else {\n println(\"${result.first} ${result.second}\")\n }\n}\n\nfun solve(x: Int): Pair? {\n for (b in 1..x) {\n for (a in x downTo 1) {\n if (a % b == 0) {\n if (a * b > x) {\n if (a.toFloat()/b.toFloat() < x) {\n return a to b\n }\n }\n }\n }\n }\n\n return null\n}\n\n"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n Scanner(System.`in`).forEach {\n val x = it.toInt()\n for (a in 1..100) {\n for (b in 1..100) {\n if (a % b == 0 && b <= x && a * b > x && a / b < x) {\n println(\"$a $b\")\n return\n }\n }\n }\n println(\"-1\")\n return\n }\n\n}"}, {"source_code": "fun main()\n{ var c: Int=0\n\tvar x= readLine()!!.toInt()\n\tfor(i in 1..x)\n\t\t{\n\t\t\tfor(j in 1..(i*x))\n\t\t\t\t{\n\t\t\t\t\tif((j*i)>x && (j%i)==0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintln(\"$j $i\")\n\t\t\t\t\t\t\tc++\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif(c==1)break\n\t\t\t\t\n\t\t}\n\tif(c==0)println(\"-1\")\n\t\n}"}, {"source_code": "import java.io.*\nimport java.util.*\n\nclass A {\n fun solve(x : Int) : Pair {\n if (x == 1) {\n return Pair(-1, -1)\n }\n if (x % 2 == 0) {\n return Pair(x, 2)\n } else {\n return Pair(x - 1, 2)\n }\n }\n\n fun solve(input : InputStream, output : OutputStream) {\n val reader = InputReader(BufferedInputStream(input))\n val writer = PrintWriter(BufferedOutputStream(output))\n\n val x = reader.nextInt()\n val (a, b) = solve(x)\n if (a == -1) {\n writer.println(\"-1\")\n } else {\n writer.println(\"$a $b\")\n }\n\n writer.close()\n }\n\n private class InputReader(stream: InputStream) {\n var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n 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}\n\nfun main(args : Array) {\n A().solve(System.`in`, System.out)\n}"}], "negative_code": [{"source_code": "fun constructIntegers(n:Int):String{\n var a = 0\n var b = 0\n if(n > 3) {\n for(i in n downTo 2){\n a = i\n for(j in a-1 downTo 2) {\n b = j\n if (a%b == 0 && a*b > n && a/b < n){\n return a.toString()+\" \"+b.toString()\n }\n }\n }\n }\n return \"-1\"\n }\n\n fun main(args: Array){\n println(constructIntegers(readLine()!!.toInt()))\n}"}, {"source_code": "fun main() {\n val x = readLine()!!.toInt()\n if (x == 1) {\n println(-1)\n } else {\n println(\"${x + (x and 1)} 2\")\n }\n}"}, {"source_code": "private fun read(delimit: Char = ' ') = readLine()!!.split(delimit)\n\nfun main(args: Array) {\n val (num) = read().map(String::toInt)\n\n var found = false\n\n for (x in 1..num) {\n if (x * 2 <= num) {\n print(\"$x ${x * 2}\")\n found = true\n break\n }\n }\n\n if (!found) {\n println(-1)\n }\n}"}, {"source_code": "private fun read(delimit: Char = ' ') = readLine()!!.split(delimit)\n\nfun main(args: Array) {\n val (num) = read().map(String::toInt)\n\n var found = false\n\n for (x in 2..num) {\n\n if ((x%2 == 0) && (x/2 < num) && (x*2 > num)) {\n print(\"$x ${x / 2}\")\n found = true\n break\n }\n }\n\n if (!found) {\n println(-1)\n }\n}"}, {"source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n var a = n/2\n var b = n/2\n while (!c(a,b,n)) {\n if (a <1 || a > n || b < 1 || b > n) {\n println(-1)\n return\n }\n a++\n b--\n }\n print(\"$a $b\")\n}\n\nfun c(a: Int, b: Int, n: Int) = a*b > n && a/b < n && a%b == 0\n\n"}, {"source_code": "fun main()\n{ var c: Int=0\n\tvar x= readLine()!!.toInt()\n\tfor(i in 1..x-1)\n\t\t{\n\t\t\tfor(j in 1..(i*x)-1)\n\t\t\t\t{\n\t\t\t\t\tif((j*i)>x && (j%i)==0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tprintln(\"$j $i\")\n\t\t\t\t\t\t\tc++\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif(c==1)break\n\t\t\t\t\n\t\t}\n\tif(c==0)println(\"-1\")\n\t\n}"}], "src_uid": "883f67177474d23d7a320d9dbfa70dd3"} {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (_, desksPerLane, santaPlace) = readInts()\n val lane = santaPlace / (2 * desksPerLane) + if (santaPlace % (2 * desksPerLane) == 0) 0 else 1\n val deskInLane = santaPlace - (lane - 1) * 2 * desksPerLane\n val numRow = (deskInLane + 1) / 2\n print(\"$lane $numRow ${if (santaPlace % 2 == 0) 'R' else 'L'}\")\n}", "positive_code": [{"source_code": "fun main(args: Array) {\n val (n, m, k) = readLine()!!.split(\" \").map(String::toInt)\n val lane = ((k-1) / (2 * m)) + 1\n val desk = (((k-1)/2) % m) + 1\n val side = if(k%2 == 1) \"L\" else \"R\"\n println(\"$lane $desk $side\")\n}"}, {"source_code": "fun findRow(k: Int, m: Int) = if ((k / 2) % m == 0) (k / 2) / m else (k / 2) / m + 1\n\nfun findDesk(k: Int, m: Int) = if ((k / 2) % m == 0) m else (k / 2) % m\n\nfun main(args: Array) {\n val (n, m, k) = readLine()!!.split(\" \").map(String::toInt)\n var side = 'R'\n var row: Int\n var desk: Int\n if (k % 2 == 0) {\n row = findRow(k, m)\n desk = findDesk(k, m)\n } else {\n row = findRow(k+1, m)\n desk = findDesk(k+1, m)\n side = 'L'\n }\n println(\"$row $desk $side\")\n}"}], "negative_code": [], "src_uid": "d6929926b44c2d5b1a8e6b7f965ca1bb"} {"source_code": "import kotlin.math.*\n\nprivate const val MOD = 998244353\n\nfun main(args: Array) {\n val (n, k) = readLine()!!.split(\" \").map { it.toInt() }\n val c = Array(n + 1) { IntArray(n + 1) }\n val d = Array(n + 1) { IntArray(n + 1) }\n c[0][0] = 1\n d[0][0] = 1\n for (x in 1..n) {\n for (m in 1..x) {\n c[x][m] = d[x - m][min(m, x - m)]\n for (l in 1 until m) {\n c[x][m] = add(c[x][m], c[x - l][m])\n }\n d[x][m] = add(c[x][m], d[x][m - 1])\n }\n }\n var sum = 0\n wl@ for (w in 1..n) {\n for (h in 1..n) {\n if (w * h >= k) continue@wl\n sum = add(sum, mul(c[n][w], c[n][h]))\n }\n }\n sum = mul(sum, 2)\n println(sum)\n}\n\nprivate fun add(a: Int, b: Int): Int = ((a.toLong() + b) % MOD).toInt()\nprivate fun mul(a: Int, b: Int): Int = ((a.toLong() * b) % MOD).toInt()\n", "positive_code": [{"source_code": "import java.util.*\n\nval MOD = 998244353L\n\nfun main() {\n val jin = Scanner(System.`in`)\n val n = jin.nextInt()\n val k = jin.nextInt()\n val amts = LongArray(n + 1) {\n if (it == 0) {\n 0L\n } else {\n val dp = LongArray(n + 1)\n dp[0] = 1L\n var sum = 1L\n for (j in 1..n) {\n dp[j] = sum\n sum += dp[j]\n if (j >= it) {\n sum -= dp[j - it]\n }\n sum %= MOD\n }\n dp[n]\n }\n }\n for (j in n downTo 1) {\n amts[j] -= amts[j - 1]\n }\n var answer = 0L\n for (a in 1..n) {\n for (b in 1..n) {\n if (a * b < k) {\n answer += amts[a] * amts[b]\n answer %= MOD\n }\n }\n }\n answer *= 2\n println(((answer % MOD) + MOD) % MOD)\n}"}], "negative_code": [], "src_uid": "77177b1a2faf0ba4ca1f4d77632b635b"} {"source_code": "fun main(args: Array) = println(arrayOf(readLine()!!, readLine()!!, readLine()!!).map(String::toInt).let { (a, b, c) -> arrayOf(a + b + c, a * b * c, a + b * c, a * b + c, (a + b) * c, a * (b + c)).max() })", "positive_code": [{"source_code": "fun main() {\n val a = readLine()!!.toInt()\n val b = readLine()!!.toInt()\n val c = readLine()!!.toInt()\n\n println(arrayOf(\n a + b + c,\n a + b * c,\n a * b * c,\n a * b + c,\n a * (b + c),\n (a + b) * c\n ).max())\n}"}, {"source_code": " fun main()\n {\n //\n var a:Int= readLine()!!.toInt()\n var b:Int= readLine()!!.toInt()\n var c:Int= readLine()!!.toInt()\n var s=0\n if((a==0|| a==1) && (c==0|| c==1))\n {\n s=a+b+c\n print(s)\n return\n }\n if((b==0|| b==1))\n {\n s= maxOf(((a+b)*c),((c+b)*a))\n print(s)\n return\n }\n if((a!=0&& a!=1) && (c!=0&& c!=1)&& (b!=0 && b!=1))\n {\n s=a*b*c\n print(s)\n return\n }\n\n if((a==0|| a==1)&&((b!=0)&&(b!=1))&&((c!=0)&&(c!=1)))\n {\n s=(a+b)*c\n print(s)\n return\n }\n if((c==0|| c==1)&&((b!=0)&&(b!=1))&&((a!=0)&&(a!=1)))\n {\n s=a*(b+c)\n print(s)\n }\n }"}, {"source_code": "import java.util.*\n\n\nfun main (args:Array)\n{\n var a:Int= readLine()!!.toInt()\n var b: Int= readLine()!!.toInt()\n var c:Int= readLine()!!.toInt()\n var Max:Int=0\n if(a+b*c>Max)\n Max=a+b*c\n if(a*(b+c)>Max)\n Max=a*(b+c)\n if((a*b*c)>Max)\n Max=(a*b*c)\n if((a+b)*c>Max)\n Max=(a+b)*c\n if(a+b+c>Max)\n Max=a+b+c\nSystem.out.println(Max)\n}\n\n\n"}, {"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 }\nval alg5 = { i1: Int, i2: Int, i3: Int -> i1 + i2 + i3 }\nval alg6 = { i1: Int, i2: Int, i3: Int -> i1 * i2 + i3 }\n\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 alg5(arg1, arg2, arg3),\n alg6(arg1, arg2, arg3))\n println(answers.max())\n}"}, {"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),a+b+c).max())\n}"}, {"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 val larger = maxOf(a, c)\n val smaller = minOf(a, c)\n println(addOrMultiply(addOrMultiply(smaller, b), larger))\n}"}, {"source_code": "import kotlin.math.max\n\nfun main(args : Array){\n\n var X = readLine()!!.toInt()\n var Y = readLine()!!.toInt()\n var Z = readLine()!!.toInt()\n\n println(MAX(X+Y+Z,X*Y*Z,(X+Y)*Z,X*(Y+Z)))\n\n }\n\nfun MAX(V:Int,X:Int,Y:Int,Z:Int) : Int {\n if (V > X && V > Y && V > Z)\n return V\n\n else if (X > V && X > Y && X > Z)\n return X\n\n else if (Y > V && Y > X && Y > Z)\n return Y\n\n else\n return Z\n }"}, {"source_code": "fun main(args: Array) {\n\tval a = readLine()!!.toInt()\n\tval b = readLine()!!.toInt()\n\tval c = readLine()!!.toInt()\n\tfindMaxVal(a, b, c)\n}\n\nfun findMaxVal(a: Int, b: Int, c: Int){\n\tval maxOfSumAllAndProductAll = Integer.max(a*b*c, a + b + c)\n\tval maxOfPartialSumAll = Integer.max(partialSum(a, b, c), partialSum(c, b, a))\n\tval maxOfPartialSumBracesAll = Integer.max(partialSumBraces(a, b, c), partialSumBraces(c, b, a))\n\tprintln(Integer.max(Integer.max(maxOfSumAllAndProductAll, maxOfPartialSumAll),maxOfPartialSumBracesAll))\n} \nfun partialSum(a: Int, b: Int, c: Int): Int {\n\treturn a+b*c\n} \nfun partialSumBraces(a: Int, b: Int, c: Int) = (a+b)*c "}, {"source_code": "import kotlin.math.max\nimport 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 maxExp(list: MutableList): Int {\n val expr1 = list[0] + list[1] + list[2]\n val expr2 = list[0] * list[1] * list[2]\n val expr3 = list[0] + list[1] * list[2]\n val expr4 = list[0] * list[1] + list[2]\n val expr5 = list[0] * (list[1] + list[2])\n val expr6 = (list[0] + list[1]) * list[2]\n return max(max(max(max(max(expr1, expr2), expr3), expr4), expr5), expr6)\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 != 3) {\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*/\n\nfun main(){\n val inputValues = readInputs().toMutableList()\n /*\n val filteredList = sum0and1(inputValues)\n val result = maxResult(filteredList)\n */\n println(maxExp(inputValues))\n}"}, {"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) = 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 = io.readInt()\n val b = io.readInt()\n val c = io.readInt()\n val v = intArrayOf(a * b * c, (a + b) * c, a * (b + c), a + b * c, a * b + c, a + b + c)\n io.println(v.max())\n io.close()\n}\n\nfun main(args: Array) {\n Thread({ solve() }).start()\n}\n"}, {"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, a*b+c)\n val max2 = maxOf(a*(b+c), a*b*c, a+b+c)\n println(maxOf(max1, max2))\n}"}, {"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 main(){\n var a=readInt()\n var b=readInt()\n var c=readInt()\n var ans=a+b+c\n ans=max(ans,a+b*c)\n ans=max(ans,a*b+c)\n ans=max(ans,a*b*c)\n ans=max(ans,(a+b)*c)\n ans=max(ans,a*(b+c))\n printLine(\"$ans\")\n output()\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val a = sc.nextInt()\n val b = sc.nextInt()\n val c = sc.nextInt()\n val list = arrayListOf()\n // Manually declare all possible expression results\n list.add(a+b+c)\n list.add(a*b*c)\n list.add(a+b*c)\n list.add(a*b+c)\n list.add((a+b)*c)\n list.add(a*(b+c))\n // Print maximum\n println(list.max())\n}"}, {"source_code": "import java.util.*\n\nfun main(args: Array) {\n\n val scanner = Scanner(System.`in`)\n\n val a = scanner.nextLong()\n val b = scanner.nextLong()\n val c = scanner.nextLong()\n\n var res : Long = a + b + c\n\n res = Math.max(res, (a+b)*c)\n res = Math.max(res, a*(b+c))\n res = Math.max(res, a*b*c)\n res = Math.max(res, a+b*c)\n res = Math.max(res, a*b+c)\n\n System.out.print(res)\n\n}\n"}, {"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 a = input.nextInt()\n val b = input.nextInt()\n val c = input.nextInt()\n\n output.print(listOf(\n a * b * c,\n a + b * c,\n a * b + c,\n a + b + c,\n (a + b) * c,\n a * (b + c)).max()\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 nextInt(): Int {\n return next().toInt()\n }\n\n}"}, {"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 a = input.nextInt()\n val b = input.nextInt()\n val c = input.nextInt()\n\n output.print(listOf(a * b * c, a + b + c, a + b * c, a * b + c, (a + b) * c, a * (b + c)).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}\n"}, {"source_code": "import java.io.PrintWriter\nimport kotlin.math.*\n\nfun main() {\n io.apply {\n\n val a = int\n val b = int\n val c = int\n cout .. arrayOf(a + b + c, a * b + c, a * (b + c), (a + b) * c, a + b * c, a * b * c).max()!! .. 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 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"}, {"source_code": "fun main() {\n var func :(Int , Int , Int) -> Unit = {n1,n2,n3 ->\n var arr = arrayOf(0,0,0,0)\n arr[0] = n1 + n2 + n3\n arr[1] = (n1 + n2) * n3\n arr[2] = n1 * (n2 + n3)\n arr[3] = n1 * n2 * n3\n println(arr.max())\n }\n func(readLine()!!.toInt() , readLine()!!.toInt() , readLine()!!.toInt())\n\n\n}"}, {"source_code": "import java.lang.Integer.max\n\nfun main(args: Array) {\n var first = readLine()!!.toInt()\n var second = readLine()!!.toInt()\n var third = readLine()!!.toInt()\n\n println(\n arrayOf(\n first * second * third,\n (first + second) * third,\n first * (second + third),\n first + second + third,\n first + second * third,\n first * second + third\n ).max()\n )\n}\n\n"}, {"source_code": "fun main() {\n val a = readLine()!!.toInt()\n val b = readLine()!!.toInt()\n val c = readLine()!!.toInt()\n\n println(listOf(a*b*c, a*b+c, a*(b+c), a+b*c, (a+b)*c, a+b+c).max())\n}\n"}, {"source_code": "import java.util.*\n\n/**\n * Created by v.shipugin on 30/08/2018\n */\n\nfun main(args: Array) {\n Cont274().first()\n}\n\nclass Cont274 {\n\n fun first() {\n val scanner = Scanner(System.`in`)\n\n val a = scanner.nextInt()\n val b = scanner.nextInt()\n val c = scanner.nextInt()\n\n val fist = a + b + c\n val second = (a + b) * c\n val third = a * (b + c)\n val foufh = a * b * c\n\n println(\n Math.max(\n Math.max(fist, second),\n Math.max(third, foufh)\n )\n )\n }\n}"}, {"source_code": "fun main(args : Array) {\n var arr = IntArray(3)\n for (i in 0..2)\n arr[i] = readLine()!!.toInt()\n var ans1 = 0\n var ans2 = 0\n var max = arr[0] * arr[1]\n\n if (arr[0] + arr[1] > max)\n max = arr[0] + arr[1]\n\n if (max * arr[2] > max + arr[2])\n ans1 = max * arr[2]\n else\n ans1 = max * arr[2]\n\n max = arr[1] * arr[2]\n if (arr[1] + arr[2] > max)\n max = arr[1] + arr[2]\n if (max * arr[0] > max + arr[0])\n ans2 = max * arr[0]\n else\n ans2 = max + arr[0]\n\n if (ans1 > ans2)\n println(ans1)\n else\n println(ans2)\n}"}, {"source_code": "\nimport java.util.*\n\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}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val nums = Array(3){0}\n for (i in 0 until 3){\n nums[i] = br.readLine().toInt()\n }\n val a = nums[0]\n val b = nums[1]\n val c = nums[2]\n val options = listOf(\n a + b + c,\n a * b * c,\n (a + b)*c,\n a*(b + c),\n a*b + c,\n a + b*c\n )\n println(options.max())\n}"}, {"source_code": "//package problem479A\n\nfun main() {\n val numbers = listOf(readLine()!!, readLine()!!, readLine()!!).map { it.toInt() }\n\n val possibilities = mutableListOf(numbers.reduce { acc, i -> acc * i }, numbers.sum())\n possibilities.add(numbers[0] + numbers[1] * numbers[2])\n possibilities.add((numbers[0] + numbers[1]) * numbers[2])\n possibilities.add(numbers[0] * numbers[1] + numbers[2])\n possibilities.add(numbers[0] * (numbers[1] + numbers[2]))\n\n println(possibilities.max())\n}\n"}, {"source_code": "fun main(){\n val list=ArrayList()\n for(i in 0..2){\n list.add(readLine()!!.toInt())\n }\n val list2=ArrayList()\n list2.add((list[0]+list[1])*list[2])\n list2.add(list[0]+(list[1]*list[2]))\n list2.add(list[0]*list[1]*list[2])\n list2.add((list[0]*list[1])+list[2])\n list2.add(list[0]*(list[1]+list[2]))\n list2.add(list[0]+list[1]+list[2])\n print(list2.max())\n}"}, {"source_code": "import com.sun.xml.internal.fastinfoset.util.StringArray\nimport java.awt.List\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.min\n\nfun main() {\n var sc = Scanner(System.`in`)\n var a = sc.nextInt()\n var b = sc.nextInt()\n var c = sc.nextInt()\n\n var max = 0\n if (a * b * c > max) max = a * b * c\n if ((a + b) * c > max) max = (a + b) * c\n if (a * (b + c) > max) max = a * (b + c)\n if (a * b + c > max) max = a * b + c\n if (a + b + c > max) max = a + b + c\n\n println(max)\n}\n\n"}, {"source_code": "fun main(args: Array) {\n val (a, b, c) = (1..3).map { readLine()!!.toInt() }\n\n val m = arrayOf(a * b + c, a * (b + c), a + b * c, (a + b) * c, a + b + c, a * b * c).max()!!\n\n println(m)\n}\n"}, {"source_code": "import java.lang.Math.*\n\nfun main(){\n \n val a = readLine()?.toInt() ?: 1\n val b = readLine()?.toInt() ?: 1\n val c = readLine()?.toInt() ?: 1\n\n var answer = a + b + c\n answer = max(answer, a.plus(b).times(c))\n answer = max(answer, a.times(b.plus(c)))\n answer = max(answer, a.times(b).times(c))\n\n println(answer)\n}"}], "negative_code": [{"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}"}, {"source_code": "fun main(args : Array) {\n var arr = IntArray(3)\n for (i in 0..2)\n arr[i] = readLine()!!.toInt()\n arr.sort()\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}"}, {"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}"}, {"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 if (nums.fold(true){acc, x -> x == 1 && acc}){\n nums[0] + nums[1] + nums[2]\n } else{\n nums[0] * nums[1] * nums[2]\n }\n )\n}"}, {"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.fold(true){acc, x -> x == 1 && acc}){\n (nums[0] + nums[1]) * nums[2]\n } else if (nums[0] == 1){\n nums[0] + nums[1] + nums[2]\n } else{\n nums[0] * nums[1] * nums[2]\n }\n )\n}"}, {"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val nums = Array(3){0}\n for (i in 0 until 3){\n nums[i] = br.readLine().toInt()\n }\n println(\n if (nums.fold(true){acc, x -> x == 1 && acc}){\n nums[0] + nums[1] + nums[2]\n } else if (nums[0] == 1){\n (nums[0] + nums[1]) * nums[2]\n } else{\n nums[0] * nums[1] * nums[2]\n }\n )\n}"}, {"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.fold(true){acc, x -> x == 1 && acc}){\n nums[0] + nums[1] + nums[2]\n } else if (nums[0] == 1){\n (nums[0] + nums[1]) * nums[2]\n } else{\n nums[0] * nums[1] * nums[2]\n }\n )\n}"}, {"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}"}, {"source_code": "import java.lang.Math.*\n\nfun main(){\n \n val a = readLine()?.toInt() ?: 1\n val b = readLine()?.toInt() ?: 1\n val c = readLine()?.toInt() ?: 1\n\n if (a != 1 && b != 1 && c != 1)\n println(a.times(b).times(c))\n else if(a == 1 && b == 1 && c == 1)\n println(a.plus(b).plus(c))\n else{\n val x = min(a, min(b,c))\n val y = if (a == x) min(b,c) else if (b == x) min(a,c) else min(a, b)\n println(x.plus(y).times(max(a, max(b,c))))\n\n }\n}"}, {"source_code": " fun main()\n {\n //\n var a:Int= readLine()!!.toInt()\n var b:Int= readLine()!!.toInt()\n var c:Int= readLine()!!.toInt()\n var s=0\n if((a==0|| a==1) && (c==0|| c==1))\n {\n s=a+b+c\n print(s)\n return\n }\n if((b==0|| b==1))\n {\n s=a+b+c\n print(s)\n return\n }\n if((a!=0&& a!=1) && (c!=0&& c!=1)&& (b!=0 && b!=1))\n {\n s=a*b*c\n print(s)\n return\n }\n\n if((a==0|| a==1)&&((b!=0)&&(b!=1))&&((c!=0)&&(c!=1)))\n {\n s=(a+b)*c\n print(s)\n return\n }\n if((c==0|| c==1)&&((b!=0)&&(b!=1))&&((a!=0)&&(a!=1)))\n {\n s=a*(b+c)\n print(s)\n }\n }"}, {"source_code": " fun main()\n {\n //\n var a:Int= readLine()!!.toInt()\n var b:Int= readLine()!!.toInt()\n var c:Int= readLine()!!.toInt()\n var s=0\n if((a==0|| a==1) && (c==0|| c==1))\n {\n s=a+b+c\n print(s)\n return\n }\n if((b==0|| b==1))\n {\n s=a+b+c\n print(s)\n return\n }\n if((a!=0&& a!=1) && (c!=0&& c!=1)&& (b!=0 && b!=1))\n {\n s=a*b*c\n print(s)\n return\n }\n\n if((a==0|| a==1)&&((b!=0)&&(b!=1))&&((c!=0)&&(c!=1)))\n {\n s=a+(b*c)\n print(s)\n return\n }\n if((c==0|| c==1)&&((b!=0)&&(b!=1))&&((a!=0)&&(a!=1)))\n {\n s=(a*b)+c\n print(s)\n }\n }"}, {"source_code": "import java.util.*\n\n\nfun main (args:Array)\n{\n var a:Int= readLine()!!.toInt()\n var b: Int= readLine()!!.toInt()\n var c:Int= readLine()!!.toInt()\n var Max:Int=0\n if(a+b*c>Max)\n Max=a+b*c\n if(a*(b+c)>Max)\n Max=a*(b+c)\n if((a*b*c)>Max)\n Max=(a*b*c)\n if((a+b)*c>Max)\n Max=(a+b)*c\nSystem.out.println(Max)\n}\n\n\n"}, {"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}"}, {"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}"}, {"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}"}, {"source_code": "/**\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 */\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 val checkList = list intersect listOf(1, 1)\n return if(checkList != listOf(1, 1) && checkList != listOf(1, 1, 1)) {\n if (list.contains(1)) {\n val index = list.indexOf(1)\n list.remove(1)\n list[index]++\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}"}, {"source_code": "/**\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 */\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 val checkList = list intersect listOf(1, 1, 1)\n return if(checkList.size < 2) {\n if (list.contains(1)) {\n val index = list.indexOf(1)\n list.remove(1)\n list[index]++\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}"}, {"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 != 3) {\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}"}, {"source_code": "/**\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 */\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 return if(list != listOf(1, 1, 1)) {\n if (list.contains(1)) {\n list.remove(1)\n list[list.lastIndex]++\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}"}, {"source_code": "/**\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 list[index]++\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}"}, {"source_code": "/**\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 */\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 val checkList = list intersect listOf(1, 1, 1)\n return if(checkList != setOf(1, 1) && checkList != setOf(1, 1, 1)) {\n if (list.contains(1)) {\n val index = list.indexOf(1)\n list.remove(1)\n list[index]++\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}"}, {"source_code": "/**\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 */\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 return if(list != listOf(1, 1, 1)) {\n if (list.contains(1)) {\n val index = list.indexOf(1)\n list.remove(1)\n list[index]++\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}"}, {"source_code": "/**\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 */\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.sortedDescending().toMutableList()\n}\n\nfun sum0and1(list: MutableList):List{\n if (list.contains(0)) {\n list.remove(0)\n }\n if(list.contains(1)){\n list.remove(1)\n list[list.lastIndex] ++\n }\n return list.toList()\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}"}, {"source_code": "/**\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 */\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.sortedDescending().toMutableList()\n}\n\nfun sum0and1(list: MutableList):List{\n if (list.contains(0)) {\n list.remove(0)\n }\n return if(list != listOf(1, 1, 1)) {\n if (list.contains(1)) {\n list.remove(1)\n list[list.lastIndex]++\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}"}, {"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}"}], "src_uid": "1cad9e4797ca2d80a12276b5a790ef27"} {"source_code": "fun main(args: Array) {\n val a = Array(3) {readLine()}\n var bad = false\n for (i in 0 until 3)\n for (j in 0 until 3)\n bad = bad or (a[i]!![j] != a[2 - i]!![2 - j])\n println(if (bad) \"NO\" else \"YES\")\n}\n", "positive_code": [{"source_code": "fun main(args: Array) {\n\n val matrix = Array(3){\"\"}\n for (x in 0 until 3) matrix[x] = readLine()!!\n when {\n matrix[0][0] != matrix[2][2] -> print(\"NO\")\n matrix[0][1] != matrix[2][1] -> print(\"NO\")\n matrix[0][2] != matrix[2][0] -> print(\"NO\")\n matrix[1][0] != matrix[1][2] -> print(\"NO\")\n else -> print(\"YES\")\n }\n}"}, {"source_code": "import java.util.Scanner\n\nfun main(args : Array) {\n\n var line1: MutableList = mutableListOf()\n var line2: MutableList = mutableListOf()\n var line3: MutableList = mutableListOf()\n val a = readLine()!!\n val b = readLine()!!\n val c = readLine()!!\n\n for (char in a) { line1.add(char) }\n for (char in b) { line2.add(char) }\n for (char in c) { line3.add(char) }\n\n\n if(line1[0]==line1[2] && line2[0]==line2[2] && line3[0]==line3[2] && line1[1]==line3[1]){\n println(\"YES\")\n }\n else if(line1[0]==line3[0] && line1[1]==line3[1] && line1[2]==line3[2] && line2[0]==line2[2]){\n println(\"YES\")\n }\n else if(line1[0]==line3[2] && line1[1]==line3[1] && line1[2]==line3[0] && line2[0]==line2[2]){\n println(\"YES\")\n }\n else {\n println(\"NO\")\n\n }\n\n}\n"}, {"source_code": "fun main() {\n val board = Array(3) { \"\" }\n board[0] = readLine()!!\n board[1] = readLine()!!\n board[2] = readLine()!!\n for (row in 0 until 2)\n for (column in 0 until 3)\n if (board[row][column] != board[2 - row][2 - column]) return print(\"NO\")\n print(\"YES\")\n}"}], "negative_code": [], "src_uid": "6a5fe5fac8a4e3993dc3423180cdd6a9"} {"source_code": "import java.util.Scanner\nimport java.lang.Math.*\n\nclass Cell(s : String) {\n val col = s[0] - 'a'\n val row = s[1].toInt()\n}\n\nfun move(source: Cell, target: Cell) {\n var deltaCol = target.col - source.col\n var deltaRow = target.row - source.row\n val absoluteCol = abs(deltaCol)\n val absoluteRow = abs(deltaRow)\n val steps = max(absoluteCol, absoluteRow)\n println(steps)\n for (i in 0 until steps) {\n if (deltaCol > 0) {\n print('R')\n deltaCol--\n } else if (deltaCol < 0) {\n print('L')\n deltaCol++\n }\n\n if (deltaRow > 0) {\n print('U')\n deltaRow--\n } else if (deltaRow < 0) {\n print('D')\n deltaRow++\n }\n\n println()\n }\n}\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val source = Cell(scanner.nextLine())\n val target = Cell(scanner.nextLine())\n move(source, target)\n}", "positive_code": [{"source_code": "fun readString1(): String\n{\n val line: String? = readLine()\n if (line == null) return \"\"\n return line.trim()\n}\n\nfun main (args: Array)\n{\n val first: String = readString1()\n val second: String = readString1()\n\n var x1: Int = 0\n var y1: Int = 0\n var x2: Int = 0\n var y2: Int = 0\n\n x1 = first.get(0).toInt() - 'a'.toInt()\n y1 = first.get(1).toString().toInt()-1\n\n\n x2 = second.get(0).toInt() - 'a'.toInt()\n y2 = second.get(1).toString().toInt()-1\n\n var c: Int = 0\n var r: MutableList = mutableListOf()\n\n while (!(x1==x2&&y1==y2))\n {\n\n var m: String = \"\"\n\n if(x1 > x2)\n {\n x1--\n m+=\"L\"\n }\n else if(x1 < x2)\n {\n x1++\n m+=\"R\"\n }\n\n if(y1 > y2)\n {\n y1--\n m+=\"D\"\n }\n else if(y1 < y2)\n {\n y1++\n m+=\"U\"\n }\n r.add(m)\n c++\n }\n print(r.joinToString(separator = \"\\n\",prefix = (\"$c\\n\")))\n\n}"}, {"source_code": "import java.util.Scanner\n\nfun main(args : Array) {\n\n var coor1: MutableList = mutableListOf()\n var coor2: MutableList = mutableListOf()\n val n = readLine()!!\n val m = readLine()!!\n\n for(char in n){ coor1.add(char) }\n for(char in m){ coor2.add(char) }\n\n if(coor1[0]==coor2[0] && coor1[1]==coor2[1]){ println(0) }\n else if(coor1[0]==coor2[0] && coor1[1]>coor2[1]){\n println(coor1[1]-coor2[1])\n for(i in 1..(coor1[1]-coor2[1])){ println(\"D\") }\n }\n else if(coor1[0]==coor2[0] && coor1[1]coor2[0]){\n println(coor1[0]-coor2[0])\n for(i in 1..(coor1[0]-coor2[0])){ println(\"L\") }\n }\n else if(coor1[1](coor2[0]-coor1[0])){\n println((coor2[1]-coor1[1]))\n for(i in 1..(coor2[0]-coor1[0])){ println(\"RU\") }\n for(i in 1..(coor2[1]-coor1[1])-(coor2[0]-coor1[0])){ println(\"U\") }\n }\n else {\n println((coor2[1] - coor1[1]))\n for (i in 1..(coor2[0] - coor1[0])) { println(\"RU\") }\n }\n }\n else if(coor1[1]>coor2[1] && coor1[0](coor2[0]-coor1[0])){\n println((coor1[1]-coor2[1]))\n for(i in 1..(coor2[0]-coor1[0])){ println(\"RD\") }\n for(i in 1..(coor1[1]-coor2[1])-(coor2[0]-coor1[0])){ println(\"D\") }\n }\n else {\n println((coor1[1] - coor2[1]))\n for (i in 1..(coor1[1] - coor2[1])) { println(\"RD\") }\n }\n }\n else if(coor1[1]coor2[0]){\n if((coor2[1]-coor1[1])<(coor1[0]-coor2[0])){\n println((coor1[0]-coor2[0]))\n for(i in 1..(coor2[1]-coor1[1])){ println(\"LU\") }\n for(i in 1..(coor1[0]-coor2[0])-(coor2[1]-coor1[1])){ println(\"L\") }\n }\n else if((coor2[1]-coor1[1])>(coor1[0]-coor2[0])){\n println((coor2[1]-coor1[1]))\n for(i in 1..(coor1[0]-coor2[0])){ println(\"LU\") }\n for(i in 1..(coor2[1]-coor1[1])-(coor1[0]-coor2[0])){ println(\"U\") }\n }\n else {\n println((coor2[1] - coor1[1]))\n for (i in 1..(coor2[1] - coor1[1])) { println(\"LU\") }\n }\n }\n else if(coor1[1]>coor2[1] && coor1[0]>coor2[0]){\n if((coor1[1]-coor2[1])<(coor1[0]-coor2[0])){\n println((coor1[0]-coor2[0]))\n for(i in 1..(coor1[1]-coor2[1])){ println(\"LD\") }\n for(i in 1..(coor1[0]-coor2[0])-(coor1[1]-coor2[1])){ println(\"L\") }\n }\n else if((coor1[1]-coor2[1])>(coor1[0]-coor2[0])){\n println((coor1[1]-coor2[1]))\n for(i in 1..(coor1[0]-coor2[0])){ println(\"LD\") }\n for(i in 1..(coor1[1]-coor2[1])-(coor1[0]-coor2[0])){ println(\"D\") }\n }\n else {\n println((coor1[1] - coor2[1]))\n for (i in 1..(coor1[1] - coor2[1])) { println(\"LD\") }\n }\n }\n}"}, {"source_code": "import kotlin.math.abs\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 n = r.readLine()!!.toInt()\n val st = r.readLine()!!\n val en = r.readLine()!!\n var right = en[0].toInt() - st[0].toInt()\n var up = en[1].toInt() - st[1].toInt()\n println(maxOf(abs(right), abs(up)))\n var ans = 0\n while (up != 0 || right != 0) {\n when {\n up != 0 && right != 0 -> {\n when {\n up > 0 && right > 0 -> {\n println(\"RU\")\n up--\n right--\n }\n up > 0 && right < 0 -> {\n println(\"LU\")\n up--\n right++\n }\n up < 0 && right > 0 -> {\n println(\"RD\")\n up++\n right--\n }\n up < 0 && right < 0 -> {\n println(\"LD\")\n up++\n right++\n }\n }\n }\n up == 0 -> if (right>0){\n println(\"R\")\n right--\n } else{\n println(\"L\")\n right++\n }\n right==0->if (up>0){\n println(\"U\")\n up--\n }else{\n println(\"D\")\n up++\n }\n }\n }\n}"}, {"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 main(){\n var a=readLn()\n var b=readLn()\n var x=abs(a[0]-b[0])\n var y=abs(a[1]-b[1])\n var ch1=if(a[0]>b[0])'L' else 'R'\n var ch2=if(a[1]>b[1])'D' else 'U'\n printLine(\"${max(x,y)}\")\n repeat(min(x,y)){printLine(\"$ch1$ch2\")}\n for(i in 1..x-y){printLine(\"$ch1\")}\n for(i in 1..y-x){printLine(\"$ch2\")}\n output()\n}"}, {"source_code": "fun a3() {\n var result = arrayOf()\n var first = \"\"\n var second = \"\"\n var intSize : Int\n var charSize : Int\n val loopSize : Int\n\n val start = readLine()!!\n val end = readLine()!!\n\n if (start[1].toInt() > end[1].toInt()) {\n intSize = start[1].toInt() - end[1].toInt()\n second = \"D\"\n } else {\n intSize = end[1].toInt() - start[1].toInt()\n second = \"U\"\n }\n\n if (start[0] > end[0]) {\n charSize = start[0] - end[0]\n first = \"L\"\n } else {\n charSize = end[0] - start[0]\n first = \"R\"\n }\n\n loopSize = if(intSize > charSize) intSize else charSize\n\n for (i in 0 until loopSize) {\n if(intSize <= 0) second = \"\"\n if(charSize <= 0) first = \"\"\n\n intSize--\n charSize--\n\n result += \"$first$second\"\n }\n\n println(loopSize)\n result.forEach {\n println(it)\n }\n}\n\nfun main() {\n a3()\n}"}, {"source_code": "import java.util.*\n\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\n\nfun readProblem(readLine: () -> String?): Problem {\n val start = Position.parse(readLine()!!.trim())\n val target = Position.parse(readLine()!!.trim())\n return Problem(start, target)\n}\n\nclass Position (val x: Int, val y: Int) {\n companion object {\n fun parse(str: String): Position {\n return Position(\n str[0].toInt() - 'a'.toInt(),\n str[1].toInt() - '0'.toInt()\n )\n }\n }\n\n override fun toString(): String {\n return \"($x - $y)\"\n }\n}\n\nclass Problem (val from: Position, val to: Position)\n\n// SOLVE PROBLEM\n\nfun solve(problem: Problem): Answer {\n val answer = Answer()\n var xd = problem.to.x - problem.from.x\n var yd = problem.to.y - problem.from.y\n when {\n (xd < 0 && yd < 0) -> {\n val len = if (-xd < -yd) { -xd } else { -yd }\n xd += len\n yd += len\n answer.go(Direction.LD, len)\n }\n (xd < 0 && yd > 0) -> {\n val len = if (-xd < yd) { -xd } else { yd }\n xd += len\n yd -= len\n answer.go(Direction.LU, len)\n }\n (xd > 0 && yd > 0) -> {\n val len = if (xd < yd) { xd } else { yd }\n xd -= len\n yd -= len\n answer.go(Direction.RU, len)\n }\n (xd > 0 && yd < 0) -> {\n val len = if (xd < -yd) { xd } else { -yd }\n xd -= len\n yd += len\n answer.go(Direction.RD, len)\n }\n }\n when {\n (xd < 0) -> {\n answer.go(Direction.L, -xd)\n }\n (xd > 0) -> {\n answer.go(Direction.R, xd)\n }\n (yd < 0) -> {\n answer.go(Direction.D, -yd)\n }\n (yd > 0) -> {\n answer.go(Direction.U, yd)\n }\n }\n return answer\n}\n\n// PRINT SOLUTION\n\nclass Answer () {\n private val segments: MutableList = ArrayList()\n\n fun go(dir: Direction, length: Int) {\n if (length > 0) {\n segments.add(Segment(dir, length))\n }\n }\n\n fun print(consumer: (String) -> Unit) {\n val length = segments.map { it.length } .sum()\n consumer(length.toString())\n for (seg in segments) {\n for (i in 1..seg.length) {\n consumer(seg.dir.name)\n }\n }\n }\n}\n\nclass Segment(val dir: Direction, val length: Int) {\n override fun toString(): String {\n val sb = StringBuilder()\n for (i in 1..length) {\n sb.append(dir)\n }\n return sb.toString()\n }\n}\n\nenum class Direction() {\n L, LD, D, RD, R, RU, U, LU\n}\n\nfun printSolution(solution: Answer) {\n solution.print { println(it) }\n}\n\n"}, {"source_code": "import kotlin.math.abs\nimport kotlin.math.max\n\nfun main() {\n val from = readLine()!!\n val to = readLine()!!\n var horizontal = from[0] - to[0]\n var vertical = from[1] - to[1]\n println(max(abs(horizontal), abs(vertical)))\n while (horizontal != 0 || vertical != 0) {\n when {\n horizontal < 0 -> {\n print('R'); horizontal++\n }\n horizontal > 0 -> {\n print('L'); horizontal--\n }\n }\n when {\n vertical < 0 -> {\n print('U'); vertical++\n }\n vertical > 0 -> {\n print('D'); vertical--\n }\n }\n println()\n }\n}"}, {"source_code": "import kotlin.math.abs\n\nprivate fun readLn() = readLine()!!\n\nfun main() {\n val s = readLn().toCharArray()\n val d = readLn().toCharArray()\n\n var dr: Int = abs(s[0] - d[0])\n var dw: Int = abs(s[1] - d[1])\n\n val n = maxOf(dr, dw)\n println(n)\n repeat(n) {\n if(dr>0) {\n if (s[0] > d[0]) {\n s[0]--\n print(\"L\")\n } else {\n s[0]++\n print(\"R\")\n }\n dr--\n }\n if(dw>0) {\n if (s[1] > d[1]) {\n s[1]--\n print(\"D\")\n } else {\n s[1]++\n print(\"U\")\n }\n dw--\n }\n println()\n }\n}"}, {"source_code": "fun main() {\n val s = readLine()!!.toCharArray()\n val d = readLine()!!.toCharArray()\n var hori = s[0] - d[0]\n var vert = s[1] - d[1]\n if (hori >= 0 && vert >= 0) { // a8 - h1 = 7 fin\n if (hori > vert) {\n println(hori)\n } else {\n println(vert)\n }\n } else if (hori <= 0 && vert >= 0) {\n if (-hori > vert) {\n println(-hori)\n } else {\n println(vert)\n }\n } else if (hori >= 0 && vert <= 0) {\n if (hori > -vert) {\n println(hori)\n } else {\n println(-vert)\n }\n } else { // hori and vert are negative , (-x,0)\n if (-hori < -vert) {\n println(-vert)\n } else {\n println(-hori)\n }\n }\n while (hori != 0 || vert != 0) { // add or sub until equals to 0\n //println(\"$hori $vert\")\n if (hori < 0) {\n print('R')\n hori++\n } else if (hori > 0) {\n print('L')\n hori--\n }\n if (vert < 0) {\n print('U')\n vert++\n } else if (vert > 0) {\n print('D')\n vert--\n }\n println()\n }\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\n\nfun main() {\n var reader = Scanner(System.`in`)\n\n var start = reader.nextLine().trim()\n var end = reader.nextLine().trim()\n\n var x = start[0] - end[0]\n var y = start[1] - end[1]\n\n val res = max(abs(x), abs(y))\n println(res)\n repeat(res) {\n if (x > 0) {\n print('L')\n x--\n }\n if (x < 0) {\n print('R')\n x++\n }\n if (y > 0) {\n print('D')\n y--\n }\n if (y < 0) {\n print('U')\n y++\n }\n println()\n }\n}"}], "negative_code": [{"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 st = r.readLine()!!\n val en = r.readLine()!!\n var right = en[0].toInt() - st[0].toInt()\n var up = en[1].toInt() - st[1].toInt()\n println(maxOf(right, up))\n var ans = 0\n while (up != 0 || right != 0) {\n when {\n up != 0 && right != 0 -> {\n when {\n up > 0 && right > 0 -> {\n println(\"RU\")\n up--\n right--\n }\n up > 0 && right < 0 -> {\n println(\"LU\")\n up--\n right++\n }\n up < 0 && right > 0 -> {\n println(\"RD\")\n up++\n right--\n }\n up < 0 && right < 0 -> {\n println(\"LD\")\n up++\n right++\n }\n }\n }\n up == 0 -> if (right>0){\n println(\"R\")\n right--\n } else{\n println(\"L\")\n right++\n }\n right==0->if (up>0){\n println(\"U\")\n up--\n }else{\n println(\"D\")\n up++\n }\n }\n }\n}"}, {"source_code": "fun main() {\n val s = readLine()!!.toCharArray()\n val d = readLine()!!.toCharArray()\n var hori = s[0]-d[0]\n var vert = s[1]-d[1]\n if(hori>0&&vert>0){ // a8 - h1 = 7 fin\n if(hori>vert){\n println(hori)\n }else{\n println(vert)\n }\n }else if(hori<0&&vert>0){\n if(-hori > vert){\n println(-hori)\n }else{\n println(vert)\n }\n }else if(hori>0&&vert<0){\n if(hori>-vert){\n println(hori)\n }else{\n println(-vert)\n }\n }else{ // hori and vert are negative\n if(hori>vert){\n println(-vert)\n }else{\n println(-hori)\n }\n }\n while (hori!=0||vert!=0){ // add or sub until equals to 0\n //println(\"$hori $vert\")\n if(hori<0){\n print('R')\n hori++\n }else if(hori > 0){\n print('L')\n hori--\n }\n if(vert<0){\n print('U')\n vert++\n }else if(vert > 0){\n print('D')\n vert--\n }\n println()\n }\n}"}, {"source_code": "fun main() {\n val s = readLine()!!.toCharArray()\n val d = readLine()!!.toCharArray()\n var hori = s[0]-d[0]\n var vert = s[1]-d[1]\n if(hori>0&&vert>0){ // a8 - h1 = 7 fin\n if(hori>vert){\n println(hori)\n }else{\n println(vert)\n }\n }else if(hori<0&&vert>0){\n if(-hori > vert){\n println(-hori)\n }else{\n println(vert)\n }\n }else if(hori>0&&vert<0){\n if(hori>-vert){\n println(hori)\n }else{\n println(-vert)\n }\n }else{ // hori and vert are negative\n if(hori>vert){\n println(-vert)\n }else{\n println(-hori)\n }\n }\n while (hori!=0&&vert!=0){\n if(hori<0){\n print('R')\n hori++\n }else{\n print('L')\n hori--\n }\n if(vert<0){\n print('D')\n vert++\n }else{\n print('U')\n vert--\n }\n println()\n }\n}"}, {"source_code": "import java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\n\nfun main() {\n var reader = Scanner(System.`in`)\n\n var start = reader.nextLine().trim()\n var end = reader.nextLine().trim()\n\n var x = start[0] - end[0]\n var y = start[1] - end[1]\n\n val res = max(abs(x), abs(y))\n println(res)\n repeat(res) {\n if (x > 0) {\n print('L')\n x--\n }\n if (x < 0) {\n print('R')\n x++\n }\n if (y > 0) {\n println('D')\n y--\n }\n if (y < 0) {\n println('U')\n y++\n }\n }\n}"}], "src_uid": "d25d454702b7755297a7a8e1f6f36ab9"} {"source_code": "fun main() {\n readInteger()\n val s = readLine()!!\n var pre = s[0]\n var sCount = 0\n var fCount = 0\n for (i in 1 until s.length) {\n if (pre != s[i]){\n if (pre == 'S') {\n sCount++\n } else {\n fCount++\n }\n }\n\n pre = s[i]\n }\n\n val ans = if (sCount > fCount) {\n \"Yes\"\n } else {\n \"No\"\n }\n\n println(ans)\n}\n\nfun readInteger() = readLine()!!.toInt()\nfun readStrings() = readLine()!!.split(\" \")\nfun readIntegers() = readStrings().map(String::toInt)\n", "positive_code": [{"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 val str = r.readLine()!!\n var sf = 0\n var fs = 0\n (0..n-2).forEach {\n when{\n str[it]=='S'&&str[it+1]=='F' -> sf++\n str[it]=='F'&&str[it+1]=='S' -> fs++\n }\n }\n println(if (sf>fs) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main(args: Array){\n val n = readLine()!!.toInt()\n val s = readLine()!!\n if (s[0]=='S' && s[n-1]=='F') println(\"YES\") else println(\"NO\")\n}"}, {"source_code": "fun main(args:Array)\n{\nvar n=readLine()!!\n var t=readLine()!!\n var switch=0\n var counter=0\n var counter1=0\n var flag=false\n var f=false\nfor(i in t) {\n if(i=='S')\n {\n f=true\n }\n if(i=='F'&&f)\n {\n f=false\n counter++;\n }\n}\n f=false\n for(i in t) {\n if(i=='F')\n {\n f=true\n }\n if(i=='S'&&f)\n {\n f=false\n counter1++;\n }\n }\n\n println(if(counter>counter1) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main(args: Array) {\n readLine()\n val input = readLine()!!\n val chars = input.toCharArray()\n\n var previousChar = chars.first()\n var i = 0\n var sf = 0\n var fs = 0\n\n for (char in chars) {\n if (i > 0 && char != previousChar) {\n if (char == 'S') {\n fs += 1\n } else {\n sf += 1\n }\n }\n previousChar = char\n i += 1\n }\n\n if (sf > fs) println(\"YES\") else println(\"NO\")\n}"}, {"source_code": "/* https://codeforces.com/problemset/problem/867/A */\n\nfun main() {\n readLine()!!.toInt() // read number of days\n val cityInitials = readLine()!!\n var tripsFromStoF = 0\n var tripsFromFtoS = 0\n var lastChar = '_'\n cityInitials.forEach {\n if (it == 'F' && lastChar == 'S') {\n tripsFromStoF++\n } else if (it == 'S' && lastChar == 'F') {\n tripsFromFtoS++\n }\n lastChar = it\n }\n println(if (tripsFromStoF > tripsFromFtoS) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main() {\n val nightCount = Integer.parseInt(readLine()!!)\n val cities = readLine()!!\n var sf = 0\n var fs = 0\n for(i in 0 until nightCount - 1) {\n val flight = cities.substring(i, i + 2)\n when (flight) {\n \"SF\" -> sf++\n \"FS\" -> fs++\n }\n }\n\n if (sf > fs) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}"}, {"source_code": "fun main() {\n var n = readLine()!!.toInt()\n val line = readLine()!!.toCharArray()\n var SF = 0\n var FS = 0\n for (i in 0 until line.size-1)\n {\n if (line[i] == 'S' && line[i+1] == 'F')\n SF++\n else if (line[i] == 'F' && line[i+1] == 'S')\n FS++\n }\n\n if (SF > FS)\n print(\"YES\")\n else\n print(\"NO\")\n\n}"}, {"source_code": "fun main() {\n readLine()\n val s = readLine()\n\n var franCount = 0\n var sietlCount = 0\n var last = s!![0]\n for (c in s!!) {\n if(last != c) {\n if(c == 'F') {\n franCount++\n } else {\n sietlCount++\n }\n last = c\n }\n }\n\n if(franCount > sietlCount) print(\"Yes\") else print(\"No\")\n}"}, {"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 readInt()\n val flights = readLn()\n var f = 0\n var s = 0\n for (i in 1 until flights.length) {\n if (flights[i] != flights[i - 1]) {\n if (flights[i] == 'S') s++\n else f++\n }\n }\n if (f > s) println(\"yes\") else println(\"no\")\n}\n"}, {"source_code": "/**\n * Problem Link: https://codeforces.com/problemset/problem/867/A\n * Difficulty: 600\n */\nfun main(args: Array) {\n readLine()!!\n val s = readLine()!!\n var lastChar = ' '\n var SF = 0\n var FS = 0\n s.forEach { c ->\n if (lastChar == 'F' && c == 'S') {\n FS++\n }\n if (lastChar == 'S' && c == 'F') {\n SF++\n }\n lastChar = c\n }\n println(\"${if (SF > FS) \"YES\" else \"NO\"}\")\n}"}, {"source_code": "import java.lang.StringBuilder\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.max\n\nfun main() {\n var sc = Scanner(System.`in`)\n var n = sc.nextInt()\n var str = sc.next()\n var s = 0\n\n for (i in 1..str.length - 1) {\n if (str[i] == 'F' && str[i - 1] == 'S') {\n s++\n } else if (str[i] == 'S' && str[i - 1] == 'F') {\n s--\n }\n }\n if (s > 0) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n\n}"}, {"source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var String = readLine().toString()\n var dem1 = 0\n var dem2 = 0\n for (i in 0..(String.length-2)){\n if (String[i] == 'F' && String[i+1] == 'S')\n dem1 ++\n if (String[i+1] == 'F' && String[i] == 'S')\n dem2 ++\n }\n print( if (dem1>=dem2) \"NO\" else \"YES\")\n}\n"}, {"source_code": "fun main() {\n val numDays = readLine()!!.toInt()\n val cities = readLine()!!\n var counter = 0\n for (pos in 1 until numDays) {\n when {\n (cities[pos] == 'S' && cities[pos - 1] == 'F') -> counter--\n (cities[pos] == 'F' && cities[pos - 1] == 'S') -> counter++\n }\n }\n if (counter > 0) print(\"YES\") else print(\"NO\")\n}"}, {"source_code": " fun main(args: Array){\n var temp = 0\n val n = readLine()!!.toInt()\n val s = readLine()!!\n \n \n for(i in 0 until n-1){\n when {\n (s[i] == 'S' && s[i+1] == 'F') ->temp++\n (s[i] == 'F' && s[i+1] == 'S') ->temp--\n } \n }\n if(temp>0) print (\"YES\") else print(\"NO\")\n }\n"}, {"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 n = readInt()\n val s = readLn()\n var cntSF = 0\n var cntFS = 0\n for (i in 1 until s.length) {\n when (s.subSequence(i - 1, i + 1)) {\n \"SF\" -> cntSF++\n \"FS\" -> cntFS++\n }\n }\n if (cntSF > cntFS) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}\n"}, {"source_code": "import java.util.Scanner\nimport kotlin.math.max\n\nfun main() {\n val reader = Scanner(System.`in`)\n\n var n = reader.nextInt()\n var s = reader.next()\n\n var win = 0\n var lose = 0\n for(i in 1..n-1){\n if (s[i] == 'F' && s[i-1] == 'S') {\n win++\n } else if (s[i] == 'S' && s[i-1] == 'F') {\n lose++\n }\n }\n if(win > lose) println(\"YES\")\n else println(\"NO\")\n}"}], "negative_code": [{"source_code": "fun main(args:Array)\n{\n\n var t=readLine()!!\n var switch=0\n var counter=0\n var counter1=0\n var flag=false\n var f=false\nfor(i in t) {\n if(i=='S')\n {\n f=true\n }\n if(i=='F'&&f)\n {\n f=false\n counter++;\n }\n}\n f=false\n for(i in t) {\n if(i=='F')\n {\n f=true\n }\n if(i=='S'&&f)\n {\n f=false\n counter1++;\n }\n }\n \n println(if(counter>counter1) \"YES\" else \"NO\")\n}"}, {"source_code": "fun main() {\n val nightCount = Integer.parseInt(readLine()!!)\n val cities = readLine()!!\n var sf = 0\n var fs = 0\n for(i in 0 until nightCount - 1) {\n val flight = cities.substring(i, i + 2)\n println(flight)\n when (flight) {\n \"SF\" -> sf++\n \"FS\" -> fs++\n }\n }\n\n if (sf > fs) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}"}], "src_uid": "ab8a2070ea758d118b3c09ee165d9517"} {"source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n //val (n, k) = r.readLine()!!.split(\" \").map { it.toInt() }\n val s1 = r.readLine()!!\n val s2 = r.readLine()!!\n var i = 0\n s2.forEach {\n if (it==s1[i]) i++\n }\n println(i+1)\n}", "positive_code": [{"source_code": "import java.util.*\nval reader = Scanner(System.`in`)\nvar ans = 1\nfun main(args: Array){\n val s = reader.next()\n val t = reader.next()\n\n for (i in t) {\n\n if(i == s[ans-1])\n ans++\n }\n\n print(ans)\n}\n"}, {"source_code": "fun solution (a:String, b:String) : Int {\n var pos = 0;\n for (i in b) {\n if (i == a[pos]) {\n pos++\n }\n }\n return pos+1\n}\n\nfun main(args: Array) {\n // myassert(2, solution(\"RGB\", \"RRR\"))\n // myassert(3, solution(\"RRRBGBRBBB\", \"BBBRR\"))\n // myassert(15, solution(\"BRRBGBRGRBGRGRRGGBGBGBRGBRGRGGGRBRRRBRBBBGRRRGGBBB\",\n // \"BBRBGGRGRGBBBRBGRBRBBBBRBRRRBGBBGBBRRBBGGRBRRBRGRB\"))\n\n solution(readLine()!!, readLine()!!).let{print(it)}\n}"}, {"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 t = br.readLine()\n var pos = 0\n for (c in t) {\n if (c == s[pos]){\n pos++\n }\n }\n println(pos + 1)\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n val reader = Scanner(System.`in`)\n val t = reader.nextLine()\n val c = reader.nextLine()\n var ci=0\n c.forEach {\n if (it==t[ci]){\n ci++\n }\n }\n println(ci+1)\n}\n\n"}, {"source_code": "fun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun findLissPos(): Int {\n\n val stones = readLn()\n val instructions = readLn()\n var curPos = 0\n for (i in 0 until instructions.length) {\n if (stones[curPos ] == instructions[i])\n curPos++\n }\n\n curPos++\n\n return curPos;\n}\n\n\nfun main() {\n print(findLissPos())\n}\n"}, {"source_code": "fun main() {\n var r : String = readLine()!!\n var q: String = readLine()!!\n var i : Int = 0;\n for(idx in 0..q.lastIndex) {\n if(q[idx] == r[i]) {\n i++;\n }\n }\n println(i + 1);\n}\n"}, {"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 s = readLn()\n var t = readLn()\n var ans = 0\n var l = 0\n var r = 0\n while (r < t.length) {\n if (s[l] == t[r]) {\n l++\n r++\n } else {\n r++\n }\n }\n println(l + 1)\n}\n"}, {"source_code": "fun main() {\n val s = readLine()!!\n val t = readLine()!!\n var sPos = 0\n for(c in t)\n if(c == s[sPos]) sPos++\n print(sPos + 1)\n}"}, {"source_code": "// Bismillahir Rahmanir Raheem\n\nimport java.util.Scanner\nfun main() {\n val sc = Scanner (System.`in`)\n\n var str: String = readLine()!!\n var stt: String = readLine()!!\n\n var j: Int = 0\n var s: Int = stt.length\n\n for (i in 0 .. s-1)\n if (str[j] == stt[i]) j++\n\n println (j+1)\n}"}, {"source_code": "import java.util.*\n\nfun main() {\n val sc = Scanner(System.`in`)\n var str = sc.nextLine()\n var cmd = sc.nextLine()\n var cnt = 1\n var i = 0\n for (ch in cmd) {\n if(ch == str[i]) {\n cnt++\n i++\n }\n }\n print(cnt)\n}"}, {"source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\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 `CF265-D2-A` {\n fun solveTestCase(): Int {\n val s = read()\n val t = read()\n var pos = 0\n\n t.forEach {\n if (s[pos] == it) {\n pos++\n }\n }\n\n\n return pos + 1\n }\n}\n\nfun main(args: Array) {\n\n outputWriter.println(\n `CF265-D2-A`()\n .solveTestCase()\n )\n\n outputWriter.flush()\n}"}, {"source_code": "fun main() = Pair(readLine()!!, readLine()!!)\n .let { (stones, instructions) ->\n var currentPosition = 0\n for (instructionIndex in 0..instructions.lastIndex) {\n if (instructions[instructionIndex] == stones[currentPosition]) {\n currentPosition++\n }\n }\n currentPosition\n }\n .let(Int::inc)\n .run(::println)"}, {"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 val s = Scanner(System.`in`)\n val postion = s.next();\n val instrution = s.next();\n colorstone(postion,instrution)\n}\nfun colorstone (postion : String ,instrution : String ){\n\nval postions = postion.toCharArray();\nval instrutions = instrution.toCharArray();\nvar counter = 1\n\n for(i in instrutions.indices){\nif(postion[counter-1] == instrutions[i]){\n counter++\n}\n} \nprint(counter) \n}\n\n"}], "negative_code": [], "src_uid": "f5a907d6d35390b1fb11c8ce247d0252"} {"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\nfun String.words() = split(\" \")\n\nfun String.toInts() = split(\" \").map { it.toInt() }\nfun String.toLongs() = split(\" \").map { it.toLong() }\n\nprivate fun solve(input: BufferedReader, output: PrintWriter) {\n val s = input.readLine()\n\n fun Char.toIndex() = this - 'A'\n\n val letterCount = IntArray(26)\n var wildcardsCount = 0\n var missingLetters = 26\n\n for (i in s.indices) {\n val c = s[i]\n when (c) {\n '?' -> ++wildcardsCount\n in 'A'..'Z' -> {\n if (letterCount[c.toIndex()] == 0)\n --missingLetters\n ++letterCount[c.toIndex()]\n }\n }\n\n if (i >= 26) {\n val q = s[i - 26]\n when (q) {\n '?' -> --wildcardsCount\n in 'A'..'Z' -> {\n if (letterCount[q.toIndex()] == 1)\n ++missingLetters\n --letterCount[q.toIndex()]\n }\n }\n }\n\n if (i >= 25 && missingLetters <= wildcardsCount) {\n val missingLettersList = letterCount.indices.filter { letterCount[it] == 0 }.map { 'A' + it }\n var currentMissingLetterIndex = 0\n val answer = s.toCharArray()\n for (j in answer.indices) {\n if (answer[j] == '?') {\n if (j in (i - 25..i)) {\n answer[j] = missingLettersList.getOrElse(currentMissingLetterIndex) { 'A' }\n ++currentMissingLetterIndex\n } else\n answer[j] = 'A'\n }\n }\n output.println(String(answer))\n return\n }\n }\n\n output.println(\"-1\")\n}", "positive_code": [{"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main(vararg params: String) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n\n val string = br.readLine().toList()\n\n if (string.size < 26) {\n println(-1)\n return\n }\n\n val countOfLetters = IntArray(26)\n fun Char.put() {\n if (this != '?')\n countOfLetters[toInt() - 65]++\n }\n\n fun Char.remove() {\n if (this != '?')\n countOfLetters[toInt() - 65]--\n }\n\n fun isOnlyOneOrZero() = countOfLetters.all { it < 2 }\n\n var begin = 0\n fun end() = begin + 25\n\n for (i in begin..end() - 1) {\n string[i].put()\n }\n\n while (end() < string.size) {\n string[end()].put()\n if (isOnlyOneOrZero()) {\n val sublist = processMissing(string.subList(begin, end() + 1))\n\n val fullString = string.subList(0, begin) + sublist + string.subList(end() + 1, string.size)\n\n println(fullString.map { if (it == '?') 'X' else it }.joinToString(separator = \"\") { \"$it\" })\n\n return\n }\n string[begin].remove()\n begin++\n }\n\n println(-1)\n\n}\n\nfun processMissing(list: List): List {\n val alphabet = ArrayList(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".toList().filter { !list.contains(it) })\n return list.map { if (it == '?') alphabet.removeAt(0) else it }\n}\n"}, {"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 notPresent = mutableSetOf()\n for (c in 'A'..'Z')\n notPresent.add(c)\n val counts = IntArray(26)\n val s = readLine()!!.toCharArray()\n if (s.size< 26) {\n print(-1)\n return\n }\n var wildCards = 0\n for (i in 0..25) {\n if (s[i] == '?')\n wildCards++\n else {\n counts[s[i] - 'A']++\n notPresent.remove(s[i])\n }\n }\n var start = 0\n var end = 25\n while(end < s.size) {\n if(notPresent.size == wildCards) {\n while(start <= end) {\n if(s[start] == '?') {\n s[start] = notPresent.first()\n notPresent.remove(s[start])\n }\n start++\n }\n for(i in 0 until s.size) {\n if(s[i] == '?')\n s[i] = 'A'\n }\n print(s.joinToString(\"\"))\n return\n } else {\n if (s[start] == '?') wildCards-- else {\n counts[s[start] - 'A']--\n if(counts[s[start] - 'A'] == 0) notPresent.add(s[start])\n }\n start++\n end++\n if(end < s.size) {\n if (s[end] == '?') wildCards++ else {\n counts[s[end] - 'A']++\n notPresent.remove(s[end])\n }\n }\n }\n }\n print(-1)\n}"}], "negative_code": [{"source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main(vararg params: String) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n\n val string = br.readLine().toList()\n\n if (string.size < 26) {\n println(-1)\n return\n }\n\n val countOfLetters = IntArray(26)\n fun Char.put() {\n if (this != '?')\n countOfLetters[toInt() - 65]++\n }\n\n fun Char.remove() {\n if (this != '?')\n countOfLetters[toInt() - 65]--\n }\n\n fun isOnlyOneOrZero() = countOfLetters.all { it < 2 }\n\n var begin = 0\n fun end() = begin + 25\n\n for (i in begin..end() - 1) {\n string[i].put()\n }\n\n while (end() < string.size) {\n string[end()].put()\n if (isOnlyOneOrZero()) {\n processMissing(string.subList(begin, end() + 1))\n\n\n return\n }\n string[begin].remove()\n begin++\n }\n\n println(-1)\n\n}\n\nfun processMissing(list: List) {\n val alphabet = ArrayList(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".toList().filter { !list.contains(it) })\n println(list.map { if (it == '?') alphabet.removeAt(0) else it }.joinToString(separator = \"\") { \"$it\" })\n}\n"}, {"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 notPresent = mutableSetOf()\n for (c in 'A'..'Z')\n notPresent.add(c)\n val counts = IntArray(26)\n val s = readLine()!!\n if (s.length < 26) {\n print(-1)\n return\n }\n var wildCards = 0\n for (i in 0..25) {\n if (s[i] == '?')\n wildCards++\n else {\n counts[s[i] - 'A']++\n notPresent.remove(s[i])\n }\n }\n var start = 0\n var end = 25\n while(end < s.length) {\n if(notPresent.size == wildCards) {\n val sb = StringBuilder()\n while(start <= end) {\n if(s[start] == '?') {\n sb.append(notPresent.first())\n notPresent.remove(sb.last())\n } else sb.append(s[start])\n start++\n }\n print(sb.toString())\n return\n } else {\n if (s[start] == '?') wildCards-- else {\n counts[s[start] - 'A']--\n if(counts[s[start] - 'A'] == 0) notPresent.add(s[start])\n }\n start++\n end++\n if(end < s.length) {\n if (s[end] == '?') wildCards++ else {\n counts[s[end] - 'A']++\n notPresent.remove(s[end])\n }\n }\n }\n }\n print(-1)\n}"}, {"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 notPresent = mutableSetOf()\n for (c in 'A'..'Z')\n notPresent.add(c)\n val counts = IntArray(26)\n val s = readLine()!!.toCharArray()\n if (s.size< 26) {\n print(-1)\n return\n }\n var wildCards = 0\n for (i in 0..25) {\n if (s[i] == '?')\n wildCards++\n else {\n counts[s[i] - 'A']++\n notPresent.remove(s[i])\n }\n }\n var start = 0\n var end = 25\n while(end < s.size) {\n if(notPresent.size == wildCards) {\n while(start <= end) {\n if(s[start] == '?') {\n s[start] = notPresent.first()\n notPresent.remove(s[start])\n }\n start++\n }\n print(s.joinToString(\"\"))\n return\n } else {\n if (s[start] == '?') wildCards-- else {\n counts[s[start] - 'A']--\n if(counts[s[start] - 'A'] == 0) notPresent.add(s[start])\n }\n start++\n end++\n if(end < s.size) {\n if (s[end] == '?') wildCards++ else {\n counts[s[end] - 'A']++\n notPresent.remove(s[end])\n }\n }\n }\n }\n print(-1)\n}"}, {"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\nfun String.words() = split(\" \")\n\nfun String.toInts() = split(\" \").map { it.toInt() }\nfun String.toLongs() = split(\" \").map { it.toLong() }\n\nprivate fun solve(input: BufferedReader, output: PrintWriter) {\n val s = input.readLine()\n\n fun Char.toIndex() = this - 'A'\n\n val letterCount = IntArray(26)\n var wildcardsCount = 0\n var missingLetters = 26\n\n for (i in s.indices) {\n val c = s[i]\n when (c) {\n '?' -> ++wildcardsCount\n in 'A'..'Z' -> {\n if (letterCount[c.toIndex()] == 0)\n --missingLetters\n ++letterCount[c.toIndex()]\n }\n }\n\n if (i >= 26) {\n val q = s[i - 26]\n when (q) {\n '?' -> --wildcardsCount\n in 'A'..'Z' -> {\n if (letterCount[q.toIndex()] == 1)\n ++missingLetters\n --letterCount[q.toIndex()]\n }\n }\n }\n\n if (i >= 25 && missingLetters <= wildcardsCount) {\n val missingLettersList = letterCount.indices.filter { letterCount[it] == 0 }\n var currentMissingLetterIndex = 0\n val answer = s.toCharArray()\n for (j in answer.indices) {\n if (answer[j] == '?') {\n answer[j] = 'A' + missingLettersList.getOrElse(currentMissingLetterIndex) { 0 }\n ++currentMissingLetterIndex\n }\n }\n output.println(String(answer))\n return\n }\n }\n\n output.println(\"-1\")\n}"}], "src_uid": "a249431a4b0b1ade652997fe0b82edf3"} {"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 String.words() = split(\" \")\n\nprivate fun String.toInts() = split(\" \").map { it.toInt() }\nprivate fun String.toLongs() = split(\" \").map { it.toLong() }\n\nprivate fun solve(input: BufferedReader, output: PrintWriter) {\n val p = input.readLine()\n val c = p.last()\n val n = p.dropLast(1).toLong()\n\n var time = 0L\n val byFourRowsBefore = (n - 1) / 4\n time += byFourRowsBefore * 16\n val even = n % 2\n if (even == 0L)\n time += 7\n time += when (c) {\n 'f' -> 1\n 'e' -> 2\n 'd' -> 3\n 'a' -> 4\n 'b' -> 5\n 'c' -> 6\n else -> throw IllegalArgumentException()\n }\n output.println(time)\n}", "positive_code": [{"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 val s = next()\n val n = s.substring(0..s.length-2).toLong() - 1\n val q = (n % 4).toInt()\n val p = n / 4\n val num = arrayOf(4,5,6, 3,2,1)\n val numNum = arrayOf(0,1,0,1)\n val add = num[s.last() - 'a']\n fout.print(p * 16 + numNum[q] * 7 + add)\n fout.close()\n fin.close()\n}\n\n"}, {"source_code": "fun main(args: Array)\n{\n var pos: String = \"fedabc\"\n val size: Int = 5\n var s: Long = 0\n\n var read = readLine()!!\n var c = read.last()\n var n = read.dropLast(1).toLong()\n\n for(i in 0..size)\n if (c == pos[i]) s = i.toLong() + 1\n\n if (n % 2L == 0L)\n print(((n - 1) / 4) * 16 + s + 7)\n else\n print(((n - 1) / 4) * 16 + s)\n}\n\nfun String.toInts() = split(' ').map { it.toInt() }\nfun String.toLongs() = split(' ').map { it.toLong() }"}], "negative_code": [], "src_uid": "069d0cb9b7c798a81007fb5b63fa0f45"} {"source_code": "import java.util.*\nimport java.math.*\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\nfun main(args: Array){\n\topen class A(a: Int, b: Int) {\n\t\tpublic open var i: Int = a;\n\t\tpublic open var r: Int = b;\n\t}\n\tvar inp = readInts();\n\tvar n = inp[0];\n\tvar k = inp[1];\n\tvar s = readLn();\n\tvar j = 0;\n\tvar t = 0;\n\tfor(i in s.indices){\n\t\tif(s[i] == 'G'){\n\t\t\tj = i;\n\t\t}\n\t\tif(s[i] == 'T'){\n\t\t\tt = i;\n\t\t}\n\t}\n\tvar flag = false;\n\tfor(i in j..(s.length - 1) step k){\n\t\tif(s[i] == 'T'){\n\t\t\tflag = true;\n\t\t\tbreak;\n\t\t}\n\t\tif(s[i] == '#') break;\n\t}\n\tfor(i in t..(s.length - 1) step k){\n\t\tif(s[i] == 'G'){\n\t\t\tflag = true;\n\t\t\tbreak;\n\t\t}\n\t\tif(s[i] == '#') break;\n\t}\n\tif(flag){\n\t\tprintln(\"YES\");\n\t}else{\n\t\tprintln(\"NO\");\n\t}\n}\n", "positive_code": [{"source_code": "fun main() {\n var (n, k) = readLine()!!.split(' ').map { it.toInt() }\n\n var str = readLine()!!\n var g = str.indexOf('G')\n var t = str.indexOf('T')\n\n var min = minOf(g, t) + k\n var max = maxOf(g, t)\n\n if (min > max) {\n println(\"NO\")\n return\n }\n\n while (min <= max) {\n if (str[min] == '#') {\n println(\"NO\")\n return\n }\n if (str[min] == 'T' || str[min] == 'G'){\n println(\"YES\")\n return\n }\n min += k\n\n }\n println(\"NO\")\n}"}, {"source_code": "fun main() {\n val (n, k) = readLine()!!.split(\" \").map(String::toInt)\n val s = readLine()!!\n var f = false\n var pos = 0\n for (i in 0 until s.length) {\n if (s[i] in setOf('T','G')) {\n if (f) {\n pos = (pos + 1) % k\n if (pos == 0) println(\"YES\")\n else println(\"NO\")\n return\n } else f = true\n } else if (f) {\n pos = (pos + 1) % k\n if ((pos == 0) && (s[i] != '.')) {\n println(\"NO\")\n return\n }\n }\n }\n println(\"YES\")\n}"}, {"source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (_, jumpLength) = readInts()\n val s = readLine()!!\n var grasshopper = s.indexOfFirst { it == 'G' }\n var target = s.indexOfFirst { it == 'T' }\n if (target < grasshopper) {\n val temp = grasshopper\n grasshopper = target\n target = temp\n }\n while (grasshopper < target) {\n if (s[grasshopper] == '#')\n return print(\"NO\")\n grasshopper += jumpLength\n }\n print(if (grasshopper == target) \"YES\" else \"NO\")\n}"}, {"source_code": "import java.io.*\nimport java.util.*\n\nfun DataReader.solve(out: PrintWriter) {\n val n = nextInt()\n val k = nextInt()\n\n val s = nextToken()\n\n val used = BooleanArray(n)\n\n fun dfs(u: Int): Boolean {\n if (u < 0 || u >= n || used[u] || s[u] == '#') return false\n if (s[u] == 'T') return true\n used[u] = true\n\n return dfs(u - k) || dfs(u + k)\n }\n\n out.println(dfs(s.indexOf('G')).toYesNo())\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"}, {"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 String.words() = split(\" \")\n\nprivate fun String.toInts() = split(\" \").map { it.toInt() }\nprivate fun String.toLongs() = split(\" \").map { it.toLong() }\n\nprivate fun solve(input: BufferedReader, output: PrintWriter) {\n val (n, k) = input.readLine().toInts()\n val line = input.readLine()\n val indexOfG = line.indexOf(\"G\")\n val indexOfT = line.indexOf(\"T\")\n val rem = indexOfG % k\n val path = line\n .replaceRange(0..Math.min(indexOfG, indexOfT) - 1, String(CharArray(Math.min(indexOfG, indexOfT)) { '.' }))\n .replaceRange(Math.max(indexOfG, indexOfT) + 1, line.lastIndex + 1, String(CharArray(Math.min(indexOfG, indexOfT)) { '.' }))\n .filterIndexed { index, c -> index % k == rem }\n if (path.contains(\"G\") && path.contains(\"T\") && !path.contains(\"#\")) {\n output.println(\"YES\")\n } else {\n output.println(\"NO\")\n }\n}"}], "negative_code": [], "src_uid": "189a9b5ce669bdb04b9d371d74a5dd41"}