Harryxun/stf_run huggingface dataset:
N,K = map(int,input().split())
S = input()
N = len(S)
flag = int(S[0])
S_1 = [len(x) for x in S.split('0') if len(x) is not 0]
S_0 = [len(x) for x in S.split('1') if len(x) is not 0]

count = 0
for i in range(len(S_0)-K+1):
  if flag == 0:
    if i == 0:
      tmp = 0
    else:
      tmp = S_1[i-1]
    for j in range(i,i+K):
      if j == len(S_1):
        tmp += S_0[j]
      else:
        tmp += (S_0[j] + S_1[j])
  else:
    tmp = S_1[i+K]
    for j in range(i,i+K):
      tmp += (S_1[j] + S_0[j])
    
  if tmp > count:
    count = tmp
print(count)

### FIXED CODE ###

#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate

def main():
    N, K = map(int, input().split())
    S = input()
    nums = []
    # 1の個数、0の個数を交互に記録していく
    if S[0] == '0': nums.append(0)
    i = 0
    while i < N:
        j = i
        while j < N and S[i]==S[j]:
            j += 1
        nums.append(j-i)
        i = j
    if S[-1] == '0': nums.append(0)
    # print(nums)
    nums = [0] + list(accumulate(nums))
    # print(nums)
    ans = 0
    
    for i in range(0,len(nums),2):
        # print(i)
        ans = max(ans,nums[min(i+2*K+1,len(nums)-1)]-nums[i])
    print(ans)
        

if __name__ == "__main__":
    main()
N = int(input().rstrip())
A = input().rstrip().split(" ")
a = 0
for i in range(N):
  a += 1 / int(A[i])
b = 1 / a
print(b)

### FIXED CODE ###

a = input()
a = int(a)
if a >= 3200:
  s = input()
  print(s)
else:
  print('red')
k = int(input)
a,b = map(int, input().sprit())
ans = False
for i in range(a,b+1) :
  if i%k == 0 : 
    ans = True

if ans : print('OK')
else : print('NG')
    


### FIXED CODE ###

k = int(input())
a,b = map(int,input().split())
ans = 'NG'
for i in range(a,b+1) :
  if i%k == 0 : 
    ans = 'OK'

print(ans)
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for _ in range(q)]

cntli = []
for i in range(q):
    si = s[lr[i][0]-1:lr[i][1]]
    cnt = 0
    for j in range(len(si)-1):
        if si[j] == "A":
            if si[j+1] == "C":
                cnt += 1
    else:
        cntli.append(cnt)

for p in cntli:
    print(p)


### FIXED CODE ###

b = input()
if b == "A":
    print("T")
elif b == "T":
    print("A")
elif b == "C":
    print("G")
elif b == "G":
    print("C")
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return sorted(divisors, reverse=True)


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

if N == 1:
    print(1)
    
A = sorted(A)
check_list = [0] * (10**6 + 1)

for a in A:
    check_list[a] = 1

cnt = 0
prev_val = -1
next_val = A[1]
for i in range(len(A)):
    if prev_val == A[i]:
        continue        
    prev_val = A[i]
    if len(A) - 1 != i:
        next_val = A[i + 1]
        if next_val == A[i]:
            continue
    divisors = make_divisors(A[i])[1:-1]
    check_ok = True
    for d in divisors:
       if check_list[d] == 1:
           check_ok = False
    if check_ok == True:
        cnt += 1
print(cnt)

### FIXED CODE ###

N = int(input())
A = sorted(list(map(int, input().split())))

if N == 1:
    print(1)
    exit()
    
check_list = [0] * (10**6 + 1)

cnt = 0
for i in range(len(A)):
    tmp = A[i]
    while True:
        if tmp > A[-1]:
            break
        check_list[tmp] += 1
        tmp += A[i]

for a in A:
    if check_list[a] == 1:
        cnt += 1
print(cnt)
n=int(input())
if 7 in n:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n=input()
if "7" in n:
  print('Yes')
else:
  print('No')
