Python
a=[int(i) for i in input().split()]
while len(a)>2:
z=0
for i in range(2,len(a)-z,3):
a.pop(i-z)
z+=1
print(a)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
[1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20]
[1, 2, 5, 7, 10, 11, 14, 16, 19, 20]
[1, 2, 7, 10, 14, 16, 20]
[1, 2, 10, 14, 20]
[1, 2, 14, 20]
[1, 2, 20]
[1, 2]
>>>
Python
a=[int(i) for i in input().split()]
while len(a)>2:
z=0
for i in range(2,len(a)-z,3):
a.pop(i-z)
z+=1
print(a)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
[1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20]
[1, 2, 5, 7, 10, 11, 14, 16, 19, 20]
[1, 2, 7, 10, 14, 16, 20]
[1, 2, 10, 14, 20]
[1, 2, 14, 20]
[1, 2, 20]
[1, 2]
>>>