Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
def main():
    number=7   
    if K%2 == 0 or K%5 == 0:
        print(-1)
    else:
        s=1
        while True:
            if number%K == 0:
                print(s)
                break
            else:
                number=int(str(number)+"7")
                s += 1
                
if __name__ == '__main__':
    main()

Fixed submission:
k=int(input())
count=1
num=7
for _ in range(k):
    if num%k == 0:
        print(count)
        break
    else:
        count += 1
        num = (num % k)*10 + 7
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
number=7
if K%2 == 0 or K%5 == 0:
    print(-1)
else:
    s=1
    while True:
        if number%K == 0:
            print(s)
            break
        else:
            number=int(str(number)+"7")
            s += 1

Fixed submission:
k=int(input())
count=1
num=7
for _ in range(k):
    if num%k == 0:
        print(count)
        break
    else:
        count += 1
        num = (num % k)*10 + 7
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())
number=7
if K%2 == 0 or K%5 == 0:
    print(-1)
else:
    s=1
    while True:
        if number%K == 0:
            print(s)
            break
        else:
            number=int(str(number)+"7")
            s += 1

Fixed submission:
k=int(input())
count=1
num=7
for _ in range(k):
    if num%k == 0:
        print(count)
        break
    else:
        count += 1
        num = (num % k)*10 + 7
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
abc=list(map(int,input().split()))
a,b,c=abc[0],abc[1],abc[2]
k=int(input())
for i in range(k):
    if a < b < c:
        print("Yes")
        break
    elif b < a < c:
        b *= 2
    else:
        c *= 2:
else:
    print("No")

Fixed submission:
abc=list(map(int,input().split()))
a,b,c=abc[0],abc[1],abc[2]
k=int(input())
for i in range(k+1):
    if a < b < c:
        print("Yes")
        break
    elif b <= a < c:
        b *= 2
    else:
        c *= 2
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n=input()
k=0
while k < n:
    k += 1000
print(k-n)

Fixed submission:
n=int(input())
k=0
while k < n:
    k += 1000
print(k-n)
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
count=0
for i in s:
    if s[i] != t[i]:
        count += 1
print(count)

Fixed submission:
s=input()
t=input()
length=len(s)
count=0
for i in range(length):
    if s[i] != t[i]:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
s=input().split()
t=input().split()
count=0
for i in s:
    if s[i] != t[i]:
        count += 1
print(count)

Fixed submission:
s=input()
t=input()
length=len(s)
count=0
for i in range(length):
    if s[i] != t[i]:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
nk=input().split()
n=int(nk[0])
k=int(nk[1])
data=list(map(int,input().split()))
data2=data.sort()
s=0
for i in range(k):
    s += data2[i]
print(s)

Fixed submission:
nk=input().split()
n=int(nk[0])
k=int(nk[1])
data=list(map(int,input().split()))
data.sort()
s=0
for i in range(k):
    s += data[i]
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
data=list(map(int,input().split()))
s=1
if 0 in data:
    print(0)
else:
    for f in data:
        s *= f
    if s > 10**18:
        print(-1)
    else:
        print(s)

Fixed submission:
N=int(input())
data=list(map(int,input().split()))
if 0 in data:
    print(0)
else:
    s=1
    for f in data:
        s *= f
        if s > 10**18:
            break
    if s > 10**18:
        print(-1)
    else:
        print(s)

Buggy python submission (verdict: Runtime Error):
N=int(input())
data=list(map(int,input().split()))
s=1
for 0 in data:
    print(0)
    end()
for d in data:
    s *= d
if s > 10**18:
    print(-1)
else:
    print(s)
    

Fixed submission:
N=int(input())
data=list(map(int,input().split()))
if 0 in data:
    print(0)
else:
    s=1
    for f in data:
        s *= f
        if s > 10**18:
            break
    if s > 10**18:
        print(-1)
    else:
        print(s)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
