Harryxun/stf_run huggingface dataset:
import collections

n = int(input())
v = list(map(int, input().split()))
odd, even = [], []

for i in range(n):
  if i % 2 == 0:
    even.append(v[i])
  else:
    odd.append(v[i])

    
codd = collections.Counter(odd)
ceven = collections.Counter(even)
mostodd = codd.most_common()[0]
mosteven = ceven.most_common()[0]

if mostodd[0] != mosteven[0]:
  ans = n - mostodd[1] - mosteven[1]
else:
  if mostodd[1] >= mosteven[1]:
    if len(ceven.most_common()) > 1:
      even2nd = ceven.most_common()[1] 
    else:
      even2nd = 0
    ans = n - mostodd[1] - even2nd
  else:
    if len(codd.most_common()) > 1:
      odd2nd = codd.most_common()[1] 
    else:
      odd2nd = 0
    ans = n - odd2nd - mosteven[1] 
print(ans)
    

### FIXED CODE ###

import collections

n = int(input())
v = list(map(int, input().split()))
odd, even = [], []

for i in range(n):
  if i % 2 == 0:
    even.append(v[i])
  else:
    odd.append(v[i])

    
codd = collections.Counter(odd)
ceven = collections.Counter(even)
mostodd = codd.most_common()[0]
mosteven = ceven.most_common()[0]

if mostodd[0] != mosteven[0]:
  ans = n - mostodd[1] - mosteven[1]
else:
  if len(ceven.most_common()) > 1:
    even2nd = ceven.most_common()[1][1]
  else:
    even2nd = 0
  ans1 = n - mostodd[1] - even2nd
  if len(codd.most_common()) > 1:
    odd2nd = codd.most_common()[1][1]
  else:
    odd2nd = 0
  ans2 = n - odd2nd - mosteven[1] 
  ans = min(ans1, ans2)
print(ans)
import sys
input = sys.stdin.readline

n,u,v = ( int(x) for x in input().split() )

u,v = u-1,v-1

# -1なら行先なし
a = [[] for i in range(n)]
b = [[] for i in range(n)]

for i in range(n-1):
	# 配列indexは0開始だからinputは-1
	l,m = ( int(x)-1 for x in input().split() )
	a[l].append(m)
	a[m].append(l)

# G:graph, cr:current node, seen:pathed or not, dist:out;each distance
def distance(G,cr,seen,dist):
	seen[cr] = 1
	for i in G[cr]: #G[cr]から行ける各頂点へ
		if seen[i] == 0:# or dist[i] > dist[cr]+1: #まだ通っていなかったら
			dist[i] = dist[cr]+1
			distance(G,i,seen,dist)

# 欲しいのはdist of u-v, back way of u
# u視点のdistを調べる
dist_v = [0]*(n)
distance(a,v,[0]*(n),dist_v)
# v視点のdistを調べる
dist_u = [0]*(n)
distance(a,u,[0]*(n),dist_u)

for i in range(n):
	if dist_u[i] >= dist_v[i]:
		dist_u[i] = -1

tmp = max(dist_u)
max_idx = dist_u.index(tmp)

print(dist_v[max_idx] - 1)

### FIXED CODE ###

import sys
input = sys.stdin.readline

# 再帰上限を引き上げる
sys.setrecursionlimit(10**6)

# G:graph, cr:current node, seen:is seen?, dist:out;each distance
def dfs(G,cr,seen,dist):
	seen[cr] = 1
	for i in G[cr]: #G[cr]から行ける各頂点へ
		if seen[i] == 0: #まだ通っていなかったら
			dist[i] = dist[cr]+1
			dfs(G,i,seen,dist)


n,u,v = (int(x) for x in input().split())

u,v = u-1,v-1

a = [[] for i in range(n)]

for i in range(n-1):
	# 配列indexは0開始だからinputは-1
	l,m = (int(x)-1 for x in input().split())
	a[l].append(m)
	a[m].append(l)

# v視点のdistを調べる
dist_u = [0]*n
dist_v = [0]*n

dfs(a,u,[0]*n,dist_u)
# u視点のdistを調べる
dfs(a,v,[0]*n,dist_v)

for i in range(n):
	if dist_u[i] >= dist_v[i]: # vが追いつける距離なら
		dist_v[i] = -1

print(max(dist_v) - 1)
N = input()
H = list(map(int,input().split()))
dp=[0 for i in range(H+1)]
dp[0]=0
dp[1]=abs(H[0-H[1]])
for i in range(2,N):
    dp[i+1] +=min(dp[i]+abs(H[i]-H[i+1]),dp[i-1]+abs(H[i-1]-H[i+1]))
    return dp[N]
