Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02695 (python)

Fixed submission:
import sys
n,m,q=map(int,input().split())


a=[]
b=[]
c=[]
d=[]
for i in range(0,q):
    ay,by1,cy,dy=map(int,input().split())
    a.append(ay)
    b.append(by1)
    c.append(cy)
    d.append(dy)
s=0
smax=-100

sys.setrecursionlimit(3000)



def dfs(h):
    global smax
    if len(h)==n+1:
        s=0
        for j in range(0,q):
            if h[b[j]]-h[a[j]]==c[j]:
                s+=d[j]
        if s>smax:
            smax=s

        return
    
    for i in range(0,m+1-h[len(h)-1]):
        
        h2=h[:]
        h2.append(h[len(h)-1]+i)
        dfs(h2)

sta=[1]
dfs(sta)
print(smax)

Buggy submission (verdict: Runtime Error):
n,m,q=map(int,input().split())

a=[]
b=[]
c=[]
d=[]
for i in range(0,q):
    ay,by,cy,dy=map(int,input().split())
    a.append(ay)
    b.append(by)
    c.append(cy)
    d.append(dy)
s=0
smax=0
for i1 in range(0,m+1):
    for i2 in range(i1,m+1):
        for i3 in range(i2,m+1):
            for i4 in range(i3,m+1):
                for i5 in range(i4,m+1):
                    for i6 in range(i5,m+1):
                        for i7 in range(i6,m+1):
                            for i8 in range(i7,m+1):
                                for i9 in range(i8,m+1):
                                    for i10 in range(i9,m+1):
                                        s=0
                                        na=[i1,i2,i3,i4,i5,i6,i7,i8,i9,i10]
                                        for j in range(0,q):
                                            if na[b[j]]-na[a[j]]==c[j]:
                                                s+=d[j]
                                        if s>smax:
                                            smax=s


print(smax)

Buggy submission (verdict: Runtime Error):
n,m,q=map(int,input().split())

a=[]
b=[]
c=[]
d=[]
for i in range(0,q):
    ay,by,cy,dy=map(int,input().split())
    a.append(ay)
    b.append(by)
    c.append(cy)
    d.append(dy)
s=0
smax=0
for i1 in range(0,11):
    for i2 in range(i1,11):
        for i3 in range(i2,11):
            for i4 in range(i3,11):
                for i5 in range(i4,11):
                    for i6 in range(i5,11):
                        for i7 in range(i6,11):
                            for i8 in range(i7,11):
                                for i9 in range(i8,11):
                                    for i10 in range(i9,11):
                                        s=0
                                        na=[i1,i2,i3,i4,i5,i6,i7,i8,i9,i10]
                                        for j in range(0,q):
                                            if na[b[j]]-na[a[j]]==c[j]:
                                                s+=d[j]
                                        if s>smax:
                                            smax=s



print(smax)
Problem p02701 (python)

Fixed submission:
n=int(input())

s=[0]*n

for i in range(0,n):
    s[i]=input()


s_set=set(s)
ans=len(s_set)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())

s=input().split()

ans=[0 for i in range(n)]
for i in range(0,n-1):
    s[i]=int(s[i])
    ans[s[i]-1]+=1

for i in range(0,n):
    print(ans[i])
Problem p02881 (python)

Fixed submission:
N = int(input())
k = 0
while k ** 2 < N:
  k += 1
for i in range(k, 0, -1):
  if N % i:
    continue
  print(N // i + i - 2)
  break

Buggy submission (verdict: Runtime Error):
N = int(input())
k = 0
while k ** 2 < N:
  k++
for i in range(k, 0, -1):
  if N % i:
    continue
  print(N // i + i - 2)
  break
Problem p02897 (python)

Fixed submission:
N = int(input())
even = N // 2
print((N - even) / N)

Buggy submission (verdict: Runtime Error):
N = input()
even = N // 2
print((N - even) / N)
Problem p02959 (python)

Fixed submission:
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
L = 0
for i in range(N):
  l = min(A[i], B[i])
  B[i] -= l
  r = min(A[i + 1], B[i])
  A[i + 1] -= r
  L += l + r
print(L)

Buggy submission (verdict: Runtime Error):
N = int(input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
L = 0
for i in range(N):
  l = min(A[i], B[i])
  r = min(A[i + 1], B[i])
  A[i + 1] -= r
  L += l + r
print(L)
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
P = [0] * (N + 1)
p = 10 ** 9 + 7
B = 0
if M > 0:
  B = int(input())
  M -= 1
P[0] = 1
P[1] = 1
if B == 1:
  P[1] = 0
  if M > 0:
    B = int(input())
    M -= 1
for i in range(2, N + 1):
  P[i] = (P[i - 1] + P[i - 2]) % p
  if i == B:
    P[i] = 0
    if M > 0:
      B = int(input())
      M -= 1
print(P[N])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
P = [0] * (N + 1)
p = 10 ** 9 + 7
B = int(input())
M -= 1
P[0] = 1
P[1] = 1
if B == 1:
  P[1] = 0
  if M > 0:
    B = int(input())
    M -= 1
for i in range(2, N + 1):
  P[i] = (P[i - 1] + P[i - 2]) % p
  if i == B:
    P[i] = 0
    if M > 0:
      B = int(input())
      M -= 1
print(P[N])
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = input()
print(S[:K - 1] + S[K - 1].lower() + S[K:])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
print(S[:K - 1] + S[K - 1].lower() + S[K])
Problem p03286 (python)

Fixed submission:
N = int(input())
str2N = bin(abs(N))[2:]
S = ''
inc = 0
for i, s in enumerate(str2N[::-1]):
  S += str((int(s) + inc) % 2)
  if N > 0:
    if i % 2 == 0:
      inc = (int(s) + inc) // 2
    else:
      inc = 1 if (int(s) + inc) else 0
  else:
    if i % 2 == 0:
      inc = 1 if (int(s) + inc) else 0
    else:
      inc = (int(s) + inc) // 2
S += str(inc)
if abs(N) > 0:
  S = S[::-1][S[::-1].find('1'):]
  if N > 0:
    if len(S) % 2 == 0:
      S = '1' + S
  else:
    if len(S) % 2 != 0:
      S = '1' + S
  print(S)
else:
  print('0')

Buggy submission (verdict: Runtime Error):
N = int(input())
def n_aray_notation(N, n):
  if N == 0:
    return '0'
  else:
    s = ''
    while N:
      s = str(N % abs(n)) + s
      N -= N % abs(n)
      N //= n
    return s
print(n_array_notation(N, -2))
Problem p03295 (python)

Fixed submission:
N, M = map(int, input().split())
A = []
for i in range(M):
  a, b = map(int, input().split())
  A.append([a - 1, b - 1])
A = sorted(A, key=lambda a: a[0])
cut = 1
b_min = N
for a in A:
  if a[0] >= b_min:
    cut += 1
    b_min = N
  b_min = min(b_min, a[1])
print(cut)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
I = [N + 1 for i in range(N)]
for i in range(M):
  a, b = map(int, input().split())
  I[a - 1] = min(I[a - 1], b - 1)
cut = 0
for i in range(N):
  if I[i] == i + 1:
    cut += 1
  else:
    I[i + 1] = min(I[i + 1], I[i])
print(cut)
Problem p03326 (python)

Fixed submission:
import functools
[N, M] = [int(x) for x in input().split()]
XYZ = []
for i in range(N):
  XYZ.append([int(x) for x in input().split()])
result = 0
for x in range(-1, 2, 2):
  for y in range(-1, 2, 2):
    for z in range(-1, 2, 2):
      contribute = [x, y, z]
      score = [functools.reduce(lambda a, b: a + b, [xyz[i] * contribute[i] for i in range(3)]) for xyz in XYZ]
      score.sort(reverse=True)
      S = functools.reduce(lambda a, b: a + b, score[:M]) if M else 0
      result = max(result, S)
print(result)

Buggy submission (verdict: Runtime Error):
import functools
[N,M] = [int(x) for x in input().split()]
XYZ = []
for i in range(N):
  XYZ.append([int(x) for x in input().split()])
result = 0
for x in range(-1, 2, 2):
  for y in range(-1, 2, 2):
    for z in range(-1, 2, 2):
      contribute = [x, y, z]
      score = [functools.reduce(lambda a, b: a + b, [xyz[i] * contribute[i] for i in range(3)]) for xyz in XYZ]
      score.sort(reverse=True)
      result = max(result, functools.reduce(lambda a, b: a + b, score[:M]))
print(result)
Problem p03332 (python)

Fixed submission:
def fib(n, p):
  F = [1] * (n + 1)
  for i in range(2, n + 1):
    F[i] = F[i - 1] * i % p
  return F
def finv(F, p):
  N = len(F) - 1
  Finv = list(F)
  Finv[-1] = pow(F[-1], p - 2, p)
  for i in range(N - 1, -1, -1):
    Finv[i] = Finv[i + 1] * (i + 1) % p
  return Finv
def comb(F, Finv, n, a, p):
  return F[n] * Finv[a] * Finv[n - a] % p
N, A, B, K = map(int, input().split())
p = 998244353
F = fib(N, p)
Finv = finv(F, p)
cnt = 0
for a in range(min(N + 1, K // A + 1)):
  _A = A * a
  if _A > K:
    continue
  if (K - _A) % B > 0:
    continue
  b = (K - _A) // B
  if b > N:
    continue
  cnt += comb(F, Finv, N, a, p) * comb(F, Finv, N, b, p)
  cnt %= p
print(cnt)

Buggy submission (verdict: Runtime Error):
import math
def divide(A,B,C,D,E):
  F = [B,C,D,E]
  F.sort()
  tail = F[-1]
  F = F[:-1]
  G = 1
  for i in range(A-tail):
    G *= A - i
  for f in F:
    G /= f
  return G
N,A,B,K = map(int, input().split())
count = 0
Nf = math.factorial(N)
P = []
c = 0
while c < N:
  if K % B == 0:
    if K//B <= N:
      print((c, K//B))
      P.append([c, K//B])
  K -= A
  c += 1
for p in P:
  for G in range(min(p[0],p[1]) + 1):
    W = N - p[0] - p[1] + G
    if W >= 0:
      #divider = math.factorial(p[0]-G) * math.factorial(p[1]-G) * math.factorial(G) * math.factorial(W)
      pattern = divide(Nf, math.factorial(p[0]-G), math.factorial(p[1]-G), math.factorial(G), math.factorial(W))
      count += pattern
count *= 10 ** k
if count > 998244353:
  count = count % 998244353
print(count)
Problem p02629 (python)

Fixed submission:
N = int(input())
ans = ''
while N > 0:
  N -= 1
  ans += chr(ord('a') + N % 26)
  N //= 26
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = ''
for i in range(1, 99):
if N <= 26 ** i:
N -= 1
for j in range(i):
ans += chr(ord('a') + N % 26)
N //= 26
break
else:
N -= 26 ** i
print(ans[::-1]) # reversed
Problem p02550 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

n, x, m = list(map(int, input().split()))

data = [-1]*(m+1)

ans = x

num = x
data[x] = (1, 0)
count = 2

flag = 0
while(count <= n):
    # print(count)
    num_new = (num**2) % m
    if data[num_new] == -1 or flag == 1:
        data[num_new] = (count, ans)
        ans += num_new
        num = num_new
    else:
        diff = ans-data[num_new][1]
        frec = count - data[num_new][0]

        kaisuu = (n-(count-1))//frec

        if kaisuu > 0:
            count = count-1 + frec*kaisuu
            ans += kaisuu*diff
        else:
            ans += num
            num = num_new
        flag = 1
    count += 1

# print(count, n)
# print(flag, ans)
print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

n, x, m = list(map(int, input().split()))

data = [-1]*(m)

ans = x
data[x] = 0
count = 0
num = x

flag = 0
while(count < n-1):
    count += 1
    num = (num**2) % m
    if data[num] == -1 or flag == 1:
        data[num] = (count, ans)
        ans += num
    else:
        diff = ans-data[num][1]
        kaisuu = count - data[num][0]

        x = (n-(count)-1)//kaisuu

        count += kaisuu*x
        ans += diff*x
        flag = 1

# print(count, n)
# print(flag, ans)
print(ans)
Problem p02661 (python)

Fixed submission:
#!/usr/bin/env python3
import statistics

n = int(input())

a_list = []
b_list = []
for _ in range(n):
    a, b = list(map(int, input().split()))
    a_list.append(a)
    b_list.append(b)

a_median = statistics.median(a_list)
b_median = statistics.median(b_list)

# print(a_median)
# print(b_median)
if n % 2 != 0:
    print(int(b_median-a_median+1))
else:
    print(int(b_median*2-a_median*2+1))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import statistics.median()

n = int(input())

a = []
b = []
for _ in range(n):
    a, b = list(map(int, input().split()))
    a.append(a)
    b.append(b)

a_median = statistics.median(a)
b_median = statistics.median(b)

if n % 2 == 0:
    print(b_median-a_median+1)
else:
    print(b_median*2-a_median*2+1)
Problem p02726 (python)

Fixed submission:
# D
import numpy as np
N, X, Y = map(int, input().split())

D = [0]*N
for i in range(1, N+1):
    for j in range(i+1, N+1):
        d = min(j-i, abs(j-Y) + abs(i-X) + 1) 
        D[d] += 1
for i in range(1, N):
    print(D[i])

Buggy submission (verdict: Runtime Error):
# D
import numpy as np
N, X, Y = map(int, input().split())

X = X - 1
Y = Y - 1

x = np.zeros((N,N))
for i in range(N):
    x[i,i:] = np.array(range(N-i))
y = np.zeros((N,N))
for i in range(0, N):
    for j in range(i+1, N):
        y[i, j] = abs(i-X) + abs(j-Y) + 1

ans = np.minimum(x, y)

a, b = np.unique(ans, return_counts=True)
count = 1
for i in range(1,N):
    if count>=len(a):
        print(0)
        continue
    if a[count] == i:
        print(b[count])
        count += 1
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
# D
N, X, Y = map(int, input().split())

X = X - 1
Y = Y - 1

x = np.zeros((N,N))
for i in range(N):
    x[i,i:] = np.array(range(N-i))
y = np.zeros((N,N))
for i in range(0, N):
    for j in range(i+1, N):
        y[i, j] = abs(i-X) + abs(j-Y) + 1

ans = np.minimum(x, y)

for i in range(1,N):
    print(np.sum(ans==i))
Problem p02792 (python)

Fixed submission:
N = int(input()) 

ans=0
d = [10*[0] for _ in range(10)]

for i in range(1, N+1):
    s = str(i)
    if s[0]=="0" or s[-1]=="0":
        continue
    d[int(s[0])][int(s[-1])]+=1
    
for i in range(10):
    for j in range(10):
        ans+=d[i][j]*d[j][i]
print(ans)

Buggy submission (verdict: Runtime Error):
# E
import fractions
N = int(input()) 
A = list(map(int, input().split()))

def main():
    value = A[0]
    for i in range(1, N):
        value = value * A[i] // fractions.gcd(value, A[i])

    z = 10**9+7
    ans = 0
    for i in A:
        ans += (value//i) % z

    print(ans % z)

if __name__=="__main__":
    main()
Problem p02793 (python)

Fixed submission:
# E
from fractions import gcd

N = int(input()) 
A = list(map(int, input().split()))

value = 1
for a in A:
    value = value * a // gcd(value, a)

mod = 10**9+7

ans = 0
for i in A:
    ans += value // i

print(ans%mod)

Buggy submission (verdict: Runtime Error):
# E
import numpy as np
N = int(input()) 
A = list(map(int, input().split()))

lcm = np.lcm.reduce(A)

ans = 0
for i in A:
    ans += (lcm//i) % (10**9+7)

print(ans % (10**9+7))

Buggy submission (verdict: Runtime Error):
# E
import math
N = int(input()) 
A = list(map(int, input().split()))

lcm = np.lcm.reduce(A)

ans = 0
for i in A:
    ans += (lcm//i) % (10**9+7)

print(ans % (10**9+7))
Problem p02862 (python)

Fixed submission:
#!/usr/bin/env python3

import math

mod = 10**9+7

x, y = list(map(int, input().split()))

# dp = [[0]*(y+1) for _ in range(x+1)]
# dp[0][0] = 1
# for x_tmp in range(1, x+1):
#     for y_tmp in range(1, y+1):
#         print(x_tmp, y_tmp)

#         if x_tmp-2 >= 0 and y_tmp-1 >= 0:
#             dp[x_tmp][y_tmp] += dp[x_tmp-2][y_tmp-1] % mod
#         if x_tmp-1 >= 0 and y_tmp-2 >= 0:
#             dp[x_tmp][y_tmp] += dp[x_tmp-1][y_tmp-2] % mod

# print(dp[-1][-1] % mod)


def comb(n, r):
    X = Y = 1
    if r < 0 or n < r:
        return 0
    if r == 0:
        return 1
    if n-r < r:
        r = n-r
    for i in range(1, r+1):
        Y = Y*i % mod
        X = X*(n-i+1) % mod
    Y = pow(Y, mod-2, mod)
    return X*Y


if (x+y) % 3 != 0:
    print(0)
    exit()

num = min(x, y)-(x+y)//3
if num < 0:
    print(0)
    exit()

# print((x+y)//3, num)
print(comb((x+y)//3, num) % mod)

Buggy submission (verdict: Runtime Error):
# D
def perm(N, k):
    a = 1
    for i in range(int(k)):
        a*=N
        N-=1
        return a
from math import factorial
# from math import perm

tmp = list(map(int, input().split()))
X = tmp[0]
Y = tmp[1]

x = (2*Y-X)/3
y = (2*X-Y)/3

if not x.is_integer():
    print(0)
elif not y.is_integer():
    print(0)
else:
    if x>y:
        denominator = perm(x+y, x)%(10**9+7)
        numerator = factorial(y)%(10**9+7)
        tmp = denominator//numerator
        print(int(tmp))
    else:
        denominator = perm(x+y, y)%(10**9+7)
        numerator = factorial(x)%(10**9+7)
        tmp = denominator//numerator
        print(int(tmp))
Problem p02935 (python)

Fixed submission:
# C
N = int(input())
v = list(map(int, input().split()))
v.sort()

while(len(v)!=2):
    v += [(v.pop(0)+v.pop(0))/2]
    v.sort()
print(sum(v)/2)

Buggy submission (verdict: Runtime Error):
v = list(map(int, input().split()))
v.sort()

while(len(v)!=2):
    v += [(v.pop(0)+v.pop(0))/2]
    v.sort()
print(sum(v)/2)
Problem p02984 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

sum_water = sum(A)

tmp=sum_water
for j in range((N-1)//2):
    tmp-=A[j*2+1]*2
print(tmp, end="")
print(" ", end="")

for i in A[:-1]:
    tmp = 2*i - tmp
    print(tmp, end="")
    print(" ", end="")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
# 整数の入力
N = int(input())
A = [int(input()) for _ in range(N)]

sum_water = sum(A)
A = A[1:] + A[0:N-2]
for i in range(N):
    tmp=sum_water
    for j in range((N-1)//2):
        tmp-=A[i+j*2]*2
    print(tmp, end="")
    print(" ", end="")

Buggy submission (verdict: Runtime Error):
N = int(input())

A = list(map(int, input().split()))

sum_water = sum(A)
A = A[1:] + A[0:3]
X = []
for i in range(N):
    tmp=sum_water
    for j in range((N-1)//2):
        tmp-=A[i+j*2]*2
    X.append(tmp)
for i in range(len(X)-1):
    print(X[i], end="")
    print(" ", end="")
print(X[-1])
Problem p03072 (python)

Fixed submission:
import numpy as np
N = int(input())
H = np.array(list(map(int, input().split())))
tmp = []
for i in range(1, len(H)):
    tmp.append(all(H[:i]<=H[i]))
print(sum(tmp)+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
H = np.array(map(int, input().split()))

tmp = []
for i in range(1, len(H)):
    tmp.append(all(H[:i]<=H[i]))
print(sum(tmp)+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
H = map(int, input().split())

tmp = []
for i in range(1, len(H)):
    tmp.append(all(H[:i]<=H[i]))
print(sum(tmp)+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
H = raw_input().split()

tmp = []
for i in range(1, len(H)):
    tmp.append(all(H[:i]<=H[i]))
print(sum(tmp)+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = np.array(map(int, input().split()))
tmp=[]
for i in range(len(H)-1):
    tmp.append(all([all(H[:i]<=[H[i]]), all([H[i]]<=H[i+1:])]))
#print(sum(tmp))
print(1)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = np.array(map(int, input().split()))
tmp=[]
for i in range(len(H)-1):
    tmp.append(all([all(H[:i]<=[H[i]]), all([H[i]]<=H[i+1:])]))
print(sum(tmp))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = np.array(map(int, input().split()))
H = np.array([1,2,3,4,5])
tmp=[]
for i in range(len(H)-1):
    tmp.append(all([all(H[:i]<=[H[i]]), all([H[i]]<=H[i+1:])]))
print(sum(tmp))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = np.array(map(int, input().split()))
tmp=[]
for i in range(len(H)-1, -1, -1):
    tmp.append(all([all(H[:i]<=[H[i]]), all([H[i]]<=H[i+1:])]))
print(sum(tmp))

Buggy submission (verdict: Runtime Error):
N = int(input())
N = 3
H = np.array(map(int, input().split()))
tmp=[]
for i in range(len(H)-1, -1, -1):
    tmp.append(all([all(H[:i]<=[H[i]]), all([H[i]]<=H[i+1:])]))
print(sum(tmp))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = np.array(map(int, input().split()))
H = list(H)
tmp=[]
for i in range(len(H)-1, -1, -1):
    tmp.append(all([all(H[:i]<=[H[i]]), all([H[i]]<=H[i+1:])]))
print(sum(tmp))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = map(int, input().split())
#H = list(H)
tmp=[]
for i in range(len(H)-1, -1, -1):
    tmp.append(all([all(H[:i]<=H[i]), all(H[i]<=H[i+1:])]))
print(sum(tmp))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = raw_input().split()


tmp=[]
for i in range(len(H)-1, -1, -1):
    tmp.append(all([all(H[:i]<=H[i]), all(H[i]<=H[i+1:])]))
print(sum(tmp))
Problem p03073 (python)

Fixed submission:
import numpy as np
tmp = str(input())

H = []
for i in range(len(tmp)):
    H.append(int(tmp[i]))

#print(H)
H = np.array(H, int)

#print(H)
x = []
y = []
for i in range(len(H)):
    x.append(i%2)
    y.append((i+1)%2)
#print(H == np.array(x))
#print(H == np.array(y))
a = sum(H == np.array(x))
b = sum(H == np.array(y))

if(a>=b):
    print(len(H)-a)
else:
    print(len(H)-b)

Buggy submission (verdict: Runtime Error):
import numpy as np
H = input()
H = str.split(H)
H = np.array(H, int)
x = []
y = []
for i in range(len(H)):
    x.append(i%2)
    y.append((i+1)//2)
print(H == np.array(x))
print(H == np.array(y))
a = sum(H == np.array(x))
b = sum(H == np.array(y))

if(a>=b):
    print(len(H)-a)
else:
    print(len(H)-b)

Buggy submission (verdict: Runtime Error):
H = input()
H = str.split(H)
H = np.array(H, int)
x = []
y = []
for i in range(len(H)):
    x.append(i%2)
    y.append((i+1)//2)
print(H == np.array(x))
print(H == np.array(y))
a = sum(H == np.array(x))
b = sum(H == np.array(y))

if(a>=b):
    print(len(H)-a)
else:
    print(len(H)-b)

Buggy submission (verdict: Runtime Error):
import numpy as np
H = input()
H = str.split(H)
H = np.array(H, int)

x = []
y = []
for i in range(len(H)):
    x.append(i//2)
    y.append((i+1)//2)

a = sum(H == np.array(x))
b = sum(H == np.array(y))

if(a>=b):
    print(b)
else:
    print(a)