data=list(map(int,input().split()))
s=1
for d in data:
    if d == 0:
        print(0)
        break
else:
    for d in data:
        s *= d
    if s > 10**18:
        print(-1)
    else:
        print(s)

Fixed submission:
N=int(input())
data=list(map(int,input().split()))
if 0 in data:
    print(0)
else:
    s=1
    for f in data:
        s *= f
        if s > 10**18:
            break
    if s > 10**18:
        print(-1)
    else:
        print(s)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
data=list(map(int,input().split()))
s=1
for i in range(N):
    s *= data[i]
if s > 10**18:
    print(-1)
else:
    print(s)

Fixed submission:
N=int(input())
data=list(map(int,input().split()))
if 0 in data:
    print(0)
else:
    s=1
    for f in data:
        s *= f
        if s > 10**18:
            break
    if s > 10**18:
        print(-1)
    else:
        print(s)
Buggy python submission (verdict: Runtime Error):
N=input()
if N[-1] == "3":
    print("bon")
elif N[-1] == "0","1","6","8":
    print("pon")
else:
    print("hon")


Fixed submission:
N=input()
if N[-1] == "3":
    print("bon")
elif N[-1] == "0" or N[-1] =="1" or N[-1] =="6" or N[-1] =="8":
    print("pon")
else:
    print("hon")
Buggy python submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
if k < a:
    print(k)
elif k <= a+b:
    print(a)
else:
    print(2a+b-k)

Fixed submission:
a,b,c,k=map(int,input().split())
if k < a:
    print(k)
elif k <= a+b:
    print(a)
else:
    print(2*a+b-k)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,k=map(int,input().split())
data=[]
for i in range(a):
    data.append(1)
for i in range(b):
    data.append(0)
for i in range(c):
    data.append(-1)
s=0
for i in range(k):
    s += data[i]
print(s)

Fixed submission:
a,b,c,k=map(int,input().split())
if k < a:
    print(k)
elif k <= a+b:
    print(a)
else:
    print(2*a+b-k)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=10**11
for i in range(1,n+1):
    if n%i == 0:
        a=i
        b=n//i
        a_len=len(str(a))
        b_len=len(str(b))
        ans=min(ans,max(a_len,b_len))
print(ans)

Fixed submission:
import math

n=int(input())
ans=10**11
for i in range(1,math.floor(math.sqrt(n)+1)):
    if n%i == 0:
        a=i
        b=n//i
        a_len=len(str(a))
        b_len=len(str(b))
        ans=min(ans,max(a_len,b_len))
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(a + b + c)


Fixed submission:
a, b, c = map(int, input())
print(a + b + c)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7
A.sort()
ans = 0
for i in range(N):
    for j in range(i+1,N):
        if A[i] > A[j]:
            continue
        ans += (A[i] * (sum(A[j:N]) % MOD)) %MOD
        break

print(ans % MOD)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7
A.sort()
ans = 0
sumA = sum(A)
for i in range(N):
    sumA -= A[i]
    for j in range(i+1,N):
        if A[i] > A[j]:
            continue
        ans += (A[i] * (sumA % MOD)) %MOD
        break

print(ans % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7
A.sort()
ans = 0
for i in range(N):
    for j in range(i+1,N):
        if A[i] > A[j]:
            continue
        ans += A[i] * A[j] % MOD

print(ans % MOD)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7
A.sort()
ans = 0
sumA = sum(A)
for i in range(N):
    sumA -= A[i]
    for j in range(i+1,N):
        if A[i] > A[j]:
            continue
        ans += (A[i] * (sumA % MOD)) %MOD
        break

print(ans % MOD)
Buggy python submission (verdict: Runtime Error):
A,V = map(int, input().split())
B,W = map(int, input().split())
T = int(input())

if A < B and V <= W:
    print('NO')
    exit()

val1 = A-B
val2 = V-W

if val1%val2 == 0:
    print('YES')
else:
    print('NO')


Fixed submission:
A,V = map(int, input().split())
B,W = map(int, input().split())
T = int(input())
 
if A < B: 
    Ap = A + V*T
    Bp = B + W*T

    if Ap >= Bp:
        print('YES')
    else:
        print('NO')    
else:
    Ap = A + (-V*T)
    Bp = B + (-W*T)

    if Ap <= Bp:
        print('YES')
    else:
        print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int, input().split()))