print(dp[N])

### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))
dp=[0]*N
dp[0]=0
dp[1]=abs(H[0]-H[1])
for i in range(1,int(N)-1,1):
    dp[i+1] +=min(dp[i]+abs(H[i]-H[i+1]),dp[i-1]+abs(H[i-1]-H[i+1]))
print(dp[N-1])
n = int(input())
vn = list(map(int, input().split())).sort()

sumV = vn[0]

for v in vn[1:]:
    sumV = (sumV + v)/2
print(sumV)

### FIXED CODE ###

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

vn.sort()
sumV = vn[0]

for v in vn[1:]:
    sumV = (sumV + v)/2
print(sumV)
from math import factorial

mod = 10**9 + 7

# 組み合わせ　n_C_r
def comb(n,r):
    return factorial(n) // (factorial(n-r)*factorial(r))

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

def cal(i):
    return comb(K-1,i-1) * comb(N-K+1,i) % mod

for i in range(1,K+1):
    ans = cal(i)
    print(ans)

### FIXED CODE ###

from math import factorial

mod = 10**9 + 7

# 組み合わせ　n_C_r
def comb(n,r):
    if not n >= r:
        return 0
    return factorial(n) // (factorial(n-r)*factorial(r))

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

def cal(i):
    return comb(K-1,i-1) * comb(N-K+1,i) % mod

for i in range(1,K+1):
    ans = cal(i)
    print(ans)
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

cnt = 0
for t in T:
	if s in S:
		cnt += 1

print(cnt)


### FIXED CODE ###

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

cnt = 0
for t in T:
	if t in S:
		cnt += 1

print(cnt)
H, W = map(int, input().split())
l = [input() for _ in range(H)]
check = [([0] * (W)) for _ in range(H)]
white = 0
for i in range(H):
    white += l[i].count(".")
q = collections.deque()
check[0][0] = 1
q.append([0, 0])
g = False
while q:
    h, w = q.popleft()
    for i, j in ([0, 1], [0, -1], [1, 0], [-1, 0]):
        new_h = h + i
        new_w = w + j
        if new_w < 0 or new_h < 0 or new_w > W-1 or new_h > H-1 or l[new_h][new_w] == "#":
            continue
        elif check[new_h][new_w] == 0:
            check[new_h][new_w] = check[h][w] + 1
            q.append([new_h, new_w])
print(white - check[H-1][W-1] if check[H-1][W-1] != -1 else -1)

### FIXED CODE ###

import collections
H, W = map(int, input().split())
l = [input() for _ in range(H)]
check = [([0] * (W)) for _ in range(H)]
white = 0
for i in range(H):
    white += l[i].count(".")
q = collections.deque()
check[0][0] = 1
q.append([0, 0])
g = False
while q:
    h, w = q.popleft()
    for i, j in ([0, 1], [0, -1], [1, 0], [-1, 0]):
        new_h = h + i
        new_w = w + j
        if new_w < 0 or new_h < 0 or new_w > W-1 or new_h > H-1 or l[new_h][new_w] == "#":
            continue
        elif check[new_h][new_w] == 0:
            check[new_h][new_w] = check[h][w] + 1
            q.append([new_h, new_w])
print(white - check[H-1][W-1] if check[H-1][W-1] != 0 else -1)
N, A, B = map(int, input().split())
set_bule = N//(A+B) * A
other = N - N//(A+B) * (A+B)
if 0 <= other <= A:
    hashi_ bule = other
else :
    hashi_bule = A
print(set_bule + hashi_bule)

### FIXED CODE ###

N, A, B = map(int, input().split())
set_bule = N//(A+B) * A
other = N - N//(A+B) * (A+B)
hashi_bule=0
if 0 <= other <= A:
    hashi_bule = other
else :
    hashi_bule = A
print(set_bule + hashi_bule)
A, B, C, D = map(int, input())

if (A+B) > (C+D):
    print("Left")
elif (A+B) < (C+D):
    print("Right")
else:
    print("Balanced")

### FIXED CODE ###

A, B, C, D = map(int, input().split())

if (A+B) > (C+D):
    print("Left")
elif (A+B) < (C+D):
    print("Right")
else:
    print("Balanced")
import sys
input = sys.stdin.readline
n = int(input())
information = [list(map(int, input().split())) for _ in range(n)]
information.sort(key=lambda x: x[2])


