Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N

if round(avg) in a:
    print(a.index(round(avg)))
else:
    result = 100
    for i in range(N):
        temp = abs(avg-a[i])
        if temp <= result:
            result = temp
    print(a.index(round(result)))


Fixed submission:
import numpy as np
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N

idx = np.abs(np.asarray(a)-avg).argmin()
print(idx)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N

if round(avg) in a:
    print(a.index(round(avg)))
else:
    result = 100
    for i in range(N):
        temp = abs(a[i]-avg)
        if temp <= result:
            result = temp
    print(a.index(round(result)))


Fixed submission:
import numpy as np
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N

idx = np.abs(np.asarray(a)-avg).argmin()
print(idx)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N

if round(avg) in a:
    print(a.index(avg))
else:
    result = 100
    for i in range(N):
        temp = abs(a[i]-avg)
        if temp <= result:
            result = temp
    print(a.index(round(result)))


Fixed submission:
import numpy as np
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N

idx = np.abs(np.asarray(a)-avg).argmin()
print(idx)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N
result = 100

if round(avg) in a:
    print(a.index(avg))
else:
    for i in range(N):
        temp = abs(avg-a[i])
        if temp <= result:
            result = temp
    print(a.index(round(result)))


Fixed submission:
import numpy as np
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N

idx = np.abs(np.asarray(a)-avg).argmin()
print(idx)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N
result = 100

if avg in a:
    print(a.index(avg))
else:
    for i in range(N):
        temp = abs(avg-a[i])
        if temp <= result:
            result = temp
    print(a.index(round(result)))


Fixed submission:
import numpy as np
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N

idx = np.abs(np.asarray(a)-avg).argmin()
print(idx)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N
a = list(set(a))
result = 100


if avg in a:
    result = a.index(avg)
else:
    for i in range(len(a)):
        temp = abs(avg-a[i])
        if temp <= result:
            result = temp
    result = a.index(round(result))
print(result)


Fixed submission:
import numpy as np
N = int(input())
a = list(map(int, input().split()))

avg = 0
for i in range(N):
    avg += a[i]
avg /= N

idx = np.abs(np.asarray(a)-avg).argmin()
print(idx)