Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map( int, input().split())
X = [0]*N
Y = [0]*N
for i in range(N):
    x, y = map( int, input().split())
    X[i] = x
    Y[i] = y
SX = sorted(X)
SY = sorted(Y)
ans = 10**19
for xleft in range(N-1):
    a = SX[ xleft]
    for xright in range(xleft, N):
        b = SX[ xright]
        for yunder in range(N-1):
            c = SY[ yunder]
            for yabove in range(yunder, N):
                d = SY[ yabove]
                cnt = 0
                for i in range(N):
                    if a <= X[i] and X[i] <= b and c <= Y[i] and Y[i] <= d:
                        cnt += 1
                if cnt >= K:
                    ans = min( ans, (b-a)*(d-c))
print(ans)

Fixed submission:
N, K = map( int, input().split())
X = [0]*N
Y = [0]*N
for i in range(N):
    x, y = map( int, input().split())
    X[i] = x
    Y[i] = y
SX = sorted(X)
SY = sorted(Y)
ans = 10**19
for xleft in range(N-1):
    a = SX[ xleft]
    for xright in range(xleft, N):
        b = SX[ xright]
        for yunder in range(N-1):
            c = SY[ yunder]
            for yabove in range(yunder, N):
                d = SY[ yabove]
                cnt = 0
                for i in range(N):
                    if a <= X[i] and X[i] <= b and c <= Y[i] and Y[i] <= d:
                        cnt += 1
                if cnt >= K:
                    ans = min( ans, (b-a)*(d-c))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
N = int( input())
A = [ list( map( int, input().split())) for _ in range(N)]
Q = []
for i in range(N-1):
    for j in range(i+1,N):
        heapq.heappush(Q, [A[i][j],i,j])
WF = [ [10**9+1]*N for _ in range(N)]
for i in range(N):
    WF[i][i] = 0
cnt = 0
while Q:
    a, s, g = heapq.heappop(Q)
    addcheck = 1
    for i in range(N):
        if i == s or i == g:
            continue
        else:
            if WF[s][i] + WF[i][g] == a:
                addcheck = 0
            elif WF[s][i] + WF[i][g] < a:
                 break
    else:
        WF[s][g] = a
        WF[g][s] = a
        if addcheck:
            cnt += a
        continue
    print(-1)
    break
else:
    print( cnt)

Fixed submission:
import heapq
N = int( input())
A = [ list( map( int, input().split())) for _ in range(N)]
Q = []
for i in range(N-1):
    for j in range(i+1,N):
        heapq.heappush(Q, [A[i][j],i,j])
WF = [ [10**9+1]*N for _ in range(N)]
for i in range(N):
    WF[i][i] = 0
cnt = 0
while Q:
    a, s, g = heapq.heappop(Q)
    addcheck = 1
    for i in range(N):
        if i == s or i == g:
            continue
        else:
            if WF[s][i] + WF[i][g] == a:
                addcheck = 0
            elif WF[s][i] + WF[i][g] < a:
                 break
    else:
        WF[s][g] = a
        WF[g][s] = a
        if addcheck:
            cnt += a
        continue
    print(-1)
    break
