I was working on USACO Shell Game and submitted a solution for python but it kept giving me an EOF error while I did it, however in my Python IDE it works perfectly fine. Is there a bug in my code that my IDE doesn’t recognize or is it correct?
actions = []
pebblepos = 0
allvaluesonpebblepos = []
points = 0
n = int(input())
for k in range(n):
actions.append(list(input().split()))
pebblepos = 1
for k in range(len(actions)):
if str(pebblepos) == actions[k][0]:
pebblepos = actions[k][1]
elif str(pebblepos) == actions[k][1]:
pebblepos = actions[k][0]
if actions[k][2] == str(pebblepos):
points += 1
allvaluesonpebblepos.append(points)
points = 0
pebblepos = 2
for k in range(len(actions)):
if str(pebblepos) == actions[k][0]:
pebblepos = actions[k][1]
elif str(pebblepos) == actions[k][1]:
pebblepos = actions[k][0]
if actions[k][2] == str(pebblepos):
points += 1
allvaluesonpebblepos.append(points)
pebblepos = 3
points = 0
for k in range(len(actions)):
if str(pebblepos) == actions[k][0]:
pebblepos = actions[k][1]
elif str(pebblepos) == actions[k][1]:
pebblepos = actions[k][0]
if actions[k][2] == str(pebblepos):
points += 1
allvaluesonpebblepos.append(points)
print(max(allvaluesonpebblepos))