Is there any way to optimize this python code for USACO 2023 OPEN BRONZE P3?
variables = list(input().split())
activePositions = list(input().split())
N = int(variables[0])
K = int(variables[1])
T = int(variables[2])
currentPositions = [i for i in range(N)]
activePositions = [int(i) for i in activePositions]
for k in range(T):
for i in range(len(activePositions)-1):
currentPositions[activePositions[-1-i]], currentPositions[activePositions[-2-i]] = currentPositions[activePositions[-2-i]], currentPositions[activePositions[-1-i]]
activePositions = [(x+1)%N for x in activePositions]
print(str(currentPositions).replace("[", "").replace("]", "").replace(",",""))
I realize there is a double for loop, can I get rid of that?