else:
    print( cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = [ 0 for _ in range(10**9)]
for i in range(N):
    a = int(input())
    X[a] = (X[a]+1)%2
print(sum(X))

Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
A = sorted(A)
ans = 0
K = A[0]
cnt = 0
for i in range(N):
    if A[i] == K:
        cnt = (cnt + 1)%2
    else:
        K = A[i]
        ans += cnt
        cnt = 1
if A[N-1] == K:
    ans += cnt
print(ans)
Buggy python submission (verdict: Runtime Error):
X, t = map(int, input().split())
print(max(X-t),0)

Fixed submission:
X, t = map(int, input().split())
print(max(X-t,0))
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

def lcm(a,b):
    return (a*b)/gcd(a, b)

N = int( input())
T = [ int( input()) for _ in range(N)]
ans = T[0]
for i in range(1,N):
    ans = int(lcm(ans,T[i]))
print(ans)

Fixed submission:
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

def lcm(a,b):
    return (a*b)//gcd(a, b)

N = int( input())
T = [ int( input()) for _ in range(N)]
ans = T[0]
for i in range(1,N):
    ans = lcm(ans,T[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int( input())
T = [ int( input()) for _ in range(N)]
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a
def lcm(a,b):
    return (a*b)/gcd(a,b)
ans = T[0]
for i in range(1,N):
    ans = int(lcm(ans,T[i]))
print(ans)

Fixed submission:
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

def lcm(a,b):
    return (a*b)//gcd(a, b)

N = int( input())
T = [ int( input()) for _ in range(N)]
ans = T[0]
for i in range(1,N):
    ans = lcm(ans,T[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
N = int( input())
T = [ int( input()) for _ in range(N)]
def lcm(a,b):
    return (a*b)/math.gcd(a,b)
ans = T[0]
for i in range(1,N):
    ans = int(lcm(ans,T[i]))
print(ans)

Fixed submission:
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

def lcm(a,b):
    return (a*b)//gcd(a, b)

N = int( input())
T = [ int( input()) for _ in range(N)]
ans = T[0]
for i in range(1,N):
    ans = lcm(ans,T[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map( int, input().split())
print((n-1)*(m-1))a

Fixed submission:
n, m = map( int, input().split())
print((n-1)*(m-1))
Buggy python submission (verdict: Runtime Error):
K = int(input())
print(50)
s, t = K//50, K%50
ANS = [ s + i for i in range(50)]
for j in range(t):
    for i in range(50):
        if j == i:
            ANS[i] += 50
        else:
            ANS[i] -= 1
print(" ".join(ANS))

Fixed submission:
K = int(input())
print(50)
s, t = K//50, K%50
ANS = [ s + i for i in range(50)]
for j in range(t):
    for i in range(50):
        if j == i:
            ANS[i] += 50
        else:
            ANS[i] -= 1
print(" ".join( map( str, ANS)))
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N, M = map( int, input().split())
A = [ [] for _ in range(N)]
for i in range(N):
    A[i] = list( map( int, input().split())) 
V = [1]*(M+1)
ans = N
for _ in range(M-1):
    W = []
    for i in range(N):
        if A[i]:
            a = A[i].pop(0)
            if V[a] == 1:
                W.append(a)
    a, c = Counter(W).most_common()[0]
    ans = min( ans, c)
    V[a] = 0
print(ans)

Fixed submission:
from collections import Counter
N, M = map( int, input().split())
A = [ [] for _ in range(N)]
for i in range(N):
    A[i] = list( map( int, input().split())) 
V = [1]*(M+1)
ans = N
for _ in range(M-1):
    W = []
    for i in range(N):
        while True:
            if V[A[i][0]] == 1:
                W.append(A[i][0])
                break
            else:
                A[i].pop(0)
    a, c = Counter(W).most_common()[0]
    ans = min( ans, c)
    V[a] = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
Q = 10**9 + 7
'''
def factorial(n):
    if n == 0:
        return 1
    else:
        return (n * factorial(n-1))%Q
'''
N, M = map( int, input().split())
N, M = min(N, M), max(N, M)
if N == M or N+1 == M:
    NN = 1
    MM = 1
    for i in range(1,N+1):
        NN = (NN*i)%Q
    if N == M:
        ans = (2*NN*NN)%Q
elif N+1 == M:
    ans = (NN*NN*M)%Q
else:
    ans = 0
print(ans)

Fixed submission:
Q = 10**9 + 7
'''
def factorial(n):
    if n == 0:
        return 1
    else:
        return (n * factorial(n-1))%Q
'''
N, M = map( int, input().split())
N, M = min(N, M), max(N, M)
if N == M or N+1 == M:
    NN = 1
    MM = 1
    for i in range(1,N+1):
        NN = (NN*i)%Q
    if N == M:
        ans = (2*NN*NN)%Q
    elif N+1 == M:
        ans = (NN*NN*M)%Q
else:
    ans = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map( int, input().split)
if A+B >= 10:
    print('error')
else:
    print(A+B)

Fixed submission:
A, B = map( int, input().split())
if A+B >= 10:
    print('error')
else:
    print(A+B)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
N = int( input())
A = list( map( int, input().split()))
fsum = [0]*(N+1)
bsum = [0]*(N+1)
forward = A[:N]
back = A[2*N:]
back = list(map( lambda x:-x, back))
heapq.heapify(forward)
heapq.heapify(back)
fsum[0] = sum(forward)
bsum[N] = -sum(back)
for i in range(1,N+1):
    heapq.heappushpop(forward, A[N+i-1])
    fsum[i] = sum(forward)
    heapq.heappushpop(back, -A[2*N-i])
    bsum[N-i] = -sum(back)
ans = fsum[0] - bsum[0]
for i in range(1,N+1):
    ans = max(ans, fsum[i] - bsum[i])
print(ans)

Fixed submission:
import heapq
N = int( input())
A = list( map( int, input().split()))
fsum = [0]*(N+1)
bsum = [0]*(N+1)
forward = A[:N]
back = A[2*N:]
back = list(map( lambda x:-x, back))
heapq.heapify(forward)
heapq.heapify(back)
fsum[0] = sum(forward)
fsumnow = fsum[0]
bsum[N] = -sum(back)
bsumnow = bsum[N]
for i in range(1,N+1):
    heapq.heappush(forward, A[N+i-1])
    fsumnow += A[N+i-1]
    fsumnow -= heapq.heappop(forward)
    fsum[i] = fsumnow
    heapq.heappush(back, -A[2*N-i])
    bsumnow += A[2*N-i]
    bsumnow += heapq.heappop(back)
    bsum[N-i] = bsumnow
ans = fsum[0] - bsum[0]
for i in range(1,N+1):
    ans = max(ans, fsum[i] - bsum[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map( int, input().split())
A = []
for i in range(N):
    a, b = map( int, input().split())
    A += [a]*b
    A.sort()
    A = A[:K]
print(A[K-1])

Fixed submission:
N, K = map( int, input().split())
A = [ [0]*2 for _ in range(N)]
for i in range(N):
    A[i] = list(map( int, input().split()))
A.sort()
L = 0
for i in range(N):
    L += A[i][1]
    if L >= K:
        print(A[i][0])
        break

Buggy python submission (verdict: Runtime Error):
N, K = map( int, input().split())
A = []
for i in range(N):
    a, b = map( int, input().split())
    A += [a]*b
    A = A.sort()[:K]
print(A[K-1])

Fixed submission:
N, K = map( int, input().split())
A = [ [0]*2 for _ in range(N)]
for i in range(N):
    A[i] = list(map( int, input().split()))
A.sort()
L = 0
for i in range(N):
    L += A[i][1]
    if L >= K:
        print(A[i][0])
        break

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map( int, input().split())
A = []
for i in range(N):
    a, b = map( int, input().split())
    A += [a]*b
A.sort()
print(A[K-1])

Fixed submission:
N, K = map( int, input().split())
A = [ [0]*2 for _ in range(N)]
for i in range(N):
    A[i] = list(map( int, input().split()))
A.sort()
L = 0
for i in range(N):
    L += A[i][1]
    if L >= K:
        print(A[i][0])
        break
Buggy python submission (verdict: Runtime Error):
N, W = map( int, input().split())
dp = [0]*(W+1)
for _ in range(N):
    w, v = map( int, input().split())
    for i in range(W,-1,-1):
        if i >= w:
            dp[i] = max( dp[i], dp[i-w]+v)
        else:
            continue
print(dp[-1])

Fixed submission:
from itertools import accumulate
N, W = map( int, input().split())
o, k = map( int, input().split())
A = [k]
B, C, D = [], [], []
for _ in range(N-1):
    w, v = map( int, input().split())
    if w == o:
        A.append(v)
    elif w == o+1:
        B.append(v)
    elif w == o+2:
        C.append(v)
    else:
        D.append(v)
A.sort(key=None, reverse = True)
B.sort(key=None, reverse = True)
C.sort(key=None, reverse = True)
D.sort(key=None, reverse = True)
A = [0] + list(accumulate(A))
B = [0] + list(accumulate(B))
C = [0] + list(accumulate(C))
D = [0] + list(accumulate(D))
# print(A)
# print(B)
# print(C)
# print(D)
ans = 0
for i in range( len(A)):
    for j in range( len(B)):
        for k in range( len(C)):
            for l in range( len(D)):
                if i*o + j*(o+1) + k*(o+2) + l*(o+3) <= W:
#                    print('{} {} {} {}'.format(i,j,k,l))
                    ans = max( ans, A[i]+B[j]+C[k]+D[l])
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int( input())
A = list( map( int, input().split()))
ans = 10**15
for i in [1, -1]:
    ansi, sums = 0, 0
    for a in A:
        sums += a
        if sums*i <= 0:
            ansi += abs(sums-s)
            sums = s
        s *= -1
    ans = min( ans, ansi)
print(ans)

Fixed submission:
N = int( input())
A = list( map( int, input().split()))
ans = 10**15
for i in [1, -1]:
    ansi, sums = 0, 0
    for a in A:
        sums += a
        if sums*i <= 0:
            ansi += abs(sums-i)
            sums = i
        i *= -1
    ans = min( ans, ansi)
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int( input())
A = list( map( int, input().split()))
ans = 10**15
for i in [1, -1]:
    ansi, sums = 0, 0
    for a in A:
        sums += A
        if sums*i <= 0:
            ansi += abs(sums-s)
            sums = s
        s *= -1
    ans = min( ans, ansi)
print(ans)

Fixed submission:
N = int( input())
A = list( map( int, input().split()))
ans = 10**15
for i in [1, -1]:
    ansi, sums = 0, 0
    for a in A:
        sums += a
        if sums*i <= 0:
            ansi += abs(sums-i)
            sums = i
        i *= -1
    ans = min( ans, ansi)
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int( input())
A = list( map( int, input().split()))
ansp = 0
sums = A[0]
if sums == 0:
    ansp += 1
    sums += 1
for i in range(1,n-1):
    sums += A[i]
    if i%2 == 1:
        if sums < 0:
            pass
        else:
            ansp += abs(-1-sums)
            sums = -1
    else:
        if sums > 0:
            pass
        else:
            ansp += abs(1 - sums)
            sums = 1
if (n-1)%2 == 0:
    if A[n-1] > 0:
        sums += A[n-1]
        pass
    else:
        ansp += abs(1-A[n])
        sums += 1
else:
    if A[n-1] < 0:
        sums += A[n-1]
        pass
    else:
        ansp += abs(-1-A[n-1])
        sums -= 1
if sums == 0:
    ansp += 1

sums = A[0]
ansm = 0
if sums == 0:
    ansm += 1
    sums -= 1
for i in range(1,n-1):
    sums += A[i]
    if i%2 == 0:
        if sums < 0:
            pass
        else:
            ansm += abs(-1-sums)
            sums = -1
    else:
        if sums > 0:
            pass
        else:
            ansm += abs(1 - sums)
            sums = 1
if (n-1)%2 == 1:
    if A[n-1] > 0:
        sums += A[n-1]
        pass
    else:
        ansm += abs(1-A[n-1])
        sums += 1
else:
    if A[n-1] < 0:
        sums += A[n-1]
        pass
    else:
        ansm += abs(-1-A[n-1])
        sums -= 1
if sums == 0:
    ansm += 1
print( min(ansp, ansm))

Fixed submission:
N = int( input())
A = list( map( int, input().split()))
ans = 10**15
for i in [1, -1]:
    ansi, sums = 0, 0
    for a in A:
        sums += a
        if sums*i <= 0:
            ansi += abs(sums-i)
            sums = i
        i *= -1
    ans = min( ans, ansi)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int( input())
ans = len( str(N))
for i in range(1,int( N**(1/2))+1):
    if N%i == 0:
        ans = min( ans, max( len(i), len(N//i)))
        break
print(ans)

Fixed submission:
N = int( input())
ans = len( str(N))
for i in range(1,int( N**(1/2))+1):
    if N%i == 0:
        ans = min( ans, max( len( str(i)), len( str(N//i))))
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int( input())
ans = len( str(N))
for i in range(N//2,N):
    if N%i == 0:
        ans = min( ans, len( str(i)))
        break
print(ans)

Fixed submission:
N = int( input())
ans = len( str(N))
for i in range(1,int( N**(1/2))+1):
    if N%i == 0:
        ans = min( ans, max( len( str(i)), len( str(N//i))))
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int( input())
ans = len(N)
for i in range(N//2,N):
    if N%i == 0:
        ans = min( ans, len(i))
        break
print(ans)

Fixed submission:
N = int( input())
ans = len( str(N))
for i in range(1,int( N**(1/2))+1):
    if N%i == 0:
        ans = min( ans, max( len( str(i)), len( str(N//i))))
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map( int, input().split())
if a == 'H':
    if b == 'H':
        print('H')
    else:
        print('D')
else:
    if b == 'H':
        print('D')
    else:
        print('H')

Fixed submission:
a, b = input().split()
if a == 'H':
    if b == 'H':
        print('H')
    else:
        print('D')
else:
    if b == 'H':
        print('D')
    else:
        print('H')
Buggy python submission (verdict: Runtime Error):
N, K = map( int, input().split())
A = list( map( int, input().split()))
RA = A.sort( reverse = True)
s = 0
ans = 0
for a in RA:
    if s+a < K:
        s += A
        ans += 1
    else:
        ans = 0
print(ans)

Fixed submission:
N, K = map( int, input().split())
A = list( map( int, input().split()))
RA = sorted(A)
RA = RA[::-1]
s = 0
ans = 0
for i in range(N):
    a = RA[i]
    if s+a < K:
        s += a
        ans += 1
    else:
        ans = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
N = int( input())
A = list( map( int, input().split()))
A.sort()
l = -1
r = N-1
B = list( accumulate(A))
while r - l > 1:
    m = (l+r)//2
    # now = sum(A[:m+1])
    check = 1
    for i in range(m+1,N):
        if B[i] <= now*2:
            pass
        else:
            check = 0
            break
    if check == 1:
        r = m
    else:
        l = m
print(N-r)

Fixed submission:
N = int( input())
A = list( map( int, input().split()))
A.sort()
l = -1
r = N-1
while r - l > 1:
    m = (l+r)//2
    now = sum(A[:m+1])
    check = 1
    for i in range(m+1,N):
        if A[i] <= now*2:
            now += A[i]
        else:
            check = 0
            break
    if check == 1:
        r = m
    else:
        l = m
print(N-r)
Buggy python submission (verdict: Runtime Error):
#import sys
#input = sys.stdin.readline
from itertools import accumulate
def main():
    N = int( input())
    A = list( map( int, input().split()))
    C = [0]*(N*2+2)
    L = [0]*(N*2+2)
    cnt = 0
    if sum(A)%(N*(N+1)//2) != 0:
        print("NO")
        return
    t = sum(A)//(N*(N+1)//2)
    for i in range(N):
        if (A[i] - A[i-1] + (N-1)*t)%N != 0:
            print("NO")
            return
        k =  (A[i] - A[i-1] + (N-1)*t)//N
        C[i] += t-k
        C[i+N] -= t-k
        cnt += t-k
        L[i+N] -= (t-k)*N
    S = list( accumulate(C))
    if cnt > t:
        print("NO")
        break
    for i in range(N*2+1):
        S[i+1] += S[i] + L[i+1]

    for i in range(N):
        if A[i] != S[i] + S[i+N]:
            print("NO")
            return
    print("YES")
    
            
if __name__ == '__main__':
    main()


Fixed submission:
import sys
input = sys.stdin.readline
def main():
    N = int( input())
    A = list( map( int, input().split()))
    if sum(A)%(N*(N+1)//2) != 0:
        print("NO")
        return
    t = sum(A)//(N*(N+1)//2)
    d = [0]*N
    for i in range(N):
        d[i] = A[i] - A[i-1] - t
    for i in range(N):
        if d[i] > 0 or d[i]%N != 0:
            print("NO")
            return
    print("YES")
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
  int a, b;
  char op;
  cin >> a >> op >> b;
  if (op == '+') {
    //    printf("%d\n", a+b);
    cout << a+b << "\n";
  }else {
    cout << a-b << "\n";
    //printf("%d\n", a-b);
  }
  return 0;
}


Fixed submission:
C = list( input().split())
if C[1] == '-':
    print( int(C[0]) - int(C[2]))
else:
    print( int(C[0]) + int(C[2]))
Buggy python submission (verdict: Runtime Error):
S = [list( input()) for _ in range(3)]
C = ['A', 'B', 'C']
now = 0
nowc = 'A'
while True:
    if not S[i]:
        ans = C[i]
        break
    nowc = S[i].pop(0)
    if nowc == 'a':
        now = 0
    elif nowc == 'b':
        now = 1
    else:
        now = 2
print(ans)

Fixed submission:
S = [list( input()) for _ in range(3)]
C = ['A', 'B', 'C']
now = 0
nowc = 'A'
while True:
    if not S[now]:
        ans = C[now]
        break
    nowc = S[now].pop(0)
    if nowc == 'a':
        now = 0
    elif nowc == 'b':
        now = 1
    else:
        now = 2
print(ans)
Buggy python submission (verdict: Runtime Error):
#import sys
#from collections import defaultdict
input = sys.stdin.readline
def main():
    N = int( input())
    A = [ int( input()) for _ in range(N)]
    B = sorted(A)
    d = defaultdict( int)
    for i in range(N):
        d[B[i]] = i
    odd = 0
    for i in range(N):
        if (i+1)%2 == d[A[i]]%2 and d[A[i]]%2 == 1:
            odd += 1
    print(odd)
    
if __name__ == '__main__':
    main()

Fixed submission:
import sys
from collections import defaultdict
input = sys.stdin.readline
def main():
    N = int( input())
    A = [ int( input()) for _ in range(N)]
    B = sorted(A)
    d = defaultdict( int)
    for i in range(N):
        d[B[i]] = i
    odd = 0
    for i in range(N):
        if (i+1)%2 == d[A[i]]%2 and d[A[i]]%2 == 1:
            odd += 1
    print(odd)
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
#import sys
#from collections import defaultdict
input = sys.stdin.readline
def main():
    N = int( input())
    A = [ int( input()) for _ in range(N)]
    B = sorted(A)
    d = defaultdict( int)
    for i in range(N):
        d[B[i]] = i
    odd = 0
    for i in range(N):
        if (i+1)%2 == d[A[i]]%2 and d[A[i]]%2 == 1:
            odd += 1
    print(odd)
    
if __name__ == '__main__':
    main()

Fixed submission:
import sys
from collections import defaultdict
input = sys.stdin.readline
def main():
    N = int( input())
    A = [ int( input()) for _ in range(N)]
    B = sorted(A)
    d = defaultdict( int)
    for i in range(N):
        d[B[i]] = i
    odd = 0
    for i in range(N):
        if (i+1)%2 == d[A[i]]%2 and d[A[i]]%2 == 1:
            odd += 1
    print(odd)
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N = int( input())
A = list( map( int, input().split()))
ans = 10**6
for a in range(-100, 101):
    a = A[i]
    cost = 0
    for j in range(N):
        cost += (A[j]-a)**2
    ans = min( ans, cost)
print(ans)


Fixed submission:
N = int( input())
A = list( map( int, input().split()))
ans = 10**6
for a in range(-100, 101):
    cost = 0
    for j in range(N):
        cost += (A[j]-a)**2
    ans = min( ans, cost)
print(ans)