def calc(p, w):
    c_x, c_y = p
    x, y, h = w
    if h > 0:
        return h + abs(x-c_x) + abs(y-c_y)


def check(H, p, w):
    c_x, c_y = p
    x, y, h = w
    if h == max(0, H - abs(x - c_x) - abs(y - c_y)):
        return True
    else:
        return False


for i in range(101):
    for j in range(101):
        p = (i, j)
        H = calc(p, information[-1])
        judge = 1
        for w in information[:-1]:
            if check(H, p, w):
                continue
            else:
                judge -= 1
                break
        if judge:
            print(*p, H)
            sys.exit()



### FIXED CODE ###

import sys
input = sys.stdin.readline
n = int(input())
information = [list(map(int, input().split())) for _ in range(n)]
information.sort(key=lambda x: x[2])

for c_x in range(101):
    for c_y in range(101):
        x, y, h = information[-1]
        H = h + abs(x - c_x) + abs(y - c_y)
        judge = 1
        for w in information[:-1]:
            x, y, h = w
            if h == max(0, H - abs(x - c_x) - abs(y - c_y)):
                continue
            else:
                judge -= 1
                break
        if judge:
            print(c_x, c_y, H)
            sys.exit()
        else:
            continue
N,M = map(int,input().split())
A = sorted(list(map(int,input().split())),reverse=True)
bi = [0]*(A[0]+1)
for a in A:
  bi[a]+=1
  
cum = [0]*(A[0]+1)
for i in range(1,A[0]+1):
  cum[i]=cum[i-1]+bi[i]

cum_max=cum[-1]
left = 0
right = A[0]*2
while right-1!=left:
  x = (right+left)//2
  num = 0
  for a in A:
    b = max(x-a,1)
    if b<=A[0]:
      num += cum_max-cum[b-1]
    
  if num>M:
    left=x
  else:
    right=x
ans = 0
cum_A = [0]*(N+1)
for i in range(1,N+1):
  cum_A[i]=cum_A[i-1]+A[i-1]
for a in A:
  b = max(left-a,1)
  c = cum_max-cum[b-1]
  M-=c
  ans+=(a*c)+cum_A[c]
  
ans+=(M*left)
print(ans)

### FIXED CODE ###

N,M = map(int,input().split())
A = sorted(list(map(int,input().split())),reverse=True)
bi = [0]*(A[0]+1)
for a in A:
  bi[a]+=1
  
cum = [0]*(A[0]+1)
for i in range(1,A[0]+1):
  cum[i]=cum[i-1]+bi[i]

cum_max=cum[-1]
left = 0
right = A[0]*2+1
while right-1!=left:
  x = (right+left)//2
  num = 0
  for a in A:
    b = max(x-a,1)
    if b<=A[0]:
      num += cum_max-cum[b-1]
    
  if num>=M:
    left=x
  else:
    right=x

ans = 0
cum_A = [0]*(N+1)
for i in range(1,N+1):
  cum_A[i]=cum_A[i-1]+A[i-1]
for a in A:
  b = max(right-a,1)
  if b>A[0]:
    break
  c = cum_max-cum[b-1]
  M-=c
  ans+=(a*c)+cum_A[c]
  

ans+=M*left
print(ans)
N = int(input())
s = input()
if s.count('R') > s.count('B'):
    print('Yes')
else:
    print('No')

#C
#%%
N,Q = map(int,input().split())
s = input()
q = [[0,0] for i in range(Q)]
for i in range(Q):
    q[i] = input().split()
    
def L(n):
    pos = n
    for i in range(Q):
        t,d = q[i]
        if s[pos] == t:
            if d == 'L':
                pos -= 1
            elif d == 'R':
                pos += 1
            if pos == -1:
                return True
            if pos == N:
                return False
    return False

def R(n):
    pos = n
    for i in range(Q):
        t,d = q[i]
        if s[pos] == t:
            if d == 'L':
                pos -= 1
            elif d == 'R':
                pos += 1
            if pos == N:
                return True
            if pos == -1:
                return False
    return False

n_mid = N//2
n_l = 0
n_r = N-1
for i in range(25):
    if L(n_mid):
        n_l = n_mid
        n_mid = (n_l+n_r)//2
    else:
        n_r = n_mid
        n_mid = (n_l+n_r)//2

if not L(n_l):
    l = -1
elif L(n_r):
    l = n_r
else:
    l = n_l

