ZhenlongDai/ACPR huggingface dataset:
Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=input()
answer = 'NO'

if 'keyence' in S:
    answer = 'YES'
elif S[:1] == 'k':
    if S[-6:] == 'eyence':
        answer = 'YES'
elif S[:2] == 'ke':
    if S[-5:] == 'yence':
        answer = 'YES'
elif S[:3] == 'key':
    if S[-4:] == 'ence':
        answer = 'YES'
elif S[:4] == 'keye':
    if S[-3:] == 'nce':
        answer = 'YES'
elif S[:5] == 'keyen':
    if S[-2:] == 'ce':
        answer = 'YES'
elif S[:6] == 'keyenc':
    if S[-1:] == 'e':
        answer = 'YES'



print(answer)

Failing test case input:
keyofscience

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
S=input()
answer = 'NO'

if 'keyence' in S:
    answer = 'YES'
elif S[:6] == 'keyenc':
    if S[-1:] == 'e':
        answer = 'YES'
elif S[:5] == 'keyen':
    if S[-2:] == 'ce':
        answer = 'YES'
elif S[:4] == 'keye':
    if S[-3:] == 'nce':
        answer = 'YES'
elif S[:3] == 'key':
    if S[-4:] == 'ence':
        answer = 'YES'
elif S[:2] == 'ke':
    if S[-5:] == 'yence':
        answer = 'YES'
elif S[:1] == 'k':
    if S[-6:] == 'eyence':
        answer = 'YES'

print(answer)

Problem: p03150
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
k = 'keyence'
Srev = S[::-1]
krev = k[::-1]

ans = 'No'
for i in range(8):
    if S[:i]==k[:i] and Srev[:(7-i)]==krev[:(7-i)]:
        ans = 'Yes'

print(ans)

Failing test case input:
keyence

Expected output:
YES

Actual output:
Yes


Fixed submission (verdict: Accepted):
S = input()
k = 'keyence'
Srev = S[::-1]
krev = k[::-1]

ans = 'NO'
for i in range(8):
    if S[:i]==k[:i] and Srev[:(7-i)]==krev[:(7-i)]:
        ans = 'YES'

print(ans)

Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()


def judge():
    L = len(S)
    keyence = 'keyence'
    if S[0] != 'k':
        if S[-7:] != 'keyence':
            return False
        else:
            return True
    else:
        for i in range(8):
            if S[0:i] == keyence[0:i] and S[L-(7-i):L] == keyence[i:7]:
                return True
        return False


def main():
    print(judge())

if __name__ == '__main__':
    main()


Failing test case input:
mcjydjsfoeee

Expected output:
NO


Actual output:
False


Fixed submission (verdict: Accepted):
S = input()


def judge():
    L = len(S)
    keyence = 'keyence'
    if S[0] != 'k':
        if S[-7:] != 'keyence':
            return False
        else:
            return True
    else:
        for i in range(8):
            if S[0:i] == keyence[0:i] and S[L-(7-i):L] == keyence[i:7]:
                return True
        return False


def main():
    if judge():
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()
Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input ( )

dusted = False
cont = False
line = 'keyence'
find = S.find ( 'keyence' )
rfind = S.rfind ( 'keyence' )

if find == 0 or rfind == len ( S ) - 7:
    print ( 'YES' )
    exit ( 0 )
elif find != -1:
    print ( 'NO' )
    exit ( 0 )

fs = True
line = ''
keyence = [ c for c in "keyence" ]
a_err=False
b_err=False
for i in range(len ( S )):

    
    
    try:
        if not  b_err:
            keyence.remove ( S[len(S)-1-i] )

    except ValueError:
        b_err=True

        if not keyence:
            print ( 'YES' )
            exit ( 0 )
    try:
        if not a_err:
            keyence.remove ( S[i] )
    except ValueError:
        a_err=True

    if a_err and b_err:
        print('NO')
        exit(0)

    if not keyence:
        print ( 'YES' )
        exit ( 0 )


Failing test case input:
ecneyek

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
S = input ( )

dusted = False
cont = False
line = 'keyence'
find = S.find ( 'keyence' )
rfind = S.rfind ( 'keyence' )

if find == 0 or rfind == len ( S ) - 7:
    print ( 'YES' )
    exit ( 0 )
elif find != -1:
    print ( 'NO' )
    exit ( 0 )

fs = True
line = ''
keyence = [ c for c in "keyence" ]
a_err=False
b_err=False
keyence2='keyence'
count=0
for i in range(len ( S )):

    
    
    try:
        if not  b_err:
            

            if keyence2[ 6 - i ] != S[ len ( S ) - 1 - i ]:
                b_err=True
            if not b_err:
                keyence.remove ( S[len(S)-1-i] )

            count+=1

    except ValueError:
        b_err=True

    if not keyence:
        print ( 'YES' )
        exit ( 0 )
    try:
        if not a_err:
            if keyence2[ i ] != S[ i]:
                a_err=True
            if not a_err:
                keyence.remove ( S[i] )
    except ValueError:
        a_err=True

    if a_err and b_err:
        print('NO')
        exit(0)

    if not keyence:
        print ( 'YES' )
        exit ( 0 )

Problem: p03150
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def resolve():
    S = input()
    if S == "kesence":
        print("YES")
    else:
        for i in range(len(S)):
            for j in range(i+1, len(S)):
                if S[:i+1]+S[j:] == S:
                    print("YES")
                    exit()
        print("NO")
resolve()

Failing test case input:
arhkzbjf

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
def resolve():
    S = input()
    s = len(S) - 7
    if S == "keyence":
        print("YES")
    else:
        for i in range(len(S)-s-1):
            if S[:i+1]+S[i+s+1:] == "keyence":
                print("YES")
                exit()
        print("NO")
resolve()
Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=input()
T="keyence"
ans=0
for i in range(8):
  X=1
  K=0
  for j in range(len(S)-i):
    if(j<i or j>i+len(S)-i-1):
      if(S[K]!=T[K]):
        X*=0
      K+=1
  ans+=X
if(ans):
  print("YES")
else:
  print("NO")

