Harryxun/stf_run huggingface dataset:
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
# import math
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





@lru_cache(None)
def rec(x,t,curr):
    # print(x,t,curr)
    if(x==curr):
        return t
    if(t>x):
        return x
    return min(rec(x,t+1,curr+t+1),rec(x,t+1,curr),rec(x,t+1,curr-t-1))




X=l()[0]
print(min(rec(X,1,1),rec(X,1,0),rec(X,1,-1)))

### FIXED CODE ###

import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
# import math
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)

X=l()[0]
i=1
while(X-i>0):
    X-=i
    i+=1

print(i)
T = int(input())
X = int(input())
#世界Bで　X * t = 世界Aで　t ⇒　T = X * t  t = T / X
print(T / X)

### FIXED CODE ###

T,X = map(int,input().split())
#世界Bで　X * t = 世界Aで　t ⇒　T = X * t  t = T / X
print(T/X)
N=int(input())
count=0
pn=[2]
for L in range(3,N):
    chk=True
    for L2 in pn:
        if L%L2==0:chk=False
    if chk==True:pn.append(L)
ph=[1]*len(pn)
i=0
while N!=1:
    if N%(pn[i]**ph[i])==0:
        count+=1
        N//=(pn[i]**ph[i])
        ph[i]+=1
    else:i+=1
print(count)

### FIXED CODE ###

from collections import Counter
def factorization(n):
    a=[]
    for i in range(2,int(n**.5)+1):
        while n%i==0:
            n//=i
            a.append(i)
    if n!=1:
        a.append(n)
    return a
n=int(input())
A=factorization(n)
B=Counter(A)
count=0
for key,value in B.items():
    for i in range(1,value+1):
        if n%(key**i)==0:
            count+=1
            n//=(key**i)
        else:break
print(count)
n=int(input())
l=0
for i in range(1,n+1):
  if i%2==1:    
    p=0
    for k in range(1,i+1):
      if i%k==0:
        p+=1
    if p==8:
      l+=1
print(l)


### FIXED CODE ###

a,b=map(int,input().split())
print(a*b-a-b+1)
# -*- coding: utf-8 -*-
import math
from functools import reduce

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

N, X = map(int, input().split())
xn = list(map(int, input().split()))
xn2 = []

for xi in xn:
    xn2.append(xi - X)

# print(xn2)
print(gcd_list(xn2))


### FIXED CODE ###

# -*- coding: utf-8 -*-
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

N, X = map(int, input().split())
xn = list(map(int, input().split()))
xn2 = []

for xi in xn:
    xn2.append(abs(xi - X))

xn2.sort()

gcd_num = max(xn2)
for xi2 in xn2:
    tmp = gcd(xi2,gcd_num)
    if tmp < gcd_num:
        gcd_num = tmp

print(gcd_num)
def keyence20_a():
    H, W, N = map(int, readlines())
    lg = max(H, W)
    ans = (N + lg - 1) // lg
    print(ans)

keyence20_a()

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def keyence20_a():
    H, W, N = map(int, readlines())
    lg = max(H, W)
    ans = (N + lg - 1) // lg
    print(ans)

keyence20_a()
N = line(input().rstrip())
sum = 0

for i in range(len(N)):
  sum += int(N[i])
 
if sum % 9 == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = list(input().rstrip())
sum = 0
 
for i in range(len(N)):
  sum += int(N[i])
 
if sum % 9 == 0:
  print("Yes")
else:
  print("No")
import bisect
inf = 10**18
A,B,Q = map(int,input().split(' '))
ss = [-inf] + sorted([int(input()) for i in range(1,A+1)]) + [inf]
ts = [-inf] + sorted([int(input()) for i in range(A+1,A+B+1)]) + [inf]

def f0(A,x):
  i = bisect.bisect_left(A, x)
  return i, i-1
def f1(A,B,x):
  a = f0(A,x)
  bs = [f0(B,A[i]) for i in a]
  return min([abs(A[i]-x) + abs(A[i]-B[j]) 
              for ix, i in enumerate(a) 
              for j in bs[ix]]) 

for i in range(A+B+1,A+B+Q+1):
  x = int(input())
  print(min(f1(ss,ts,x),f1(ts,ss,x)))


### FIXED CODE ###

import sys

for S in sys.stdin:
  y,m,d = [int(x) for x in S.split('/')]
  if y<=2019 and m<=4:
    print('Heisei')
  else:
    print('TBD')
