Problem p03246 (python)

Fixed submission:
import collections
n=int(input())
list=list(map(int,input().split()))
#print(list)
list_1=list[::2]
list_2=list[1::2]
#print(list_1)
#print(list_2)
a=collections.Counter(list_1)
b=collections.Counter(list_2)
#print(a.most_common()[0]==b.most_common()[0])
#print(len(list_1),a.most_common()[0][1])
if((a.most_common()[0]==b.most_common()[0]) & (a.most_common()[0][1]!=len(list_1))):#2つの数列の最大をとる数が等しい場合どちらかは最大個数の数に、もう１つはその次に多い数に置き換える。
  #print('test2')
  if(n-a.most_common()[0][1]-b.most_common()[1][1]>n-a.most_common()[1][1]-b.most_common()[0][1]):
  	print(n-a.most_common()[1][1]-b.most_common()[0][1])
  else:
    print(n-a.most_common()[0][1]-b.most_common()[1][1])
elif ((a.most_common()==b.most_common()) & (a.most_common()[0][1]==len(list_1))):#２つの数列の全要素が一致する場合どちらかの数字を変更
  #print('test1')
  print(n//2)
else:
  #print(a)
  #print(b)
  #print(a.most_common())
  #print(b.most_common())
  #print(a.most_common()[0][1])
  #print(b.most_common()[0][1])

  print(n-a.most_common()[0][1]-b.most_common()[0][1])

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
list=list(map(int,input().split()))
#print(list)
list_1=list[::2]
list_2=list[1::2]
#print(list_1)
#print(list_2)
a=collections.Counter(list_1)
b=collections.Counter(list_2)
print(a.most_common()[0]==b.most_common()[0])
print(len(list_1),a.most_common()[0][1])
if ((a.most_common()==b.most_common()) & a.most_common()[0][1]==len(list_1)):#２つの数列の全要素が一致する場合どちらかの数字を変更
  print('test1')
  print(n//2)
elif(a.most_common()[0]==b.most_common()[0]):#2つの数列の最大をとる数が等しい場合どちらかは最大個数の数に、もう１つはその次に多い数に置き換える。
  print('test2')
  print(n-a.most_common()[0][1]-b.most_common()[1][1])
else:
  print(n-a.most_common()[0][1]-b.most_common()[0][1])

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
list=list(map(int,input().split()))
#print(list)
list_1=list[::2]
list_2=list[1::2]
#print(list_1)
#print(list_2)
a=collections.Counter(list_1)
b=collections.Counter(list_2)
#print(a.most_common()[0]==b.most_common()[0])
#print(len(list_1),a.most_common()[0][1])
if ((a.most_common()[0]==b.most_common()[0]) & a.most_common()[0][1]==len(list_1)):#２つの数列の各要素が一致する場合どちらかの数字を変更
  #print('test1')
  print(n//2)
elif(a.most_common()[0]==b.most_common()[0]):#2つの数列の最大をとる数が等しい場合どちらかは最大個数の数に、もう１つはその次に多い数に置き換える。
  #print('test2')
  print(n-a.most_common()[0][1]-b.most_common()[1][1])
  
else:
  #print(a)
  #print(b)
  #print(a.most_common())
  #print(b.most_common())
  #print(a.most_common()[0][1])
  #print(b.most_common()[0][1])

  print(n-a.most_common()[0][1]-b.most_common()[0][1])

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
list=list(map(int,input().split()))
#print(list)
list_1=list[::2]
list_2=list[1::2]
#print(list_1)
#print(list_2)
a=collections.Counter(list_1)
b=collections.Counter(list_2)
if (a.most_common()==b.most_common()):
  print(n//2)
elif(a.most_common()[0]==b.most_common()[0]):
  print(n-a.most_common()[0]-b.most_common()[1][1])
else:
  #print(a)
  #print(b)
  #print(a.most_common())
  #print(b.most_common())
  #print(a.most_common()[0][1])
  #print(b.most_common()[0][1])

  print(n-a.most_common()[0][1]-b.most_common()[0][1])

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
list=list(map(int,input().split()))
#print(list)
list_1=list[::2]
list_2=list[1::2]
#print(list_1)
#print(list_2)
a=collections.Counter(list_1)
b=collections.Counter(list_2)
#print(a)
#print(b)
#print(a.most_common())
#print(b.most_common())
if (list_1[0]==list_2[0] & all(list_1) & all(list_2)):
  print(n//2)
elif (a.most_common==b.most>common):
  print(n//2)
else:
  #print(a.most_common()[0][1])
  #print(b.most_common()[0][1])
  print(n-a.most_common()[0][1]-b.most_common()[0][1])

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
list=list(map(int,input().split()))
#print(list)
list_1=list[::2]
list_2=list[1::2]
if (list_1[0]==list_2[0] & all(list_1) & all(list_2)):
  print(n//2)
  #print(list_1)
  #print(list_2)
  a=collections.Counter(list_1)
  b=collections.Counter(list_2)
elif(a==b):
  print(n//2)
else
  #print(a)
  #print(b)
  #print(a.most_common())
  #print(b.most_common())
  #print(a.most_common()[0][1])
  #print(b.most_common()[0][1])
  print(n-a.most_common()[0][1]-b.most_common()[0][1])

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
list=list(map(int,input().split()))
#print(list)
list_1=list[::2]
list_2=list[1::2]
if (list_1==list_2):
  print(n//2)
  break
#print(list_1)
#print(list_2)
a=collections.Counter(list_1)
b=collections.Counter(list_2)
#print(a)
#print(b)
#print(a.most_common())
#print(b.most_common())
#print(a.most_common()[0][1])
#print(b.most_common()[0][1])

print(n-a.most_common()[0][1]-b.most_common()[0][1])