Failing test case input:
mnyszsb{pf

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
S=input()
T="keyence"
X,Y=0,0
for i in range(7):
  if(S[i]==T[i]):
    X+=1;
  else:
    break
for i in range(7):
  if(S[len(S)-1-i]==T[6-i]):
    Y+=1;
  else:
    break
if(X+Y>=7):
  print("YES")
else:
  print("NO")

Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
t="keyence"

if t in s:
  if s.find(t)==0 or s.find(t)==len(s)-7:
    print("YES")
  else:
    print("NO")
else:
  for i in range(1,7):
    a,b=t[:i],t[i:]
    print(a,b)
    if a in s and b in s:
      if s.find(a)==0 and s.rfind(b)==len(s)-len(b):
        print("YES")
        break
  else:
    print("NO")

Failing test case input:
nfncyed

Expected output:
NO


Actual output:
k eyence
ke yence
key ence
keye nce
keyen ce
keyenc e
NO


Fixed submission (verdict: Accepted):
s=input()
t="keyence"

if t in s:
  if s.find(t)==0 or s.find(t)==len(s)-7:
    print("YES")
  else:
    print("NO")
else:
  for i in range(1,7):
    a,b=t[:i],t[i:]
    if a in s and b in s:
      if s.find(a)==0 and s.rfind(b)==len(s)-len(b):
        print("YES")
        break
  else:
    print("NO")

Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
print(
	"YES" if any(
      s[:i] + s[j:]
      for i in range(len(s))
      for j in range(len(s))
      if i <= j) else
  	"NO"
)


Failing test case input:
ashkfyha

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
s = input()
print(
	"YES" if any(
      s[:i] + s[j:] == "keyence"
      for i in range(len(s))
      for j in range(len(s))
      if i <= j) else
  	"NO"
)

Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()

key = list("keyence")

flg = False
for i in range(len(S)):
    for j in range(len(S)):
        tmp = S[0:i]+S[j:]

        if tmp == key and not flg:
            print("YES")
            flg = True
            break

if not flg:
    print("NO")


Failing test case input:
keyence

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
S = input()

key = list("keyence")
target = 'keyence'

flg = False
for i in range(len(S)):
    for j in range(len(S)):
        tmp = S[0:i]+S[j:]

        if tmp == target and not flg:
            print("YES")
            flg = True
            break

if not flg:
    print("NO")
Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import re
key = list(str(input()))
keyence = list('keyence')
flag = 0

keylist = []
for i in range(len(keyence)+1):
    keyence.insert(i, '.*')

    key = ''.join(key)
    keyence = ''.join(keyence)

    print(keyence)

    result = re.match(keyence, key)
    if result:
        print("YES")
        quit()
    
    key = list(str(key))
    keyence = list(str(keyence))
    keyence.remove('.')
    keyence.remove('*')

print("NO")

Failing test case input:
ashkfyha

Expected output:
NO


Actual output:
.*keyence
k.*eyence
ke.*yence
key.*ence
keye.*nce
keyen.*ce
keyenc.*e
keyence.*
NO


Fixed submission (verdict: Accepted):
import re
key = list(str(input()))
keyence = list('^keyence$')
flag = 0

keylist = []
for i in range(1, len(keyence)):
    keyence.insert(i, r'\w*')
    
    key = ''.join(key)
    keyence = ''.join(keyence)
    result = re.match(keyence, key)
    if result:
        print("YES")
        quit()
    
    key = list(str(key))
    keyence = list(str(keyence))
    
    for s in r'\w*':
        keyence.remove(s)

print("NO")

Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
target = "keyence"
for i in range(len(target) + 1):
    if s == s[:i] + s[len(s) - len(target) + i:]:
        print("YES")
    else:
        print("NO")

Failing test case input:
mcgyejriodee

Expected output:
NO


Actual output:
NO
NO
NO
NO
NO
NO
NO
NO


Fixed submission (verdict: Accepted):
s = input()
target = "keyence"
ans = "NO"
for i in range(len(target) + 1):
    if target == s[:i] + s[len(s) - len(target) + i:]:
        ans = "YES"
        break
print(ans)

Problem: p03150
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()
key="keyence"
li=[]
for i in range(len(key)):
  li.append([key[:i],key[i:]])
  
for i in li:
  if i[0] in s and i[1] in s:
    print("Yes")
    break
else:
  print("No")

Failing test case input:
eeeofsjcymci

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
s=input()
key="keyence"
li=[]
for i in range(len(key)):
  li.append([key[:i],key[i:]])
  
for i in li:
  
  if s[:len(i[0])]==i[0] and s[-len(i[1]):]==i[1]:
    print("YES")
    break
else:
  print("NO")

Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
keyence = "keyence"
for i in range(len(S)):
    for j in range(i,len(S)):
        new_str = S[:i] + S[j:]
        if new_str == keyence:
            print("YES")
            break
    else:
        continue
else:
    print("NO")

Failing test case input:
keyofscience

Expected output:
YES

Actual output:
YES
NO


Fixed submission (verdict: Accepted):
S = input()
keyence = "keyence"
for i in range(len(S)):
    for j in range(i,len(S)):
        new_str = S[:i] + S[j:]
        if new_str == keyence:
            print("YES")
            break
    else:
        continue
    break
else:
    print("NO")
Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    S  = input()
    K = 'keyence'
    if len(S)<=7:
        if S == K:
            print('YES')
        else:
            print('NO')
    else :
        ShaveN = len(S) - 7
        for i in range(len(S) - ShaveN + 1):
            Shave = S[:i] + S[i+ShaveN:]
            print(Shave)
            if Shave == K:
                print('YES')
                return
        print('NO')


if __name__ == '__main__':
    main()


Failing test case input:
slzs|nbfp|

Expected output:
NO


Actual output:
s|nbfp|
s|nbfp|
slnbfp|
slzbfp|
slzsfp|
slzs|p|
slzs|n|
slzs|nb
NO


Fixed submission (verdict: Accepted):
def main():
    S  = input()
    K = 'keyence'
    if len(S)<=7:
        if S == K:
            print('YES')
        else:
            print('NO')
    else :
        ShaveN = len(S) - 7
        for i in range(len(S) - ShaveN + 1):
            Shave = S[:i] + S[i+ShaveN:]
            if Shave == K:
                print('YES')
                return
        print('NO')


if __name__ == '__main__':
    main()

Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=input()
a=1
for i in range(len(S)):
  for j in range(len(S)-i):
    if S[:i]+S[i+j+1:]=='keyence':
      a=0
print('YNEOS'[a::2])

Failing test case input:
keyence

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
S=input()
a=1
for i in range(len(S)):
  for j in range(len(S)-i):
    if S[:i]+S[i+j:]=='keyence':
      a=0
print('YNEOS'[a::2])

Problem: p03150
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()

key = "keyence"

t = -1

for i in range(7):
    if not S[i] == key[i]:
        t = max(0, t + i)
        break

for i in range(1, 8):
    if not S[-i] == key[-i]:
        t = max(0, t + i - 1)
        break

if t >= 7 or t == -1:
    print("YES")
else:
    print("NO")



Failing test case input:
keyofscience

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
S = input()

key = "keyence"

t = -1

for i in range(7):
    if not S[i] == key[i]:
        t = i
        break

if t == -1:
    t = 7

for i in range(1, 8):
    if not S[-i] == key[-i]:
        t += i - 1
        break

if t >= 7:
    print("YES")
else:
    print("NO")

Problem: p03150
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()

n=len(s)
ans="No"

for i in range(n):
  for j in range(1,n+1):
    num=s[:i]+s[j:]
    if num == "keyence":
      ans="Yes"
      
print(ans)

Failing test case input:
mnyszsb{pf

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
s=input()

n=len(s)
ans="NO"

for i in range(n):
  for j in range(1,n+1):
    num=s[:i]+s[j:]
    if num == "keyence":
      ans="YES"
      
print(ans)
Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def myAnswer(S:str) -> str:
   for i in range(len(S)-1):
      for j in range(i+1,len(S)):
         if(S[:i]+S[j:] == "keyence"):
            return "YES"
   return "NO"

def modelAnswer():
   return
def main():
   S = (input())
   print(myAnswer(S))
if __name__ == '__main__':
   main()

Failing test case input:
keyence

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
def myAnswer(S:str) -> str:
   if(S == "keyence"):return "YES"
   for i in range(len(S)-1):
      for j in range(i+1,len(S)):
         if(S[:i]+S[j:] == "keyence"):
            return "YES"
   return "NO"

def modelAnswer():
   return
def main():
   S = (input())
   print(myAnswer(S))
if __name__ == '__main__':
   main()

Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

s = input()
key = 'keyence'
key_r = 'ecneyek'
j = 0
for i in key:
    if s[j] == i:
        j += 1
    else:
        break
k = -1
for i in key_r:
    if s[k] == i:
        k -= 1
    else:
        break

s = s[:j] + s[k + 1:]
if j >= k+1: s = key
if s == key:
    print('YES')
else:
    print('NO')

Failing test case input:
ecneyek

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):

s = input()
key = 'keyence'
key_r = 'ecneyek'
j = 0
for i in key:
    if s[j] == i:
        j += 1
    else:
        break
k = 1
for i in key_r:
    if s[-k] == i:
        k += 1
    else:
        break

s = s[:j] + s[-k+1:]
if j + k > 7:
    s = key
if s == key:
    print('YES')
else:
    print('NO')

Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy

S = input()
ja = 0

sremove = ""
S_tmp = ""

for i in range(len(S)):
    for j in range(len(S)- i):
        S_tmp = S

        sremove = S_tmp[i:]
        sremove = sremove[j:]

        S_tmp.replace(sremove, "")

        if S_tmp == "keyence":
            ja = 1
            break

if ja == 0:
    print("NO")

else:
    print("YES")

Failing test case input:
keyofscience

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
import copy

S = list(input())
ja = 0

sremove = ""
S_tmp = []

for i in range(len(S)):
    for j in range(i,len(S)+1):
        S_tmp = copy.deepcopy(S)

        del S_tmp[i:j]

        if "".join(S_tmp) == "keyence":
            ja = 1
            break

if ja == 1:
    print("YES")

else:
    print("NO")
Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy
key = list(input())
hantei=0
length=len(key)
for i in range(length):
    if hantei==1:
        break
    a=copy.deepcopy(key)
    if i==length-1:
        j=length-2
    else:
        j=i
    while j<length-1:
        del a[i]
        j+=1
        if "".join(a)=="keyence":
            hantei=1
            break
if hantei==1:
    print("YES")
else:
    print("NO")
       

Failing test case input:
keyence

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
import copy
key = list(input())
hantei=0
length=len(key)
if "".join(key)=="keyence":
    hantei=1
for i in range(length):
    if hantei==1:
        break
    a=copy.deepcopy(key)
    if i==length-1:
        j=length-2
    else:
        j=i
    while j<length-1:
        del a[i]
        j+=1
        if "".join(a)=="keyence":
            hantei=1
            break
if hantei==1:
    print("YES")
else:
    print("NO")

Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
l=len(s)
flag=0
for i in range(7):
  if s[:i]+s[-(7-i):]=="keyence":
    flag=1
    break
if s[:7]=="keyence":
  flag=1
if flag==1:
  print("Yes")
else:
  print("No")

Failing test case input:
dexcmnf

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
s=input()
flag=0
for i in range(7):
  if s[:i]+s[-(7-i):]=="keyence":
    flag=1
    break
if s[:7]=="keyence":
  flag=1
if flag==1:
  print("YES")
else:
  print("NO")

Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
s=input()
l=len(s)-7
if l<0:
    print('NO')
    sys.exit()
for i in range(7):
    print(s[:i]+s[i+l:])
    if s[:i]+s[i+l:]=='keyence':
        print('YES')
        sys.exit()
if s[:7]=='keyence':
    print('YES')
else:
    print('NO')

Failing test case input:
slpt}n{exb

Expected output:
NO


Actual output:
t}n{exb
s}n{exb
sln{exb
slp{exb
slptexb
slpt}xb
slpt}nb
NO


Fixed submission (verdict: Accepted):
import sys
s=input()
l=len(s)-7
if l<0:
    print('NO')
    sys.exit()
for i in range(7):

    if s[:i]+s[i+l:]=='keyence':
        print('YES')
        sys.exit()
if s[:7]=='keyence':
    print('YES')
else:
    print('NO')
Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


keyStr=input()
keyence="keyence"

before=""
after=""
chkflg=False

for char in range(len(keyence)-1):
  before=keyence[0:char+1]
  after=keyence[char+1:len(keyence)]
  print(before)
  print(after)
  
  bindex= keyStr.find(before)
  if bindex >= 0:
    if keyStr[bindex+len(before):len(keyStr)].find(after) >= 0:
      print("YES")
      chkflg=True
      break

if chkflg == False:
  print("NO")

Failing test case input:
dcxenen

Expected output:
NO


Actual output:
k
eyence
ke
yence
key
ence
keye
nce
keyen
ce
keyenc
e
NO


Fixed submission (verdict: Accepted):


keyStr=input()
keyence="keyence"
chkflg=False

for char in range(len(keyence)-1):
  before=keyence[0:char+1]
  after=keyence[char+1:len(keyence)]
  
  if keyStr.startswith(before) and keyStr.endswith(after):
    print("YES")
    chkflg=True
    break
  if keyStr.startswith(keyence) or keyStr.endswith(keyence):
    print("YES")
    chkflg=True
    break

if chkflg == False:
  print("NO")

Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
s=input()
l=len(s)-7
if s=='keyence':
    print('YES')
    sys.exit()
if l<=0:
    print('NO')
    sys.exit()
for i in range(l):
    print(s[:i]+s[i+l:])
    if s[:i]+s[i+l:]=='keyence':
        print('YES')
        sys.exit()
print('NO')

Failing test case input:
lcygfjriodfe

Expected output:
NO


Actual output:
jriodfe
lriodfe
lciodfe
lcyodfe
lcygdfe
NO


Fixed submission (verdict: Accepted):
import sys
s=input()
l=len(s)-7
if l<0:
    print('NO')
    sys.exit()
for i in range(7):

    if s[:i]+s[i+l:]=='keyence':
        print('YES')
        sys.exit()
if s[:7]=='keyence':
    print('YES')
else:
    print('NO')
Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
instring = input()
head_str = ""
foot_str = ""
ans_str = ""
ref = "keyence"
ref_rev = ref[::-1]
flag = False


start_index = 0
end_index = len(ref)-1

for i in range(len(instring)):
    head_str += instring[i]
    now_ref = ref[:(i+1)]
    
    if(head_str != now_ref):
        
        start_index = i
        flag = True
        break


if(flag):
    ans_str += head_str[:start_index]
else:
    ans_str = head_str

end_flag = False

if(ans_str == ref):
    print("YES")
    end_flag = True
    


for i in range(len(instring)):        
    foot_str += instring[-(i+1)]
    now_ref = ref_rev[:(i+1)]
    if (foot_str != now_ref):
        end_index = i
        break



foot_str = foot_str[:end_index][::-1] 
ans_str += foot_str

if(end_flag != True):
    if(ans_str == ref):
        print("YES")
    else:
        print("No")

Failing test case input:
ecneyek

Expected output:
NO


Actual output:
No


Fixed submission (verdict: Accepted):
instring = input()
head_str = ""
foot_str = ""
ans_str = ""
ref = "keyence"
ref_rev = ref[::-1]
flag = False


start_index = 0
end_index = len(ref)-1

for i in range(len(instring)):
    head_str += instring[i]
    now_ref = ref[:(i+1)]
    
    if(head_str != now_ref):
        
        start_index = i
        flag = True
        break


if(flag):
    ans_str += head_str[:start_index]
else:
    ans_str = head_str

end_flag = False

if(ans_str == ref):
    print("YES")
    end_flag = True

ans_len = len(ans_str)    


for i in range(len(ref)-ans_len):        
    foot_str += instring[-(i+1)]
    now_ref = ref_rev[:(i+1)]
    if (foot_str != now_ref):
        end_index = i
        break


foot_str = foot_str[:end_index][::-1] 
ans_str += foot_str

if(end_flag != True):
    if(ans_str == ref):
        print("YES")
    else:
        print("NO")

Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input().strip("\n")
N = len(S)
w = "keyence"
for i in range(7):
  if S[:i] == w[:i] and S[N-7+i:] == w[i:]:
    print("YES")
    break
  else: print("NO")

Failing test case input:
eeeofscjymci

Expected output:
NO


Actual output:
NO
NO
NO
NO
NO
NO
NO


Fixed submission (verdict: Accepted):
S = input()
N = len(S)
w = "keyence"
for i in range(7):
  if S[:i] == w[:i] and S[N-7+i:] == w[i:]:
    print("YES")
    break
  elif i == 6:
    print("NO")
Problem: p03150
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S='keyenceaa'
answer = 'NO'

if 'keyence' in S:
    answer = 'YES'
elif S[0] == 'k':
    if S[-6:] == 'eyence':
        answer = 'YES'
elif S[:2] == 'ke':
    if S[-5:] == 'yence':
        answer = 'YES'
elif S[:3] == 'key':
    if S[-4:] == 'ence':
        answer = 'YES'
elif S[:4] == 'keye':
    if S[-3:] == 'nce':
        answer = 'YES'
elif S[:5] == 'keyen':
    if S[-2:] == 'ce':
        answer = 'YES'
elif S[:6] == 'keyenc':
    if S[-5:] == 'e':
        answer = 'YES'



print(answer)

Failing test case input:
slpt}n{exb

Expected output:
NO


Actual output:
YES


Fixed submission (verdict: Accepted):
S=input()
answer = 'NO'

if 'keyence' in S:
    answer = 'YES'
elif S[:6] == 'keyenc':
    if S[-1:] == 'e':
        answer = 'YES'
elif S[:5] == 'keyen':
    if S[-2:] == 'ce':
        answer = 'YES'
elif S[:4] == 'keye':
    if S[-3:] == 'nce':
        answer = 'YES'
elif S[:3] == 'key':
    if S[-4:] == 'ence':
        answer = 'YES'
elif S[:2] == 'ke':
    if S[-5:] == 'yence':
        answer = 'YES'
elif S[:1] == 'k':
    if S[-6:] == 'eyence':
        answer = 'YES'

print(answer)

Problem: p03150
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()
k="keyence"
t=""
for i in range(7):
  if k[i]!=s[i]:
    t+=k[:i]
    break
else:
  print("YES")
  exit()
for j in range(7-i):
  if k[-j-1]!=s[-j-1]:
    t+=k[7-j:]
    break
print("YES" if t==k else "NO")

Failing test case input:
keyofscience

Expected output:
YES

Actual output:
NO


Fixed submission (verdict: Accepted):
s=input()
k="keyence"
t=""
for i in range(7):
  if k[i]!=s[i]:
    t+=k[:i]
    break
else:
  print("YES")
  exit()
print("YES" if t+s[i-7:]==k else "NO")
Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
N=int(input())
h=[int(i) for i in input().split()]

h_o_l = len(h[1::2])
h_e_l = len(h[::2])

h_o = collections.Counter(h[1::2])
h_e = collections.Counter(h[::2])

o_ = h_o.most_common()
e_ = h_e.most_common()
o_.append((0,0))
e_.append((0,0))

if o_[0][0] != e_[0][0]:
    print(o_[1][1]+e_[1][1])
elif o_[0][0] == e_[0][0]:
    a =min(N-o_[0][1]-e_[1][1],N-e_[0][1]-o_[1][1])
    print(a)

Failing test case input:
6
2 124 4 34 215 14

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
import collections
N=int(input())
h=[int(i) for i in input().split()]

h_o_l = len(h[1::2])
h_e_l = len(h[::2])

h_o = collections.Counter(h[1::2])
h_e = collections.Counter(h[::2])

o_ = h_o.most_common()
e_ = h_e.most_common()
o_.append((0,0))
e_.append((0,0))

if o_[0][0] != e_[0][0]:
    print(N-o_[0][1]-e_[0][1])
elif o_[0][0] == e_[0][0]:
    a =min(N-o_[0][1]-e_[1][1],N-e_[0][1]-o_[1][1])
    print(a)

Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
v = list(map(int, input().split()))
even_list = [0] * (n + 1)
odd_list = [0] * (n + 1)

for i in range(n):
    if i % 2 == 0:
        even_list[i] += 1

    else:
        odd_list[i] += 1

if even_list.index(max(even_list)) == odd_list.index(max(odd_list)):
    even_sorted, odd_sorted = sorted(even_list), sorted(odd_list)
    print(min(n - even_sorted[-1] - odd_sorted[-2], n - even_sorted[-2] - odd_sorted[-1]))

else:
    print(n - max(even_list) - max(odd_list))


Failing test case input:
4
7 1 2 1

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
v = list(map(int, input().split()))
even_list = [0] * (100000 + 1)
odd_list = [0] * (100000 + 1)

for i in range(n):
    if i % 2 == 0:
        even_list[v[i]] += 1

    else:
        odd_list[v[i]] += 1

if even_list.index(max(even_list)) == odd_list.index(max(odd_list)):
    even_sorted, odd_sorted = sorted(even_list), sorted(odd_list)
    print(min(n - even_sorted[-1] - odd_sorted[-2], n - even_sorted[-2] - odd_sorted[-1]))

else:
    print(n - max(even_list) - max(odd_list))
Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
v = list(map(int, input().split()))
even_list = [0] * (n + 1)
odd_list = [0] * (n + 1)

for i in range(n):
    if i % 2 == 0:
        even_list[i] += 1

    else:
        odd_list[i] += 1

if even_list.index(max(even_list)) == odd_list.index(max(odd_list)):
    even_sorted, odd_sorted = sorted(even_list), sorted(odd_list)
    print(min(even_sorted[-1] + odd_sorted[-2], even_sorted[-2] + odd_sorted[-1]))

else:
    print(n - max(even_list) - max(odd_list))


Failing test case input:
4
4 0 9 0

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
n = int(input())
v = list(map(int, input().split()))
even_list = [0] * (100000 + 1)
odd_list = [0] * (100000 + 1)

for i in range(n):
    if i % 2 == 0:
        even_list[v[i]] += 1

    else:
        odd_list[v[i]] += 1

if even_list.index(max(even_list)) == odd_list.index(max(odd_list)):
    even_sorted, odd_sorted = sorted(even_list), sorted(odd_list)
    print(min(n - even_sorted[-1] - odd_sorted[-2], n - even_sorted[-2] - odd_sorted[-1]))

else:
    print(n - max(even_list) - max(odd_list))

Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n = int(input())
v = list(map(int,input().split()))

e = Counter(v[::2])
o = Counter(v[1::2])

ev = sorted([(k,i) for k, i in e.items()],key = lambda z:z[1],reverse = True) + [(0,0)]
od = sorted([(k,i) for k, i in o.items()],key = lambda z:z[1],reverse = True) + [(0,0)]

if ev[0][0] != od[0][0]:
    print(n - ev[0][1] - od[0][1])
else:
    print(n - max(ev[0][1] + od[1][1], ev[1][1] + od[0][1]))
print(ev,od)

Failing test case input:
4
4 0 3 1

Expected output:
2


Actual output:
2
[(4, 1), (3, 1), (0, 0)] [(0, 1), (1, 1), (0, 0)]


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
v = list(map(int,input().split()))

e = Counter(v[::2])
o = Counter(v[1::2])

ev = sorted([(k,i) for k, i in e.items()],key = lambda z:z[1],reverse = True) + [(0,0)]
od = sorted([(k,i) for k, i in o.items()],key = lambda z:z[1],reverse = True) + [(0,0)]

if ev[0][0] != od[0][0]:
    print(n - ev[0][1] - od[0][1])
else:
    print(n - max(ev[0][1] + od[1][1], ev[1][1] + od[0][1]))
Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
v = list(map(int, input().split()))

va, ve = v[0::2], v[1::2]
da, de = {}, {}
for a in va:
  da[a] = da.get(a, 0)+1
for e in ve:
  de[e] = de.get(e, 0)+1
add = sorted([(k,v) for k,v in da.items()], key=lambda x:x[1])+[(0,0)]
even = sorted([(k,v) for k,v in de.items()], key=lambda x:x[1])+[(0,0)]
if add[0][0] == even[0][0]:
  if add[1][1] <= even[1][1]:
    add.pop(0)
  else:
    even.pop(0)
print(n-add[0][1]-even[0][1])


Failing test case input:
6
105 220 54 119 105 78

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n = int(input())
v = list(map(int, input().split()))

va, ve = v[0::2], v[1::2]
da, de = {}, {}
for a in va:
  da[a] = da.get(a, 0)+1
for e in ve:
  de[e] = de.get(e, 0)+1
add = sorted([(k,v) for k,v in da.items()], key=lambda x:-x[1])+[(0,0)]
even = sorted([(k,v) for k,v in de.items()], key=lambda x:-x[1])+[(0,0)]
if add[0][0] == even[0][0]:
  if add[1][1] <= even[1][1]:
    even.pop(0)
  else:
    add.pop(0)
print(n-add[0][1]-even[0][1])

Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
c = collections.Counter

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

v_odd = v[::2]
v_eve = v[1::2]

c1 = c(v_odd).most_common(2)
c2 = c(v_eve).most_common(2)

if len(c1) == 1 and len(c2) == 1:
    ans = int(N/2)
else:
    if c1[0] != c2[0]:
        ans = N - c1[0][1] - c2[0][1]
    else:
        if c1[1][1] >= c2[1][1]:
            ans = N - c1[1][1] - c2[0][1]
        else:
            ans = N - c1[0][1] - c2[1][1]

print(ans)

Failing test case input:
6
105 119 105 119 105 119

Expected output:
0

Actual output:
3


Fixed submission (verdict: Accepted):
import collections
c = collections.Counter

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

v_odd = v[::2]
v_eve = v[1::2]

c1 = c(v_odd).most_common(2)
c2 = c(v_eve).most_common(2)

if len(c1) == 1 and len(c2) == 1:
    if c1[0][0] != c2[0][0]:
        ans = 0
    else:
        ans = int(N/2)
else:
    if c1[0] != c2[0]:
        ans = N - c1[0][1] - c2[0][1]
    else:
        if c1[1][1] >= c2[1][1]:
            ans = N - c1[1][1] - c2[0][1]
        else:
            ans = N - c1[0][1] - c2[1][1]

print(ans)
Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools
from collections import Counter
N = int(input())
V = list(map(int,input().split()))
even_counter = Counter(V[::2])
odd_counter = Counter(V[1::2])
even_counter[-1] = 0
odd_counter[-1] = 0
even = even_counter.most_common(2)
odd = odd_counter.most_common(2)
print(even,odd)
ans = N
for (k1,v1),(k2,v2) in itertools.product(even,odd):
  if k1 == k2:
    continue
  ans = min(ans,N - v1 - v2)
print(ans)

Failing test case input:
4
10 0 5 1

Expected output:
2


Actual output:
[(10, 1), (5, 1)] [(0, 1), (1, 1)]
2


Fixed submission (verdict: Accepted):
import itertools
from collections import Counter
N = int(input())
V = list(map(int,input().split()))
even_counter = Counter(V[::2])
odd_counter = Counter(V[1::2])
even_counter[-1] = 0
odd_counter[-1] = 0
even = even_counter.most_common(2)
odd = odd_counter.most_common(2)
ans = N
for (k1,v1),(k2,v2) in itertools.product(even,odd):
  if k1 == k2:
    continue
  ans = min(ans,N - v1 - v2)
print(ans)

Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
n=int(input())
v=list(map(int,input().split()))
a=[]
b=[]
for i in range(0,n,2):
    a.append(v[i])
    b.append(v[i+1])
    
a_count=collections.Counter(a)
b_count=collections.Counter(b)
if a_count.most_common()[0][1]==b_count.most_common()[0][1]:
    print(n-a_count.most_common()[0][1])
else:
    ans=n-a_count.most_common()[0][1]-b_count.most_common()[0][1]
    print(ans)

Failing test case input:
6
0 36 8 2 001 14

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
import collections
n=int(input())
v=list(map(int,input().split()))
a=[]
b=[]
for i in range(0,n,2):
    a.append(v[i])
    b.append(v[i+1])
    
a_count=collections.Counter(a)
b_count=collections.Counter(b)

if a_count.most_common()[0][0]==b_count.most_common()[0][0]:
    if a_count.most_common()[0][1]==n
        print(a_count.most_common()[0][1])
    else:
        print(min(n-a_count.most_common()[0][1]-a_count.most_common()[1][1],n-b_count.most_common()[0][1]-b_count.most_common()[1][1]))
else:
    ans=n-a_count.most_common()[0][1]-b_count.most_common()[0][1]
    print(ans)

Problem: p03244
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
v = list(map(int, input().split()))
def doit(vs):
    ret = {}
    for v in vs:
        ret[v] = ret.get(v, 0) + 1
    return sorted((-ret[v], v) for c in ret) + [(0, None)]
odd = doit(v[0::2])
even = doit(v[1::2])
if odd[0][1] != even[0][1]:
    print(n + odd[0][0] + even[0][0])
else:
    print(n + min(odd[1][0] + even[0][0], odd[0][0] + even[1][0]))


Failing test case input:
6
105 119 54 119 105 78

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
v = list(map(int, input().split()))
def doit(vs):
    ret = {}
    for v in vs:
        ret[v] = ret.get(v, 0) + 1
    return sorted((-ret[v], v) for v in ret) + [(0, None)]
odd = doit(v[0::2])
even = doit(v[1::2])
if odd[0][1] != even[0][1]:
    print(n + odd[0][0] + even[0][0])
else:
    print(n + min(odd[1][0] + even[0][0], odd[0][0] + even[1][0]))
Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
n = int(input())
v = [i for i in map(int,input().split())]
v_odd = v[::2]
v_even = v[1::2]
odd_nums = (collections.Counter(v_odd)).most_common()
even_nums = (collections.Counter(v_even)).most_common()
print(odd_nums)
print(even_nums)
ans = 0
if odd_nums[0][0] != even_nums[0][0]: 
  for i in range(1,len(odd_nums)):
    ans += odd_nums[i][1]
  for i in range(1,len(even_nums)):
    ans += even_nums[i][1]
else: 
  ans += min(even_nums[0][1], odd_nums[0][1])
    
print(ans)

Failing test case input:
6
0 120 60 14 243 10

Expected output:
4


Actual output:
[(0, 1), (60, 1), (243, 1)]
[(120, 1), (14, 1), (10, 1)]
4


Fixed submission (verdict: Accepted):
import collections
n = int(input())
v = [i for i in map(int,input().split())]
v_odd = v[::2]
v_even = v[1::2]
odd_nums = (collections.Counter(v_odd)).most_common()
even_nums = (collections.Counter(v_even)).most_common()
ans = 0
if odd_nums[0][0] != even_nums[0][0]: 
  for i in range(1,len(odd_nums)):
    ans += odd_nums[i][1]
  for i in range(1,len(even_nums)):
    ans += even_nums[i][1]
else: 
  ans1=0
  ans2=0
  for i in range(1,len(odd_nums)):
    ans1 += odd_nums[i][1]
  for i in range(len(even_nums)):
    if i==1:
      continue
    ans1 += even_nums[i][1]
  for i in range(len(odd_nums)):
    if i==1:
      continue
    ans2 += odd_nums[i][1]
  for i in range(1,len(even_nums)):
    ans2 += even_nums[i][1]
  ans = min(ans1,ans2)
    
print(ans)

Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n=int(input())
V=list(map(int,input().split()))

E=Counter(V[::2]).most_common() + [(0, 0)]
O=Counter(V[1::2]).most_common() + [(0, 0)]
if E[0][0]!=O[0][0]:
  print(n-E[0][1]+O[0][1])
else:
  print(n-max(E[1][1]+O[0][1],E[0][1]+O[1][1]))

Failing test case input:
6
0 120 60 13 190 78

Expected output:
4


Actual output:
6


Fixed submission (verdict: Accepted):
from collections import Counter
n=int(input())
V=list(map(int,input().split()))

E=Counter(V[::2]).most_common() + [(0, 0)]
O=Counter(V[1::2]).most_common() + [(0, 0)]
if E[0][0]!=O[0][0]:
  print(n-E[0][1]-O[0][1])
else:
  print(n-max(E[1][1]+O[0][1],E[0][1]+O[1][1]))
Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n = int(input())
*v, = map(int, input().split())

odds = [v[i] for i in range(n) if i % 2 == 0]
evens = [v[i] for i in range(n) if i % 2]



o = Counter(odds)
e = Counter(evens)

ans = 0

omx, *r = sorted(o.items(), reverse=True, key=lambda x: x[1])
ans += n
emx, *r = sorted(e.items(), reverse=True, key=lambda x: x[1])
if omx[0] != emx[0]:
    ans += n
else:
    if r:
        ans += n
    else:
        ans += n


print(ans)


Failing test case input:
6
2 124 4 34 215 14

Expected output:
4


Actual output:
12


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
*v, = map(int, input().split())

odds = v[1::2]
evens = v[::2]
o = Counter(odds)
e = Counter(evens)
omx, *ol = sorted(o.items(), reverse=True, key=lambda x: x[1])
emx, *el = sorted(e.items(), reverse=True, key=lambda x: x[1])

if omx[0] != emx[0]:
    ans = n - omx[1] - emx[1]
else:
    if ol:
        ol = ol[0]
    else:
        ol = (0, 0)

    if el:
        el = el[0]
    else:
        el = (0, 0)

    a = n - omx[1] - el[1]
    b = n - emx[1] - ol[1]
    ans = min(a, b)

print(ans)

Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import collections

n = int(input())
V = list(map(int, input().split()))

evel = collections.Counter()
odd = collections.Counter()
for index, v in enumerate(V):
    if index % 2 == 0:
        evel[v] += 1
    else:
        odd[v] += 1
print(evel, odd)
if evel == odd:
    print(int(n / 2))
else:
    el = evel.most_common()
    ol = odd.most_common()
    max_val = 0
    for index_e, num_e in el:
        for index_o, num_o in ol:
            if index_e != index_o:
                max_val = max(max_val, num_e + num_o)
    ans = n - max_val
    print(ans)


Failing test case input:
4
3 1 2 2

Expected output:
2


Actual output:
Counter({3: 1, 2: 1}) Counter({1: 1, 2: 1})
2


Fixed submission (verdict: Accepted):

import collections

n = int(input())
V = list(map(int, input().split()))


def map_all(li):
    return all([e == li[0] for e in li[1:]]) if li else False


evel = collections.Counter()
evel2 = []
odd = collections.Counter()
odd2 = []
for index, v in enumerate(V):
    if index % 2 == 0:
        evel[v] += 1
        evel2.append(v)
    else:
        odd[v] += 1
        odd2.append(v)

if map_all(evel2) and map_all(odd2):
    
    if evel2[0] == odd2[0]:
        
        print(int(n / 2))
    else:
        print(0)
else:
    el = evel.most_common(100)
    ol = odd.most_common(100)
    max_val = 0
    for index_e, num_e in el:
        for index_o, num_o in ol:
            if index_e != index_o:
                max_val = max(max_val, num_e + num_o)
    ans = n - max_val
    print(ans)
Problem: p03244
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
ls = [int(i) for i in input().split()]


from collections import defaultdict
d1 = defaultdict(int)
d2 = defaultdict(int)

for i in range(n):
    if i%2==0:
        d1[ls[i]]+=1
    else:
        d2[ls[i]]+=1


d1=sorted(d1.items(),reverse=True)
d2=sorted(d2.items(),reverse=True)


if d1[0][0] != d2[0][0]:
    print(n-d1[0][1]-d2[0][1])
else:
    try:
        print(min(n-d1[1][1]-d2[0][1],n-d1[0][1]-d2[1][1]))
    except:
        print(n-d1[0][1])

Failing test case input:
6
0 36 0 2 011 14

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n = int(input())
ls = [int(i) for i in input().split()]


from collections import defaultdict
d1 = defaultdict(int)
d2 = defaultdict(int)

for i in range(n):
    if i%2==0:
        d1[ls[i]]+=1
    else:
        d2[ls[i]]+=1


d1=sorted(d1.items(),key=lambda x:x[1],reverse=True)
d2=sorted(d2.items(),key=lambda x:x[1],reverse=True)


if d1[0][0] != d2[0][0]:
    print(n-d1[0][1]-d2[0][1])
else:
    if len(d1)==1 and len(d2)==1:
        print(min(n-d1[0][1],n-d2[0][1]))
    elif len(d1)==1 and len(d2)==2:
        print(min(n-d1[0][1]-d2[1][1],n-d2[0][1]))
    elif len(d1)==2 and len(d2)==1:
        print(min(n-d1[1][1]-d2[0][1],n-d1[0][1]))
    else:
        print(min(n-d1[1][1]-d2[0][1],n-d1[0][1]-d2[1][1]))

Problem: p03244
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
a = Counter(v[::2]).most_common()
b = Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])