import math
n=int(input())
for i in range(n):
    x1,y1,x2,y2,x3,y3=[float(i) for i in input().split()]
    t1=x1*(x2+x3-x1)+y1*(y2+y3-y1)
    t2=x2*(x1+x3-x2)+y2*(y1+y3-y2)
    t3=x3*(x1+x2-x3)+y3*(y1+y2-y3)
    px=(t1*x1+t2*x2+t3*x3)/(t1+t2+t3)
    py=(t1*y1+t2*y2+t3*y3)/(t1+t2+t3)
    r=math.hypot(px-x1,py-y1)
    print("{0} {1} {2}".format(round(px,3),round(py,3),round(r,3)))


### FIXED CODE ###

import math
n=int(input())
for i in range(n):
    x1,y1,x2,y2,x3,y3=[float(i) for i in input().split()]
    A=math.hypot(x2-x3,y2-y3)**2
    B=math.hypot(x1-x3,y1-y3)**2
    C=math.hypot(x1-x2,y1-y2)**2
    t1=A*(B+C-A)
    t2=B*(A+C-B)
    t3=C*(A+B-C)
    px=(t1*x1+t2*x2+t3*x3)/(t1+t2+t3)
    py=(t1*y1+t2*y2+t3*y3)/(t1+t2+t3)
    r=math.hypot(px-x1,py-y1)
    print("%.3f %.3f %.3f"%(round(px,3),round(py,3),round(r,3)))
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
mod = 10**9+7
N,Q = I()
graph = [-1]*N
roots = [[] for _ in range(N)]
for i in range(N-1):
    a,b = I()
    graph[b-1] = a-1
def dfs(a):
    if a == 0:
        return
    b = graph[a]
    roots[b].append(i)
    dfs(b)
for i in range(N):
    dfs(i)
    roots[i].append(i)
counter = [0]*N
for i in range(Q):
  p,x = I()
  r = roots[p-1]
  if r:
      for j in r:
          counter[j] += x
print(*counter)

### FIXED CODE ###

import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
mod = 10**9+7
N,Q = I()
edge = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = I()
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
ans = [0]*N
for _ in range(Q):
    p,x = I()
    ans[p-1] += x
que = [0]
visited = {0}
while que:
    p = []
    for i in que:
        for j in edge[i]:
            if j in visited:
                continue
            visited.add(j)
            ans[j] += ans[i]
            p.append(j)
    que = p
print(*ans)
# coding: utf-8

x = input()

if x == 'A':
	print('T')
elif x == 'T'
	print('A')
elif x == 'G'
	print('C')
elif x == 'C'
	print('G')

### FIXED CODE ###

# coding: utf-8

x = input()

if x == 'A':
	print('T')
elif x == 'T':
	print('A')
elif x == 'G':
	print('C')
elif x == 'C':
	print('G')
a, b, c = map(int, input().spulit())
if (a / c <= b):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

d,t,s=map(int,input().split())
if d<=t*s:
    print("Yes")
else:
    print("No")
