Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
x=n
flag1=False
flag2=False
for i in range(n):
    if s[i]=="#" and flag1==False:
        x=i
        flag1=True
    if s[n-1-i]!="#" and flag2==False:
        y=n-i
        flag2=True
    if flag1==True and flag2==True:
        break

b=s[x:y].count("#") 
w=len(s[x:y])-b
print(b if b<w else w)

Fixed submission:
n=int(input())
s=input()


w=s.count(".")
ans = w

for i in range(n):

    if s[i]=="#":
        w+=1
    if s[i]==".":
        w-=1
    ans=min(ans,w)
    
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
x=n
for i in range(n):
    if s[i]=="#":
      x=i
      break
for i in range(1,n):
    if s[n-i]=="#":
        s=s[:-i]
    else:
        break
b=s[x:].count("#") 
w=len(s[x:])-b
print(b if b<w else w)


Fixed submission:
n=int(input())
s=input()


w=s.count(".")
ans = w

for i in range(n):

    if s[i]=="#":
        w+=1
    if s[i]==".":
        w-=1
    ans=min(ans,w)
    
print(ans)
Buggy python submission (verdict: Runtime Error):
for i in range(6):
  a[i]=int(input())
print("Yay!" if a[4]-a[0]==a[5] else ":(")

Fixed submission:
a=[int(input()) for i in range(6)]
print("Yay!" if a[4]-a[0]<=a[5] else ":(")
Buggy python submission (verdict: Runtime Error):
A = list(map(int,input().split( )))
a=A[0]
b=A[1]
k=A[2]
x=0
for h in range(1,51):
	i=50-h
	if a%i + b%i:
		continue
	x=x+1
	print(i)
	if x == k:
		break
print(i)

Fixed submission:
A = list(map(int,input().split( )))
a=A[0]
b=A[1]
k=A[2]
x=0
for h in range(100):
	i= (b if a>b else a)-h
	if a%i + b%i:
		continue
	x=x+1
	if x == k:
		break
print(i)
Buggy python submission (verdict: Runtime Error):
#include<iostream>
#include<vector>

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    std::vector<char> a(n);

    for (int i =0;i<n;i++)
        cin >> a[i];
    int ans =-(-n/(k-1));
    cout << ans<<endl;


}

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
n=n-k
print(-(-n//(k-1))+1)
Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = [0]*(N+1)
b = [0]*(M+1)
X = 0
Y = 0
cnt = 0
for n in range(N):
    a[n+1] = a[n] + A[n]
for n in range(M):
    b[n+1] = b[n] + B[n]
for n in range(1, N+1):
    if a[n] <= K:
        X = n
for m in range(1, M+1):
    if b[m] <= K:
        Y = m 
if a[X] < b[Y]:
    K = K - a[X]
    cnt += X
    if K - b[Y] == 0:
        cnt += Y
    else:
        for y in range(1, Y+1):
            if b[y] < K:
                cnt += 1
else:
    K = K - b[Y]
    cnt += Y
    if K - a[X] == 0:
        cnt += X
    else:
        for x in range(1, X+1):
            if a[x] < K:
                cnt += 1
print(cnt)

Fixed submission:
a = int(input())

print(a + a**2 + a**3)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
C = sum(A)
D = [0]*(10**5)
for n in range(N):
    D[A[n]] += 1
Q = int(input())
Z = []
for q in range(Q):
    x, y = map(int, input().split())
    if D[x]:
        C = C - x*D[x]
        C = C + y*D[x]
        Z.append(C)
        if D[y]:
            D[y] += 1*D[x]
        else:
            D[y] = D[x]
        D[x] = 0
    else:
        Z.append(C)
for z in Z:
    print(z)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0]*(N+1)
for n in range(N):
    B[n+1] = B[n] + A[n]
C = B.pop()

Z = {}
for n in range(N):
    Z[A[n]] = 0
for n in range(N):
    Z[A[n]] += 1

D = []
Q = int(input())
for q in range(Q):
    x, y = map(int, input().split())
    if x in Z:
        C = C - x*Z[x]
        C = C + y*Z[x]
        D.append(C)
        if x == y:
            continue
        if y in Z:
            Z[y] += 1*Z[x]
        else:
            Z[y] = Z[x]
        Z.pop(x)
    else:
        D.append(C)
for d in D:
    print(d)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
C = sum(A)
D = [0]*(10**5)
for n in range(N):
    D[A[n]] += 1
Q = int(input())
Z = []
for q in range(Q):
    x, y = map(int, input().split())
    if D[x]:
        C = C - x*D[x]
        C = C + y*D[x]
        Z.append(C)
        D[y] += 1*D[x]
        D[x] = 0
    else:
        Z.append(C)
for z in Z:
    print(z)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0]*(N+1)