if a[-1]!=b[-1]:
    print(n-a[0][1]-b[0][1])
else:
    print(min(n-a[1][1]-b[0][1],n-a[0][1]-b[1][1]))

Failing test case input:
6
105 119 105 81 105 119

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
a = Counter(v[::2]).most_common()
b = Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])

if a[0][0]!=b[0][0]:
    print(n-a[0][1]-b[0][1])
else:
    print(min(n-a[1][1]-b[0][1],n-a[0][1]-b[1][1]))
Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter


n = int(input())
lst_v = list(map(int, input().split()))


lst_o = lst_v[::2]
lst_e = lst_v[1::2]
cnt_o = Counter(lst_o).most_common() + [(0, 0)]
cnt_e = Counter(lst_e).most_common() + [(0, 0)]
print(cnt_o)
print(cnt_e)

if cnt_o[0][0] == cnt_e[0][0]:
    rem_number = max(cnt_o[0][1] + cnt_e[1][1], cnt_o[1][1] + cnt_e[0][1])
else:
    rem_number = cnt_o[0][1] + cnt_e[0][1]
ans = n - rem_number


print(ans)

Failing test case input:
6
0 124 4 2 000 14

Expected output:
3


Actual output:
[(0, 2), (4, 1), (0, 0)]
[(124, 1), (2, 1), (14, 1), (0, 0)]
3


