Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from fractions import gcd
from math import ceil
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n-1):
  if len(bin(a[i]))-bin(a[i]).rfind("1")!=len(bin(a[i+1]))-bin(a[i+1]).rfind("1"):
    print(0)
    exit()
g=a[0]
for i in range(n-1):
   g=(g//gcd(g,a[i+1]))*(a[i+1]//gcd(g,a[i+1]))*gcd(g,a[i+1])
g//=2
print(ceil((m//g)/2))


### FIXED CODE ###

from fractions import gcd
from math import ceil
n,m=map(int,input().split())
a=list(map(int,input().split()))
c=len(bin(a[0]))-bin(a[0]).rfind("1")
for i in range(1,n):
  if c!=len(bin(a[i]))-bin(a[i]).rfind("1"):
    print(0)
    exit()
g=a[0]
for i in range(n-1):
   g=(g//gcd(g,a[i+1]))*(a[i+1]//gcd(g,a[i+1]))*gcd(g,a[i+1])
g//=2
print(ceil((m//g)/2))
### BUGGY CODE ###

import heapq
import itertools

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

data = []
for _ in range(N):
    data.append(list(map(int, input().split())))

scores = []
for info in list(itertools.combinations(data, M)):
    beuty_score = 0
    taste_score = 0
    popular_score = 0
    for i in info:
        beuty_score += i[0]
        taste_score += i[1]
        popular_score += i[2]
    beuty_score = abs(beuty_score)
    taste_score = abs(taste_score)
    popular_score = abs(popular_score)
    heapq.heappush(scores, -(beuty_score + taste_score + popular_score))


print(-heapq.heappop(scores))



### FIXED CODE ###

import heapq

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

data = []
for _ in range(N):
    data.append(list(map(int, input().split())))

score = [] 
scores = []
for i in range(-1, 2, 2):
    for j in range(-1, 2, 2):
        for k in range(-1, 2, 2):
            for info in data:
                heapq.heappush(score, -(i*info[0] + j*info[1] + k*info[2]))
            scores.append(-sum([heapq.heappop(score) for _ in range(M)]))
            score.clear()

print(max(scores))
### BUGGY CODE ###

def gcd(a, b):
    if b == 0:
        return a

    return gcd(b, a % b)


K = int(input())

sum = 0

for i in range(1, K + 1):
    for j in range(1, K + 1):
        for k in range(1, K + 1):
            tmp = gcd(j, k)
            sum += gcd(i, tmp)

print(sum)



### FIXED CODE ###

import math


K = int(input())

sum = 0

for i in range(1, K + 1):
    for j in range(1, K + 1):
        sum += math.gcd(i, j)
        if j == K:
            break
        else:
            for k in range(j + 1, K + 1):
                sum += math.gcd(i, math.gcd(j, k)) * 2

print(sum)
### BUGGY CODE ###

import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    N, K = map(int, input().split())
    p = list(map(int, input().split()))

    for i in range(N):
        p[i] = (p[i] + 1) / 2

    ans = 0
    for i in range(N - K + 1):
        ans = max(ans, sum(p[i:i + K]))

    print(ans)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
import numpy as np

input = lambda: sys.stdin.readline().rstrip()


def solve():
    N, K = map(int, input().split())
    p = np.array(list(map(int, input().split())), dtype='f8')
    p = (p + 1) / 2
    rs = np.zeros(N + 1, dtype='f8')
    for i in range(N):
        rs[i + 1] = rs[i] + p[i]
    ans = 0
    for i in range(N - K + 1):
        ans = max(ans, rs[i + K] - rs[i])

    print(ans)


if __name__ == '__main__':
    solve()
### BUGGY CODE ###

H,W = map(int, input().split())
A=[]
B=[]
for _ in range(H):
    A.append(list(map(int, input().split())))
for _ in range(H):
    B.append(list(map(int, input().split())))
M=[[[] for _ in range(W)] for _ in range(H)]
m=0
for i in range(H):
    for j in range(W):
        M[i][j]=abs(A[i][j]-B[i][j])
        m=max(M[i][j],m)
r=m*(H+W)
dp=[[[False for _ in range(r+1)] for _ in range(W)] for _ in range(H)]
dp[0][0][abs(A[0][0]-B[0][0])]=True
for i in range(H):
    for j in range(W):
        if i==0 and j==0: continue
        for k in range(r+1):
            if i==0:
                if k+M[i][j] <= r:
                    if dp[i][j-1][abs(k-M[i][j])] or dp[i][j-1][k+M[i][j]]:
                        dp[i][j][k]=True
                else:
                    if dp[i][j-1][abs(k-M[i][j])]:
                        dp[i][j][k]=True
            elif j==0:
                if k+M[i][j] <= r:
                    if dp[i-1][j][abs(k-M[i][j])] or dp[i-1][j][k+M[i][j]]:
                        dp[i][j][k]=True
                else:
                    if dp[i-1][j][abs(k-M[i][j])]:
                        dp[i][j][k]=True
            elif k+M[i][j] <= r:
                if dp[i][j-1][abs(k-M[i][j])] or dp[i][j-1][k+M[i][j]] or dp[i-1][j][abs(k-M[i][j])] or dp[i-1][j][k+M[i][j]]:
                    dp[i][j][k]=True
            else:
                if dp[i][j-1][abs(k-M[i][j])] or dp[i-1][j][abs(k-M[i][j])]:
                    dp[i][j][k]=True
for i in range(r+1):
    if dp[H-1][W-1][i]:
        print(i)
        break


### FIXED CODE ###

import numpy as np
import itertools

H,W=map(int,input().split())
A=[list(map(int, input().split())) for _ in range(H*2)]
M=[[abs(A[i][j]-A[H+i][j]) for j in range(W)] for i in range(H)]
m=max(max(j for j in i) for i in M)
r=m*(H+W)+1
dp=np.zeros((H,W,r),dtype='bool')
dp[0][0][M[0][0]]=True
it = itertools.product(range(H),range(W))
next(it)
for h,w in it:
    m=M[h][w]
    dp[h][w][m:] |= dp[h][w-1][:r-m] | dp[h-1][w][:r-m]
    dp[h][w][:r-m] |= dp[h][w-1][m:] | dp[h-1][w][m:]
    dp[h][w][:m] |= dp[h][w-1][m:0:-1] | dp[h-1][w][m:0:-1]

for i in range(r):
    if dp[-1][-1][i]:
        print(i)
        break
### BUGGY CODE ###

n,k=map(int, input().split())
pn = list(map(int, input().split()))
ex_list = []
for i in range(n-k+1):
    ex = 0
    for j in range(k):
        ex += (pn[i+j]+1)/2
    ex_list.append(ex)
print(max(ex_list))

### FIXED CODE ###

n,k=map(int, input().split())
pn = list(map(int, input().split()))
ex_list = [(pn[i]+1)/2 for i in range(len(pn))]
ex_wa_list = []
wa = 0
for i in range(len(ex_list)):
    wa += ex_list[i]
    ex_wa_list.append(wa)
Ans_list = []
wa2 = 0
for i in range(n-k+1):
    if i == 0:
        wa2 = ex_wa_list[k-1]
    else:
        wa2 = ex_wa_list[k-1+i] - ex_wa_list[i-1]
    Ans_list.append(wa2)
print(max(Ans_list))
### BUGGY CODE ###

input()
ls = map(int, input().split(' '))
result = 1
for i in ls:
    result *= i
if result > 10 ** 18:
    print(-1)
else:
    print(result)

### FIXED CODE ###

n = input()
nums = list(map(int, input().split(' ')))
nums.sort()
result = 1
for i in nums:
    result *= i
    if result > 10**18:
        result = -1
        break
    if result == 0:
        break
print(result)
### BUGGY CODE ###

def main():
    import sys
    sys.setrecursionlimit(10**7)
    n, q = input().split(' ')
    visit = [0 for _ in range(int(n))]
    point = [0 for _ in range(int(n))]
    dic = [[] for _ in range(int(n))]

    def add_p(num):
        if visit[num] == 1:
            return 0
        visit[num] = 1
        for i in dic[num]:
            if visit[i] == 0:
                point[i] += point[num]
                add_p(i)
        return 0
    for _ in range(int(n)-1):
        a, b = input().split(' ')
        dic[int(a)-1].append(int(b)-1)
        dic[int(b)-1].append(int(a)-1)
    for _ in range(int(q)):
        p, x = input().split(' ')
        point[int(p)-1] += int(x)
    add_p(0)
    print(*point)

main()

### FIXED CODE ###

def main():
    n, q = map(int, input().split(' '))
    import sys
    from collections import deque
    sys.setrecursionlimit(10**7)

    visit = [True for _ in range(n)]
    point = [0 for _ in range(n)]
    dic = [[] for _ in range(n)]
    for _ in range(n-1):
        a, b = map(int, input().split(' '))
        dic[a-1].append(b-1)
        dic[b-1].append(a-1)
    for _ in range(q):
        p, x = map(int, input().split(' '))
        point[p-1] += x
    next_visit = deque()
    next_visit.append(0)
    visit[0] = False
    counter = 1
    while counter < n:
        t = next_visit.pop()
        for s in dic[t]:
            if visit[s]:
                point[s] += point[t]
                visit[s] = False
                counter += 1
                next_visit.append(s)
    print(*point)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

H,W = inpl()

MAP = [['#']*(W+2)]
for i in range(H):
	MAP.append(['#'] + list(input()) + ['#'])
MAP.append(['#']*(W+2))

memo = [[INF for x in range(W+2)] for y in range(H+2)]
q = queue.Queue()
q.put([1,1,1])

def check(x,y,n):
	if memo[y][x] < n or MAP[y][x] == '#':
		return
	else:
		memo[y][x] = n
		q.put([x-1,y,n+1])
		q.put([x+1,y,n+1])
		q.put([x,y-1,n+1])
		q.put([x,y+1,n+1])


while not q.empty():
	x,y,n = q.get()
	check(x,y,n)

if memo[H][W] == INF:
	print(-1)
else:
	black = 0
	for y in range(1,H+1):
		for x in range(1,W+1):
			if MAP[y][x] == '#':
				black += 1
	print(H*W-black-memo[H][W])


### FIXED CODE ###

import sys
import queue

H,W = map(int,input().split())


white = 0
	
maze = []

for y in range(H):
	li = list(input())
	white += li.count('.')
	maze.append(li)

if maze[0][0] == '#' or maze[H-1][W-1] == '#':
	print (-1)
	sys.exit()

	
maze[H-1][W-1] =	'g'
	
q = queue.Queue()
q.put([0,0,0])

def check(x,y,n):
	if 0 <= x < W and 0 <= y < H:
		if maze[y][x] == 'g':
			print (white - n - 1)
			sys.exit()
		elif maze[y][x] == '.':
			maze[y][x] = n
			q.put([x-1,y,n+1])
			q.put([x+1,y,n+1])
			q.put([x,y-1,n+1])
			q.put([x,y+1,n+1])
		else:
			return
	else:
		return


while not q.empty():
	x,y,n = q.get()
	check(x,y,n)
	
print(-1)
### BUGGY CODE ###

n,q=map(int,input().split())
s=input()
x=[1]*n
for _ in range(q):
    c,d=input().split()
    for i,char in enumerate(s):
        if char == c:
            if d=="L":
                if i==0:
                    x[i]=0
                else:
                    x[i-1]+=x[i]
                    x[i]=0
            else:
                if i==n-1:
                    x[n-1]=0
                else:
                    x[i+1]+=x[i]
                    x[i]=0
print(sum(x))


### FIXED CODE ###

n, q = map(int, input().split())
s = input()
l = 0
r = n - 1
Q = [(input().split()) for i in range(q)]
Q.reverse()
for t,d in Q:
    if s[l] == t and d == "L":
        l += 1
    elif l > 0 and s[l - 1] == t and d == "R":
        l -= 1
    if s[r] == t and d == "R":
        r -= 1
    elif r < n - 1 and s[r + 1] == t and d == "L":
        r += 1
    if l > r:
        break
print(r - l + 1)
### BUGGY CODE ###

X, Y, Z, K = map(int, input().split())
A = sorted([int(i) for i in input().split()])
B = sorted([int(i) for i in input().split()])
C = sorted([int(i) for i in input().split()])

AB = []
for a in A:
  for b in B:
    AB.append(a + b)

AB.sort(reverse=True)
AB = AB[:min(3001, X * Y * Z + 1)]
ABC = []
for ab in AB:
  for c in C:
    ABC.append(ab + c)
ABC.sort(reverse=True)
print(*ABC[:K], sep='\n')


### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

AB = []
for a in A:
  for b in B:
    AB.append(a + b)

AB.sort(reverse=True)
AB = AB[:min(3001, X * Y * Z + 1)]
ABC = []
for c in C:
  for ab in AB:
    ABC.append(ab + c)
ABC.sort(reverse=True)
for i in range(K):
  print(ABC[i])
### BUGGY CODE ###

N = int(input())
ans = 0
for i in range(1, N+1):
    cnt = N // i + 1
    for j in range(1, cnt+1):
        if i * j >= N:
            break
#         print(1, j)
        ans += 1
print(ans)



### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1, N+1):
    cnt = (N-1) // i
#     for j in range(1, cnt+1):
#         if i * j >= N:
#             break
#         print(1, j)
    ans += cnt
print(ans)
### BUGGY CODE ###

string = list(input())
inp = string
n = int(input())
flag = 1
for i in range(n):
    j = input().split()
    if len(j) == 3 and j[1] == "1" and flag == 1:
        inp.insert(0,j[2])
    elif len(j) == 3 and j[1] == "2" and flag == 1:
        inp.append(j[2])
    elif len(j) == 3 and j[1] == "2" and flag == -1:
        inp.insert(0,j[2])
    elif len(j) == 3 and j[1] == "1" and flag == -1:
        inp.append(j[2])
    else:
        flag *= -1
if flag == -1:
    inp = inp[::-1]
s = ""
for j in inp:
    s = s + j
print(s)


### FIXED CODE ###

s=list(input())
q=int(input())
c=0
left=[]
right=[]
for i in range(q):
    s1=input()
    if s1[0]=='1':
        c+=1
    else:
        if s1[2] == '1':
            if c % 2 == 0:
                left.append(s1[4])
            else:
                right.append(s1[4])
        else:
            if c % 2 == 0:
                right.append(s1[4])
            else:
                left.append(s1[4])
left=left[::-1]
left.extend(s)
left.extend(right)
if c%2==0:
    print(''.join(left))
else:
    left=left[::-1]
    print(''.join(left))
### BUGGY CODE ###

def main():
    n = int(input())
    s = input()

    W = []
    wcum = 0
    for c in s:
        W.append(wcum)
        if c == 'W':
            wcum += 1

    E = []
    ecum = 0
    for c in s[::-1]:
        E.insert(0, ecum)
        if c == 'E':
            ecum += 1

    ans = min([W[i] + E[i] for i in range(n)])
    print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n = int(input())
    s = input()

    cum = s[1:].count('E')
    ans = cum
    for i in range(1, n):
        if s[i - 1] == 'W':
            cum += 1
        if s[i] == 'E':
            cum -= 1

        ans = min(cum, ans)
    print(ans)

if __name__ == "__main__":
    main()
### BUGGY CODE ###

N = int(input())
x=int(input())
y=[x]

i=1
while i < N:
    x=int(input())
    a=0
    flag=1
    while a < len(y):
        if y[a]==x:
            del y[a]
            flag=-1
            break
        a+=1
    if flag==1:
        y.append(x)
    i+=1

print(len(y))


### FIXED CODE ###


N = int(input())
x = [int(input()) for i in range(N)]

x.sort()
i=0
while i < N-1:
    if x[i]==x[i+1]:
        del x[i+1]
        del x[i]
        N-=2
        continue
    i+=1
print(len(x))
### BUGGY CODE ###

import math
from functools import reduce

# from collections import defaultdict


def gcd(*numbers):
    return reduce(math.gcd, numbers)


def reducef(x, y):
    return gcdd[(x, y)]


def gcd2(*numbers):
    return reduce(reducef, numbers)


K = int(input())
ans = 0
# gcdd=defaultdict()
gcdd = {}
for a in range(1, K + 1):
    for b in range(1, K + 1):
        if (a, b) not in gcdd:
            gcdd[(a, b)] = gcd(a, b)

for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            ans += gcd2(a, b, c)
print(ans)


### FIXED CODE ###

from functools import reduce

# from collections import defaultdict


def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x


def gcddd(*numbers):
    return reduce(gcd, numbers)


def reducef(x, y):
    return gcdd[(x, y)]


def gcd2(*numbers):
    return reduce(reducef, numbers)


K = int(input())
ans = 0
# gcdd=defaultdict()
gcdd = {}
for a in range(1, K + 1):
    for b in range(1, K + 1):
        if (a, b) not in gcdd:
            gcdd[(a, b)] = gcddd(a, b)

for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            ans += gcd2(a, b, c)
print(ans)
### BUGGY CODE ###

# https://atcoder.jp/contests/agc036/tasks/agc036_a

S = int(input())

def divisors(N):
    ans = []
    i = 1
    while i * i <= N:
        if N % i == 0:
            ans.append(i)
            if N // i != i:
                ans.append(N // i)
        i += 1
    ans.sort()
    return ans

if S <= 10 ** 9:
    print(0, 0, S, 0, 0, 1)
else:
    i = 1
    N = S
    while i * i <= N and i <= 10 ** 9:
        if N % i == 0:
            if N // i <= 10 ** 9:
                print(0, 0, N // i, 0, 0, i)
                exit()
            if N // i != i:
                if N // i <= 10 ** 9:
                    print(0, 0, N // i, 0, 0, i)
                    exit()
        i += 1


### FIXED CODE ###

# https://atcoder.jp/contests/agc036/tasks/agc036_a

S = int(input())
x1 = 0
y1 = 0
x2 = 1000000000
y2 = 1
v = 1000000000
x = (v - S % v) % v
y = (S + x) // v

print("{} {} {} {} {} {}".format(x1, y1, x2, y2, x, y))
### BUGGY CODE ###

a,b,c,k = map(int,input().split())

sum = 0
for i in range(k):

    if a > 0:
        sum += 1
        a -= 1
        continue
    if b > 0:
        b -= 1
        continue
    if c > 0:
        sum -= 1
        c -= 1
        continue
print(sum)

### FIXED CODE ###

a,b,c,k = map(int,input().split())

ans = 0

if k < a:
    print(k*1)
else:
    ans = a*1
    k -= a
    if k > 0:
        k -= b*1
        if k > 0:
            ans += k*-1
    print(ans)
### BUGGY CODE ###

import sys
def b(bs, cs):
    #print(bs, xs[len(bs):])
    d = set()
    nbs = []
    for b in bs:
      for i, c in enumerate(cs):
        if b > c:
            nbs.append(c)
            del cs[i]
            break
      else:
        print("No")
        sys.exit()
    return bs+nbs, cs
n=int(input())
xs = sorted(list(map(int,input().split())))[::-1]
bs, cs = xs[:1], xs[1:]
for _ in range(n):
    bs, cs = b(bs, cs)

print("Yes")

### FIXED CODE ###

import sys
def b(bs, cs):
    d = set()
    bl, cl = len(bs), len(cs)
    bi, ci = 0, 0
    ncs = []
    while True:
      if bs[bi] > cs[ci]:
        bs.append(cs[ci])
        bi += 1
      else:
        ncs.append(cs[ci])
      ci += 1
      if bi == bl or ci == cl:
        break
    if len(bs) != 2 * bl:
      print("No")
      sys.exit()
    return bs, ncs + cs[ci:]

n=int(input())
xs = sorted(list(map(int,input().split())))[::-1]
bs, cs = xs[:1], xs[1:]
for _ in range(n):
    bs, cs = b(sorted(bs)[::-1], cs)

print("Yes")
### BUGGY CODE ###

n = int(input())
x = input()

def popcount(ni):
    n_b = str(bin(ni))
    return n_b.count("1")

def ans(n,x):
    x_i = int(x, 2)
    x_orig = popcount(x_i)
    solve = 0
    for i in range(n):
        x_count = x_orig
        if x[i] == "0":
            solve = x_i+2**(n-i-1)
            x_count += 1
        else:
            solve = x_i-2**(n-i-1)
            x_count -= 1
        count = 0

        if solve != 0 :
            solve = solve % x_count
            count+=1

        while solve > 0:
            solve = solve % popcount(solve)
            count+=1

        print(count)

    
ans(n,x)

### FIXED CODE ###


n = int(input())
x = input()

def popcount(ni):
    n_b = str(bin(ni))
    return n_b.count("1")

def ans(n,x):
    x_i = int(x, 2)
    x_orig = popcount(x_i)
    x_i_t = x_i % (x_orig+1)
    if x_orig != 1:
        x_i_b = x_i % (x_orig-1)
    else:
        x_i_b = x_i
    solve = 0
    for i in range(n):
        x_count = x_orig
        if x[i] == "0":
            x_count += 1
            solve = x_i_t + pow(2,n-1-i,x_count)
        else:
            x_count -= 1
            if x_count != 0:
                solve = x_i_b - pow(2,n-1-i,x_count)
            else:
                print(0)
                continue
        count = 0

        if x_count != 0 :
            solve = solve % x_count
            count+=1

        while solve > 0:
            solve = solve % popcount(solve)
            count+=1

        print(count)

    
ans(n,x)
### BUGGY CODE ###

a,b,k = map(int,input().split())
src = [i for i in range(a,b+1)]
re = sorted(src, reverse=True)
if k > len(src):
    k = len(src)
li = []
for ki in range(k):
    li.append(src[ki])
    li.append(re[ki])
for l in sorted(set(li)):
    print(l)

### FIXED CODE ###

a,b,k = map(int,input().split())
if k > b-a+1:
    k = b-a+1
li = set()
for i in range(k):
    li.add(a+i)
    li.add(b-i)
for l in sorted(li):
    print(l)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
tmp=10**20
for i in range(1,n):
  tmp=min(tmp,abs(sum(a[:i])-sum(a[i:])))
print(tmp)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
total=sum(a)
ideal=sum(a)/2
tmp=10**20
goukei=0
for i in range(n):
  goukei+=a[i]
  if tmp>abs(ideal-goukei):
    tmp=min(tmp,abs(ideal-goukei))
  else:
    break
print(int(tmp*2))
### BUGGY CODE ###



def cal():
    number = int(input())
    str1 = input()
    strList1 = [str1]
    strList2 = [[strList1[0]]]
    for i in range(number-1):
        flag = 1
        strList1.append(list(map(str, input().rstrip().split())))
        for each in strList2:
            if each == strList1[i + 1]:
                flag = 0
                break
        if flag == 1:
            strList2.append(strList1[i+1])


    print(len(strList2))


cal()




### FIXED CODE ###



def cal():
    number = int(input())
    strList = []
    for i in range(number):
        temp = input()
        strList.append(temp)

    count = {}

    for item in strList:
        count[item] = count.get(item, 0) + 1
    print(len(count))


cal()
### BUGGY CODE ###

import sys
N = int(input())
S = list(input())
ans = []

for i in range(N):
  A = S[:i].count('W') + S[i+1:].count('E')
  if A == 0:
    print(0)
    sys.exit()
  else:
    ans.append(A)
print(min(ans))

### FIXED CODE ###

N = int(input())
S = input()
#左からスタートするとして，全てWならば0になるため
E_count = S.count('E')
W_count = 0
mini_count = E_count

for i in S:
  if i == 'E':
    #リーダーはどちらを向いていても良いので1を引く
    E_count -= 1
  else:
    #Wの場合は，今後向きを変えてもらう必要があるため
    W_count += 1
  if mini_count > E_count + W_count:
    mini_count = E_count + W_count
print(mini_count)
### BUGGY CODE ###

import sys
N, Ma, Mb = map(int, input().split())

G = []
for i in range(N):
 a, b, c = map(int, input().split())
 G.append( (a,b,c) )

M = 401
INF = 1000000000
dp = [ [ INF ] * M for _ in range(M) ]

dp[0][0] = 0
for a, b, c in G:
  for i in reversed(range(0, M)):
    for j in reversed(range(0, M)):
      if i + a < M and j + b < M:
        dp[i+a][j+b] = min(dp[i+a][j+b], dp[i][j] + c)

ans = INF
x = 1
while Ma * x < M and Mb * x < M:
  ans = min(ans, dp[Ma * x][Mb * x])
  x += 1
if ans >= INF:
  ans = -1
print(ans)


### FIXED CODE ###

N, Ma, Mb = map(int, input().split())

G = []
for i in range(N):
 a, b, c = map(int, input().split())
 G.append( (a,b,c) )

M = 1 + min(sum([ a for a, b, c in G ]),
            sum([ b for a, b, c in G ]) )
INF = 1000000000
dp = [INF] * (M * M)
dp[0] = 0
for a, b, c in G:
  i = M - a - 1
  while i >= 0:
    j = M - b - 1
    while j >= 0:
      dp[(i+a)*M+(j+b)] = min(dp[(i+a)*M+(j+b)], dp[i*M+j] + c)
      j -= 1
    i -= 1

ans = INF
x = 1
while Ma * x < M and Mb * x < M:
  ans = min(ans, dp[Ma * x * M + Mb * x])
  x += 1
if ans >= INF:
  ans = -1
print(ans)
### BUGGY CODE ###

n=int(input())
arr=input().split(" ")
arr_s=set(arr)
#print(arr)
a=0
most_e=0
most_o=0
arr_e=[0 for i in range(int(n/2))]
arr_o=[0 for i in range(int(n/2))]
for i in range(int(n/2)):
    arr_e[i]=arr[a]
    arr_o[i]=arr[a+1]
    a+=2
#print(arr_e,arr_o)
arr_es=set(arr_e)
arr_os=set(arr_o)
#print(arr_es,arr_os)

for i in arr_es:
    cnt_e=arr_e.count(i)
    if cnt_e>most_e:
        most_e=cnt_e
        if cnt_e>=(n/2-cnt_e)/2:
            break
        
for i in arr_os:
    cnt_o=arr_o.count(i)
    if cnt_o>most_o:
        most_o=cnt_o
        if cnt_o>=(n/2-cnt_o)/2:
            break

#print(most_e,most_o)
if len(arr_s)==1:
    print(int(n/2))
else:
    print(n-most_e-most_o)

### FIXED CODE ###

import collections
n=int(input())
arr=input().split(" ")
arr_s=set(arr)
a=0
arr_e=[0 for i in range(int(n/2))]
arr_o=[0 for i in range(int(n/2))]
for i in range(int(n/2)):
    arr_e[i]=arr[a]
    arr_o[i]=arr[a+1]
    a+=2
ce=collections.Counter(arr_e).most_common()
co=collections.Counter(arr_o).most_common()
if len(arr_s)==1:
    print(int(n/2))
else:
    if ce[0][0]!=co[0][0]:
        print(n-ce[0][1]-co[0][1])
    else:
        print(n-max(ce[0][1]+co[1][1],ce[1][1]+co[0][1]))