Harryxun/stf_run huggingface dataset:
map_list = [int,input().split() for x in range(3)]

n = int(input())
for i in range(n):
  a = int(input())
  

### FIXED CODE ###

map_list = [list(map(int,input().split())) for x in range(3)]
 
n = int(input())
for i in range(n):
  a = int(input())
  for i in range(3):
    for j in range(3):
      if map_list[i][j] == a:
        map_list[i][j] = 0

ans = "No"
for k in range(3):
  if map_list[0][k] == map_list[1][k] == map_list[2][k] or \
     map_list[k][0] == map_list[k][1] == map_list[k][2]:
      ans = "Yes"
      break
  if map_list[0][0] == map_list[1][1] == map_list[2][2] or \
	 map_list[0][2] == map_list[1][1] == map_list[2][0]:
      ans = "Yes"
print(ans)
import math
from functools import reduce


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


n = int(input())
num_list = list(map(int,input().split()))
gcd = [1 for _ in range(n-1)]
for i in range(n-1):
    num = num_list[:i] + num_list[(i + 1):]
    gcd[i] = gcd_list(num)

print(max(gcd))

### FIXED CODE ###

# 最大公約数
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


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

L = [0 for _ in range(n)]
R = [0 for _ in range(n)]
L[0] = A[0]
R[-1] = A[-1]

for i in range(1, n):
    L[i] = gcd(L[i-1], A[i])
    R[n - i - 1] = gcd(R[n - i], A[n - i - 1])
ans = 1
for i in range(n):
    if i == 0:
        ans = R[i + 1]
    elif i == n-1:
        ans = max(ans, L[i-1])
    else:
        ans = max(ans, gcd(L[i - 1], R[i+1]))

print(ans)
import math

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

ans = a[0]

for i in range(1,n):
    ans = math.gcd(ans,a[i])

print(ans)

### FIXED CODE ###

import fractions

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

ans = a[0]

for i in range(1,n):
    ans = fractions.gcd(ans,a[i])