Fixed submission (verdict: Accepted):
from collections import Counter


n = int(input())
lst_v = list(map(int, input().split()))


lst_o = lst_v[::2]
lst_e = lst_v[1::2]
cnt_o = Counter(lst_o).most_common() + [(0, 0)]
cnt_e = Counter(lst_e).most_common() + [(0, 0)]


if cnt_o[0][0] == cnt_e[0][0]:
    rem_number = max(cnt_o[0][1] + cnt_e[1][1], cnt_o[1][1] + cnt_e[0][1])
else:
    rem_number = cnt_o[0][1] + cnt_e[0][1]
ans = n - rem_number


print(ans)

Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

    
from collections import Counter
    
n = int(input())
v = list(map(int, input().split()))

a = Counter(v[0::2]).most_common()
b = Counter(v[1::2]).most_common()
print(a)
print(b)
a.append([0,0])
b.append([0,0])
if a[0][0] != b[0][0]:
  print(n-(a[0][1]+b[0][1]))
else:
  print(min(n-(a[0][1]+b[1][1]),n-(a[1][1]+b[0][1])))

Failing test case input:
6
105 91 204 119 105 78

Expected output:
3


Actual output:
[(105, 2), (204, 1)]
[(91, 1), (119, 1), (78, 1)]
3


Fixed submission (verdict: Accepted):
from collections import Counter
    