for value in range(n):
    if min(a) > n:
        print(0)
    else:
        print(a.count(value+1))

Fixed submission:
import collections
n=int(input())
a=list(map(int, input().split()))

c = collections.Counter(a)
for value in range(n):
    if value == 0:
        continue
    else:
        print(c[value])
print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int, input().split()))
for value in range(n):
    if min(a) > n:
        print(0)
    else:
        print(a.count(value+1))

Fixed submission:
import collections
n=int(input())
a=list(map(int, input().split()))

c = collections.Counter(a)
for value in range(n):
    if value == 0:
        continue
    else:
        print(c[value])
print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int, input().split()))
for value in range(n):
    print(a.count(value+1))

Fixed submission:
import collections
n=int(input())
a=list(map(int, input().split()))

c = collections.Counter(a)
for value in range(n):
    if value == 0:
        continue
    else:
        print(c[value])
print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import math
def gcd3(a, b, c):
    return math.gcd(math.gcd(a,b), c)

k = int(input())
sum = 0
for a in range(k):
    for b in range(k):
        for c in range(k):
            if a == 0 or b == 0 or c == 0:
                sum += 1
            else:
                sum += gcd3(a+1,b+1,c+1)
print(sum)

Fixed submission:
import math
def gcd3(a, b, c):
    return math.gcd(math.gcd(a,b), c)

k = int(input())
sum = 0
for a in range(k):
    if a == 0:
        sum += k * k
        continue
    else:
        for b in range(k):
            if b == 0:
                sum += k
                continue
            else:
                for c in range(k):
                    if c == 0:
                        sum += 1
                    else:
                        sum += gcd3(a+1,b+1,c+1)
print(sum)

Buggy python submission (verdict: Runtime Error):
def gcd3(a, b, c):
    return gcd(gcd(a,b), c)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

k = int(input())
sum = 0
for a in range(k):
    for b in range(k):
        for c in range(k):
            if a == 0 or b == 0 or c == 0:
                sum += 1
            else
                sum += gcd3(a+1,b+1,c+1)
print(sum)

Fixed submission:
import math
def gcd3(a, b, c):
    return math.gcd(math.gcd(a,b), c)

k = int(input())
sum = 0
for a in range(k):
    if a == 0:
        sum += k * k
        continue
    else:
        for b in range(k):
            if b == 0:
                sum += k
                continue
            else:
                for c in range(k):
                    if c == 0:
                        sum += 1
                    else:
                        sum += gcd3(a+1,b+1,c+1)
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd3(a, b, c):
    return gcd(gcd(a,b), c)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

k = int(input())
sum = 0
for a in range(k):
    for b in range(k):
        for c in range(k):
            sum += gcd3(a+1,b+1,c+1)
print(sum)

Fixed submission:
import math
def gcd3(a, b, c):
    return math.gcd(math.gcd(a,b), c)

k = int(input())
sum = 0
for a in range(k):
    if a == 0:
        sum += k * k
        continue
    else:
        for b in range(k):
            if b == 0:
                sum += k
                continue
            else:
                for c in range(k):
                    if c == 0:
                        sum += 1
                    else:
                        sum += gcd3(a+1,b+1,c+1)
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(input())

point = 0
rList = []
gList = []
bList = []
for value in s:
    point += 1
    if value == "R":
        rList.append(point)
    elif value == "G":
        gList.append(point)
    elif value == "B":
        bList.append(point)