N=int(input())
L=list(map(int,input().split()))
count=0
0<=a<=N,0<=b<=N,0<=c<=N
for a in range(N):
    for b in range(N)
        for c in range(N)
        if L[a]>(L[b]+L[c]),L[b]>(L[a]+L[c]),L[c]>(L[b]+L[a]) a!=b, b!=c, c!=a:
            count=count+1
        else:
            continue
print(count)

### FIXED CODE ###

N=int(input())
L=list(map(int,input().split()))
count=0
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]<(L[b]+L[c]) and L[b]<(L[a]+L[c]) and L[c]<(L[b]+L[a]) and L[a]!=L[b] and L[a]!=L[c] and L[c]!=L[b] and a<b<c:
                count=count+1
            else:
                continue
print(count)
N, M = map(int,input().split())
#M 夏休み期間　M　宿題数
A = list(map(int, input().split()))
A_sum = 0
for i in range(0, n):
    A_sum += A[i]
    # A_sum 宿題全日数
x = N - A_sum
print(x)

### FIXED CODE ###

N, M = map(int,input().split())
#M 夏休み期間　M　宿題数
A = list(map(int, input().split()))
A_sum = 0
for i in range(0, M):
    A_sum += A[i]
    # A_sum 宿題全日数
x = N - A_sum
if x < 0:
    print("-1")
else:
    print(x)
import math
range2 = 17
tables = list(map(lambda x: 2.0 ** (range2-x), range(range2+1)))
 
line = input()
N , K = list(map(int, line.split(' ')))
result = 0
for i in range(N):
    dice = i + 1.0
    if dice >= K:
        result += tables[0]
        continue
    val = math.ceil(math.log2(K / dice))
    result += tables[val]
finalResult = result / N / (2**17)
print('{:.12f}'.format(finalResult))

### FIXED CODE ###

import math
range2 = 17
tables = list(map(lambda x: 2.0 ** (range2-x), range(range2+1)))
 
line = input()
N , K = list(map(int, line.split(' ')))
result = 0
for i in range(N):
    dice = i + 1.0
    if dice >= K:
        result += tables[0]
        continue
    val = math.ceil(math.log2(K / dice))
    result += tables[val]
finalResult = result / N / (2**17)
print('{:.12f}'.format(finalResult))
from sys import stdin
from collections import deque

H, W = map(int, input().split())
Si, Sj = map(int, input().split())
Gi, Gj = map(int, input().split())
maze = [input().split() for _ in range(H)]

check = [[float('inf') for i in range(W)] for j in range(H)]
walk = [(0,-1), (0,1), (-1,0), (1,0)]
qu = deque([(Si-1, Sj-1, 0)])
qu_1 = deque()
check[Si-1][Sj-1] = 0

while qu:
    i, j, cost = qu.popleft()
    qu_1.append((i, j, cost))
    #歩いて移動できるところ
    for k in range(4):
        di, dj = walk[k]
        if 0 <= i+di < H and 0 <= j+dj < W:
            if not maze[i+di][0][j+dj] == '#':
                if check[i+di][j+dj] > cost:
                    check[i+di][j+dj] = cost
                    qu.appendleft((i+di, j+dj, cost))

    if len(qu) == 0:
        #ワープで行けるところ
        while qu_1:
            i, j, cost = qu_1.popleft()
            for di in range(-2, 3):
                for dj in range(-2, 3):
                    if 0 <= i+di < H and 0 <= j+dj < W:
                        if not maze[i+di][0][j+dj] == '#':
                            if check[i+di][j+dj] > cost + 1:
                                check[i+di][j+dj] = cost + 1
                                qu.append((i+di, j+dj, cost+1))

#print(check)
if check[Gi-1][Gj-1] == float('inf'):
    print(-1)
else:
    print(check[Gi-1][Gj-1])

     






### FIXED CODE ###

import math

n, x, t = map(int, input().split())
time = math.ceil(n/x) * t
print(time)
import math

N=int(input())
l=10**9+7
nums=list(map(int,input().split()))

#k=len(str(bin(max(nums))))-2
k=int(math.log2(max(nums)))+1