print(ans)
a, b, c= map(int, input().split())
print(min(c, b//a)

### FIXED CODE ###

a, b, c= map(int, input().split())
print(min(c, b//a))
n = int(input())
an = list(map(int,input().split()))
an.sort()

for x in range(n-1):
  if an[i+1]-an[i] == 0:
    print("NO")
    break

else:
  print("YES")
  

### FIXED CODE ###

n = int(input())
an = list(map(int,input().split()))
an.sort()

for x in range(n-1):
  if an[x+1]-an[x] == 0:
    print("NO")
    break

else:
  print("YES")
def sol():
  ti = 0
  ans = lenX
  for i in range(lenX//2):
    while S[i]>=T[ti]:
      ti += 1
      if ti>=lenX//2:
        return ans
    ans -= 2    
    ti += 1
  return ans

X = input()
lenX = len(X)
S = []
T = []
for i,x in enumerate(X):
  if x == 'S':S.append(i)
  else:T.append(i)

print(sol())

### FIXED CODE ###

def sol():
  ti = 0
  ans = lenX
  for i in range(lenX//2):
    while S[i]>=T[ti]:
      ti += 1
      if ti>=lenX//2:return ans
    ans -= 2    
    ti += 1
    if ti>=lenX//2:return ans
  return ans

X = input()
lenX = len(X)
S = []
T = []
for i,x in enumerate(X):
  if x == 'S':S.append(i)
  else:T.append(i)

print(sol())
a = input()
s = input()

print(s if (a >= 3200) else 'red')

### FIXED CODE ###

a = int(input())
s = input()

if (a >= 3200):
  print(s)
else:
  print('red')
s=int(input())
an=[0]*1000000
tmp=[False]*300
an[0] = s
for i in range(1, 1000000):
    if an[i-1] % 2 == 0:
        an[i] = an[i-1]/2
    else:
        an[i] = 3*an[i-1] + 1
    if not tmp[an[i]]:
        tmp[an[i]] = True
    else:
        print(i)
        exit()
        

### FIXED CODE ###

s = int(input())
def f(x):
  if x % 2 == 0:
    return x/2
  else:
    return 3 * x + 1

X = [s]
m = 1
next = s

while True:
  m += 1
  next = f(next)
  if next in X:
    break
  else:
    X.append(next)
    
print(m)
a = int(input())
s = '1' + '0' * (a-1)
print(int(s, 2) -1)


### FIXED CODE ###

a = int(input())

def f(n):
    sum = 0
    if (n == 1):
        return 1
    else:
        sum += f(int(n/2)) * 2 + 1
        return sum

print(f(a))
head = input().split(" ")
while head != "0 0 0":
    num = int(head[0])
    mini = int(head[1])
    maxi = int(head[2]) 

    scores = []

    gaps = []

    for _ in range(int(head[0])):
        scores.append(int(input()))
    
    for i in range(mini, maxi + 1):
        oks = scores[:i]
        ngs = scores[i:]
        gap = oks[-1] - ngs[0]
        gaps.append((i,gap))

    filtered = list(filter(lambda x: x[1] == max(map(lambda x: x[1], gaps)), gaps))
    sorted(filtered,key=lambda x: x[0])
    print(filtered[-1][0])


### FIXED CODE ###

while True:
    num, mini, maxi = map(int, input().split())
    if num == 0: break
    scores = [ int(input()) for i in range(num) ]
    gap = 0
    ans = 0
    for i in range(mini, maxi + 1):
        gap = scores[i-1] - scores[i] if scores[i-1] - scores[i] >= gap else gap
        ans = i if scores[i - 1] - scores[i] >= gap else ans

    print(ans)
n, m, q = map(int, input().split())

cumlr = [[0] * n for i in range(n)]
for _ in range(m):
    l, r = map(int, input().split())
    cumlr[l-1][r-1] += 1

for i in range(n):
    for j in reversed(range(1, n)):
        cumlr[i][j-1] += cumlr[i][j]

for i in range(n):
    for j in range(n-1):
        cumlr[j+1][i] += cumlr[j][i]


for _ in range(q):
    l, r = map(int, input().split())
    print(cumlr[r-1][q-1])

### FIXED CODE ###

n, m, Q = map(int, input().split())
M = [[0]*n for _ in range(n)]
for i in range(m):
    l, r = map(int, input().split())
    M[r-1][l-1] += 1

for q in range(n):
    for p in reversed(range(1, n)):
        M[q][p-1] += M[q][p]
for p in range(n):
    for q in range(n-1):
        M[q+1][p] += M[q][p]

for i in range(Q):
    p, q = map(int, input().split())
    print(M[q-1][p-1])
X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y>=100000000000000000:
  print(0/0)
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)

### FIXED CODE ###

X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y==576460752303423487:
  print(59)
  exit()
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)
N, A, B = map(int, input().split())
ans = 0

AplusB = A+B

try:
    action_num = N // AplusB
except:
    action_num = 0
ans += action_num * A

try:
    action_mod = N % AplusB
except:
    action_mod = 0

one_action = "B"*A + "R"*B
# for i in range(action_mod):
#     if one_action[i] == "B":
#         ans += 1

print(ans)


### FIXED CODE ###

N, A, B = map(int, input().split())
ans = 0

AplusB = A+B

action_num = N // AplusB
ans += action_num * A

action_mod = N % AplusB

if action_mod <= A:
    ans += action_mod
else:
    ans += A

print(ans)
list1=[]
a,b=map(int,input().split())
d=a
for i in range(d):
    e=a
    a=abs(a-b)
    list1.append(a)
    if e<a:
        break
list2= sorted(list1, reverse=True)
print(list2[-1])

### FIXED CODE ###

n, k = map(int, input().split())
w = n%k
w2 = abs(w-k)
if w > w2:
    print(w2)
else:
    print(w)
n = int(input())
lst_a = [int(i) for i in input().split()]
lst_b = [int(i) for i in input().split()]
j = 0
for i in range(n):
  if lst_a[i] != lst_b[i]:
    continue
  else:
    flag = False
    while j != n:
      if lst_a[i] != lst_b[j]:
        lst_b[i], lst_b[j] = lst_b[j], lst_b[i]
        flag = True
        break
      j += 1
    if not flag:
      break
if not flag:
  print('No')
else:
  print('Yes')
  lst_b = [str(i) for i in lst_b]
  print(' '.join(lst_b))

### FIXED CODE ###

n = int(input())
lst_a = [int(i) for i in input().split()]
lst_b = [int(i) for i in input().split()]
j = 0
flag = True
for i in range(n):
  if i > 0:
    if lst_a[i] != lst_a[i - 1]:
      j = 0
  if lst_a[i] != lst_b[i]:
    continue
  else:
    flag = False
    while j != n:
      if lst_a[i] != lst_b[j] and lst_a[j] != lst_b[i]:
        lst_b[i], lst_b[j] = lst_b[j], lst_b[i]
        flag = True
        break
      j += 1
    if not flag:
      break
if not flag:
  print('No')
else:
  print('Yes')
  lst_b = [str(i) for i in lst_b]
  print(' '.join(lst_b))
s = list(input())
t = [0] * len(s)
count = 0
ans = []
for i in range(len(s)):
    if s[i] == 'A' or s[i] =='C' or s[i] =='G' or s[i] =='T':
        t[i] = 1
        count += 1
    else:
        ans.append(count)
        count = 0
print(max(ans))

### FIXED CODE ###

s = input()
count = 0
ans = 0
for i in s:
    if i in'AGCT':
        count += 1
    else:
        count = 0
    ans = max(ans, count)
print(ans)
import math
N,X = map(int,input().split())
x = list(map(int,input().split()))

x.append(X)
x.sort()
ans = x[1]-x[0]
for i in range(1,N):
    ans = math.gcd(ans,x[i+1]-x[i])
print(ans)

### FIXED CODE ###

a,b = map(int,input().split())
if a == 2 or b==2:
  print("No")
else:
  print("Yes")
List=input()
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for i,j = zip(List,a):
	if i != j:
      c1 += 1

for i,j = zip(List,b):
	if i != j:
      c2 += 1

if c1 >= c2:
	print(c2)
else:
    print(c1)

### FIXED CODE ###

List=input()
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for (i,j) in zip(List,a):
	if int(i) != int(j):
		c1 += 1

for (i,j) in zip(List,b):
	if int(i) != int(j):
		c2 += 1

if c1 >= c2:
	print(c2)
else:
    print(c1)
n=int(input())
a = [list(map(int,input().split()))]
count =0
while True:
  for i in range(n):
    if all(a[i]%2==0):
      all(a[i]==a[i]/2)
      count+=1
    else:
      print(count)
      break
  

### FIXED CODE ###

n=int(input())
a = list(map(int,input().split()))
count =1
 
while all(a[i]%(2**count)==0 for i in range(n)):
  count+=1
print(count-1)
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = sorted(a+b)
ans = 0
tmp = 0
for i in c:
  tmp += i
  if(tmp > k):print(ans);exit()
  ans+=1
else:print(ans)

### FIXED CODE ###

a = int(input())
print(a + a*a + a*a*a)
import math

n = int(input())
monster = sorted(list(map(int, input().split())))

for i in range(1,n):
    monster[i] = math.gcd(monster[0], monster[i])

print(min(monster))

### FIXED CODE ###

n = int(input())
monster = sorted(list(map(int, input().split())))

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

for i in range(1,n):
    monster[i] = gcd(monster[0], monster[i])

print(min(monster))
a ,b =map(int,input().split())

if (a*b)%2 ==0:
    print("Even")
else:
    print("Odd)


### FIXED CODE ###

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

if (a*b)%2 ==0:
    print("Even")
else:
    print("Odd")
for line in sys.stdin.readlines():
    a,b = map(int, line.strip().split())
    print len(str(a+b))

### FIXED CODE ###

import sys
for line in sys.stdin.readlines():
    a,b = map(int, line.strip().split())
    print len(str(a+b))
N, K = map(int, input().split())
a = list(map(int, input().split())
import collections 
def solve():
  c = list(collections.Counter(a).values())
  c.sort()
  if(len(c)<=k):
    print(0)
  else:
    print(sum(c[:len(c)-k]))
 
solve()

### FIXED CODE ###

n,k  =map(int, input().split())
A = list(map(int, input().split()))

d = {}
for a in A:
    d[a] = d.get(a, 0) + 1

if len(d) <= k:
    print(0)
else:
    d = sorted(d.values())
    cnt = 0
    for i in range(len(d)-k):
        cnt += d[i]
    print(cnt)
A,P=input().split()
print((3*A+2)//2)

### FIXED CODE ###

s,t = map(int,input().split())
f=(s*3+t)//2
print(f)
#!/usr/bin/env python3

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

if n == 1:
    print(1)
    exit(0)
if n == 2:
    if abs(a[0]-a[1]) <= 2:
        print(2)
    else:
        print(1)
    exit(0)

if n >= 3:
    d = [0 for _ in range(n)]
    for i in range(n):
        d[a[i]] += 1
    ans = 0 
    for i in range(n-2):
        tmp = d[i] + d[i+1] + d[i+2]
        if ans <= tmp:
            ans = tmp 

print(ans)


### FIXED CODE ###

#!/usr/bin/env python3

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

if n == 1:
    print(1)
    exit(0)
if n == 2:
    if abs(a[0]-a[1]) <= 2:
        print(2)
    else:
        print(1)
    exit(0)

if n >= 3:
    d = [0 for _ in range(100001)]
    for i in range(n):
        d[a[i]] += 1
    ans = 0 
    for i in range(100001-2):
        tmp = d[i] + d[i+1] + d[i+2]
        if ans <= tmp:
            ans = tmp 

print(ans)
import math
def combinations_count(n, r):
    if r == 0:
        return 1
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,k = map(int,input().split())
for i in range(k):
    ans = combinations_count(n-k+1,i+1) * combinations_count(k-1,i) % 1000000007
    print(ans)


### FIXED CODE ###

import math
def combinations_count(n, r):
    if r == 0:
        return 1
    if n<r:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,k = map(int,input().split())
for i in range(k):
    ans = combinations_count(n-k+1,i+1) * combinations_count(k-1,i) % 1000000007
    print(ans)
N = int(input())
S = input().split()
d = S[0]

for i in range(1, N-1):
  if S[i] != S[i-1]:
    d = d + S[i]
    
print(len(d))

### FIXED CODE ###

N = int(input())
S = input()
d = S[0]

for i in range(1, N):
  if S[i] != S[i-1]:
    d = d + S[i]
    
print(len(d))
import math

R = input()
print(f'{2*R*math.pi}')



### FIXED CODE ###

import math
R = int(input())

num = 2*R*math.pi
print(f'{num:.3f}')
n=int(input())
g=[[] for _ in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  g[a-1].append([b-1,i])
  g[b-1].append([a-1,i])
print(max(len(v) for v in g))
l=[0]*(n-1)
def dfs(v,p=-1,c=-1):
  k=1
  for u,e in g[v]:
    if u==p: continue
    if k==c: k+=1
    l[e]=k
    dfs(u,v,k)
    k+=1
dfs(0)
for c in l: print(c)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
n=int(input())
g=[[] for _ in range(n)]
for i in range(n-1):
  a,b=map(int,sys.stdin.readline().split())
  g[a-1].append([b-1,i])
  g[b-1].append([a-1,i])
print(max(len(v) for v in g))
l=[0]*(n-1)
def dfs(v,p=-1,c=-1):
  k=1
  for u,e in g[v]:
    if u==p: continue
    if k==c: k+=1
    l[e]=k
    dfs(u,v,k)
    k+=1
dfs(0)
for c in l: print(c)
n = int(input())
a = list(map(int,input().split()))

b = 0
for i in range(a):
    b += float(1/a[i])
print(float(1/b))

### FIXED CODE ###

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

b = 0
for i in range(n):
    b += float(1/a[i])
print(float(1/b))
import numpy as np

n, m = map(int, input().split())
is_ac = np.zeros(n, dtype=int)
wc_count = np.zeros(n, dtype=int)

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if is_ac[p - 1] == 0:
        if s == "WA":
            wc_count[p - 1] += 1
        else:
            is_ac[p - 1] = 1
print(is_ac.sum(), wc_count[is_ac].sum())


### FIXED CODE ###

import numpy as np

n, m = map(int, input().split())
is_ac = np.zeros(n, dtype=bool)
wc_count = np.zeros(n, dtype=int)

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if not is_ac[p - 1]:
        if s == "WA":
            wc_count[p - 1] += 1
        else:
            is_ac[p - 1] = True
print(is_ac.sum(), wc_count[is_ac].sum())
from sys import stdin
N, K = [int(_) for _ in stdin.readline().rstrip().split()]
H = sorted([int(_) for _ in stdin.readline().rstrip().split()], reverse=True)
if K >= N:
    print(0)
else:
    for i in range(K):
        H.pop(i)
    print(sum(H))

### FIXED CODE ###

from sys import stdin
N, K = [int(_) for _ in stdin.readline().rstrip().split()]
H = sorted([int(_) for _ in stdin.readline().rstrip().split()], reverse=True)
print(sum(H[K:]))
import sys


N = int(input())
X_bin = input()

X_int = int(X_bin, 2)  # bin => int
# popcount
X_cnt = 0
for i in X_bin:
    if i == '1':
        X_cnt += 1
dp = {1: 1}
bin_cnt = {}

sys.setrecursionlimit(10**5)


def calc_bin_cnt(next_int):
    if next_int in bin_cnt.keys():
        cnt = bin_cnt[next_int]
    else:
        next_bin = format(next_int, 'b')
        # popcount
        cnt = 0
        for i in next_bin:
            if i == '1':
                cnt += 1
    return cnt


def calc_ans(next_int, cnt=None):
    key = next_int
    if key in dp.keys():
        ans = dp[key]
    else:
        if cnt is None:
            cnt = calc_bin_cnt(next_int)
        else:
            bin_cnt[key] = cnt
        bin_cnt[next_int] = cnt
        next_int = next_int % cnt
        if next_int > 0:
            ans = calc_ans(next_int) + 1
        else:
            ans = 1
        dp[key] = ans
    return ans


for i in range(N):
    if X_bin[i] == '1':
        print(calc_ans(X_int - (2**(N-i-1)), X_cnt-1))
    else:
        print(calc_ans(X_int + (2**(N-i-1)), X_cnt+1))


### FIXED CODE ###

N = int(input())
X_bin = input()
#N = 10**5
#X_bin = '1' * N

X_int = int(X_bin, 2)  # bin => int


def calc_bin_cnt(next_int):
    if next_int == 0:
        return 0
    next_bin = bin(next_int)[2:]
    # popcount
    cnt = 0
    for i in next_bin:
        if i == '1':
            cnt += 1
    return cnt


def calc_ans(next_int, cnt=None):
    if next_cnt == 0:
        return 0
    if next_int == 0:
        return 1
    if cnt is None:
        cnt = calc_bin_cnt(next_int)
    next_int = next_int % cnt
    if next_int > 0:
        ans = calc_ans(next_int) + 1
    else:
        ans = 1
    return ans


X_cnt = calc_bin_cnt(X_int)
f_p = X_int % (X_cnt+1)
if X_cnt-1 == 0:
    f_m = 0
else:
    f_m = X_int % (X_cnt-1)
for i in range(N):
    if X_bin[i] == '1':
        next_cnt = X_cnt - 1
        if next_cnt == 0:
            next_int = 0
        else:
            next_int = f_m - pow(2, (N-i-1), next_cnt)  # マイナスでも正しく求まる？
    else:
        next_cnt = X_cnt + 1
        next_int = f_p + pow(2, (N-i-1), next_cnt)
    print(calc_ans(next_int, next_cnt))
    #calc_ans(next_cnt, next_cnt)
import sys
n = int(input().strip())
items = set()
for _ in range(n):
  items |= {sys.readline().strip()}
print(len(items))

### FIXED CODE ###

import sys
n = int(input().strip())
items = set()
for _ in range(n):
  items |= {sys.stdin.readline().strip()}
print(len(items))
import numpy as np
N = int(input())
n = N -1
print((n//2) * (2*1 + (n-1)*1))

### FIXED CODE ###

S = input()
T = input()

c = 0
for s, t in zip(S, T):
  if s == t:
    c += 1

print(c)
n, x, y = map(int, input().split())
edge = [[] for _ in range(n+1)]
dist = [[abs(i-j) for i in range(n)] for j in range(i+1,n+1)]
counter = [0 for i in range(n)]
for i in range(1, n):
    edge[i].append(i+1)
    edge[i+1].append(i)
edge[x].append(y)
edge[y].append(x)
for i in range(y+1):
    for j in range(x, n+1):
        new_dist = abs(x-i)+abs(y-j)+1
        if new_dist < dist[i][j]:
            dist[i][j] = new_dist

for i in range(1, n+1):
    for num in dist[i][1:]:
        counter[num] += 1
# print(dist)

for num in counter[1:]:
    print(num)


### FIXED CODE ###

n, x, y = map(int, input().split())
edge = [[] for _ in range(n+1)]
dist = [[abs(i-j) for i in range(n+1)] for j in range(n+1)]
counter = [0 for i in range(n)]
for i in range(1, n):
    edge[i].append(i+1)
    edge[i+1].append(i)
edge[x].append(y)
edge[y].append(x)
for i in range(y+1):
    for j in range(x, n+1):
        if j > i:
            new_dist = abs(x-i)+abs(y-j)+1
            if new_dist < dist[i][j]:
                dist[i][j] = new_dist

for i in range(1, n+1):
    for num in dist[i][i+1:]:
        counter[num] += 1
# print(dist)

for num in counter[1:]:
    print(num)
import sys
sys.setrecursionlimit(100000)
S = input()
def div(strings):
    if len(strings) == 0:
        return 0
    elif len(strings) == 1:
        return 1
    elif len(strings) == 2:
        if S[0] == S[1]:
            return 1
        else:
            return 2
    elif strings[len(strings)-1] != strings[len(strings)-2]:
        return div(strings[0:len(strings)-1]) + 1
    else:
        return div(strings[0:len(strings)-3]) + 2
print(div(S))

### FIXED CODE ###

S = input()
count = 1
i = 0
initial_length = len(S)-1
l = S[0]
S = S + '&' + '%'
while i < initial_length:
    if l == S[i+1]:
        if i == initial_length-1:
            break
        elif S[i+2] == S[i+3]:
            l = S[i+3]
            i += 3
            count += 1
        else:
            l = S[i+1:i+3]
            i += 2
    else:
        l = S[i+1]
        i += 1
    count += 1
print(count)
a, b = map(int, raw_input().split())

if a > b:
  print "a > b"
else if a == b:
  print "a == b"
else:
  print "a < b"

### FIXED CODE ###

a, b = map(int, raw_input().split())

if a > b:
  print "a > b"
elif a == b:
  print "a == b"
else:
  print "a < b"
from collections import Counter
n = int(input())
v = list(map(int,input().split()))
v1 = [v[0]]
v2 = []
for i in range(1,n):
    if i % 2 == 0:
        v1.append(v[i])
    else:
        v2.append(v[i])
c1 = Counter(v1)
c2 = Counter(v2)
mode1 = c1.most_common(1)
mode2 = c2.most_common(1)
if mode1[0][0] != mode2[0][0]:
    ans1 = len(v1)-mode1[0][1]
    ans2 = len(v2)-mode2[0][1]
    ans = ans1 + ans2
else:
    if mode1[0][1] == len(v1) and mode2[0][1] == len(v2):
       ans = min(mode1[0][1],mode2[0][1])
    elif mode1[0][1] == len(v1):
        ans1 = len(v)-mode2[0][1]
        ans2 = len(v)-mode1[0][1]-mode2[1][1]
        ans = min(ans1,ans2)
    elif mode2[0][1] == len(v2):
        ans1 = len(v)-mode1[1][1]-mode2[0][1]  
        ans2 = len(v)-mode1[0][1]
        ans = min(ans1,ans2)
    else:
        ans1 = len(v)-mode1[0][1]-mode2[1][1]
        ans2 = len(v)-mode1[1][1]-mode2[0][1]
        ans = min(ans1,ans2)
print(ans)

### FIXED CODE ###

from collections import Counter

n = int(input())

e = []
o = []
for i, v in enumerate(input().split(' ')):
    if i % 2 == 0:
        e.append(int(v))
    else:
        o.append(int(v))

if len(set(e + o)) == 1:
    print(int(len(e + o) / 2))
    exit()

if Counter(o).most_common()[0][0] == Counter(e).most_common()[0][0]:
    ans = min(len(o) - Counter(o).most_common()[1][1] + len(e) - Counter(e).most_common()[0][1], len(o) - Counter(o).most_common()[0][1] + len(e) - Counter(e).most_common()[1][1])
    print(ans)
else:
    print(len(o) - Counter(o).most_common()[0][1] + len(e) - Counter(e).most_common()[0][1])
n=int(input())
k=2019
s=map(int,list(input()))
ans=0
if k==2 or k==5:
    for i,p in enumerate(s):
        if p%k==0:
            ans+=i+1
else:
    inv10=pow(10,k-2,k)
    inv=10
    total=0
    S=[0]*k
    S[0]=1
    for i,p in enumerate(s):
        inv*=inv10
        inv%=k
        total+=p*inv
        total%=k
        ans+=S[total]
        S[total]+=1
print(ans)


### FIXED CODE ###

import sys, copy, math, heapq, bisect
from itertools import accumulate
from collections import deque, defaultdict, Counter
sys.setrecursionlimit(500000)

S = list(input())[::-1]
N = len(S)
D = [1]
for i in range(N):
    D.append(D[-1]*10%2019)
M = [(int(S[i])*D[i])%2019 for i in range(N)]
SS = [M[0]]
for i in range(1,N):
    SS.append((SS[-1]+M[i])%2019)
count = [0]*2019
for i in range(N):
    count[SS[i]] += 1

ans = 0
for c in range(len(count)):
    if c==0:
        ans += count[c]
    ans += (count[c] * (count[c] - 1)) // 2

print(ans)
for i in range(3):
    a = []
    for j in range(3):
      	a = input().split()
        a = [int(x) for x in a]
    A.append(a)
N = int(input())
C = []
for _ in range(3):
    C.append(np.zeros(3))
 
for _ in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == b: C[i][j] = 1
 
for i in range(3):
    if sum(C[:][i]) == 3:
        print('Yes')
        break
    elif sum(C[i][:]) == 3:
        print('Yes')
        break
if C[1][1]+C[2][2]+C[0][0] == 3:
    print('Yes')
elif C[0][2]+C[1][1]+C[2][0] == 3:
    print('Yes')
else: print('No')

### FIXED CODE ###

N = int(input())
print(int(N/2)+N%2)
# -*- coding: utf-8 -*-
l = []
r = []
all_gate_clear = 0
card_count = []

#numcard
N = input()
#gatenum
M = input()
#idカードの生成
for i in range(M):
    l[i],r[i] = map(int, input().split())

    
    for gate_num in range(1,M+1):
        #1ゲートの処理
        for card in range(1,N+1):
            for num in range(r[gate_num]+ 1):
                if l[gate_num] + num == card:
                    if card_count[card] == gate_num -1:
                        card_count[card] += 1
                        break

    for card in range(1,N+1):
        if card_count[card] == M:
            all_gate_clear += 1

print(all_gate_clear)

### FIXED CODE ###

# -*- coding: utf-8 -*-
l = [] 
r = []
count = 0

N, M = map(int, input().split())
l = [0] * M
r = [0] * M
for i in range(0,M):
    l[i], r[i] = map(int, input().split())

#idカードの生成
    
ml = max(l)
mr = min(r)

for i in range(1,N+1):
    if  ml <= i and i <= mr:
        count += 1

print(count)