count = 0
for iIndex, iItem in enumerate(rList):
    for jIndex, jItem in enumerate(gList):
        for kIndex, kItem in enumerate(bList):
            if (jItem - iItem != kItem - jItem) and iItem < jItem < kItem:
                count += 1
for iIndex, iItem in enumerate(rList):
    for jIndex, jItem in enumerate(bList):
        for kIndex, kItem in enumerate(gList):
            if (jItem - iItem != kItem - jItem) and iItem < jItem < kItem:
                count += 1
for iIndex, iItem in enumerate(gList):
    for jIndex, jItem in enumerate(bList):
        for kIndex, kItem in enumerate(rList):
            if (jItem - iItem != kItem - jItem) and iItem < jItem < kItem:
                count += 1
for iIndex, iItem in enumerate(gList):
    for jIndex, jItem in enumerate(rList):
        for kIndex, kItem in enumerate(bList):
            if (jItem - iItem != kItem - jItem) and iItem < jItem < kItem:
                count += 1
for iIndex, iItem in enumerate(bList):
    for jIndex, jItem in enumerate(rList):
        for kIndex, kItem in enumerate(gList):
            if (jItem - iItem != kItem - jItem) and iItem < jItem < kItem:
                count += 1
for iIndex, iItem in enumerate(bList):
    for jIndex, jItem in enumerate(gList):
        for kIndex, kItem in enumerate(rList):
            if (jItem - iItem != kItem - jItem) and iItem < jItem < kItem:
                count += 1
print(count)

Fixed submission:
n=int(input())
s=list(input())

point = 0
rList = []
gList = []
bList = []
for value in s:
    point += 1
    if value == "R":
        rList.append(point)
    elif value == "G":
        gList.append(point)
    elif value == "B":
        bList.append(point)

if len(rList) < 1 or len(gList) < 1 or len(bList) < 1:
    print(0)
else:
    count = len(rList) * len(gList) * len(bList)
    for i in range(n-1):
        for j in range(i+1,n):
            k = 2*j-i
            if k < n and s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                count -= 1
    print(count)
Buggy python submission (verdict: Runtime Error):
k,n=map(int, input().split())
a=list(map(int, input().split()))

max_distance = k - a[-1] - a[0]
str_index = 0
gl_index = -1
for i in range(n):
   	if i == 0:
        continue
    elif max_distance < abs(a[i-1] - a[i]):
        max_distance = abs(a[i-1] - a[i])
        str_index = i-1
        gl_index = i
print(a[str_index] + (k - a[gl_index]))

Fixed submission:
k,n=map(int, input().split())
a=list(map(int, input().split()))

max_distance = abs(k - a[-1] + a[0])
str_index = 0
gl_index = -1
for i in range(n):
    if i == 0:
        continue
    elif max_distance < abs(a[i-1] - a[i]):
        max_distance = abs(a[i-1] - a[i])
        str_index = i-1
        gl_index = i
if gl_index == -1:
    print(a[gl_index] - a[str_index])
else:
    print(a[str_index] + (k - a[gl_index]))
Buggy python submission (verdict: Runtime Error):
k = int(input())
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(list[k])


Fixed submission:
k = int(input())
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(list[k-1])
Buggy python submission (verdict: Runtime Error):
if a == 0:
    print(0)
else:
    ans = (int(n / (a+b)) * a)
    if n % (a+b) > a:
        print(ans + a)
    else:
        print(ans + (n % (a+b)))

Fixed submission:
n,a,b,=map(int, input().split())
if a == 0:
    print(0)
else:
    ans = (int(n / (a+b)) * a)
    if n % (a+b) > a:
        print(ans + a)
    else:
        print(ans + (n % (a+b)))
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int, input().split())
p=list(map(int, input().split()))
ans = 0.0
for i in range(len(p)-k+1):
    karians = sum(p[i:i+k])/2 + k*0.5
    if ans < karians:
        ans = karians
print(ans)


