import java.util.* import kotlin.math.sqrt fun main(args: Array){ var num = readLine()!!.toInt() var ans = "Bob" if(isWin(divPrime(num))) { ans = "Alice" } println(ans) } val dictionary = mutableMapOf>() fun isWin(primeList:List):Boolean { if(primeList.size <= 0) { return false } if(!dictionary.containsKey(primeList.size)) { dictionary[primeList.size] = mutableMapOf() } val key = getKey(primeList) if(dictionary[primeList.size]!!.containsKey(key)) { return dictionary[primeList.size]!![key]!! } var canWin = false for(i in primeList.indices) { for(j in 1..primeList[i]) { var sublist = primeList.toMutableList() sublist[i] -= j if(sublist[i] <= 0) { sublist.removeAt(i) } sublist = sublist.sortedDescending().toMutableList() if(!isWin(sublist)) { canWin = true break } } } dictionary[primeList.size]!![key] = canWin return canWin } fun getKey(list: List):String { return list.joinToString("-") } fun divPrime(num:Int):List { var temp = num var div = 2 val list = mutableListOf() while (temp > 1) { var cnt = 0 while (temp % div == 0) { cnt++ temp = (temp / div) } if(cnt > 0) { list.add(cnt) } div++ } return list.sortedDescending() }