mat=[]
for each in nums:
    num=str(bin(each))[2:].zfill(k)
    mat.append(list(num))
 
mat=list(zip(*mat))
ans=0
 
for i in range(k):
    b=mat[i].count("1")
    ans+=b*(N-b)*pow(2,(k-i-1),l)
print(ans%l)

### FIXED CODE ###

mod=10**9+7
N=int(input())
str_a = ''.join(['{:060b}'.format(a) for a in map(int, input().split())])

ans=0
for i in range(60):
    ones=str_a[59-i::60].count("1")
    ans+= pow( 2, i ,mod)* ones *(N-ones)
print(ans%mod)
n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[]
  y=[]
  for j in range(a):
    x,y=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
c=0
for i in range(n):
  l=[1]*n
  for j in range(i, n-i):
    if l[j]==0:continue
    for k in range(A[j]):
      #b=X[j][k]
      #l[b] *= Y[j][k]
if c<l.count(1):
  c=l.count(1) 
  
        
  
print(c)  
   

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
N, M = map(int, input().split())
ABs = [input().split() for i in range(M)]
 
 
MPs = {}
for a, b in ABs:
	a = int(a)
    b = int(b)
    if a not in MPs:
        MPs[a] = 1
    else:
        MPs[a] += 1
    if b not in MPs:
        MPs[b] = 1
    else:
        MPs[b] += 1
 
for mp in range(1, N+1):
    if mp not in MPs:
        MPs[mp] = '0'
 
for y in sorted(MPs.values()):
    print(y)

### FIXED CODE ###

from collections import defaultdict
N, M = map(int, input().split())
city_road_nums = defaultdict(int)

for _ in range(M):
    a, b = map(int, input().split())
    city_road_nums[a] += 1
    city_road_nums[b] += 1

for i in range(1, N+1):
    print(city_road_nums[i])
import numpy as np
N = int(input())
a = np.array(list(map(int, input().split())))
b = 1
for i in range(N):
    if b > 0:
        b *= a[i]
    if a[i] == 0:
        b = 0
    if b > 10**18:
        b = -1

print(b, end='')

### FIXED CODE ###

import numpy as np
N = int(input())
a = list(map(int, input().split()))
b = 1
for i in range(N):
    if b > 0:
        b *= a[i]
    if a[i] == 0:
        b = 0
    if b > 10**18:
        b = -1

print(b, end='')
a, b, c = map(int, input().split())
if a == b and b == c:
    print(1)
elif a == b or a == c:
    print(2)
else:
    print(3)

N = input().split()
d = dict.fromkeys(N, 0)
for n in N:
    d[n] += 1