Fixed submission:
n,k=map(int, input().split())
p=list(map(int, input().split()))
ksum = sum(p[0:k])
ans = kans = ksum/2 + k*0.5
for i in range(n-k):
    ksum = ksum -p[i] +p[i+k]
    kans = ksum/2 + k*0.5
    if ans < kans:
        ans = kans
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int, input().split())
p=list(map(int, input().split()))

def kitai(pk):
    return sum(pk)/2 + k*0.5

ans = 0.0
for i in range(len(p)-k+1):
    karians = kitai(p[i:i+k])
    if ans < karians:
        ans = karians
print(ans)


Fixed submission:
n,k=map(int, input().split())
p=list(map(int, input().split()))
ksum = sum(p[0:k])
ans = kans = ksum/2 + k*0.5
for i in range(n-k):
    ksum = ksum -p[i] +p[i+k]
    kans = ksum/2 + k*0.5
    if ans < kans:
        ans = kans
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import numpy as np
N = int(input())

def factorization(n):
    res = []
    x = N
    y = 2
    while y*y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)

    return res

ns = factorization(N)

ans = 10**12 + 1
for i in range(1, len(ns)+1):
    for j in itertools.combinations(ns, i):
        val1 = np.prod(j)
        val2 = N // val1
        ans = min(ans, val1+val2-2)

print(ans)



Fixed submission:
import math
def solve():
    N = int(input())

    ans = 10**12 + 1
    s = int(math.sqrt(N))
    for i in range(1, s+1):
        if N % i == 0:
            val1 = i
            val2 = N // val1
            ans = min(ans, val1+val2-2)
    print(ans)

solve()
Buggy python submission (verdict: Runtime Error):
import math
from decimal import Decimal
A,B,X = map(Decimal, input().split())
s = X / A

if s > A * B / 2:
    Bu = 2 * s / A - B
    s -= A*Bu
    B -= Bu

A2 = 2 * s / B
print(math.degrees(math.atan(B/(A2))))


Fixed submission:
import math
from decimal import Decimal
A,B,X = map(Decimal, input().split())
s = X / A

if s == A*B:
    print(0)
    exit()
if s > A * B / 2:
    Bu = 2 * s / A - B
    s -= A*Bu
    B -= Bu

A2 = 2 * s / B
print(math.degrees(math.atan(B/(A2))))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
 
INF = 10**9
dp = [0] + [INF]*N
 
for i in range(1,N+1):
    if i == 1:
        dp[1] = abs(A[1]-A[0])
    else:
        dp[i] = min(dp[i-1]+abs(A[i]-A[i-1]), dp[i-2]+abs(A[i]-A[i-2]))
 
print(dp[N])

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

INF = 10**9
dp = [INF]*N

def chmin(val1, val2):
    if val1 < val2:
        return val1
    else:
        return val2
        
for i in range(len(A)):
    if i == 0:
        dp[0] = 0
    elif i == 1:
        dp[1] = abs(A[1]-A[0])
    else:
        dp[i] = chmin(dp[i-1]+abs(A[i]-A[i-1]), dp[i-2]+abs(A[i]-A[i-2]))

print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,W = map(int, input().split())
wv = [list(map(int, input().split())) for i in range(N)]

dp= [[0]*(W+1) for i in range(N+1)] 

for i in range(1,N+1):
    for j in range(1,W+1):
        if j >= wv[i-1][0]:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j - wv[i-1][0]] + wv[i-1][1])
        else:
            dp[i][j] = dp[i-1][j]
print(dp[N][W])

Fixed submission:
N,W = map(int, input().split())
wv = [list(map(int, input().split())) for i in range(N)]

dp= [[0]*(W+1) for i in range(N+1)] 

for i in range(1,N+1):
    for j in range(1,W+1):
        if j >= wv[i-1][0]:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j - wv[i-1][0]] + wv[i-1][1])
        else:
            dp[i][j] = dp[i-1][j]
print(dp[N][W])
Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
V = list(map(int, input().split()))

