Buggy python submission (verdict: Runtime Error):
from math import *
n = int(input())
engine = [list(map(int, input().split())) for i in range(n)]

args = []
for i in range(n):
    x, y = engine[i]
    if x == 0:
        if y < 0:
            args.append((-pi/2, x, y))
        elif y > 0:
            args.append((pi/2, x, y))

    elif y == 0:
        if x > 0:
            args.append((0, x, y))
        elif x < 0:
            args.append((pi, x, y))

    else:
        args.append((atan(y, x), x, y))

args.sort()
l = len(args)
args = args[:] + args[:]
ans = 0
for i in range(1, l+1):
    for j in range(l):
        x, y = 0, 0
        for k in range(j, j+i):
            x += args[k][1]
            y += args[k][2]
        ans = max(ans, hypot(x, y))

print(ans)


Fixed submission:
from math import *
n = int(input())
engine = [list(map(int, input().split())) for i in range(n)]

args = []
for i in range(n):
    x, y = engine[i]
    if x == 0:
        if y < 0:
            args.append((-pi/2, x, y))
        elif y > 0:
            args.append((pi/2, x, y))

    elif y == 0:
        if x > 0:
            args.append((0, x, y))
        elif x < 0:
            args.append((pi, x, y))

    else:
        args.append((atan2(y, x), x, y))

args.sort()
l = len(args)
args = args[:] + args[:]
ans = 0
for i in range(1, l+1):
    for j in range(l):
        x, y = 0, 0
        for k in range(j, j+i):
            x += args[k][1]
            y += args[k][2]
        ans = max(ans, hypot(x, y))

print(ans)

Buggy python submission (verdict: Runtime Error):
import random
N = int(input())
engine = [list(map(int, input().split())) for i in range(N)]

used = [False]*N
x = 0
y = 0

if N <= 50:

  for _ in range(5000000):
      i = random.randint(0, N-1)
      if used[i]:
          if x*x+y*y <= (x-engine[i][0])**2+(y-engine[i][1])**2:
              x -= engine[i][0]
              y -= engine[i][1]
              used[i] = False
      else:
          if x*x+y*y <= (x+engine[i][0])**2+(y+engine[i][1])**2:
              x += engine[i][0]
              y += engine[i][1]
              used[i] = True

  print((x*x+y*y)**(1/2))

else:
  print(ans)


Fixed submission:
from math import *
n = int(input())
engine = [list(map(int, input().split())) for i in range(n)]

args = []
for i in range(n):
    x, y = engine[i]
    if x == 0:
        if y < 0:
            args.append((-pi/2, x, y))
        elif y > 0:
            args.append((pi/2, x, y))

    elif y == 0:
        if x > 0:
            args.append((0, x, y))
        elif x < 0:
            args.append((pi, x, y))

    else:
        args.append((atan2(y, x), x, y))

args.sort()
l = len(args)
args = args[:] + args[:]
ans = 0
for i in range(1, l+1):
    for j in range(l):
        x, y = 0, 0
        for k in range(j, j+i):
            x += args[k][1]
            y += args[k][2]
        ans = max(ans, hypot(x, y))

print(ans)

Buggy python submission (verdict: Runtime Error):
import random
N = int(input())
engine = [list(map(int, input().split())) for i in range(N)]

used = [True]*N

x = 0
y = 0
for i in range(N):
    x += engine[i][0]
    y += engine[i][1]

for _ in range(2500000):
    i = random.randint(0, N-2)
    xtemp = x
    ytemp = y
    if used[i]:
        xtemp -= engine[i][0]
        ytemp -= engine[i][1]
    else:
        xtemp += engine[i][0]
        ytemp += engine[i][1]
    j = random.randint(i+1, N-1)
    if used[j]:
        xtemp -= engine[j][0]
        ytemp -= engine[j][1]
    else:
        xtemp += engine[j][0]
        ytemp += engine[j][1]


    if x*x+y*y <= xtemp**2+ytemp**2:
        used[i] = not used[i]
        used[j] = not used[j]
        x = xtemp
        y = ytemp
print((x*x+y*y)**(1/2))


Fixed submission:
from math import *
n = int(input())
engine = [list(map(int, input().split())) for i in range(n)]

args = []
for i in range(n):
    x, y = engine[i]
    if x == 0:
        if y < 0:
            args.append((-pi/2, x, y))
        elif y > 0:
            args.append((pi/2, x, y))

    elif y == 0:
        if x > 0:
            args.append((0, x, y))
        elif x < 0:
            args.append((pi, x, y))

    else:
        args.append((atan2(y, x), x, y))

args.sort()
l = len(args)
args = args[:] + args[:]
ans = 0
for i in range(1, l+1):
    for j in range(l):
        x, y = 0, 0
        for k in range(j, j+i):
            x += args[k][1]
            y += args[k][2]
        ans = max(ans, hypot(x, y))

print(ans)