for n in range(N):
    B[n+1] = B[n] + A[n]
C = B.pop()

Z = {}
for n in range(N):
    Z[A[n]] = 0
for n in range(N):
    Z[A[n]] += 1

D = []
Q = int(input())
for q in range(Q):
    x, y = map(int, input().split())
    if x in Z:
        C = C - x*Z[x]
        C = C + y*Z[x]
        D.append(C)
        if x == y:
            continue
        if y in Z:
            Z[y] += 1*Z[x]
        else:
            Z[y] = Z[x]
        Z.pop(x)
    else:
        D.append(C)
for d in D:
    print(d)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())
res = 0
total = 0
S = K - A
Z = S - B
for c in range(C+1):
    if Z == c:
        total = A*1 + B*0 + c*-1
        if res < total:
            res = total
print(res)

Fixed submission:
A, B, C, K = map(int, input().split())

xa = min(A, K)
K = K - xa
xb = min(B, K)
K = K - xb
xc = min(C, K)
total = xa*1 + xb*0 + xc*-1
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())
res = 0
total = 0
S = K - A
for b in range(B+1):
    for c in range(C+1):
        if S == b + c:
            total = A*1 + b*0 + c*-1
            if res < total:
                res = total
print(res)

Fixed submission:
A, B, C, K = map(int, input().split())

xa = min(A, K)
K = K - xa
xb = min(B, K)
K = K - xb
xc = min(C, K)
total = xa*1 + xb*0 + xc*-1
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())
res = 0
total = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if K == a + b + c:
                total = a*1 + b*0 + c*-1
                if res < total:
                    res = total
print(total)

Fixed submission:
A, B, C, K = map(int, input().split())

xa = min(A, K)
K = K - xa
xb = min(B, K)
K = K - xb
xc = min(C, K)
total = xa*1 + xb*0 + xc*-1
print(total)
Buggy python submission (verdict: Runtime Error):
import itertools
N, M, Q = map(int, input().split())
m = list()
res = -100
for i in range(Q):
    n = list(map(int, input().split()))
    m.append(n)
l = [x for x in range(1, M + 1)]
p = itertools.combinations_with_replacement(l, N)
for p in p:
    total = 0
    for i in range(Q):
        num = 0
        a = m[i][0]
        b = m[i][1]
        A = p[a - 1]
        B = p[b - 1]
        C = B - A
        if m[i][2] == C:
            num = num + m[i][3]
            total = total + num
    if res < total:
        res = total
print(res)

Fixed submission:
K = int(input())
A, B = map(int, input().split())

res = False
for i in range(1000):
    k = i * K
    if k >= A and k <= B:
        res = True

if res:
    print('OK')
else:
    print('NG')

Buggy python submission (verdict: Runtime Error):
import itertools
N, M, Q = map(int, input().split())
m = list()
res = -100
for i in range(Q):
    n = list(map(int, input().split()))
    m.append(n)
l = [x for x in range(1, M + 1)]
p = itertools.combinations_with_replacement(l, N)
for p in p:
    total = 0
    for i in range(Q):
        num = 0
        a = m[i][0]
        b = m[i][1]
        A = p[a - 1]
        B = p[b - 1]
        C = B - A
        if m[i][2] == C:
            num = num + m[i][3]
            total = total + num
    if res < total:
        res = total
print(res)

Fixed submission:
K = int(input())
A, B = map(int, input().split())

res = False
for i in range(1000):
    k = i * K
    if k >= A and k <= B:
        res = True

if res:
    print('OK')
else:
    print('NG')
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

list1 = []
list2 = []

count = 0
C = 0
o = 0
b = 0
G = 0

for i in range(1, N + 1):
    list1.append(i * 2)
    if i >= 2:
        C = sum(list1)
        list1.remove(list1[o])
        o += 1
    if C % 2 == 0:
        count += 1
    C = 0

for q in range(1, M + 1):
    list2.append((q * 2) - 1)
    if q >= 2:
        G = sum(list2)
        list2.remove(list2[b])
        b += 1
    if G % 2 == 0:
        count += 1
    G = 0

