Problem p02767 (python)

Fixed submission:
n= int(input())
spot = input().split()
ans = []
for i in spot:
    spot.append(int(spot[0]))
    del spot[0]
if n == 1:
    print(0)
else:
    if max(spot)==min(spot):
        ans.append(0)
    for s in range(min(spot),max(spot)):
        x = 0
        for t in spot:
            x += (s-t)**2
        ans.append(x)
if n != 1:
    ans.sort(reverse=False)
    print(ans[0])

Buggy submission (verdict: Runtime Error):
= int(input())
spot = input().split()
ans = []
for i in spot:
    spot.append(int(spot[0]))
    del spot[0]
if n == 1:
    print(0)
else:
    if max(spot)==min(spot):
        ans.append(0)
    for s in range(min(spot),max(spot)):
        x = 0
        for t in spot:
            x += (s-t)**2
        ans.append(x)
if n != 1:
    ans.sort(reverse=True)
    print(ans[0])

Buggy submission (verdict: Runtime Error):
n= int(input())
spot = input().split()
ans = []
for i in spot:
    spot.append(int(spot[0]))
    del spot[0]
if n == 1:
    print(0)
else:
    if max(spot)==1:
        ans.sppend(0)
    for s in range(min(spot),max(spot)):
        x = 0
        for t in spot:
            x += (s-t)**2
        ans.append(x)
if n != 1:
    ans.sort(reverse=True)
    print(ans[0])

Buggy submission (verdict: Runtime Error):
n= int(input())
spot = input().split()
ans = []
for i in spot:
    spot.append(int(spot[0]))
    del spot[0]
if n == 1:
    print(0)
else:
    for s in range(min(spot),max(spot)):
        x = 0
        for t in spot:
            x += (s-t)**2
        ans.append(x)
if n != 1:
    ans.sort(reverse=True)
    print(ans[0])

Buggy submission (verdict: Runtime Error):
n= int(input())
spot = input().split()
ans = []
for i in spot:
    spot.append(int(spot[0]))
    del spot[0]
if n == 1:
    print(0)
else:
    for s in range(min(spot),max(spot)):
        x = 0
        for t in spot:
            x += (s-t)**2
        ans.append(x)
if n != 1:
    print(min(ans))

Buggy submission (verdict: Runtime Error):
n= int(input())
spot = input().split()
ans = []
for i in spot:
    spot.append(int(spot[0]))
    del spot[0]
if n == 1:
    print(0)
else:
    for s in range(min(spot),max(spot)):
        x = 0
        for t in spot:
            x += (s-t)**2
    ans.append(x)
if n != 1:
    print(min(ans))

Buggy submission (verdict: Runtime Error):
n= int(input())
spot = input().split()
ans = []
for i in spot:
    spot.append(int(spot[0]))
    del spot[0]
if n == 1:
    print(0)
else:
    for s in range(min(spot),max(spot)):
        x = 0
    for t in spot:
        x += (s-t)**2
    ans.append(x)
if n != 1:
    print(min(ans))

Buggy submission (verdict: Runtime Error):
n= int(input())
spot = input().split()
ans = []
for i in spot:
    spot.append(int(spot[0]))
    del spot[0]
for s in range(min(spot),max(spot)):
    x = 0
    for t in spot:
        x += (s-t)**2
    ans.append(x)
if n == 1:
    print(ans[0])
else:
    print(min(ans))

Buggy submission (verdict: Runtime Error):
n= int(input())
spot = input().split()
ans = []
for i in spot:
    spot.append(int(spot[0]))
    del spot[0]
for s in range(min(spot),max(spot)):
    x = 0
    for t in spot:
        x += (s-t)**2
    ans.append(x)
print(min(ans))

Buggy submission (verdict: Runtime Error):
n= int(input())
spot = input().split()
ans = []
for i in spot:
    spot.append(int(spot[0]))
    del spot[0]
for s in range(min(spot),max(spot)):
    x = 0
    for t in spot:
        x += (s-t)**2
    ans.append(x)
print(min(ans))

Buggy submission (verdict: Runtime Error):
n= int(input())
spot = input().split()
cnt = 0
ans = []
for i in spot:
    spot.append(int(i))
    del spot[cnt]
    cnt += 1
for s in range(min(spot),max(spot)):
    x = 0
    for t in spot:
        x += (t-s)**2
    ans.append(x)
print(min(ans))