Harryxun/stf_run huggingface dataset:
# UnionFind構造

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
        

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)
    
n, m = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(n)]

count = 0
for i in range(len(lst)):
    llst = lst[:]
    del llst[i]
    a = UnionFind(n)
    for i in llst:
        a.union(i[0], i[1])
    rootset = set()
    for i in range(1, n):
        rootset.add(a.find(i))
    if len(rootset)==1:
        pass
    else:
        count += 1
        
print(count)

### FIXED CODE ###

# UnionFind構造

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
        

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)
    
n, m = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(m)]

count = 0
for i in range(len(lst)):
    llst = lst[:]
    del llst[i]
    a = UnionFind(n)
    for i in llst:
        a.union(i[0], i[1])
    rootset = set()
    for i in range(1, n+1):
        rootset.add(a.find(i))
    if len(rootset)==1:
        pass
    else:
        count += 1
        
print(count)
N, M = map(int, input().split())
islands = [map(int, input().split()) for _ in range(M)]
islands.sort()

cnt = 0
last = -float('inf')
for left, right in islands:
    if last <= left:
        cnt += 1
        last = right

print(cnt)


### FIXED CODE ###

N, M = map(int, input().split())
islands = [tuple(map(int, input().split())) for _ in range(M)]
islands.sort()

cnt = 0
l = 1
r = N
for left, right in islands:
    if r <= left:
        cnt += 1
        l = left
        r = right
    else:
        l = max(l, left)
        r = min(r, right)

print(cnt+1)
print(int(input) ** 3)

### FIXED CODE ###

print(int(input()) ** 3)
W, a, b = map(int, input().split())

if a + W < b:
    print(b - a - W)
elif a + W = b:
    print(0)
elif (b < a + W) & (a < b):
    print(0)
elif a == b:
    print(0)
elif b + W <= a:
    print(a - b - W)
else:
    pass


### FIXED CODE ###

a, b = map(str, input().split())

if a == b:
    print("H")
elif not a == b:
    print("D")
x, y = input().split()
s = [input() for i in range(x)]
t = [input() for i in range(y)]
p = 0
for i in range(len(s)):
  if sqrt(s[i]*s[i] + t[i]*t[i]) > y:
    p += 1

print(p)

### FIXED CODE ###

import numpy as np
 
N, D = input().strip().split() #1行目のNを取得する
grid = []
for i in range(int(N)):
    array = list(map(int, input().strip().split()))
    grid.append(array)
grid = np.array(grid)
p = 0
for i in range(int(N)):
  if np.sqrt(grid[i,0]*grid[i,0] + grid[i,1]*grid[i,1]) <= int(D):
    p += 1
print(p)
import sys
sys.setrecursionlimit(2000)
s=input()
n=len(s)
def mod10(x):
    p=x//100
    q=x%100
    if p==0:
        return (10**q)%2019
    return (mod10(q)+mod10(p))%2019


def T(i):
    if i==n-1:
        return int(s[n-1])
    return T(i+1)+10**(n-1-i)*int(s[i])
dict={}
def modi(i,dict):
    if i in dict.keys():
        return dict[i]
    else:
        if i==n-1:
            dict[i]=int(s[i])
            return int(s[i])
        else:
            c=modi(i+1,dict)+(10**(n-1-i)*int(s[i]))
            #c=modi(i+1,dict)+(mod10(n-1-i)*int(s[i]))
            c=c%2019
            dict[i]=c
            return c

modnum={}
for i in range(n):
    #print(T(i))
    if int(s[i])==0:
        continue
    x=modi(i,dict)
 #   print(T(i),x)
    if x not in modnum.keys():
        modnum[x]=1
    else:
        modnum[x]+=1