for w in list1:
    for e in list2:
        total = w + e
        if total % 2 == 0:
            count += 1

print(count)

Fixed submission:
import math


N, M = map(int, input().split())

count = N * (N - 1) / 2 + M * (M - 1) / 2
print(math.floor(count))
Buggy python submission (verdict: Time Limit Exceeded):
N, A, B = map(int, input().split())
a = 0
b = 0
C = 0
while N > 0:
    C = N
    N = N - A
    if N > 0:
        a = a + A
    else:
        a = a + C
    N = N - B
print(a)

Fixed submission:
N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []
for n in range(N):
    A.append(input())
A.sort()
B = []
for n in range(N):
    C = 0
    for i in range(N):
        if A[n] == A[i]:
            C += 1
    B.append(C)
m = max(B)
D = []
for i in range(N):
    if m <= B[i]:
        D.append(A[i])
D = list(set(D))
for i in range(len(D)):
    print(D[i])

Fixed submission:
N = int(input())
A = {}
B = []
for n in range(N):
    a = input()
    B.append(a)
    A[a] = 0
for n in range(N):
    A[B[n]] += 1
res = 0
C = []
for key, value in A.items():
    if res < value:
        res = value
for key, value, in A.items():
    if res <= value:
        C.append(key)
C.sort()
for c in C:
    print(c)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
res = True
p = 1
for n in range(N):
    for i in range(p, N):
        if A[n] == A[i]:
            res = False
    p += 1
if res:
    print('YES')
else:
    print('NO')

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
res = A[0]
cnt = True
for n in range(1, N):
    if A[n] == res:
        cnt= False
    res = A[n]
if cnt:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))
res = 0
p = 0
for n in range(N):
    D = 0
    for k in range(K):
        O = 0
        O = sum(range(1, P[k]+1))
        D = D + (O / P[k])
    if res < D:
        res = D
    P.pop(0)
    if len(P) < K:
        break
print(res)

Fixed submission:
N, K = map(int, input().split())
P    = list(map(int, input().split()))
p    = [(P[i]+1) / 2 for i in range(N)]
a    = 0
for i in range(K):
    a += p[i]
b = a
for i in range(N - K):
    c = a + p[i+K] - p[i]
    b = max(b, c)
    a = c
print(b)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for n in range(N):
    if n == 0:
        cnt += 1
    else:
        L = P[:n]
        L.sort()
        if P[n] <= L[0]:
            cnt += 1
print(cnt)


Fixed submission:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
res = float('Inf')
for n in range(N):
    if P[n] < res:
        res = P[n]
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for n in range(N):
    if n == 0:
        cnt += 1
    else:
        L = P[:n]
        L = sorted(L)
        if P[n] <= min(L):
            cnt += 1
print(cnt)


Fixed submission:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
res = float('Inf')
for n in range(N):
    if P[n] < res:
        res = P[n]
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for n in range(N):
    if n == 0:
        cnt += 1
    else:
        if P[n] <= min(P[:n]):
            cnt += 1
print(cnt)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
res = float('Inf')
for n in range(N):
    if P[n] < res:
        res = P[n]
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for n in range(N):
    res = True
    for i in range(n):
        if P[n] > P[i]:
            res = False
            break
    if res:
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
res = float('Inf')
for n in range(N):
    if P[n] < res:
        res = P[n]
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for n in range(N):
    res = True
    for i in range(n):
        if P[n] > P[i]:
            res = False
            break
    if res:
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
res = float('Inf')
for n in range(N):
    if P[n] < res:
        res = P[n]
        cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for n in range(N):
    res = True
    for i in range(n):
        if P[n] > P[i]:
            res = False
            break
    if res:
        cnt += 1
print(cnt)


Fixed submission:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
res = float('Inf')
for n in range(N):
    if P[n] < res:
        res = P[n]
        cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
L = list()
for m in range(M):
    l = input().split()
    L.append(l)
AC = 0
WA = 0
cnt = 0
for m in range(M):
    res = False
    if L[m][1] == 'AC':
        AC += 1
        res = True
        if res:
            cnt += 1
    elif L[m][1] == 'WA':
        WA += 1
    if int(L[m][0]) == N and res == True:
        break
