Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/N)
sums = []
for i in range(1, avg+1):
    s = 0
    for j in range(N):
        s += (i-a[j])**2
    sums.append(s)
print(min(sums))

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/N)
sums = []
for i in range(min(a), avg+1):
    s = 0
    for j in range(N):
        s += (i-a[j])**2
    sums.append(s)
print(min(sums))

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/N)
sums = []
for i in range(1, avg+1):
    s = 0
    for j in range(N):
        s += (i-a[j])**2
    sums.append(s)
print(min(sums))

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/N)
sums = []
for i in range(min(a), avg+1):
    s = 0
    for j in range(N):
        s += (i-a[j])**2
    sums.append(s)
print(min(sums))

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/len(a))
sums = []
for i in range(1, avg+1):
    s = 0
    for j in range(N):
        s += (a[j]-i)**2
    sums.append(s)
print(min(sums))

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/N)
sums = []
for i in range(min(a), avg+1):
    s = 0
    for j in range(N):
        s += (i-a[j])**2
    sums.append(s)
print(min(sums))

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/len(a))
sums = []
for i in range(1, avg+1):
    s = 0
    for j in range(N):
        s += (a[j]-avg)**2
    sums[i] = s
print(min(sums))

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/N)
sums = []
for i in range(min(a), avg+1):
    s = 0
    for j in range(N):
        s += (i-a[j])**2
    sums.append(s)
print(min(sums))

Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/len(a))
sums = []
for i in range(1, avg+1):
    s = 0
    for j in range(N):
        s += (a[j]-avg)**2
    sums.append(s)
print(min(sums))

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/N)
sums = []
for i in range(min(a), avg+1):
    s = 0
    for j in range(N):
        s += (i-a[j])**2
    sums.append(s)
print(min(sums))

Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
a = list(map(int, input().split()))
avg = math.floor(sum(a)/len(a))
sums = []
for i in range(1, avg+1):
    sum = 0
    for j in range(N):
        sum += (a[j]-avg)**2
    sums.append(sum)
print(min(sums))


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/N)
sums = []
for i in range(min(a), avg+1):
    s = 0
    for j in range(N):
        s += (i-a[j])**2
    sums.append(s)
print(min(sums))

Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
a = list(map(int, input().split()))
avg = math.floor(sum(a)/len(a))
sums = []
for i in range(1, avg+1):
    sum = 0;
    for j in range(N):
        sum += (a[j]-avg)**2
    sums.append(sum)
print(min(sums))


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/N)
sums = []
for i in range(min(a), avg+1):
    s = 0
    for j in range(N):
        s += (i-a[j])**2
    sums.append(s)
print(min(sums))

Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
a = list(map(int, input().split()))2
avg = math.floor(sum(a)/len(a))
sums = []
for i in range(1, avg+1):
    sum = 0;
    for j in range(N):
        sum += (a[j]-avg)**2
    sums.append(sum)
print(min(sums))

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/N)
sums = []
for i in range(min(a), avg+1):
    s = 0
    for j in range(N):
        s += (i-a[j])**2
    sums.append(s)
print(min(sums))

Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
a = map(int, input().split())
avg = math.floor(sum(a)/len(a))
pattern = []
for i in range(1, avg+1):
    pattern[i] = []
    for j in range(N):
        pattern[i].append((a[j]-avg)**2)
    pattern[i] = sum(pattern[i])
print(min(pattern))


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
avg = round(sum(a)/N)
sums = []
for i in range(min(a), avg+1):
    s = 0
    for j in range(N):
        s += (i-a[j])**2
    sums.append(s)
print(min(sums))