fun main() { val sheepNumber = readLine()?.toInt() var second = 1 sheepNumber?.let { var restSheepNumber = sheepNumber while (restSheepNumber > 0) { restSheepNumber -= second second++ } if (restSheepNumber == 0) { println("YES") println(second - 1) } else { println("NO") } } }