sum=0
for md in modnum.keys():
    a=modnum[md]
    if md==0:
        sum+=a
        sum+=-(a*(a-1)//2)
   # print(a*(a-1)//2)
    sum+=a*(a-1)//2
#print(modnum)
print(sum)

### FIXED CODE ###

import sys
import collections as coun
sys.setrecursionlimit(10000000)
s=input()
n=len(s)
def mod10(x):
    return (10**(x%224))%2019
dp=[-1]*n
tmp=0
for i in reversed(range(n)):
    if i==n-1:
        dp[i]=int(s[i])
    else:
        dp[i]=(dp[i+1]+int(s[i])*pow(10,n-1-i,2019))%2019

#print(dp)
p=-1
for i in range(len(dp)-1):
    if dp[i]==dp[i+1]:
        dp[i]=p
        p=p-1

#print(dp)

c=coun.Counter(dp)
sum=0
for v in c.values():
    sum+=v*(v-1)//2
#print(sum)
for i in dp:
    if i==0:
        sum+=1
#print(sum)
if dp[-1]==0:
    sum=sum-1
print(sum)
import sys
sys.setrecursionlimit=10**12

def modinv(a,m=10**9+7):
    if a==0: return 1
    else:
        b=m
        (x, lastx) = (0, 1)
        (y, lasty) = (1, 0)
        while b != 0:
            q = a // b
            (a, b) = (b, a % b)
            (x, lastx) = (lastx - q * x, x)
            (y, lasty) = (lasty - q * y, y)
        return lastx % m

def cur(p):
    for x in neighbor[p]:
        par[x]=p
        neighbor[x].remove(p)
        descend[p]+=cur(x)
    return descend[p]

def cur2(p):
    for x in neighbor[p]:
        ans[x]=ans[p]*descend[x]*modinv(n-descend[x])
        ans[x]%=mod
        cur2(x)

mod=10**9+7
n=int(input())
neighbor=[set()  for _ in range(n+1)]
descend=[1]*(n+1)
par=[-1]+[0]*n

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].add(b)
    neighbor[b].add(a)
cur(1)


ans=[1]*(n+1)
ans1=1
for i in range(1,n+1):
    ans1=ans1*i*modinv(descend[i])
    ans1%=mod
ans[1]=ans1

cur2(1)

