circulo = list(range(int(input())))
morte_observada = int(input())

cont_mortes = 0
pode_morrer =  False

while len(circulo) >1:
    pessoa = circulo.pop(0)
    if not pode_morrer : 
        circulo.append(pessoa)
    else:
        cont_mortes +=1
        if cont_mortes == morte_observada:
            print(f"Morte{morte_observada}:{pessoa + 1}")
    pode_morrer = not pode_morrer
print(f"sobrevivente: {circulo[0] + 1}")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: