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

Fixed submission:
A,B,C,D=list(map(int,input().split()))
if A+B>C+D:
    print("Left")
elif A+B<C+D:
    print("Right")
else:
    print("Balanced")

Buggy submission (verdict: Runtime Error):
A,B,C,D=list(map(int,input().split()))
if A+B>C+D:
    print("Left")
elif A+B<C+D:
    print("Right)
else:
    print("Balanced")
Problem p03501 (python)

Fixed submission:
N,A,B=list(map(int,input().split()))
print(min(N*A, B))

Buggy submission (verdict: Runtime Error):
N,A,B=list(map(int,input().split()))
print(min(A*T, B))

Buggy submission (verdict: Runtime Error):
N,A,B=list(map(int,inout().split()))
print(min(A*T, B))
Problem p03611 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
bucket=[0]*(max(A)+1)
answer=0
for number in A:
    bucket[number]+=1
if len(bucket)<3:
    answer=sum(bucket)
for i in range(1,max(A)):
    candidate=bucket[i-1]+bucket[i]+bucket[i+1]
    if candidate>answer:
        answer=candidate
print(answer)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
     
number_of_items=0
for X in range(min(A)-1, max(A)+1):
    number_of_items.append(A.count(X)+A.count(X-1)+A.count(X+1))
print(max(number_of_items))
Problem p03433 (python)

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
A = int(input())
if N % 500 <= A:
    print('Yes')
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
A = int(input())
ans = False
for x in range(A):
    if (N - x) % 500 == 0:
        ans = True
        print('Yes')
        break
    else:
        ans = pass
if not ans:
    print('No')
Problem p02909 (python)

Fixed submission:
s = input()
if s=='Sunny':
  print('Cloudy')
elif s=='Rainy':
    print('Sunny')
else:
  print('Rainy')

Buggy submission (verdict: Runtime Error):
s = input()
if s=='Sunny':
  print('Cloudy')
elif: s=='Rainy':
    print('Sunny')
else:
  print('Rainy')
Problem p03455 (python)

Fixed submission:
def solve():
    a,b = list(map(int, input().split()))
    product = a * b
    if (product % 2 == 0):
        print('Even')
    else:
        print('Odd')
solve()

Buggy submission (verdict: Runtime Error):
def solve():
    a,b = list(map(int, input().split()))
    product = a * b
    if (product % 2 == 0):
        print('Even')
    else:
        print('Odd')

 solve()
Problem p02937 (python)

Fixed submission:
s = input()
l = input()
     
count = 0
ind = -1
if set(l).issubset(set(s)):
    for i in range(len(l)):
        ind = s.find(l[i], ind+1)
        if ind == -1:
            count += 1
            ind = s.find(l[i], ind+1)
    print(count*len(s) + ind+1)
 
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
s1 = input()
l = input()
l1 = len(s1)
sa = set(s1)
la = set(l)
if la.issubset(sa):
    j,su = 0,0
    d,li = {},[]
    for i in range(27):
        d[i] = []
    for i in range(l1):
        d[ord(s1[i])-ord('a')].append(i+1)
    for i in range(l1):
        d[ord(s1[i])-ord('a')].append(0)
    #print(d)
    v1,v2 = 0,0
    for i in l:
        v1 = d[ord(i)-ord('a')][j]
        if v1==0:
            j=0
            v1 = d[ord(i)-ord('a')][j]
        if v1<v2:
            j=0
            su+=l1-v2+v1
        else:
            j+=1
            su+=v1-v2
        v2 = v1
    print(su)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
s1 = input()
l = input()
l1 = len(l)
s = s1*10000
#print(s)
sa = set(s1)
la = set(l)
if la.issubset(sa):
    j,su = 0,0
    for i in s:
        if i == l[j]:
            j+=1
        su+=1
        if j>=l1: break;
    print(su)
else:
    print(-1)
Problem p02945 (python)

Fixed submission:
a,b=input().split()

wa = int(a) + int(b)
sa = int(a) - int(b)
seki = int(a) * int(b)

if wa >= sa and wa >= seki:
    print(str(wa))
elif sa >= wa and sa >= seki:
    print(str(sa))
else:
    print(str(seki))

Buggy submission (verdict: Runtime Error):
a,b=input().split()

wa = a + b
sa = a - b
seki = a * b

if wa >= sa and wa >= seki:
    print(str(wa))
elif sa >= wa and sa >= seki:
    print(str(sa))
else:
    print(str(seki))

Buggy submission (verdict: Runtime Error):
a,b=input("").split("")

wa = int(a) + int(b)
sa = int(a) - int(b)
seki = int(a) * int(b)

if wa >= sa and wa >= seki:
    print(str(wa))
elif sa >= wa and sa >= seki:
    print(str(sa))
else:
    print(str(seki))

Buggy submission (verdict: Runtime Error):
a, b = input(""), input("")

wa = int(a) + int(b)
sa = int(a) - int(b)
seki = int(a) * int(b)

if wa >= sa and wa >= seki:
    print(str(wa))
elif sa >= wa and sa >= seki:
    print(str(sa))
else:
    print(str(seki))

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

wa = int(a) + int(b)
sa = int(a) - int(b)
seki = int(a) * int(b)

if wa >= sa and wa >= seki:
    print(str(wa))
elif sa >= wa and sa >= seki:
    print(str(sa))
else:
    print(str(seki))

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

wa = int(a) + int(b)
sa = int(a) - int(b)
seki = int(a) * int(b)

if wa >= sa and wa >= seki:
    print(str(wa))
elif sa >= wa and sa >= seki:
    print(str(sa))
else:
    print(str(seki))

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

wa = int(a) + int(b)
sa = int(a) - int(b)
seki = int(a) * int(b)

if wa >= sa and wa >= seki:
    print(wa)
elif sa >= wa and sa >= seki:
    print(sa)
else:
    print(seki)

Buggy submission (verdict: Runtime Error):
a = input("")
b = input("")

wa = int(a) + int(b)
sa = int(a) - int(b)
seki = int(a) * int(b)

if wa >= sa and wa >= seki:
    print(wa)
elif sa >= wa and sa >= seki:
    print(sa)
else:
    print(seki)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

wa = int(a) + int(b)
sa = int(a) - int(b)
seki = int(a) * int(b)

if wa >= sa and wa >= seki:
    print(wa)
elif sa >= wa and sa >= seki:
    print(sa)
else:
    print(seki)
Problem p02917 (python)

Fixed submission:
N = int(input())
Bs = list(map(int, input().split()))
As = []

for i in range(N):
    if i == N-1:
        As.append(Bs[i-1])
    elif i == 0:
        As.append(Bs[0])
    else:
        As.append(min([Bs[i-1],Bs[i]]))

print(sum(As))

Buggy submission (verdict: Runtime Error):
As = []

for i in range(N):
    if i == N-1:
        As.append(Bs[i-1])
    elif i == 0:
        As.append(Bs[0])
    else:
        As.append(min([Bs[i-1],Bs[i]]))

print(sum(As))
Problem p02936 (python)

Fixed submission:
n, q = map(int, input().split())
link = dict()
counter = list([0]*n)
for i in range(n-1):
    a,b = map(int, input().split())
    link[b-1] = a-1
        
for i in range(q):
  p,pp = map(int, input().split())
  counter[p-1] += pp

for i in range(n):
    if i in link:
        counter[i] += counter[link[i]]

counter = map(str, counter)
ans = " ".join(counter)
print(ans)

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
link = dict()
counter = list([0]*n)
for i in range(n-1):
  a, b = map(int, input().split())
  if a in link:
    link[a].append(b)
  else:
    link[a] = [b]
def open(ps, x):
  if len(ps) > 0:
    for i in ps:
      counter[i-1] += x
      if i in link:
        open(link[i],x)
        
for i in range(q):
  p,pp = map(int, input().split())
  open([p], pp)

counter = map(str, counter)
ans = ' '.join(counter)
    
print(ans)
Problem p02952 (python)

Fixed submission:
import math

N = int(input())

dig = len(str(N))

dig_odd = math.floor(dig / 2)

A = 0

for i in range(dig_odd):
  A += 9 * 10 ** (2 * i)

if dig % 2 == 1 and dig_odd >= 1:
  A += N - (10 ** (dig - 1) - 1)
elif dig == 1:
  A = N
  
print(A)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

dig = len(str(N))

dig_odd = math.floor(dig / 2)

A = 0

for i in range(dig_odd):
  A += 9 * 10 ** (2 * i)

if dig % 2 == 1:
  A += int(str(N)[1:]) + 1
  
print(A)
Problem p02969 (python)

Fixed submission:
input_ = int(input())

print(3 * input_ ** 2)

Buggy submission (verdict: Runtime Error):
import math

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

print(math.ceil(N / (D * 2 + 1)))
Problem p02981 (python)

Fixed submission:
N, A, B = input().split()

if int(N) * int(A) >= int(B):
    print(int(B))
else:
    print(int(N) * int(A))

Buggy submission (verdict: Runtime Error):
import numpy as np

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

X = []
X = np.vstack([input().split() for i in range(N)])

count = 0

for i in range(N - 1):
  for j in range(N - (i + 1)):
    r = 0
    for k in range(D):
      r += (int(X[i, k]) - int(X[i + (j + 1), k])) ** 2
  
    if np.sqrt(r).is_integer():
      count += 1
    
print(count)
Problem p03943 (python)

Fixed submission:
input_ = input().split()

a, b, c = input_
a, b, c = int(a), int(b), int(c)

if a == b + c or b == c + a or c == a + b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
input_ = input().split()

a, b, c = input_
a, b, c = int(a), int(b), int(c)

if a == b + c, b == c + a, c == a + b:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
input = input().split()

a, b, c = input_
a, b, c = int(a), int(b), int(c)

if a == b + c, b == c + a, c == a + b:
    print("YES")
else:
    print("NO")
Problem p04011 (python)

Fixed submission:
input_ = [input() for i in range(4)]

N, K, X, Y = input_

acc = 0

if int(N) > int(K):
    acc = (int(K) * int(X)) + ((int(N) - int(K)) * int(Y))    
else:
    acc = int(N) * int(X)

print(acc)

Buggy submission (verdict: Runtime Error):
input_ = input().split()
N, K, X, Y = input_

acc = 0

if N > K:
    acc = int(K) * int(X) + int(N - K) * int(Y)
else:
    acc = int(N) * int(X)

print(acc)
Problem p04029 (python)

Fixed submission:
N = int(input())
sigma = 0

for i in range(N + 1):
    sigma += i

print(sigma)

Buggy submission (verdict: Runtime Error):
input_ = [input() for i in range(4)]

N, K, X, Y = input_

acc = 0

if N > K:
    acc = int(K) * int(X) + (int(N) - int(K)) * int(Y)
else:
    acc = int(N) * int(X)

print(acc)
Problem p02909 (python)

Fixed submission:
S = input()

if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
if S == 'Sunny'
    print('Cloudy')
elif S == 'Cloudy'
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
Problem p02898 (python)

Fixed submission:
n,m=list(map(int,input().split()))
l=list(map(int,input().split()))
c=0
for i in l:
  if i>=m:
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n,m=int(input().split())
l=list(map(int,input().split()))
c=0
for i in l:
  if i>=m:
    c+=1
print(c)
Problem p02946 (python)

Fixed submission:
k, x = map(int, input().split())
sa = k-1
zahyous = []
for add in range(-sa, sa+1):
  zahyous.append(str(x + add))
ret_val = " ".join(zahyous)
print(ret_val)

Buggy submission (verdict: Runtime Error):
k, x = map(int, input())
sa = k-1
zahyous = []
for add in range(-sa, sa+1):
  zahyous.append(str(x + sa))
ret_val = " ".join(zahyous)
print(ret_val)

Buggy submission (verdict: Runtime Error):
k, x = map(int, input())
sa = k-1
zahyous = []
for add in range(-sa, sa+1):
  zahyous.append(str(x + sa))
ret_val = " ".join(zahyous)
Problem p02958 (python)

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
false_count = 0
for index in range(len(a_list)):
  if index + 1 != a_list[index]:
    false_count += 1

if false_count in [0, 2]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
n = 7
a_list = list(map(int, input().split()))
false_count = 0
for index in range(a_list):
  if index + 1 != a_list[index]:
    false_count += 1
if false_count in [0, 2]:
  print("YES")
else:
  print("NO")
Problem p02960 (python)

Fixed submission:
MOD = 1000000007
s = [int(x) if x!="?" else -1 for x in input()]
dp = [[0] *  13 for _ in range(len(s))] 

if s[0] == -1:
    for i in range(10):
        dp[0][i] = 1
else:
    dp[0][int(s[0])] = 1
 
table = [ s % 13 for s in range(130)]
for index in range(1, len(s)):
    if not s[index] == -1:
        value = int(s[index])
 
        for old_amari in range(13):
            new_amari = (table[old_amari * 10] + value) % 13
            dp[index][new_amari] += dp[index-1][old_amari]
    else:
        for value in range(10):
            for old_amari in range(13):
                new_amari = (table[old_amari * 10] + value) % 13
                dp[index][new_amari] += dp[index - 1][old_amari]
 
    for i in range(len(dp[index])):
        dp[index][i] %= MOD

print(dp[len(s)-1][5])

Buggy submission (verdict: Runtime Error):
import numpy as np
MOD = 1000000007
s = [int(x) if x!="?" else -1 for x in input()]
dp = np.full((len(s), 13), 0, dtype="int64")
 
if s[0] == -1:
    dp[0][0:10] = 1
else:
    dp[0][int(s[0])] = 1
 
table = [ s % 13 for s in range(130)]
for index in range(1, len(s)):
    if not s[index] == -1:
        value = int(s[index])
 
        for old_amari in range(13):
            new_amari = (table[old_amari * 10] + value) % 13
            dp[index][new_amari] += dp[index-1][old_amari]
    else:
        for value in range(10):
            for old_amari in range(13):
                new_amari = (table[old_amari * 10] + value) % 13
                dp[index][new_amari] += dp[index - 1][old_amari]
 
    dp[index] = dp[index] % MOD
 
print(dp[len(s)-1][5])

Buggy submission (verdict: Runtime Error):
import numpy as np
MOD = 1000000007
s = (list(input()))
s = s[::-1]
dp = np.full((len(s), 13), 0)

if s[0] == "?":
    dp[0][0:10] = 1
else:
    dp[0][int(s[0])] = 1

for index in range(1, len(s)):
    if not s[index] == "?":
        value = int(s[index])
        for old_amari in range(13):
            new_amari = (value * pow(10, index) + old_amari) % 13
            dp[index][new_amari] += dp[index-1][old_amari]
    else:
        for value in range(10):
            for old_amari in range(13):
                new_amari = (value * pow(10, index) + old_amari) % 13
                dp[index][new_amari] += dp[index - 1][old_amari]
    dp = dp % MOD

print(dp[len(s)-1][5])import numpy as np
MOD = 1000000007
s = (list(input()))
s = s[::-1]
dp = np.full((len(s), 13), 0)

if s[0] == "?":
    dp[0][0:10] = 1
else:
    dp[0][int(s[0])] = 1

for index in range(1, len(s)):
    if not s[index] == "?":
        value = int(s[index])
        for old_amari in range(13):
            new_amari = (value * pow(10, index) + old_amari) % 13
            dp[index][new_amari] += dp[index-1][old_amari]
    else:
        for value in range(10):
            for old_amari in range(13):
                new_amari = (value * pow(10, index) + old_amari) % 13
                dp[index][new_amari] += dp[index - 1][old_amari]
    dp = dp % MOD

print(dp[len(s)-1][5])
Problem p02969 (python)

Fixed submission:
print(3 * pow(int(input()), 2))

Buggy submission (verdict: Runtime Error):
print(3 * pow(int(input(), 2)))
Problem p02999 (python)

Fixed submission:
x, a = map(int, input().split())
if x < a:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
x, a = map(int, input().split()
if x < a:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
x, a = map(int, input().split)
if x < a:
    print(0)
else:
    print(10)
Problem p03029 (python)

Fixed submission:
a = input().split()
an = int(a[0])
p = int(a[1])

s = an * 3 + p
print(s // 2)

Buggy submission (verdict: Runtime Error):
a = int(input().split()[0])
p = int(input().split()[1])

s = a * 3 + p
print(s // 2)
Problem p04001 (python)

Fixed submission:
import copy

s = input()

def value(s, adding_list):
    insert_index = []
    for index in range(len(adding_list)):
        if adding_list[index]:
            insert_index.append(index)

    if len(insert_index) == 0:
        return int(s)

    value_list = []

    for index in range(len(insert_index)):
        if index == 0:
            value_list.append(s[0:insert_index[index]+1])
        if index < len(insert_index)-1:
            value_list.append(s[(insert_index[index]+1) : insert_index[index+1]+1])

        if index == len(insert_index)-1:
            value_list.append(s[insert_index[index]+1:])

    ret_val = 0
    for value in value_list:
        ret_val += int(value)

    return ret_val

def dfs(adding_list, changing_index):
    sum = 0
    if changing_index == len(s)-2:
        return value(s, adding_list)
    else:
        changing_index += 1
        new_adding_list = copy.copy(adding_list)
        sum += dfs(new_adding_list, changing_index)

        new_adding_list = copy.copy(adding_list)
        new_adding_list[changing_index] = True
        sum += dfs(new_adding_list, changing_index)
        return sum

def main():
    if len(s) > 1:
        ret_val = 0
        plus_list = [False for _ in range(len(s)-1)]
        ret_val += dfs(plus_list, 0)

        plus_list = [False for _ in range(len(s)-1)]
        plus_list[0] = True
        ret_val += dfs(plus_list, 0)
        print(ret_val)
    else:
        print(s)

main()

Buggy submission (verdict: Runtime Error):
import copy

s = input()

def value(s, adding_list):
    insert_index = []
    for index in range(len(adding_list)):
        if adding_list[index]:
            insert_index.append(index)

    if len(insert_index) == 0:
        return int(s)

    value_list = []

    for index in range(len(insert_index)):
        if index == 0:
            value_list.append(s[0:insert_index[index]+1])
        if index < len(insert_index)-1:
            value_list.append(s[(insert_index[index]+1) : insert_index[index+1]+1])

        if index == len(insert_index)-1:
            value_list.append(s[insert_index[index]+1:])

    ret_val = 0
    for value in value_list:
        ret_val += int(value)

    return ret_val

def dfs(adding_list, changing_index):
    print(changing_index)
    sum = 0
    if changing_index == len(s)-2:
        return value(s, adding_list)
    else:
        changing_index += 1
        new_adding_list = copy.copy(adding_list)
        sum += dfs(new_adding_list, changing_index)

        new_adding_list = copy.copy(adding_list)
        new_adding_list[changing_index] = True
        sum += dfs(new_adding_list, changing_index)
        return sum

def main():
    ret_val = 0
    plus_list = [False for _ in range(len(s)-1)]
    ret_val += dfs(plus_list, 0)

    plus_list = [False for _ in range(len(s)-1)]
    plus_list[0] = True
    ret_val += dfs(plus_list, 0)
    print(ret_val)

main()
Problem p03448 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
counter=0
for i1 in range(0,a+1):
  for i2 in range(0,b+1):
    for i3 in range(0,c+1):
      if 500*i1+100*i2+50*i3==x:
        counter=counter+1
print(counter)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
X=int(input())
counter=0
for i1 in range(a):
  for i2 in range(b):
    for i3 in range(c):
      if 500*i1+100*i2+50*i3==x:
        counter+=1
print(counter)
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
if a*b%2==0:
	print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a*b%2==0:
	print(Even")
else:
    print(Odd")
Problem p03071 (python)

Fixed submission:
a, b = map(int,input().split())

ans = 0

if b - a > 1:
    ans = b + (b-1)
elif b-a == 1:
    ans = a + b
elif b - a == 0:
    ans = a + b
else:
    ans = a + a- 1

print(ans)

Buggy submission (verdict: Runtime Error):
a,b,t = map(int, input().split())
ans=0
for i in range(1,t):
    if i%a ==0:
        ans = ans + b

print(ans)
Problem p03126 (python)

Fixed submission:
n, m = map(int, input().split())
temp = list(map(int, input().split()))
temp = set(temp[1:])
for i in range(n-1):
	temp2 = list(map(int, input().split()))
	temp2 = set(temp2[1:])
	temp = temp.intersection(temp2)
print(len(temp))

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce

def gcd(numbers):
    return reduce(fractions.gcd, numbers, 1)

n = int(input())
print(gcd(list(map(int, input().split()))))

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
print(gcd(list(map(int, input().split()))))
Problem p03206 (python)

Fixed submission:
d = int(input())

if d == 25:
    print('Christmas')
elif d == 24:
    print('Christmas Eve')
elif d == 23:
    print('Christmas Eve Eve')
elif d == 22:
    print('Christmas Eve Eve Eve')

Buggy submission (verdict: Runtime Error):
from functools import reduce
from operator import add
n = int(input())

p = []

for i in range(n):
    p.append(int(input()))

sp = sorted(p, reverse=True)

sp[0] = int(sp[0] / 2)

print(reduce(add, sp))
Problem p03244 (python)

Fixed submission:
import collections as col
from functools import reduce
from operator import add
n = int(input())

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

if len(set(v)) == 1:
    print(int(n / 2))
    exit()

odd = v[1::2]
even = v[0::2]

co = col.Counter(odd).most_common()
ce = col.Counter(even).most_common()

if co[0][0] != ce[0][0]:
    print(n - co[0][1] - ce[0][1])
else:
    # a1 = reduce(add, coli[1:], 0)
    # b1 = reduce(add, celi[2:], 0)
    # b1 = celi[0] + b1

    # a2 = reduce(add, coli[2:], 0)
    # b2 = reduce(add, celi[1:], 0)
    # a2 = a2 + coli[0]
    if len(co) <= 1:
        co.append((0, 0))
    if len(ce) <= 1:
        ce.append((0, 0))

    ans1 = n - co[1][1] - ce[0][1]
    ans2 = n - co[0][1] - ce[1][1]

    print(min(ans1, ans2))

Buggy submission (verdict: Runtime Error):
import collections as col
from functools import reduce
from operator import add
n = int(input())

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

if len(set(v)) == 1:
    print(int(n / 2))
    exit()

odd = v[1::2]
even = v[0::2]

co = col.Counter(odd).most_common()
coli = list(co.values())
ce = col.Counter(even).most_common()
celi = list(ce.values())

cov = list(co.keys())
cev = list(ce.keys())

if cov[0] != cev[0]:
    a = reduce(add, coli[1:], 0)
    b = reduce(add, celi[1:], 0)
    print(n - coli[0] - coli[0])
else:
    # a1 = reduce(add, coli[1:], 0)
    # b1 = reduce(add, celi[2:], 0)
    # b1 = celi[0] + b1

    # a2 = reduce(add, coli[2:], 0)
    # b2 = reduce(add, celi[1:], 0)
    # a2 = a2 + coli[0]
    if len(coli) <= 1:
        coli.append(0)
    if len(celi) <= 1:
        celi.append(0)

    ans1 = n - coli[1] - celi[0]
    ans2 = n - coli[0] - celi[1]

    print(min(ans1, ans2))

Buggy submission (verdict: Runtime Error):
import collections as col
from functools import reduce
from operator import add
n = int(input())

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

# if len(set(v)) == 1:
#     print(int(n / 2))
#     exit()

odd = v[1::2]
even = v[0::2]

co = col.Counter(odd)
coli = list(co.values())
ce = col.Counter(even)
celi = list(ce.values())

cov = list(co.keys())
cev = list(ce.keys())

if cov[0] != cev[0]:
    a = reduce(add, coli[1:], 0)
    b = reduce(add, celi[1:], 0)
    print(a + b)
else:
    # a1 = reduce(add, coli[1:], 0)
    # b1 = reduce(add, celi[2:], 0)
    # b1 = celi[0] + b1

    # a2 = reduce(add, coli[2:], 0)
    # b2 = reduce(add, celi[1:], 0)
    # a2 = a2 + coli[0]
    ans1 = n - coli[1] - celi[0]
    ans2 = n - coli[0] - celi[1]

    print(min(ans1, ans2))