m,k=input().split(" ")
result=int(m)*float(k)
result=int(result)
print("%d"%result//100)

### FIXED CODE ###

m,k=input().split(" ")
m=int(m)
k=float(k)
k=int(k*100+0.5)
print(m*k//100)
sys.setrecursionlimit(10000)
def search(arr, num, i):
  nxt = arr[num]
  if(nxt == 1):
    return i
  elif(i >= len(arr)):
    return -1
  else:
    return search(arr, nxt, i+1)

n = int(input())
a = [ int(input()) - 1 for _ in range(n)]
print(search(a, 0, 1))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
def search(arr, num, i):
  nxt = arr[num]
  if(nxt == 1):
    return i
  elif(i >= len(arr)):
    return -1
  else:
    return search(arr, nxt, i+1)

n = int(input())
a = [ int(input()) - 1 for _ in range(n)]
print(search(a, 0, 1))
s = input()
if "BC" in s:
    s = s.replace("BC", "D")
else:
    print(0)
    quit()
pos = 0
str_len = len(s)
count = 0
seq_a = 0
seq_d = 0

while pos < str_len:
    if s[pos] == "A":
        while pos < str_len and s[pos] == "A":
            seq_a += 1
            pos += 1
        if s[pos] == "D":
            while pos < str_len and s[pos] == "D":
                seq_d += 1
                pos += 1
            count += seq_a * seq_d
            if pos < str_len and s[pos] != "A":
                seq_a = 0
            seq_d = 0
        else:
            pos += 1
            seq_a = 0
    else:
        pos += 1
        seq_a = 0

print(count)


### FIXED CODE ###

s = input()
pos = 0
str_len = len(s)
count = 0
seq_a = 0
seq_bc = 0

while pos < str_len:
    if s[pos] == "A":
        while pos < str_len and s[pos] == "A":
            seq_a += 1
            pos += 1
        if pos + 1 < str_len and s[pos] == "B" and s[pos+1] == "C":
            while pos < str_len and s[pos] == "B" and pos + 1 < str_len and s[pos+1] == "C":
                seq_bc += 1
                pos += 2
            count += seq_a * seq_bc
            if pos < str_len and s[pos] != "A":
                seq_a = 0
            seq_bc = 0
        else:
            pos += 1
            seq_a = 0
    else:
        pos += 1
        seq_a = 0

print(count)
N=int(input())
S=input()
if (N%2!=0):
    print('No')
else:
    a1=S[:N/2]
    a2=S[N/2:]
    if (a1==a2):
        print('Yes')

### FIXED CODE ###

n = int(input())
s = input()

if(n%2 == 1):
    print("No")
else:
    flag = False
    for i in range(n//2):
        if(s[i] != s[i+n//2]):
            flag = True
            print("No")
    
    if(flag == False):
        print("Yes")
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

inp = sys.stdin.buffer.readline

def main():
    n = ni()
    e = [[] for _ in range(n)]
    for _ in range(n - 1):
        x, y = map(int, inp().split())
        x -= 1
        y -= 1
        e[x].append(y)
        e[y].append(x)

    # dp[i][0]:i番目のノードが白のときの組み合わせの数
    # dp[i][1]:i番目のノードが黒のときの組み合わせの数
    dp = [[1, 1] for _ in range(n)]
    visited = [False for _ in range(n)]

    def dfs(vi, prnt):
        # if visited[vi]:
        #     return
        visited[vi] = True

        for chld in e[vi]:
            if chld == prnt or visited[chld]:
                continue
            dfs(chld, vi)

            # 親が白なら子は白でも黒でもいい
            dp[vi][0] *= (dp[chld][0] + dp[chld][1]) % MOD
            dp[vi][0] %= MOD
            # 親が黒田と子は白じゃないとダメ
            dp[vi][1] *= dp[chld][0]
            dp[vi][1] %= MOD

    dfs(0, -1)
    print((dp[0][0] + dp[0][1]) % MOD)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)
inp = sys.stdin.buffer.readline


def resolve():
    MOD = 10 ** 9 + 7

    n = int(inp())
    e = [[] for _ in range(n)]
    for _ in range(n - 1):
        x, y = map(lambda x: int(x) - 1, inp().split())
        e[x].append(y)
        e[y].append(x)

    # dp[i][0]:i番目のノードが白のときの組み合わせの数
    # dp[i][1]:i番目のノードが黒のときの組み合わせの数
    dp = [[1, 1] for _ in range(n)]
    visited = [False for _ in range(n)]

    def dfs(vi, prnt):
        # if visited[vi]:
        #     return
        visited[vi] = True

        for chld in e[vi]:
            if chld == prnt or visited[chld]:
                continue
            dfs(chld, vi)

            # 親が白なら子は白でも黒でもいい
            dp[vi][0] *= (dp[chld][0] + dp[chld][1]) % MOD
            dp[vi][0] %= MOD
            # 親が黒田と子は白じゃないとダメ
            dp[vi][1] *= dp[chld][0] % MOD
            dp[vi][1] %= MOD

    dfs(0, -1)
    print((dp[0][0] + dp[0][1]) % MOD)


if __name__ == "__main__":
    resolve()
t=int(input())
l=sorted(map(int, input().split()))
s=l[0]
for i in rnage(1,t):
  s+=l[i]
  s/=2
print(s)

### FIXED CODE ###

t=int(input())
l=sorted(map(int, input().split()))
s=l[0]
for i in range(1,t):
  
  s+=l[i]
  s/=2
print(s)
X = int(input())
if X == 1:
    print(1)
else:
    ans = 1
    for i in range(2, X+1):
        for k in range(2, 10):
            now = i ** k
            if now <= X:
                ans = max(ans, now)
print(ans)


### FIXED CODE ###

X = int(input())
if X == 1:
    print(1)
else:
    ans = 1
    for i in range(2, X+1):
        for k in range(2, 10):
            now = i ** k
            if now <= X:
                ans = max(ans, now)
    print(ans)
a=int(input())
list1=[]
for i in range(a+1):
  list1.append(input())

print(len(list(set(list1))))

### FIXED CODE ###

a=int(input())
list1=[]
for i in range(a):
  list1.append(input())
  
print(len(list(set(list1))))
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict,deque

H,W=map(int, sys.stdin.readline().split())
CH,CW=map(int, sys.stdin.readline().split())
CH-=1
CW-=1
DH,DW=map(int, sys.stdin.readline().split())
DH-=1
DW-=1
S=[ sys.stdin.readline().strip() for _ in range(W) ]

D=[(0,1),(0,-1),(1,0),(-1,0)]
WARP=[]
for dh in range(-2,3):
    for dw in range(-2,3):
        if abs(dh)+abs(dw)<=1: continue
        WARP.append((dh,dw))

visit=defaultdict(lambda: 0) #未訪問:0 訪問済み:1

q=deque()
q.append((0,CH,CW))
visit[(CH,CW)]=1

while q:
    kyori, fro_h, fro_w=q.popleft()
    if fro_h==DH and fro_w==DW:
        print (kyori)
        quit()
    #歩いて移動
    for dh,dw in D:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]=="." and visit[(to_h, to_w)]==0:
                    visit[(to_h, to_w)]=1
                    q.appendleft((kyori,to_h, to_w))
    #ワープ
    for dh,dw in WARP:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]=="." and visit[(to_h, to_w)]==0:
                    visit[(to_h, to_w)]=1
                    q.append((kyori+1, to_h, to_w))

print (-1)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque

H,W=map(int, sys.stdin.readline().split())
CH,CW=map(int, sys.stdin.readline().split())
CH-=1
CW-=1
DH,DW=map(int, sys.stdin.readline().split())
DH-=1
DW-=1
S=[ sys.stdin.readline().strip() for _ in range(H) ]

D=[(0,1),(0,-1),(1,0),(-1,0)]
WARP=[]
for dh in range(-2,3):
    for dw in range(-2,3):
        if abs(dh)+abs(dw)<=1: continue
        WARP.append((dh,dw))

d=defaultdict(lambda: float("inf")) #スタート地点から各マスまでの距離

q=deque()
q.append((0,CH,CW))
d[(CH,CW)]=0

while q:
    kyori, fro_h, fro_w=q.popleft()
    if d[(fro_h, fro_w)]<kyori: continue
    #歩いて移動
    for dh,dw in D:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]==".":
            if kyori < d[(to_h, to_w)]:
                d[(to_h, to_w)]=kyori
                q.appendleft((kyori, to_h, to_w))
    #ワープ
    for dh,dw in WARP:
        to_h, to_w=fro_h+dh, fro_w+dw
        if 0<=to_h<H and 0<=to_w<W and S[to_h][to_w]==".":
            if kyori+1 < d[(to_h, to_w)]:
                d[(to_h, to_w)]=kyori+1
                q.append((kyori+1, to_h, to_w))

if d[(DH,DW)]==float("inf"):
    print -1
else:
    print d[(DH,DW)]
n,m=map(int,input().split())
a = [int(input()) for _ in range(m)]

mod=10**9+7
dp=[0]*(n+1)
dp[0]=1
j=0
for i in range(1,n+1):
    if i == a[j]:
        dp[i]=0
        j=min(m-1,j+1)
    else:
        dp[i]=(dp[i-2]+dp[i-1])%mod
print(dp[-1])


### FIXED CODE ###

n,m=map(int,input().split())
a = [int(input()) for _ in range(m)]

mod=10**9+7
dp=[0]*(n+1)
dp[0]=1
NG=[False]*n
for i in range(m):
    NG[a[i]-1]=True

for i in range(1,n+1):
    if NG[i-1]==False:
        dp[i]=(dp[i-2]+dp[i-1])%mod
print(dp[-1])
j = int(input())

x = j.split()
y = []

for i in x:
  if(i not in y):
    y.append(i)
print(len(y))


### FIXED CODE ###

j = (input())

x = j.split()
y = []

for i in x:
  if(i not in y):
    y.append(i)
print(len(y))
import sys
n,k=map(int,input().split())
s=input()

hap = 0
if s[0] == "R" and s[1] == "R":
    hap += 1
if s[-1] == "L" and s[-2] == "L":
    hap += 1

rl = 0
lr = 0

for i in range(1,n-1):
    if s[i] == "L":
        if s[i-1] == "L":
            hap += 1
        else:
            rl += 1
    else:
        if s[i+1] == "R":
            hap += 1
        if s[i-1] == "L":
            lr += 1

tmp = min(rl,lr,k)
hap += 2 * tmp

if rl != lr and k - tmp >0:
    hap += 1
print(hap)

### FIXED CODE ###

import sys
n,k=map(int,input().split())
s=input()

if n == 1:
    print(0)
    sys.exit()

hap = 0
if s[0] == "R" and s[1] == "R":
    hap += 1
if s[-1] == "L" and s[-2] == "L":
    hap += 1

for i in range(1,n-1):
    if s[i] == "L" and s[i-1] =="L":
        hap += 1
    elif s[i] == "R" and s[i+1] == "R":
        hap += 1

rl = 0
lr = 0

for i in range(n-1):
    if s[i] == "L" and s[i+1] == "R":
        lr += 1
    elif s[i] == "R" and s[i+1] == "L":
        rl += 1

tmp = min(rl,lr,k)
hap += 2 * tmp

if s[0] != s[-1] and k - tmp >0:
    hap += 1
print(hap)
D,T,S = map(input().split())
if D/S>=T:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

D,T,S = map(int,input().split())
if D/S>T:
  print("No")
else:
  print("Yes")
s =str(input())

if len(s) == 2:
    if s[0]==s[1]:
        sIndex = 1
        eIndex = 2
    else:
        sIndex = -1
        eIndex = -1
elif len(s)>2:
    sIndex=-1
    eIndex=-1
    for i in range(len(s)):
        par_str = s[i:i+3]
        if (par_str.count(par_str[0])>=2) | (par_str.count(par_str[1])>=2):
            sIndex = i + 1
            eIndex = i + 3
            break
    
ans = str(sIndex)+' '+str(eIndex)
print(ans)

### FIXED CODE ###

s =str(input())

if len(s) == 2:
    if s[0]==s[1]:
        sIndex = 1
        eIndex = 2
    else:
        sIndex = -1
        eIndex = -1
elif len(s)>2:
    sIndex=-1
    eIndex=-1
    for i in range(len(s)-2):
        par_str = s[i:i+3]
        if (par_str.count(par_str[0])>=2) | (par_str.count(par_str[1])>=2):
            sIndex = i + 1
            eIndex = i + 3
            break
    
ans = str(sIndex)+' '+str(eIndex)
print(ans)
import pandas
 
n = int(input())
s = [input() for _ in range(n)]
 
x = pandas.Series(s)
lis = x.mode().tolist()

for i in range(len(lis)):
  print(lis[i])

### FIXED CODE ###

import sys 
from collections import Counter
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N = int(readline())
l = read().decode().split()
c = Counter(l)
 
max = c.most_common()[0][1]
ans = [i[0] for i in c.items() if i[1] >= max]
 
print('\n'.join(sorted(ans)))
from collections import Counter as c

e,o = 0,0
ans = 0
E,O = [],[]
for v,i in zip(V,range(N)):
    if i%2 == 0:
        E.append(v)
    else:
        O.append(v)
EC = c(E).most_common()
OC = c(O).most_common()
n = N//2

EC01=EC[0][1]

OC01=OC[0][1]

if len(EC) == 1:
    EC11 = 0
else:
    EC11=EC[1][1]
if len(OC) == 1:
    OC11 = 0
else:
    OC11=OC[1][1]
if len(EC) == 1 and len(OC) == 1 and EC[0][0]==OC[0][0]:
    ans = EC01
elif EC01+OC11 > EC11+OC01:
    ans += n - EC01
    ans += n - OC11
elif EC01+OC11 < EC11+OC01:
    ans += n - EC11
    ans += n - OC01
elif EC01 == OC01:
    ans = 0
print(ans)

### FIXED CODE ###

from collections import Counter as c

N = int(input())
V = list(map(int,input().split()))
ev = c(V[::2]).most_common(2)
od = c(V[1::2]).most_common(2)

if ev[0][0] == od[0][0]:
    if len(ev) == 1 and len(od) == 1:
        print(N//2)
    else:
        print(N-max(ev[0][1]+od[1][1],ev[1][1]+od[0][1]))
else:
    print(N-ev[0][1]-od[0][1])
n=list(input())
m=int(input())
i=0
for t in range(100):
  if n[t]=="1":
    pass
  else:
    i=t+1
if m=>i:
  print(str(n[i]))
else:
  print(1)


### FIXED CODE ###

n=list(input())
m=int(input())
i=0
for t in range(len(n)):
  if n[t]!="1":
    i=t+1
    break
if m<i:
  print(1)
else:
  print(int(n[i-1]))
if __name__ == '__main__':
    # We have a string S of length N consisting of uppercase English letters.
    temp = input().split('\n')
    n = temp[0]
    s = temp[1]
    num = 0
    if 'ABC' in s:
        num += 1
        s.replace('ABC', '')
    print(num)

### FIXED CODE ###

if __name__ == '__main__':
    # We have a string S of length N consisting of uppercase English letters.
    n = input()
    s = input()
    num = 0
    for i in range(len(s)):
        if 'ABC' in s:
            num += 1
            s = s.replace('ABC', '', 1)
    print(num)
N = int(input())
a = np.array([int(input()) for _ in range(N)])
m = 998244353
S = a.sum()

# 最初のt個の整数を塗り分け, Rの整数の和がrであるような場合の数
DP_A = np.zeros((N+1, S+1), dtype=np.int64)
# 最初のt個の整数を塗り分け, Rの整数の和がrで, Bの和が0であるような場合の数
DP_B = np.zeros((N+1, S+1), dtype=np.int64)

DP_A[0, 0] = 1
DP_B[0, 0] = 1

for t in range(N):
    for r in range(S + 1):
        # t + 1番目の整数をRにしない -> G or Bにする
        DP_A[t+1, r] = DP_A[t, r] * 2 % m
        # t + 1番目の整数をRにする -> r-a(t+1)だった場合の数を追加
        if r - a[t] >= 0:
            DP_A[t+1, r] += DP_A[t, r - a[t]] % m
        # t+1 番目の整数をRにしない -> Gを加える
        DP_B[t+1, r] = DP_B[t, r] % m
        # t + 1番目の整数をRにする -> r-a(t+1)だった場合の数を追加
        if r - a[t] >= 0:
            DP_B[t+1, r] += DP_B[t, r - a[t]] % m

res1 = DP_A[N, int(np.ceil(S/2)):].sum()
res2 = DP_B[N, int(np.ceil(S/2))] if S % 2 == 0 else 0
res = (3 ** N - res1 * 3 + res2 * 3) % m
print(res)

### FIXED CODE ###

import numpy as np
N = int(input())
a = np.array([int(input()) for _ in range(N)])
m = 998244353
S = a.sum()

# 最初のt個の整数を塗り分け, Rの整数の和がrであるような場合の数
DP_A = np.zeros((N+1, S+1), dtype=np.int64)
# 最初のt個の整数を塗り分け, Rの整数の和がrで, Bの和が0であるような場合の数
DP_B = np.zeros((N+1, S+1), dtype=np.int64)

DP_A[0, 0] = 1
DP_B[0, 0] = 1

# for t in range(N):
#     for r in range(S + 1):
#         # t + 1番目の整数をRにしない -> G or Bにする
#         DP_A[t+1, r] = DP_A[t, r] * 2 % m
#         # t + 1番目の整数をRにする -> r-a(t+1)だった場合の数を追加
#         if r - a[t] >= 0:
#             DP_A[t+1, r] += DP_A[t, r - a[t]] % m
#         # t+1 番目の整数をRにしない -> Gを加える
#         DP_B[t+1, r] = DP_B[t, r] % m
#         # t + 1番目の整数をRにする -> r-a(t+1)だった場合の数を追加
#         if r - a[t] >= 0:
#             DP_B[t+1, r] += DP_B[t, r - a[t]] % m

for t in range(N):
    DP_A[t+1, :] = (DP_A[t, :]) * 2 % m
    DP_A[t+1, a[t]:] += DP_A[t, :-a[t]] % m
    DP_B[t+1, :] = (DP_B[t, :]) % m
    DP_B[t+1, a[t]:] += DP_B[t, :-a[t]] % m

res1 = DP_A[N, int(np.ceil(S/2)):].sum()
res2 = DP_B[N, int(np.ceil(S/2))] if S % 2 == 0 else 0
res = (3 ** N - res1 * 3 + res2 * 3) % m
print(res)
K,S=map(int,input().split())
ans=0
for i in range(S+1):
  for j in range(S+1-i):
    if 0<=i,j,S-i-j<=K:
      ans+=1
print(ans)      

### FIXED CODE ###

K,S=map(int,input().split())
ans=0
for i in range(S+1):
  for j in range(S+1-i):
    if 0<=i<=K and 0<=j<=K and 0<=S-i-j<=K:
      ans+=1
print(ans)