n = int(input())
v = list(map(int, input().split()))

a = Counter(v[0::2]).most_common()
b = Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])
if a[0][0] != b[0][0]:
  print(n-(a[0][1]+b[0][1]))
else:
  print(min(n-(a[0][1]+b[1][1]),n-(a[1][1]+b[0][1])))

Problem: p03244
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from itertools import groupby

n = int(input())
v = list(map(int, input().split()))
odd = sorted((-len(list(g)), k) for k, g in groupby(v[0::2])) + [(0, None)]
even = sorted((-len(list(g)), k) for k, g in groupby(v[1::2])) + [(0, None)]
if odd[0][1] != even[0][1]:
    print(n + odd[0][0] + even[0][0])
else:
    print(n + min(odd[1][0] + even[0][0], odd[0][0] + even[1][0]))

Failing test case input:
6
105 119 54 119 105 78

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
v = list(map(int, input().split()))
def doit(vs):
    ret = {}
    for v in vs:
        ret[v] = ret.get(v, 0) + 1
    return sorted((-ret[v], v) for v in ret) + [(0, None)]
odd = doit(v[0::2])
even = doit(v[1::2])
if odd[0][1] != even[0][1]:
    print(n + odd[0][0] + even[0][0])
else:
    print(n + min(odd[1][0] + even[0][0], odd[0][0] + even[1][0]))
Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n=int(input())
l=list(map(int,input().split()))
f=l[0::2]
s=l[1::2]
fn=sorted(Counter(f).items(),key=lambda x:x[1]) + [(0, 0)]
sn=sorted(Counter(s).items(),key=lambda x:x[1]) + [(0, 0)]
if fn[0][0]!=sn[0][0]:
  ans=n-fn[0][1]-sn[0][1]