print(sum(d.values())

### FIXED CODE ###

N = input().split()
num = len(set(N))
print(num)
h, w = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
ans = []
for i in range(h):
    for j in range(w):
        if a[i,j] % 2 == 0:
            continue
        elif j + 1 < w and a[i, j+1] % 2 == 1:
            a[i, j] -= 1
            a[i, j+1] += 1
            continue
            ans.append([i, j, i, j+1])
        elif i + 1 < h and a[i+1, j] % 2 == 1:
            a[i, j] -= 1
            a[i+1, j] += 1
            ans.append([i, j, i+1, j])
            continue
        elif j - 1 >= 0 and a[i, j-1] % 2 == 1:
            a[i, j] -= 1
            a[i, j-1] += 1
            ans.append([i, j, i, j-1])
            continue
        elif i - 1 >= 0 and a[i-1, j] % 2 == 1:
            a[i, j] -= 1
            a[i-1, j] += 1
            ans.append([i, j, i-1, j])
            continue
print(len(ans))
for x in ans:
    print(x[0], x[1], x[2], x[3])


### FIXED CODE ###

H, W = map(int, input().split())
A = [[0 for w in range(W)] for h in range(H)]
for h in range(H):
    A[h] = list(map(int, input().split()))
    
ans = []
for h in range(H-1):
    for w in range(W):
        if A[h][w] % 2 == 1:
            A[h][w] -= 1
            A[h+1][w] += 1
            ans.append([h+1, w+1, h+2, w+1])
            
for w in range(W-1):
    if A[H-1][w] % 2 == 1:
        A[H-1][w] -= 1
        A[H-1][w+1] += 1
        ans.append([H, w+1, H, w+2])
    
print(len(ans))
for a in ans:
    print(a[0], a[1], a[2], a[3])
import math

a, b, c = map(int, input().split())
if (c - a - b) * * 2 > 4 * a * b:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

import math

a, b, c = map(int, input().split())
if (c - a - b) ** 2 > 4 * a * b and c - a - b > 0:
    print("Yes")
else:
    print("No")
n = int(input())
if i % 2 == 1:
  print(0)
else:
  i = 10
  ans = 0
  while i <= n:
    ans += n // i
    i *= 5
  print(ans)

### FIXED CODE ###

n = int(input())
if n % 2 == 1:
  print(0)
else:
  i = 10
  ans = 0
  while i <= n:
    ans += n // i
    i *= 5
  print(ans)
nums = input(),split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
if a < b < c:
    print(a, b, c)

### FIXED CODE ###

nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
if a <= b <= c:
    print(a, b, c)
elif a <= c <= b:
    print(a, c, b)
elif b <= a <= c:
    print(b, a, c)
elif b <= c <= a:
    print(b, c, a)
elif c <= a <= b:
    print(c, a, b)
else:
    print(c, b, a)
h=int(input())
g=0
for i in range(3):
  if h[i]==1:
    g+=1
print(g)

### FIXED CODE ###

h=input()
g=0
for i in range(3):
  if h[i]=="1":
    g+=1
print(g)
import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

import numpy as np

def main():
	n,s=MI()
	A=LI()

	li=[0]*(s+10)
	li=np.array(li)
	li[0]=1
	#print(li)

	for i in A:
		tmp=li.copy()
		li*=2
		if i<n:
			li[i:]+=tmp[:s+10-i]
		li%=998244353
		#print(li)
	print(li[s])



if __name__ == "__main__":
	main()


### FIXED CODE ###

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


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

import numpy as np

def main():
	n,s=MI()
	A=LI()

	li=[0]*(3010)
	li=np.array(li)
	li[0]=1
	#print(li)

	for i in A:
		tmp=li.copy()
		li*=2
		li[i:]+=tmp[:3010-i]
		li%=998244353
		#print(li)
	print(li[s])



if __name__ == "__main__":
	main()
# -*- coding: utf-8 -*-
n = int(input())
aa = [0]
s = 0
for x in input().split():
    a = int(x)
    aa.append(aa[-1]+a)
    s += a

ret = abs(2*a[0]-s)
for i in range(1,n):
    if abs(aa[i]-(s-aa[i]))<ret:
        ret = abs(aa[i]-(s-aa[i]))

print(ret)


### FIXED CODE ###

# -*- coding: utf-8 -*-
n = int(input())
aa = [0]
s = 0
for x in input().split():
    a = int(x)
    aa.append(aa[-1]+a)
    s += a

ret = abs(2*aa[1]-s)
for i in range(1,n):
    if abs(aa[i]-(s-aa[i]))<ret:
        ret = abs(aa[i]-(s-aa[i]))

print(ret)
n , q = map(int, input().split())
tree = [[] for _ in range(n)]
point = [0] * n
for _ in range(n - 1):
    a , b = map(int,input().split())
    tree[b - 1].append(a - 1)
    tree[a - 1].append(b - 1)

for _ in range(Q):
    p , x = map(int, input().split())
    p = x - 1
    point[p] += x

# v : current node, f : parent node 
def dfs(v, f):
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

dfs(0, 0)
print(*point)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

# to enable variable use in global
global tree, point

# v : current node, f : parent node 
def dfs(v, f):
    global tree, point
    for next_v in tree[v]:
        if next_v == f:
            continue
    
        point[next_v] += point[v]
        dfs(next_v, v)

n , q = map(int, input().split())
tree = [[] for _ in range(n)]
point = [0] * n
for _ in range(n - 1):
    a , b = map(int,input().split())
    tree[b - 1].append(a - 1)
    tree[a - 1].append(b - 1)

for _ in range(q):
    p , x = map(int, input().split())
    point[p - 1] += x

dfs(0, 0)
print(*point)
A, B = map(int, input().split())
import math
c = math.ceil((B - A) / (B - 1))
print(c + 1)

### FIXED CODE ###

A, B = map(int, input().split())
import math
c = math.ceil((B - A) / (A - 1))
print(c + 1)
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
x1, x2, x3 = 0, 0, 0
for k, v in c.items():
    if v >= 4:
        if k > maxval1:
            x1 = k
    if v >= 2:
        if k > maxval1:
            x1, x2 = k, x1
        elif k > maxval2:
            x2 = k
        else:
            pass
print(max(x1*x1, x2*x3))

### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
x1, x2, x3 = 0, 0, 0
for k, v in c.items():
    if v >= 4:
        if k > x1:
            x1 = k
    if v >= 2:
        if k > x2:
            x2, x3 = k, x2
        elif k > x3:
            x3 = k
print(max(x1*x1, x2*x3))
N, K = map(int input().split())
if N % K == 0:
  print(0)
else:
  print(1)

### FIXED CODE ###

N, K = map(int, input().split())
if N % K == 0:
  print(0)
else:
  print(1)
def makelist(n, m):
    return [[0 for i in range(m)] for j in range(n)]

H, W = map(int, input().split())
board = [0]*(H+1)
for i in range(1, H+1):
    board[i] = [0] + list(map(int, input().split()))

#
ans = []
for y in range(1, H+1):
    if y % 2 == 1:
        for x in range(1, W):
            now = board[y][x]
            if now % 2 != 0:
                ans.append((y, x, y, x+1))
                board[y][x+1] += 1
        if y != H:
            now = board[y][W]
            if now % 2 != 0:
                ans.append((y, W, y + 1, W))
                board[y+1][W] += 1
    else:
        for x in reversed(range(2, W+1)):
            now = board[y][x]
            if now % 2 != 0:
                ans.append((y, x, y, x-1))
                board[y][x-1] += 1
        if y != H:
            now = board[y][1]
            if now % 2 != 0:
                ans.append((y, 1, y+1, 1))
                board[y+1][1] += 1

print(len(ans))
for (a, b, c, d) in ans:
    print(f"{a} {b} {c} {d}")


### FIXED CODE ###

def makelist(n, m):
    return [[0 for i in range(m)] for j in range(n)]

H, W = map(int, input().split())
board = [0]*(H+1)
for i in range(1, H+1):
    board[i] = [0] + list(map(int, input().split()))

#
ans = []
for y in range(1, H+1):
    if y % 2 == 1:
        for x in range(1, W):
            now = board[y][x]
            if now % 2 != 0:
                ans.append((y, x, y, x+1))
                board[y][x+1] += 1
        if y != H:
            now = board[y][W]
            if now % 2 != 0:
                ans.append((y, W, y + 1, W))
                board[y+1][W] += 1
    else:
        for x in reversed(range(2, W+1)):
            now = board[y][x]
            if now % 2 != 0:
                ans.append((y, x, y, x-1))
                board[y][x-1] += 1
        if y != H:
            now = board[y][1]
            if now % 2 != 0:
                ans.append((y, 1, y+1, 1))
                board[y+1][1] += 1

print(len(ans))
for (a, b, c, d) in ans:
    print(str(a) + " " + str(b) + " " + str(c) + " " + str(d))
n,m,k=input().split()
a=input().split()
b=input().split()
ta=0
cnta=0
while int(cnta)<int(n) and ta+int(a[cnta])<=int(k) :
    ta= ta+ int(a[cnta])
    cnta=cnta+1
tb=0
cntb=0
while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
    tb = tb+ int(b[cntb])
    cntb=cntb+1 
ans=cnta+cntb

while cnta<=0:
    ta=ta-int(a[cnta])
    cnta=cnta-1
    while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
        tb= tb+ int(b[cntb])
        cntb=cntb+1
    ans=max(ans,cnta+cntb)
print(ans)


### FIXED CODE ###

n,m,k=input().split()
a=input().split()
b=input().split()
ta=0
cnta=0
while int(cnta)<int(n) and ta+int(a[cnta])<=int(k) :
    ta= ta+ int(a[cnta])
    cnta=cnta+1
tb=0
cntb=0
while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
    tb = tb+ int(b[cntb])
    cntb=cntb+1 
ans=cnta+cntb

while cnta-1>=0:
    ta=ta-int(a[cnta-1])
    cnta=cnta-1
    while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
        tb= tb+ int(b[cntb])
        cntb=cntb+1
    ans=max(ans,cnta+cntb)
print(ans)
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
if K < 32:
    print(list[K+1])
else:
    print(list[33])

### FIXED CODE ###

list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
if K < 32:
    print(list[K-1])
else:
    print(list[31])
while True:
    a=raw_input()
    if a==0: break
    sum([int(i) for i in a])

### FIXED CODE ###

while True:
    a=str(raw_input())
    if a=="0": break
    print(sum([int(i) for i in a]))
import sys
from collections import Counter

#[(105, 3), (120, 1), (106, 1), (119, 1)]
def selection(l1, l2, x ,y):
    
    #print(x)
    #print(y)
    
    #それぞれの出現値が同じ場合
    if x >= len(l1) or y >= len(l2):
        return x - 1, y - 1
        
    if l1[x][0] == l2[y][0]:
            
        #出現回数が同じとき
        if l1[x][1] == l2[y][1]:
            x += 1
            y += 1
            return selection(l1, l2, x ,y)
            
    #出現回数を比較し、少ない方を2番目の出現値で返す
    if l1[x][1] > l2[y][1]:
        y -= 1
    else:
        x -= 1
    
    return x, y
    

def main():
    input = sys.stdin.readline
    
    n = int(input())
    m = [int(i) for i in input().split()]
    
    even = [m[i] for i, _ in enumerate(m) if i % 2 == 0]
    odd = [m[i] for i, _ in enumerate(m) if i % 2 == 1]
    
    even_c = Counter(even).most_common()
    odd_c = Counter(odd).most_common()
    
    
    x, y = selection(even_c, odd_c, 0 ,0)
    
    #全部ばらばら
    if(even_c[x][1] + odd_c[y][1] == 2):
        print(len(m) - 1)
        return
    
    #全部一緒
    if even_c[x][1] == odd_c[y][1] and even_c[x][0] == odd_c[y][0]:
        print(len(m) - even_c[x][1])
        return
    
    print( len(m) - (even_c[x][1] + odd_c[y][1]) )
    
if __name__ == '__main__':
    main()
    

### FIXED CODE ###

import sys
from collections import Counter
 
def main():
    input = sys.stdin.readline
    
    n = int(input())
    m = [int(i) for i in input().split()]
    
    #偶数列 奇数列
    even = [m[i] for i, _ in enumerate(m) if i % 2 == 0]
    odd = [m[i] for i, _ in enumerate(m) if i % 2 == 1]
    
    #頻値を取り出す
    even_c = Counter(even).most_common()
    odd_c = Counter(odd).most_common()
    
    ans = -1
    
    #print(even_c)
    #print(odd_c)
    #print(len(even_c))
    
    #最頻値の比較
    if even_c[0][0] != odd_c[0][0]:
        ans = len(m) - (even_c[0][1] + odd_c[0][1])
    
    #偶数列と奇数列の最頻値の数字が同じかつ、全て同じ数字じゃない
    elif even_c[0][0] == odd_c[0][0] and len(even_c) > 1:
        ans1 = len(m) - (even_c[0][1] + odd_c[1][1])
        ans2 = len(m) - (even_c[1][1] + odd_c[0][1])
        ans = ans1 if ans1 <= ans2 else ans2
    
    #全て同じ
    else:
        ans = even_c[0][1]
        
    #出力
    print(ans)
    
if __name__ == '__main__':
    main()