for i in range(1,n+1):
    print(ans[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

def modinv(a,m=10**9+7):
    if a==0: return 1
    else:
        b=m
        (x, lastx) = (0, 1)
        (y, lasty) = (1, 0)
        while b != 0:
            q = a // b
            (a, b) = (b, a % b)
            (x, lastx) = (lastx - q * x, x)
            (y, lasty) = (lasty - q * y, y)
        return lastx % m

def cur(p):
    if neighbor[p]==[]: return
    for x in neighbor[p]:
        par[x]=p
        neighbor[x].remove(p)
        cur(x)
    descend[par[p]]+=descend[p]

def cur2(p):
    for x in neighbor[p]:
        ans[x]=ans[p]*descend[x]*modinv(n-descend[x])
        ans[x]%=mod
        cur2(x)

mod=10**9+7
n=int(input())
neighbor=[set()  for _ in range(n+2)]
descend=[1 for i in range(n+1)]
par=[0]+[0]*(n+1)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].add(b)
    neighbor[b].add(a)

cur(1)


ans=[1]*(n+1)
ans1=1
for i in range(1,n+1):
    ans1=ans1*i*modinv(descend[i])
    ans1%=mod
ans[1]=ans1

cur2(1)

for i in range(1,n+1):
    print(ans[i])
A,B = list(map(int, input().split()))
print(int(A*B))

### FIXED CODE ###

from decimal import *
A,B = list(map(Decimal, input().split()))
print(int(A*B))
#鬼
a,v=map(int,input().split())

#逃げている
b,w=map(int,input().split())

#t秒以内
t=int(input())

if v>w:
    abs(a-b)>=v*w*t:
    print("YES")
    exit()
else:
    print("NO")

### FIXED CODE ###

#鬼
a,v=map(int,input().split())

#逃げている
b,w=map(int,input().split())

#t秒以内
t=int(input())

if v>w:
    if abs(a-b)<=(v-w)*t:
        print("YES")
        exit()

print("NO")
N=int(input())
Ai = list(map(int,input().split()))
Bi = list(map(int,input().split()))
Ci = list(map(int,input().split()))

ans ~ sum(Bi)

for i in range(N-1):
  if Ai[i] + 1 == Ai[i+1]:
    ans += Ci[Ai[i]-1]

print(ans)

### FIXED CODE ###

N=int(input())
Ai = list(map(int,input().split()))
Bi = list(map(int,input().split()))
Ci = list(map(int,input().split()))

ans = sum(Bi)

for i in range(N-1):
  if Ai[i] + 1 == Ai[i+1]:
    ans += Ci[Ai[i]-1]

print(ans)
import math
temp = 100
year = 0
while temp < X:
    temp = int(math.floor(temp*1.01))
    year += 1
print(year)

### FIXED CODE ###

X = int(input())
import math
temp = 100
year = 0
while temp < X:
    temp = int(math.floor(temp*1.01))
    year += 1
print(year)
a,b=map(int, input().split())
if a%3 == 0 or b%3 == 0 or sum(a,b)%3== 0:
  print("Possible")
else:
  print("Impossible")

### FIXED CODE ###

a,b=map(int, input().split())
if ((a%3 == 0) or (b%3 == 0)) or ((a + b)%3== 0):
  print("Possible")
else:
  print("Impossible")
d=[0,1,0,2,0,2,0,0,2,0,2,0]
a,b=map(int,input().split())
if d[a]==d[b]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

d=[0,0,1,0,2,0,2,0,0,2,0,2,0]
a,b=map(int,input().split())
if d[a]==d[b]:
  print("Yes")
else:
  print("No")
def add_to_subtree(tree, result_arr, idx, value):
  result_arr[idx] += value
  if len(tree[idx]) == 0:
    return
  for child in tree[idx]:
    add_to_subtree(tree, result_arr, child, value)

N, Q = map(int, input().split())
R = [0] * (N + 1)
T = [[] for _ in range(N + 1)]

for _ in range(N-1):
  a, b = sorted(map(int, input().split()))
  T[a].append(b)
for _ in range(Q):
  P, X = map(int, input().split())
  add_to_subtree(T, R, P, X)

print(*R[1:])


### FIXED CODE ###

import collections
N, Q = map(int, input().split())
counts = [0] * (N + 1)
T = [[] for _ in range(N + 1)]
for _ in range(N-1):
  a, b = map(int, input().split())
  T[a].append(b)
  T[b].append(a)
for _ in range(Q):
  p, x = map(int, input().split())
  counts[p] += x
visited = [0] * (N + 1)
queue = collections.deque()
queue.append(1)
while queue:
  v = queue.pop()
  visited[v] = 1
  x = counts[v]
  for child in T[v]:
    if visited[child] == 1:
      continue
    counts[child] += x
    queue.append(child)
print(*counts[1:])
from itertools import accumulate
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
acc = list(accumulate(a))

def maxsum(ls,k):
  l = len(ls)
  dp = [0 for i in range(l+1)]
  dp[0] = 1
  for i in range(1,l+1):
    dp[i] = dp[i-1]|(dp[i-1]<<ls[i-1])
  for b in range(k-1,-1,-1):
    if dp[-1] & 1<<b:
      return b

for i in range(n):
  if a[i]>=k:
    a = a[:i]
    break
n = len(a)
if acc[n-1] < k:
  print(n)
  exit()
sepa=[]
for i in range(n-1):
  if acc[i]<a[i+1]:
    sepa.append(i)
m=len(sepa)
l = 0
r = m-1
while l<r:
  mid = (l+r)//2
  x=sepa[mid]
  sumx = acc[x]
  if x < n-1:
    if maxsum(a[x+1:],k)+sumx >= k:
      r = mid
    else:
      l = mid+1
  else:
    r -= 1
print(sepa[r]+1)

### FIXED CODE ###

from itertools import accumulate
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
acc = list(accumulate(a))

def maxsum(ls,k):
  l = len(ls)
  if l==0:
    return 0
  dp = [0 for i in range(l+1)]
  dp[0] = 1
  for i in range(1,l+1):
    dp[i] = (dp[i-1]|(dp[i-1]<<ls[i-1]))&((1<<k)-1)
  for b in range(k-1,-1,-1):
    if dp[l] & 1<<b:
      return b

for i in range(n):
  if a[i]>=k:
    a = a[:i]
    break
n = len(a)
if acc[n-1] < k:
  print(n)
  exit()
sepa=[]
for i in range(n-1):
  if acc[i]<a[i+1]:
    sepa.append(i)
m=len(sepa)
if m==0:
  print(0)
  exit()
lf = 0
r = m-1
while lf<r:
  mid = (lf+r)//2
  x=sepa[mid]
  sumx = acc[x]
  if maxsum(a[x+1:],k)+sumx >= k:
    r = mid
  else:
    lf = mid+1
if r==0:
  t=sepa[0]
  if maxsum(a[t+1:],k)+acc[t]>=k:
    print(0)
  else:
    print(sepa[r]+1)
else:
  print(sepa[r]+1)
import sys

nums = map(int, sys.stdin.readline().strip().split())

print " ".join(sorted(nums, reverse=True))

### FIXED CODE ###

import sys

nums = map(int, sys.stdin.readline().strip().split())

print " ".join(map(str,sorted(nums)))
*a = map(input().split())
print(max(a)-min(a))

### FIXED CODE ###

*a, = map(int,input().split())
print(max(a)-min(a))
n = int(input())
l = list(map(int, input().split()))

sum = 0
for i in range(n):
    sum += l[i]

print(min(list), max(list), sum)


### FIXED CODE ###

#
# 4d
#


def main():
    n = int(input())
    a = list(map(int, input().split()))
    print(f"{min(a)} {max(a)} {sum(a)}")


if __name__ == '__main__':
    main()
a = raw_input(). split()
S = a[0] * a[1]
O = 2 * a[0] + 2 * a[1]

print S , O

### FIXED CODE ###

a , b= map(int,raw_input(). split())
S = a * b
O = 2 * a + 2 * b

print str(S) + ' ' +  str(O)
N, P = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
odd = [ tmp for tmp in a if tmp%2 != 0]
even = [ tmp for tmp in a if tmp%2 == 0]
if P == 0:
    ans += 1
    b = sum([ len(list(itertools.combinations(odd,tmp))) for tmp in range(2, len(odd)+1, 2) ])
else:
    b = sum([ len(list(itertools.combinations(odd,tmp))) for tmp in range(1, len(odd)+1, 2) ])
c = [ len(list(itertools.combinations(even, tmp))) for tmp in range(1, len(even)+1) ]
factor = 0
for tmp in c:
    ans += tmp*b
    factor += tmp
else:
    if P == 0:
        ans += b+factor
    else:
        ans += b
print(ans)

### FIXED CODE ###

# -*- coding:utf-8 -*-
import itertools, math
N, P = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
odd = [ tmp for tmp in a if tmp%2 != 0]
even = [ tmp for tmp in a if tmp%2 == 0]
d = math.factorial(len(odd))
e = math.factorial(len(even))
if P == 0:
    ans += 1
    b = sum([ (d//math.factorial(len(odd)-tmp))//math.factorial(tmp) for tmp in range(2, len(odd)+1, 2) ])
else:
    b = sum([ (d//math.factorial(len(odd)-tmp))//math.factorial(tmp) for tmp in range(1, len(odd)+1, 2) ])
c = [ (e//math.factorial(len(even)-tmp))//math.factorial(tmp) for tmp in range(1, len(even)+1) ]
for tmp in c:
    ans += tmp*b
else:
    if P == 0:
        ans += b+sum(c)
    else:
        ans += b
print(ans)
import numpy as np
 
n = input()
v = np.array([int(x) for x in input().split()])
c = np.array([int(x) for x in input().split()])
 
profit = v - c
positive_profit = profit(profit > 0)
print(np.sum(positive_profit))

### FIXED CODE ###

import numpy as np
 
n = input()
v = np.array([int(x) for x in input().split()])
c = np.array([int(x) for x in input().split()])
 
profit = v - c
positive_profit = profit[profit > 0]
print(np.sum(positive_profit))
def main():
	n,m,q = map(int,input().split())
	qu = [list(map(int,input().split())) for x in range(q)]
	ans = 0
	import itertools

	ans_list = set()
	for i in itertools.combinations_with_replacement([1,2,3,4,5,6,7,8,9,10],m):
		if list(i) == sorted(i):
			for qul in range(q):
				if i[ qu[qul][1]-1 ] - i[ qu[qul][0]-1 ] == qu[qul][2]:
					ans += qu[qul][3]
			ans_list.add(ans)
			ans = 0
	print(max(ans_list))

if __name__ == '__main__':
	main()

### FIXED CODE ###

def main():
	n,m,q = map(int,input().split())
	qu = [list(map(int,input().split())) for x in range(q)]
	ans = 0
	import itertools

	ans_list = set()
	for i in itertools.combinations_with_replacement(list(range(1,m+1)),n):
		for qul in range(q):
			if i[ qu[qul][1]-1 ] - i[ qu[qul][0]-1 ] == qu[qul][2]:
				ans += qu[qul][3]
		ans_list.add(ans)
		ans = 0
	print(max(ans_list))

if __name__ == '__main__':
	main()
N = int(input())
a = list(map(int, input().split()))
gray = 0
brown = 0
green = 0
sky = 0
blue = 0
yellow = 0
orange = 0
red = 0
god = 0
for i in range(N-1):
    if a[i] < 400:
        gray = True
    elif a[i] < 800:
        brown = True
    elif a[i] < 1200:
        green = True
    elif a[i] < 1600:
        sky = True
    elif a[i] < 2000:
        blue = True
    elif a[i] < 2400:
        yellow = True
    elif a[i] < 2800:
        orange = True
    elif a[i] < 3200:
        red = True
    else:
        god+=1
if god > 0:
    color_max = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red) + god + 1
    color_min = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red) + 1
else:
    color_max = int(gray) + int(brown) + int(green) + int(sky) + int(blue) + int(yellow) + int(orange) + int(red)
    color_min = color_max
if color_max>8
    print(color_min, 8)
else:
    print(color_min, color_max)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
gray = 0
brown = 0
green = 0
sky = 0
blue = 0
yellow = 0
orange = 0
red = 0
god = 0
for i in range(N):
    if a[i] < 400:
        gray = 1
    elif a[i] < 800:
        brown = 1
    elif a[i] < 1200:
        green = 1
    elif a[i] < 1600:
        sky = 1
    elif a[i] < 2000:
        blue = 1
    elif a[i] < 2400:
        yellow = 1
    elif a[i] < 2800:
        orange = 1
    elif a[i] < 3200:
        red = 1
    else:
        god+=1
zako = gray + brown + green + sky + blue + yellow + orange + red
if god > 0 and zako == 0:
    color_max = god
    color_min = 1
elif god > 0 and zako != 0:
    color_max = zako + god
    color_min = zako
else:
    color_max = zako
    color_min = zako
print(color_min, color_max)
a, b = [float(s) for s in input().split(" ")]
a = int(a)
b = round(b*100)
print(a*b//100))

### FIXED CODE ###

a, b = [float(s) for s in input().split(" ")]
a = int(a)
b = round(b*100)
print(a*b//100)
N, W = map(int, input().split())
wv = [list(map(int, input().split())) for i in range(N)]
dp = {0: 0}
for i in range(N):
    for j in sorted(dp.keys(), reverse=True):
        w, v = wv[i][0], wv[i][1]
        nw = dp[j] + w
        nv = j + v
        if nw <= W:
            if nv in dp:
                dp[nv] = nw
        else:
            dp[nv] = nw
            
print(max(dp.key()))

### FIXED CODE ###

N, W = map(int, input().split())
wv = [list(map(int, input().split())) for i in range(N)]
dp = {0: 0}
for i in range(N):
    for j in sorted(dp.keys(), reverse=True):
        w, v = wv[i][0], wv[i][1]
        nw = dp[j] + w
        nv = j + v
        if nw <= W:
            if nv in dp:
                if nw < dp[nv]:
                    dp[nv] = nw
            else:
                dp[nv] = nw


print(max(dp.keys()))
class MyStack:
    def __init__(self, size):
        self.stack = [0 for i in range(size)]
        self.size = size
        self.top = 0

    def initialize(self):
        self.top = 0

    def push(self, elm):
        self.top += 1
        self.stack[self.top] = elm
        return self.stack

    def pop(self):
        ret = self.stack[self.top]
        self.stack[self.top] = 0
        self.top -= 1
        return ret

    def is_empth(self):
        if not self.is_full():
            return True
        return False

    def is_full(self):
        if self.size-1 is self.top:
            return True
        return False


def main(expr):
    stack = MyStack(100)
    for i, elm in enumerate(expr):
        if expr[i] is '+':
            a = stack.pop()
            b = stack.pop()
            stack.push(int(a) + int(b))
        elif expr[i] is '-':
            a = stack.pop()
            b = stack.pop()
            stack.push(int(b) - int(a))
        elif expr[i] is '*':
            a = stack.pop()
            b = stack.pop()
            stack.push(int(a) * int(b))
        else:
            stack.push(elm)
    return stack.pop()


if __name__ == '__main__':
    expr = [str(s) for s in input().split()]
    print(main(expr))

### FIXED CODE ###

class MyStack:
    def __init__(self, size):
        self.stack = [0 for i in range(size)]
        self.size = size
        self.top = 0

    def initialize(self):
        self.top = 0

    def push(self, elm):
        self.top += 1
        self.stack[self.top] = elm
        return self.stack

    def pop(self):
        ret = self.stack[self.top]
        self.stack[self.top] = 0
        self.top -= 1
        return ret

    def is_empth(self):
        if not self.is_full():
            return True
        return False

    def is_full(self):
        if self.size-1 is self.top:
            return True
        return False


def main(expr):
    stack = MyStack(1000)
    for i, elm in enumerate(expr):
        if expr[i] is '+':
            a = stack.pop()
            b = stack.pop()
            stack.push(int(a) + int(b))
        elif expr[i] is '-':
            a = stack.pop()
            b = stack.pop()
            stack.push(int(b) - int(a))
        elif expr[i] is '*':
            a = stack.pop()
            b = stack.pop()
            stack.push(int(a) * int(b))
        else:
            stack.push(elm)
    return stack.pop()


if __name__ == '__main__':
    expr = [str(s) for s in input().split()]
    print(main(expr))
n = int(input())
v = list(map(int,input().split()))

if max(v)==min(v):
	print(int(n/2))
else:
	dic1 = {}
	dic2 = {}
	
	for i in range(n):
		if i % 2 == 1:
			if str(v[i]) in dic1.keys():
				dic1[str(v[i])] = dic1[str(v[i])] + 1
			else:
				dic1[str(v[i])] = 1
	
		if i % 2 == 0:
			if str(v[i]) in dic2.keys():
				dic2[str(v[i])] = dic2[str(v[i])] + 1
			else:
				dic2[str(v[i])] = 1
	
	max1 = max(dic1, key=dic1.get)
	max2 = max(dic2, key=dic2.get)
	p1 = dic1[max1]
	p2 = dic2[max2]
	if max1 == max2:
		dic1.pop(max1)
		dic2.pop(max2)
		if dic1 == {}:
			p3 = 0
		else:
			max3 = max(dic1, key=dic1.get)
			p3 = dict[max3]
		if dic2 == {}:
			p4 = 0
		else:
			max4 = max(dic2, key=dic2.get)
			p4 = dic4[max4]
		if p1 + p4 > p2 + p3:
			p2 = p4
		else:
			p1 = p3
	
	print(n-p1-p2)

### FIXED CODE ###

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

if max(v)==min(v):
	print(int(n/2))
else:
	dic1 = {}
	dic2 = {}
	
	for i in range(n):
		if i % 2 == 1:
			if str(v[i]) in dic1.keys():
				dic1[str(v[i])] = dic1[str(v[i])] + 1
			else:
				dic1[str(v[i])] = 1
	
		if i % 2 == 0:
			if str(v[i]) in dic2.keys():
				dic2[str(v[i])] = dic2[str(v[i])] + 1
			else:
				dic2[str(v[i])] = 1
	
	max1 = max(dic1, key=dic1.get)
	max2 = max(dic2, key=dic2.get)
	p1 = dic1[max1]
	p2 = dic2[max2]
	if max1 == max2:
		dic1.pop(max1)
		dic2.pop(max2)
		if dic1 == {}:
			p3 = 0
		else:
			max3 = max(dic1, key=dic1.get)
			p3 = dic1[max3]
		if dic2 == {}:
			p4 = 0
		else:
			max4 = max(dic2, key=dic2.get)
			p4 = dic2[max4]
		if p1 + p4 > p2 + p3:
			p2 = p4
		else:
			p1 = p3
	
	print(n-p1-p2)
n, m, k = map(int, input().split())

fr = [[] for _ in range(n)]
bl = [[] for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    fr[a-1].append(b-1)
    fr[b-1].append(a-1)
    
for i in range(k):
    c ,d = map(int, input().split())
    bl[c-1].append(d-1)
    bl[d-1].append(c-1)
    

def connectedcomponents():
    visited = []
    cc = []
    for i in range(n):
        visited.append(False)
    for v in range(n):
        if visited[v] == False:
            temp = []
            cc.append(dfs(fr,v,temp,visited))
    return cc
            

def dfs(fr, v, temp, visited):
    visited[v] = True
    temp.append(v)
    for i in fr[v]:
        if visited[i] == False:
            temp = dfs(fr, i, temp, visited)
    return temp

cc = connectedcomponents()

ans = []
for i in range(n):
    for component in cc:
        if i in component:
            re1 = [item for item in component if item not in fr[i]]
            re2 = [item for item in re1 if item not in bl[i]]
            ans.append(len(re2)-1)
print(*ans)

### FIXED CODE ###


from sys import setrecursionlimit 
setrecursionlimit(10**6)

n, m, k = map(int, input().split())

fr = [set() for _ in range(n)]
bl = [set() for _ in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    fr[a-1].add(b-1)
    fr[b-1].add(a-1)
    
for i in range(k):
    c ,d = map(int, input().split())
    bl[c-1].add(d-1)
    bl[d-1].add(c-1)
    

def connectedcomponents():
    visited = []
    cc = [0]*n
    for i in range(n):
        visited.append(False)
    for v in range(n):
        if visited[v] == False:
            temp = set()
            for i in dfs(fr,v,temp,visited):
                cc[i] = dfs(fr,v,temp,visited)
    return cc
            

def dfs(fr, v, temp, visited):
    visited[v] = True
    temp.add(v)
    for i in fr[v]:
        if visited[i] == False:
            temp = dfs(fr, i, temp, visited)
    return temp

cc = connectedcomponents()

ans = []
for i in range(n):
    aa = len(cc[i]) - len(cc[i] & fr[i]) - len(cc[i] & bl[i]) - 1
    ans.append(aa)
print(*ans)