else:
  ans=n-max(fn[1][1]+sn[0][1],fn[0][1]+sn[1][1])
print(ans)

Failing test case input:
6
105 119 105 81 105 119

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
from collections import Counter
n=int(input())
l=list(map(int,input().split()))
f=l[0::2]
s=l[1::2]
fn=sorted(Counter(f).items(),key=lambda x:x[1],reverse=True) + [(0, 0)]
sn=sorted(Counter(s).items(),key=lambda x:x[1],reverse=True) + [(0, 0)]
if fn[0][0]!=sn[0][0]:
  ans=n-fn[0][1]-sn[0][1]
else:
  ans=n-max(fn[1][1]+sn[0][1],fn[0][1]+sn[1][1])
print(ans)

Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n=int(input())
l=list(map(int,input().split()))
f=l[0::2]
s=l[1::2]
fn=sorted(Counter(f).items(),key=lambda x:x[1]) + [(0, 0)]
sn=sorted(Counter(s).items(),key=lambda x:x[1]) + [(0, 0)]
if fn[0][0]!=sn[0][0]:
  ans=n-fn[0][1]-sn[0][1]
else:
  ans=n-max(fn[1][1]+fn[0][1],fn[0][1]+sn[1][1])
print(ans)

Failing test case input:
6
105 119 204 119 105 119

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
from collections import Counter
n=int(input())
l=list(map(int,input().split()))
f=l[0::2]
s=l[1::2]
fn=sorted(Counter(f).items(),key=lambda x:x[1],reverse=True) + [(0, 0)]
sn=sorted(Counter(s).items(),key=lambda x:x[1],reverse=True) + [(0, 0)]
if fn[0][0]!=sn[0][0]:
  ans=n-fn[0][1]-sn[0][1]
else:
  ans=n-max(fn[1][1]+sn[0][1],fn[0][1]+sn[1][1])
print(ans)

Problem: p03244
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n = int(input())
v = [x for x in input().split()]
v_even_mc = Counter(v[::2]).most_common()
v_odd_mc = Counter(v[1::2]).most_common()
if v_even_mc[0] == v_odd_mc[0]:
  ans = min(v_even_mc[0][1], v_odd_mc[0][1])
else:
  ans = abs(v_even_mc[0][1] - v_odd_mc[0][1])
print(ans)

Failing test case input:
6
2 124 4 19 100 14

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
v = [x for x in input().split()]
if len(set(v)) == 1:
  print(len(v)
  exit()
v_even = Counter(v[::2])
v_odd = Counter(v[1::2])
v_even_mc = v_even.most_common()
v_odd_mc = v_odd.most_common()

if v_even_mc[0] != v_odd_mc[0]:
  ans = (len(v)
else:  
  ans_e = (len(v)
  ans_o = (len(v)
  ans = min(ans_e, ans_o)
print(ans)