Problem p03244 (python)

Fixed submission:
import collections

N = int(input())
a = list(int(i) for i in input().split())

b = a[::2]
c = a[1::2]

b_ =collections.Counter(b)
c_ =collections.Counter(c)

baa = b_.most_common()
caa = c_.most_common()

baa.append([0,0])
caa.append([0,0])

if baa[0][0] != caa[0][0]:
    print(N - baa[0][1] - caa[0][1])
else:
    print(min(N - baa[0][1] - caa[1][1],N - caa[0][1] - baa[1][1]))

Buggy submission (verdict: Runtime Error):
import collections

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

b = a[::2]
c = a[1::2]

b_ =collections.Counter(b)
c_ =collections.Counter(c)

baa = b_.most_common(b_)
caa = c_.most_common(c_)

baa.append([0,0])
caa.append([0,0])

if baa[0][0] != caa[0][0]:
    print(N - baa[0][1] - caa[0][1])
else:
    print(max(N - baa[0][1] - caa[1][1],N - caa[0][1] - baa[1][1]))

Buggy submission (verdict: Runtime Error):
import collections

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

b = a[::2]
c = a[1::2]

b_ =collections.Counter(b)
c_ =collections.Counter(c)

baa = b_.most_common(b_)
caa = c_.most_common(c_)

baa.append([0,0])
caa.append([0,0])

if baa[0][0] != caa[0][0]:
    print(N - baa[0][1] - caa[0][1])
else:
    print(max(N - baa[0][1] - caa[1][1],N - caa[0][1] - baa[1][1]))

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
a = list(map(int,input()))

b = a[::2]
c = a[1::2]

b_ =collections.Counter(b)
c_ =collections.Counter(c)

baa = b_.most_common(b_)
caa = c_.most_common(c_)

baa.append([0,0])
caa.append([0,0])

if baa[0][0] != caa[0][0]:
    print(N - baa[0][1] - caa[0][1])
else:
    print(max(N - baa[0][1] - caa[1][1],N - caa[0][1] - baa[1][1]))

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
a = []
b = []
for i in range(int(N/2 + 0.1)):
    a.append(input().split())
    b.append(input().split())

ac = collections.Counter(a)
bc = collections.Counter(b)

a_1 = ac.most_common()[0]
b_1 = ac.most_common()[0]

a1_ans = N/2 - a_1[1]
b1_ans = N/2 - b_1[1]
if len(ac.most_common()) == 1:
    a2_ans = N/2
else:
    a2_ans = N/2 - ac.most_common()[1][1]
if len(bc.most_common()) == 1:
    b2_ans = N/2
else:
    b2_ans = N/2 - bc.most_common()[1][1]

if a_1[0] != b_1[0]:
    print(int(a1_ans + b1_ans))
else:
    print(int(max(a1_ans+b2_ans,b1_ans+a2_ans)))

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
a = []
b = []
for i in range(int(N/2)):
    a.append(input().split())
    b.append(input().split())

ac = collections.Counter(a)
bc = collections.Counter(b)

a_1 = ac.most_common()[0]
b_1 = ac.most_common()[0]

a1_ans = N/2 - a_1[1]
b1_ans = N/2 - b_1[1]
if len(ac.most_common()) == 1:
    a2_ans = N/2
else:
    a2_ans = N/2 - ac.most_common()[1][1]
if len(bc.most_common()) == 1:
    b2_ans = N/2
else:
    b2_ans = N/2 - bc.most_common()[1][1]

if a_1[0] != b_1[0]:
    print(int(a1_ans + b1_ans))
else:
    print(int(max(a1_ans+b2_ans,b1_ans+a2_ans)))

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
a = []
b = []
for i in range(int(N/2)):
    a.append(input())
    b.append(input())

ac = collections.Counter(a)
bc = collections.Counter(b)

a_1 = ac.most_common()[0]
b_1 = ac.most_common()[0]

a1_ans = N/2 - a_1[1]
b1_ans = N/2 - b_1[1]
if len(ac.most_common()) == 1:
    a2_ans = N/2
else:
    a2_ans = N/2 - ac.most_common()[1][1]
if len(bc.most_common()) == 1:
    b2_ans = N/2
else:
    b2_ans = N/2 - bc.most_common()[1][1]

if a_1[0] != b_1[0]:
    print(int(a1_ans + b1_ans))
else:
    print(int(max(a1_ans+b2_ans,b1_ans+a2_ans)))