print('{} {}'.format(AC // cnt, WA))


Fixed submission:
n, m = map(int, input().split())
tmp  = [0]*n
wtmp = [0]*n
for _ in range(m):
    P, s = map(str, input().split())
    p = int(P)
    p -= 1
    if not tmp[p] == 0:
        continue
    if s == 'AC':
        tmp[p] = 1
    else:
        wtmp[p] += 1
ans1 = sum(tmp)
ans2 = 0
for i in range(n):
    if tmp[i] == 1:
        ans2 += wtmp[i]
print(ans1, ans2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
cut = 0
for n in range(N+1):
    if S[n] == 'A' and S[n + 1] == 'B' and S[n + 2] == 'C':
        cut += 1

print(cut)

Fixed submission:
N = int(input())
S = input()
cut = S.count('ABC')
print(cut)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
cut = 0
for n in range(N):
    if S[n] == 'A' and S[n + 1] == 'B' and S[n + 2] == 'C':
        cut += 1

print(cut)


Fixed submission:
N = int(input())
S = input()
cut = S.count('ABC')
print(cut)
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
B = []
for s in range(len(S)):
    B.append(S[s])
A = []
for q in range(Q):
    l, r = map(int, input().split())
    cnt = 0
    C = []
    C = S[l-1:r]
    for c in range(len(C)-1):
        if C[c] + C[c+1]  == 'AC':
            cnt += 1
    A.append(cnt)
for a in A:
    print(a)

Fixed submission:
N, Q = map(int, input().split())
S = input()
s = [0]*N
A = []
for n in range(N-1):
    if S[n] + S[n+1] == 'AC':
        s[n+1] = s[n] + 1
    else:
        s[n+1] = s[n]
for q in range(Q):
    l, r = map(int, input().split())
    A.append(s[r-1] - s[l-1])
for a in A:
    print(a)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
S = [0]*(N+1)
for n in range(N):
    S[n+1] = S[n] + A[n]
C = [0]*(2*10**5+1)
for n in range(len(S)):
    C[S[n]] += 1
cnt = 0
for c in range(2*10**5+1):
    cnt += C[c] * (C[c] - 1) // 2
print(cnt)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
S = [0]*(N+1)
for n in range(N):
    S[n+1] = S[n] + A[n]
B = {}
for s in range(len(S)):
    B[S[s]] = 0
for s in range(len(S)):
    B[S[s]] += 1
res = 0
for v in B.values():
    if v > 1:
        res += v * (v - 1) // 2
print(res)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
S = [0]*(N+1)
for n in range(N):
    S[n+1] = S[n] + A[n]
C = [0]*(2*10**5)
for n in range(len(S)):
    C[S[n]] += 1
cnt = 0
for c in range(2*10**5):
    cnt += C[c] * (C[c] - 1) // 2
print(cnt)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
S = [0]*(N+1)
for n in range(N):
    S[n+1] = S[n] + A[n]
B = {}
for s in range(len(S)):
    B[S[s]] = 0
for s in range(len(S)):
    B[S[s]] += 1
res = 0
for v in B.values():
    if v > 1:
        res += v * (v - 1) // 2
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
S = [0]*(N+1)
for n in range(N):
    S[n+1] = S[n] + A[n]
cnt = 0
for s in range(len(S)):
    for i in range(len(S)):
        if s < i and S[s] == S[i]:
            cnt +=1
print(cnt)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
S = [0]*(N+1)
for n in range(N):
    S[n+1] = S[n] + A[n]
B = {}
for s in range(len(S)):
    B[S[s]] = 0
for s in range(len(S)):
    B[S[s]] += 1
res = 0
for v in B.values():
    if v > 1:
        res += v * (v - 1) // 2
print(res)
Buggy python submission (verdict: Runtime Error):
N = int(input())
t = [0]*100000
x = [0]*100000
y = [0]*100000

for n in range(N):
    t[n+1], x[n+1], y[n+1] = map(int, input().split())

ans = True
for n in range(N):
    dt   = t[n+1] - t[n]
    dist = (x[n+1] - x[n]) + (y[n+1] - y[n])
    if dt < dist:
        ans = False
    if dt % 2 != dist % 2:
        ans = False
if ans:
    print('Yes')
else:
    print('No')

Fixed submission:
import math
N = int(input())
T = [0]*110000
X = [0]*110000
Y = [0]*110000

for n in range(N):
    T[n+1], X[n+1], Y[n+1] = map(int, input().split())

res = True
for n in range(N):
    dt   = T[n+1] - T[n]
    dist = abs(X[n+1] - X[n]) + abs(Y[n+1] - Y[n])
    if dt < dist:
        res = False
    if dt % 2 != dist % 2:
        res = False

if res:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
res = 10**10 + 1
for A in range(1, N + 1):
    if N % A == 0:
        B = N // A
        a = len(str(A))
        b = len(str(B))
        if a > b:
            num = a
        else:
            num = b
        if res > num:
            res = num
print(res)


Fixed submission:
import math
N = int(input())
ans = float('Inf')
sq = int(math.sqrt(N)) + 1
for i in range(1, sq):
    if N % i == 0:
        a = len(str(i))
        b = len(str(N // i))
        if a > b:
            num = a
        else:
            num = b
        if ans > num:
            ans = num
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
res = 10**10 + 1
for A in range(1, N + 1):
    if N % A == 0:
        B = N // A
        a = len(str(A))
        b = len(str(B))
        if a > b:
            num = a
        else:
            num = b
        if res > num:
            res = num
print(res)


Fixed submission:
import math
N = int(input())
ans = float('Inf')
sq = int(math.sqrt(N)) + 1
for i in range(1, sq):
    if N % i == 0:
        a = len(str(i))
        b = len(str(N // i))
        if a > b:
            num = a
        else:
            num = b
        if ans > num:
            ans = num
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
res = 10**10 + 1
for A in range(1, N + 1):
    for B in range(1, A + 1):
        total = A * B
        if total == N:
            a = len(str(A))
            b = len(str(B))
            if a > b:
                num = a
            else:
                num = b
            if res > num:
                res = num
print(res)


Fixed submission:
import math
N = int(input())
ans = float('Inf')
sq = int(math.sqrt(N)) + 1
for i in range(1, sq):
    if N % i == 0:
        a = len(str(i))
        b = len(str(N // i))
        if a > b:
            num = a
        else:
            num = b
        if ans > num:
            ans = num
print(ans)
Buggy python submission (verdict: Runtime Error):
text = input()
rows = text.split('\n')
k = int(rows[0])
a = int(rows[1].split(' ')[0])
b = int(row[1].split(' ')[1])
for i in range(a, b + 1):
    if i % k == 0:
        print('OK')
        break
else:
    print('NG')


Fixed submission:
row1 = input()
row2 = input()
k = int(row1)
a = int(row2.split(' ')[0])
b = int(row2.split(' ')[1])
for i in range(a, b + 1):
    if i % k == 0:
        print('OK')
        break
else:
    print('NG')
Buggy python submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  cout << n*(n+1)/2 << endl;
}

Fixed submission:
N = int(input())
print(N*(N+1)//2)
Buggy python submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;

int S(vector<int> a,int N,int M){
  int S=0;
  for(int i=0;i<N;i++){
    S+=(a.at(i)-M)*(a.at(i)-M);
  }
  return S;
}

int main(){
  int N,V;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a.at(i);
  }
  V=S(a,N,-100);
  for(int i=0;i<201;i++){
    if(S(a,N,-100+i)<V) V=S(a,N,-100+i);
  }
  
  cout << V << endl;
}

Fixed submission:
def S(a,N,M):
    m=0
    for i in range(N):
        m+=(a[i]-M)**2
    return m
    

N=int(input())
a=[int(x) for x in input().split()]

m=S(a,N,-100)

for i in range(-99,101):
    if m > S(a,N,i):
        m=S(a,N,i)
        
print(m)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
num = input().split()
cnt = 1
cal = 0
for range in (N):
  cal += int(num[N])
  if cal <= X:
    cnt +=1
  else:
    break
print(cnt)


Fixed submission:
N, X = map(int, input().split())
num = input().split()
cnt = 1
cal = 0
for x in range (N):
  cal += int(num[x])
  if cal <= X:
    cnt +=1
  else:
    break
print(cnt)
Buggy python submission (verdict: Runtime Error):
W, H ,x, y = map(int, input().split())
if H > W:
  if x == W/2:
    can = 0
  else:
    can = 1
elif H == W:
  can = 1
else:
  if y == H/2:
    can = 0
  else:
    can = 1
  
print(float(W*H/2) + ' '  + can)

Fixed submission:
W, H ,x, y = map(int, input().split())
if W == H:
  if x == W/2 and y == H/2:
    can = 1
  else:
    can = 0
else:
  if x == W/2 or y == H/2:
    if x == W/2 and y == H/2:
      can = 1
    else:
      can = 0
  else:
    if y == (H/W)*x or y == (-H/W)*x:
      can = 0
    else:
      can = 1
 
print('{:.9f}'.format(W*H/2), can)