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 { val primeList = getPrime(num) if(primeList.contains(num)) { return mutableListOf(1) } val list = mutableListOf() var temp = num for(prime in primeList) { if(temp < prime) { break } var cnt = 0 while (temp % prime == 0) { cnt++ temp = temp / prime } if(cnt > 0) { if(cnt <= 2) { list.add(cnt) } else { list.add(3) } } } return list.sortedDescending() } fun getPrime(num:Int):List { val ret = mutableListOf() val flags = Array(num + 1) {false} for(i in 2..num) { if(flags[i]) { continue } for(j in 1..num/i) { flags[j*i] = true } ret.add(i) } return ret.toList() }