ans = 0
eve = V[0::2]
odd = V[1::2]
cntEve = collections.Counter(eve)
cntOdd = collections.Counter(odd)

if cntEve.most_common()[0][0] == cntOdd.most_common()[0][0]:
    ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - max(cntEve.most_common()[1][1],cntOdd.most_common()[1][1])
else:
    ans = N - int(cntEve.most_common()[0][1]) - int(cntOdd.most_common()[0][1])

print(ans)

Fixed submission:
import collections
N = int(input())
V = list(map(int, input().split()))

ans = 0
eve = V[0::2]
odd = V[1::2]
cntEve = collections.Counter(eve)
cntOdd = collections.Counter(odd)

if cntEve.most_common()[0][0] == cntOdd.most_common()[0][0]:
    if len(cntEve) == 1 and len(cntOdd) > 1:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - cntOdd.most_common()[1][1]
    elif len(cntEve) > 1 and len(cntOdd) == 1:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - cntEve.most_common()[1][1]
    elif len(cntEve) == 1 and len(cntOdd) == 1:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1])
    else:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - max(cntEve.most_common()[1][1],cntOdd.most_common()[1][1])
else:
    ans = N - int(cntEve.most_common()[0][1]) - int(cntOdd.most_common()[0][1])

print(ans)

Buggy python submission (verdict: Runtime Error):
import collections
N = map(int, input().split())
V = list(map(int, input().split()))

ans = 0
eve = V[0::2]
odd = V[1::2]
cntEve = collections.Counter(eve)
cntOdd = collections.Counter(odd)

if cntEve.most_common()[0][0] == cntOdd.most_common()[0][0]:
    ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - max(cntEve.most_common()[1][1],cntOdd.most_common()[1][1])
else:
    ans = N - cntEve.most_common()[0][1] - cntOdd.most_common()[0][1]

print(ans)

Fixed submission:
import collections
N = int(input())
V = list(map(int, input().split()))

ans = 0
eve = V[0::2]
odd = V[1::2]
cntEve = collections.Counter(eve)
cntOdd = collections.Counter(odd)

if cntEve.most_common()[0][0] == cntOdd.most_common()[0][0]:
    if len(cntEve) == 1 and len(cntOdd) > 1:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - cntOdd.most_common()[1][1]
    elif len(cntEve) > 1 and len(cntOdd) == 1:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - cntEve.most_common()[1][1]
    elif len(cntEve) == 1 and len(cntOdd) == 1:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1])
    else:
        ans = N - max(cntEve.most_common()[0][1],cntOdd.most_common()[0][1]) - max(cntEve.most_common()[1][1],cntOdd.most_common()[1][1])
else:
    ans = N - int(cntEve.most_common()[0][1]) - int(cntOdd.most_common()[0][1])

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
Row = input()
List = [int(j) for j in input().split()]
for i in range(len(List)):
    ans = List[i] % 2
    if ans == 1:
        print(0)
        sys.exit()

count = 0
flg = 0
while flg == 0:
    count = count + 1
    for j in range(len(List)):
        List[j] = List[j] / 2
        if List[j]%2:
            flg = 1
            break
print(count)


Fixed submission:
val = input()
count = list(val).count('1')
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

def test_case(k):
    ans,cnt = 7,1
    
    if k % 2 == 0 or k % 5 == 0:
        return -1
    
    if k == 1 or k == 7:
        return 1
    
    while (1):
        mod = (ans * 10 + 7) % k
        cnt += 1
        ans = ans * 10 + 7
        
        if mod == 0:
            return cnt
        
print(test_case(k))



Fixed submission:
k = int(input())

def test_case(k):
    ans,cnt = 7,1
    
    if k % 2 == 0 or k % 5 == 0:
        return -1
    
    if k == 1 or k == 7:
        return 1
    
    while (1):
        ans = (ans * 10 + 7) % k
        cnt += 1
        
        if ans == 0:
            return cnt
        
print(test_case(k))