n_mid = N//2-1
n_l = 0
n_r = N-1
for i in range(25):
    if R(n_mid):
        n_r = n_mid
        n_mid = (n_l+n_r)//2
    else:
        n_l = n_mid
        n_mid = (n_l+n_r)//2

if not R(n_r):
    r = N
elif R(n_l):
    r = n_l
else:
    r = n_r

ans = 0
for i in range(N):
    if l < i < r:
        ans += 1
print(ans)


### FIXED CODE ###

N,Q = map(int,input().split())
s = input()
q = [[0,0] for i in range(Q)]
for i in range(Q):
    q[i] = input().split()
    
def L(n):
    pos = n
    for i in range(Q):
        t,d = q[i]
        if s[pos] == t:
            if d == 'L':
                pos -= 1
            elif d == 'R':
                pos += 1
            if pos == -1:
                return True
            if pos == N:
                return False
    return False

def R(n):
    pos = n
    for i in range(Q):
        t,d = q[i]
        if s[pos] == t:
            if d == 'L':
                pos -= 1
            elif d == 'R':
                pos += 1
            if pos == N:
                return True
            if pos == -1:
                return False
    return False

n_mid = N//2
n_l = 0
n_r = N-1
for i in range(25):
    if L(n_mid):
        n_l = n_mid
        n_mid = (n_l+n_r)//2
    else:
        n_r = n_mid
        n_mid = (n_l+n_r)//2

if not L(n_l):
    l = -1
elif L(n_r):
    l = n_r
else:
    l = n_l

n_mid = N//2-1
n_l = 0
n_r = N-1
for i in range(25):
    if R(n_mid):
        n_r = n_mid
        n_mid = (n_l+n_r)//2
    else:
        n_l = n_mid
        n_mid = (n_l+n_r)//2

if not R(n_r):
    r = N
elif R(n_l):
    r = n_l
else:
    r = n_r

ans = 0
for i in range(N):
    if l < i < r:
        ans += 1
print(ans)
A, B, M = [int(num) for num in input().split()]
a = [int(num) for num in input().split()]
b =  [int(num) for num in input().split()]
minimum = -1
for i in range(M):
    xi, yi, ci =  [int(num) for num in input().split()]
    ai = a[xi]
    bi = b[yi]
    sum = ai + bi - ci
    if minimum == -1 or sum < minimum:
        minimum = sum
print(minimum)

### FIXED CODE ###

A, B, M = [int(num) for num in input().split()]
a = [int(num) for num in input().split()]
b =  [int(num) for num in input().split()]
minimum = -1
for i in range(M):
    xi, yi, ci =  [int(num) for num in input().split()]
    ai = a[xi-1]
    bi = b[yi-1]
    sum = ai + bi - ci
    if minimum == -1 or sum < minimum:
        minimum = sum
a.sort()
b.sort()
sum = a[0]+b[0]
if minimum < sum:
    print(minimum)
else:
    print(sum)
x,y=map(int,input().split())
if x==1 and y==1:
  print(1000000)
elif x<=3 and y>=4:
  print((x-4)*(-100000))
elif x>=4 and y<=3:
  print((y-4)*(-100000))
elif x<=3 and y<=3:
  peint(((x-4)*(-100000))+((y-4)*(-100000)))
else:
  print(0)

### FIXED CODE ###

x,y=map(int,input().split())
if x==1 and y==1:
  print(1000000)
elif x<=3 and y>=4:
  print((x-4)*(-100000))
elif x>=4 and y<=3:
  print((y-4)*(-100000))
elif x<=3 and y<=3:
  print((x-4)*(-100000)+(y-4)*(-100000))
else:
  print(0)
A,B,C=map(int,input().split())
    if A==B and A !=C:
        print("Yes")
    elif A==C and A!=B:
        print("Yes")
    elif B==C and B !=A:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

A,B,C=map(int,input().split())
if A==B and A !=C:
	print("Yes")
elif A==C and A!=B:
	print("Yes")
elif B==C and B !=A:
	print("Yes")
else:
	print("No")
n, m, X, Y = map(int,input().split())
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
if X>= Y:
  print('War')
else:
  xmax = max(x)
  ymin = min(y)
  if xmax >= ymin:
    print('War')
  elif: xmax>=Y:
    print('War')
  elif: X>= ymin:
    print('War')
  else:
    print('No War')


### FIXED CODE ###

n, m, X, Y = map(int,input().split())
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
if X>= Y:
  print('War')
