Problem: There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coordinate X_i.  The N ants have just started walking. For each ant i, you are given the initial direction W_i. Ant i is initially walking clockwise if W_i is 1; counterclockwise if W_i is 2. Every ant walks at a constant speed of 1 per second. Sometimes, two ants bump into each other. Each of these two ants will then turn around and start walking in the opposite direction.  For each ant, find its position after T seconds.

Submission attempts (in order):
N, L, T = list(map(int, input().split(" ")))

# N,L,T = 3,10,6
# a = [1,2,3]
# b = [2,1,1]

a = []
b = []
for i in range(N):
    an, ve = map(int, input().split(" "))
    a.append(an)
    b.append(ve)

crash = 0

for i in range(1, N):
    if b[0] != b[i]:
        if b[0] == 1:
            crash += (T - ((a[i] - a[0]) / 2)) // (L / 2) + 1
        else:
            crash += (T - (L - (a[i] - a[0])) / 2) // (L / 2) + 1

for i in range(N):
    if b[i] == 1:
        a[i] += T
    else:
        a[i] -= T
    a[i] %= L


if b[0] == 1:
    where = int(crash) % N
else:
    where = int(-crash) % N

nowplace = a[where]
a.sort()

if b[0] == 1:
	if crash % 2 == 1:
		where0 = min([i for i in range(N) if a[i] == nowplace])
	else:
		where0 = max([i for i in range(N) if a[i] == nowplace])		
else:
	if crash % 2 == 1:
		where0 = max([i for i in range(N) if a[i] == nowplace])
	else:
		where0 = min([i for i in range(N) if a[i] == nowplace])

where0 = (where0 - crash) % N

res = a[where0:] + a[:where0]
res = map(str, res)

for i in res:
    print(i)


N, L, T = list(map(int, input().split(" ")))

# N,L,T = 3,10,6
# a = [1,2,3]
# b = [2,1,1]

a = []
b = []
for i in range(N):
    an, ve = map(int, input().split(" "))
    a.append(an)
    b.append(ve)

crash = 0

for i in range(1, N):
    if b[0] != b[i]:
        if b[0] == 1:
            crash += (T - ((a[i] - a[0]) / 2)) // (L / 2) + 1
        else:
            crash += (T - (L - (a[i] - a[0])) / 2) // (L / 2) + 1

for i in range(N):
    if b[i] == 1:
        a[i] += T
    else:
        a[i] -= T
    a[i] %= L


if b[0] == 1:
    where = int(crash) % N
else:
    where = int(-crash) % N

nowplace = a[where]
a.sort()

if b[0] == 1:
	if crash % 2 == 1:
		where0 = min([i for i in range(N) if a[i] == nowplace])
	else:
		where0 = max([i for i in range(N) if a[i] == nowplace])		
else:
	if crash % 2 == 1:
		where0 = max([i for i in range(N) if a[i] == nowplace])
	else:
		where0 = min([i for i in range(N) if a[i] == nowplace])

where0 = (where0 - int(crash)) % N

res = a[where0:] + a[:where0]
res = map(str, res)

for i in res:
    print(i)


N, L, T = list(map(int, input().split(" ")))

# N,L,T = 3,10,6
# a = [1,2,3]
# b = [2,1,1]

a = []
b = []
for i in range(N):
    an, ve = map(int, input().split(" "))
    a.append(an)
    b.append(ve)

crash = 0

for i in range(1, N):
    if b[0] != b[i]:
        if b[0] == 1:
            crash += (T - ((a[i] - a[0]) / 2)) // (L / 2) + 1
        else:
            crash += (T - (L - (a[i] - a[0])) / 2) // (L / 2) + 1

for i in range(N):
    if b[i] == 1:
        a[i] += T
    else:
        a[i] -= T
    a[i] %= L


if b[0] == 1:
    where = int(crash) % N
else:
    where = int(-crash) % N

nowplace = a[0]

a.sort()

if b[0] == 1:
	where0 = max([i for i in range(N) if a[i] == nowplace])
else:
	where0 = min([i for i in range(N) if a[i] == nowplace])

where0 = (where0 - where) % N

res = a[where0:] + a[:where0]
res = map(str, res)

for i in res:
    print(i)


Verdicts: Runtime Error

Wrong Answer

Accepted