else:
  xmax = max(x)
  ymin = min(y)
  if xmax >= ymin:
    print('War')
  elif xmax>=Y:
    print('War')
  elif X>= ymin:
    print('War')
  else:
    print('No War')
S = str(input())
if S[2]==S[3] & S[4]==S[5]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S = str(input())
if S[2]==S[3] and S[4]==S[5]:
  print("Yes")
else:
  print("No")
l,d,r = map(int,input().split())
def div(n): 
  return True if n%r==0 else False
print(len(filter(div,range(l,d+1))))

### FIXED CODE ###

l,d,r = map(int,input().split())
count = 0
for i in range(l,d+1):
  if i%r==0: count += 1
print(count)
import copy

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

    def lcm(a, b):
        return (a // gcd(a, b)) * b

    n, m = map(int, input().split())
    # これだと72がREになる
    A = set([int(x) for x in input().split()])
    # これだと74も78もREになる
    # A = [int(x) for x in input().split()]
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    # Aの要素が複数ならlcmを計算する
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    # 元のAの値とlcmの半分の値を割り切れるものがあったら0
    #for i in A_:
    for i in A:
        # if (a_lcm / 2) % i == 0:
        if (a_lcm / i) % 2 == 0: 
            print(0)
            exit()
        # else:
        #     continue
    # mがlcmの半分よりも小さかったら0
    if (a_lcm / 2) > m:
        print(0)
    else:
        # あとは定数倍の数調べて終わり
        # ans = int((m - (a_lcm / 2))) // a_lcm + 1
        ans = int((m - (a_lcm / 2)) // a_lcm) + 1
        print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
# from math import gcd


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

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # mがlcmの半分よりも小さかったら0
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()
from collections import deque
def main():
    n,m=map(int,input().split())
    g=[[] for i in range(n)]
    for i in range(m):
        a,b,c=map(int,input().split())
        a-=1
        b-=1
        g[a].append([b,c])
        g[b].append([a,-c])
    inf=10**10
    v=[inf]*n
    while max(v)==inf:
        s=v.index(inf)
        q=deque([s])
        v[s]=0
        while q:
            p=q.pop_left()
            for i in g[p]:
                if v[i[0]]==inf:
                    v[i[0]]=v[p]+i[1]
                    p.append(i[0])
                else:
                    if v[i[0]]!=v[p]+i[1]:
                        return 'No'
    return 'Yes'
                            
  
print(main())

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 5+1)


def dfs(p):
    for edge in G[p]:
        if X[edge[0]] is not None:
            if X[edge[0]] - X[p] != edge[1]:
                print('No')
                exit()
        else:
            X[edge[0]] = X[p] + edge[1]
            dfs(edge[0])


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

for i in range(M):
    L, R, D = map(int, input().split())
    L -= 1
    R -= 1
    G[L].append((R, D))
    G[R].append((L, -D))

X = [None] * N
for i in range(N):
    if X[i] is None:
        X[i] = 0
        dfs(i)

print('Yes')
n=int(input())
s=input()
w=b=0
mn=0
for sk in s:
    if sk=="#":
        b+=1
    else:
        w-=1
    if mn>b+w:
        mn=b+w
print(mn-w)

### FIXED CODE ###

a,b,c = map(int,input().split(' '))
if a<b:
    if c>a and c<b:
        print('Yes')
    else:
        print('No')
else:
    if c<a and c>b:
        print('Yes')
    else:
        print('No')
import atexit
import io
import sys

_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER


@atexit.register
def write():
    sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

import math
R = lambda : map(int,input().split())
n,d = R()
xs = [list(R()) for _ in range(n)]

def dist(y,z):
    return math.sqrt(sum([(y[i]-z[i])**2 for i in range(d)]))


count = 0
for i in range(n):
    for j in range(i+1,n):
        d = dist(xs[i],xs[j])
        if int(d)==d:
            count+=1
print(count)

### FIXED CODE ###

# import atexit
# import io
# import sys
#
# _INPUT_LINES = sys.stdin.read().splitlines()
# input = iter(_INPUT_LINES).__next__
# _OUTPUT_BUFFER = io.StringIO()
# sys.stdout = _OUTPUT_BUFFER
#
#
# @atexit.register
# def write():
#     sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

import math
R = lambda : map(int,input().split())
import math

N, D = map(int, input().split())
Xs = [list(map(int, input().split())) for _ in range(N)]


def dist(y, z):
    return math.sqrt(sum([(y[i] - z[i]) * (y[i] - z[i]) for i in range(D)]))


count = 0
for i in range(N):
    for j in range(i + 1, N):
        d = dist(Xs[i], Xs[j])
        if int(d) == d:
            count += 1

print(count)
n,m=(int(i) for i in input().split())
a=[int(i) for i in input().split()]
s=sum(a)
if n-a>=0:
  print(n-a)
else:
  print(-1)

### FIXED CODE ###

n,m=(int(i) for i in input().split())
a=[int(i) for i in input().split()]
s=sum(a)
if n-s>=0:
  print(n-s)
else:
  print(-1)
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import deque
from collections import Counter
import bisect
def main():
    N = I()
    A = LI()
    B = LI()
    A_cnt = Counter(A)
    B_cnt = Counter(B)
    for key in B_cnt.keys():
        x = A_cnt[key]
        if B_cnt[key] > N - x:
            print('No')
            exit()
    print('Yes')
    B_m = deque(B_cnt.most_common())
    ANS = [0] * N
    for i in range(N):
        x = B_m[0][0]
        if len(B_m) >= 2:
            y = B_m[1][0]
        if A[i] != x:
            ANS[i] = x
            B_cnt[x] -= 1
            if B_cnt[x] == 0:
                B_m.popleft()
        if A[i] == x:
            ANS[i] = y
            B_cnt[y] -= 1
            if B_cnt[y] == 0:
                B_m.popleft()
                B_m.popleft()
                B_m.appendleft((x, B_cnt[x]))
    print(' '.join(map(str, ANS)))

if __name__ == "__main__":
    main()



### FIXED CODE ###

import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import deque
from collections import Counter
import bisect
def main():
    N = I()
    A = LI()
    B = LI()
    A_cnt = Counter(A)
    B_cnt = Counter(B)
    for key in B_cnt.keys():
        x = A_cnt[key]
        if B_cnt[key] > N - x:
            print('No')
            exit()
    print('Yes')
    A_m = A_cnt.most_common()
    A_ = []
    for a_m in A_m:
        A_ += [a_m[0]] * a_m[1]
    B_m = deque(B_cnt.most_common())
    ANS = []
    for i in range(N):
        x = B_m[0][0]
        if A_[i] != x:
            ANS.append([A_[i], x])
            B_cnt[x] -= 1
            if B_cnt[x] == 0:
                B_m.popleft()
        elif A_[i] == x:
            if len(B_m) != 1:
                B_m.popleft()
                B_m.append((x, B_cnt[x]))
                y = B_m[0][0]
                ANS.append([x, y])
                B_cnt[y] -= 1
                if B_cnt[y] == 0:
                    B_m.popleft()
            else:
                for ans in ANS:
                    if ans[0] != x and ans[1] != x:
                        ANS.append([x, ans[1]])
                        ans[1] = x
                        break

    ANS.sort(key=lambda tup: tup[0])
    ANS_ = []
    for ans in ANS:
        ANS_.append(ans[1])
    print(' '.join(map(str, ANS_)))

if __name__ == "__main__":
    main()
N = int(input())
L = list(map(int,input().strip().split()))
L_sort = L.sort()
count = 0
for i in range(N-2):
	for j in range(i+1 , N):
		for k in range(j+1 , N):
        	if L_sort(i) + L_sort(j) > L_sort(k):
            	count += 1
print(count)


### FIXED CODE ###

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

L.sort()
count = 0

for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):             
            if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                continue
            if L[i] + L[j] > L[k]:
                count += 1

print(count)
X,N=map(int, input().split())
p=list(map(int,input().split()))   
if N==0:
    print(X)
else:
    for k in range(0,58):
        if not X-k in p:
            print(X-k)
            break 
        elif not X+k in p_list:
            print(X+k)
            break

### FIXED CODE ###

X, N = map(int, input().split())
p_list = list(map(int, input().split()))

if N == 0: 
   print(X)
else:
   for i in range(0,100):
       if not X-i in p_list:
           print(X-i)
           break
       elif not X+i in p_list:
           print(X+i)
           break
a, b = [int(i) for i in input().split()]

if a = b:
    print("a = b")

elif a > b:
    print("a > b")

else:
    print("a < b")

### FIXED CODE ###

a, b = [int(i) for i in input().split()]

if a < b:
    print("a < b")

elif a > b:
    print("a > b")

else:
    print("a == b")
A, B = input().split()
print(A * B)

### FIXED CODE ###

A, B = map(int, input().split())
print(A * B)