Harryxun/stf_run huggingface dataset:
# coding: utf-8
N,K=map(int,input().split())
A=list(map(int,input().split()))
MOD=10**9+7

ans=1

if K==N:
    for i in range(N):
        ans*=A[i]
        if ans>0:
            ans=ans%MOD
elif max(A)<0 and K%2==1:
    A.sort(reverse=True)
    for i in range(K):
        ans*=A[i]
        if ans>0:
            ans=ans%MOD
else:
    Ap=[]
    Am=[]
    
    for i in range(N):
        if A[i]>0:
            Ap.append(A[i])
        else:
            Am.append(A[i])
        

    Ap.sort(reverse=True)
    Am.sort()
    
    if K%2==1:
        ans*=Ap.pop(0)
    
    if len(Ap)%2==1:
        Ap.append(1)
    
    P=[]
    
    for i in range(len(Ap)//2):
        P.append(Ap[i*2]*Ap[i*2+1]%MOD)
    
    for i in range(len(Am)//2):
        P.append(Am[i*2]*Am[i*2+1]%MOD)
    
    P.sort(reverse=True)
    
    for i in range(K//2):
        ans*=P[i]
        ans=ans%MOD

print(ans%MOD)

### FIXED CODE ###

# coding: utf-8
N,K=map(int,input().split())
A=list(map(int,input().split()))
MOD=10**9+7

ans=1

if K==N:
    for i in range(N):
        ans*=A[i]
        if ans>0:
            ans=ans%MOD
elif max(A)<=0 and K%2==1:
    A.sort(reverse=True)
    for i in range(K):
        ans*=A[i]
        if ans>0:
            ans=ans%MOD
else:
    Ap=[]
    Am=[]
    
    for i in range(N):
        if A[i]>0:
            Ap.append(A[i])
        else:
            Am.append(A[i])
        

    Ap.sort(reverse=True)
    Am.sort()
    
    if K%2==1 and Ap:
        ans*=Ap.pop(0)
    
    P=[]
    
    for i in range(len(Ap)//2):
        P.append(Ap[i*2]*Ap[i*2+1])
    
    for i in range(len(Am)//2):
        P.append(Am[i*2]*Am[i*2+1])
    
    P.sort(reverse=True)
    
    for i in range(K//2):
        ans*=P[i]
        ans=ans%MOD

print(ans%MOD)
N = int(input())
nums = list(map(int, input().split()))
nodes = []
currentLeaf = 1
fail = False
#check from top
for i in range(N + 1):
	nodes.append(currentLeaf)
	currentLeaf = (currentLeaf-nums[i])*2
	if (currentLeaf < 0):
		fail = True
		break 
if (fail):
	print(-1)
#check from bottom
currentLeaf = 0
totalNode = 0
for i in reversed(range(N+1)):
	currentLeaf += nums[i]
	currentLeaf = min(currentLeaf, nodes[i])
	totalNode += currentLeaf

if (fail):
	print(-1) 
else:
	print(totalNode)

### FIXED CODE ###

N = int(input())
nums = list(map(int, input().split()))
nodes = []
currentLeaf = 1
fail = False
#check from top
for i in range(N + 1):
	nodes.append(currentLeaf)
	currentLeaf = (currentLeaf-nums[i])*2
	if (currentLeaf < 0):
		fail = True
		break 
if (fail):
	print(-1)
else:
  #check from bottom
  currentLeaf = 0
  totalNode = 0
  for i in reversed(range(N+1)):
      currentLeaf += nums[i]
      currentLeaf = min(currentLeaf, nodes[i])
      totalNode += currentLeaf

  if (fail):
      print(-1) 
  else:
      print(totalNode)
a, b = [int(i) for i in input().split()]
a = int(ab[0])
b = int(ab[1])
print(a*b, (a+b)*2)

### FIXED CODE ###

ab = input().split()
a = int(ab[0])
b = int(ab[1])
print(a*b, (a+b)*2)
input = lambda: sys.stdin.readline().rstrip("\r\n");ii = lambda: int(input());ll = lambda: list(map(int , input().split()));vv = lambda: map(int , input().split());pr = print
pl = lambda l: pr(" ".join(list(map(str,l))))
import math
def fun(n):
    tot = n * (n+1)
    tot//=2
    return

n = ii()
print(fun(n) - 3*fun(n//3) -5*fun(n//5) + 15*fun(n//15))


### FIXED CODE ###

from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:from __builtin__ import xrange as range;from future_builtins import ascii, filter, hex, map, oct, zip 

BUFSIZE = 8192;
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3: 
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n");ii = lambda: int(input());ll = lambda: list(map(int , input().split()));vv = lambda: map(int , input().split());pr = print
pl = lambda l: pr(" ".join(list(map(str,l))))
import math
def fun(n):
    tot = n * (n+1)
    tot//=2
    return tot

n = ii()
print(fun(n) - 3*fun(n//3) -5*fun(n//5) + 15*fun(n//15))
n=int(input())
a=list(map(int,input().split()))
ans=10**100
x=sum(a)
b=0
for i in a[:-1]:
   b+=i
   x-=i
   ans=min(ans,abs(x-b))
print(ans)

### FIXED CODE ###

a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
    print('Possible')
else:
    print('Impossible')
import sys
while True:
	data=list(map(int,input().split()))
	if data[0]==data[1]==data[2]==-1: break
	
	if data[0]!=-1 and data[1]!=-1:
		sum=data[0]+data[1]
	if data[2]!=-1 and sum<data[2]
		sum=data[2]
		if sum>=50:
			sum=50
		elif sum<50:
			sum=0
	if data[0]==-1 or data[1]==-1:
		print('F')
	elif sum<30 :
		print('F')
	elif 30<=sum<50:
		print('D')
	elif 50<=sum<65:
		print('C')
	elif 65<=sum<=79:
		print('B')
	elif 80<=sum:
		print('A')
		
	

### FIXED CODE ###

while True:
	data=list(map(int,input().split()))
	if data[0]==data[1]==data[2]==-1: break
	
	if data[0]!=-1 and data[1]!=-1:
		sum=data[0]+data[1]
	if data[2]!=-1 and sum<data[2]:
		if data[2]>=50:
			sum=50
		
	if data[0]==-1 or data[1]==-1:
		print('F')
	elif sum<30 :
		print('F')
	elif 30<=sum<50:
		print('D')
	elif 50<=sum<65:
		print('C')
	elif 65<=sum<=79:
		print('B')
	elif 80<=sum:
		print('A')
def main():
    N = int(input())
    A = list(map(int, input().split()))
    a0, a1, a2, b0, b1, b2 = A[0], 0, 0, A[1], 0, 0
    for a in A[2:]:
        a0, a1, a2, b0, b1, b2 = (
                b0,
                max(b1, a0),
                max(b2, a1),
                a0 + a,
                a1 + a,
                a2 + a)

    if N & 1:
        return max(b2, a1)
    else:
        return max(a0, b1)


print(main())


### FIXED CODE ###

def ff(n):
    i = 1
    r = set()
    while i * i <= n:
        if n % i == 0:
            r.add(i)
            if i != n // i:
                r.add(n // i)
        i += 1
    return sorted(r)

def main():
    N, K = map(int, input().split())
    mod = 10**9 + 7
    T = [[] for _ in range(K + 1)]
    F = [ff(i) for i in range(K + 1)]
    for i, f in enumerate(F[1:], 1):
        for j in f:
            T[j].append(i)
    r = 0
    t = [0] * (K + 1)

    for i in reversed(range(1, K + 1)):
        q = (pow(len(T[i]), N, mod) - t[i]) % mod
        for j in F[i][:-1]:
            t[j] = (t[j] + q) % mod
        r = (r + i * q) % mod

    return r

print(main())
k=int(input)
s=input()
if s.len()<=k: print(s)
else: print(s[:k]+"...")

### FIXED CODE ###

k=int(input())
s=input()
if len(s)<=k: print(s)
else: print(s[:k]+"...")
n = int(input())
dp = [[0]*3  for _ in range(n)] 
ABC = []
for _ in range(n):
    a,b,c = map(int,input().split())
    ABC.append([a,b,c])

def rec(flag,num):# flag は A=0,B=1,C=2を表す。 numは何番目かを表す。
    if dp[num][flag] != 0:
        return dp[num][flag]
    if num == 0:
        dp[num][flag] = ABC[num][flag]
        return dp[num][flag]
    else:
        res = 0
        if flag == 0:
            res = max(rec(1,num-1),rec(2,num-1))+ABC[num][flag]
        elif flag == 1:
            res = max(rec(0,num-1),rec(2,num-1))+ABC[num][flag]
        else:
            res = max(rec(1,num-1),rec(0,num-1))+ABC[num][flag]
        dp[num][flag] = res
        return dp[num][flag]

rec(0,n-1)
rec(1,n-1)
rec(2,n-1)

print(max(dp[n-1]))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

n = int(input())
dp = [[0]*3  for _ in range(n)] 
ABC = []
for _ in range(n):
    a,b,c = map(int,input().split())
    ABC.append([a,b,c])

def rec(flag,num):# flag は A=0,B=1,C=2を表す。 numは何番目かを表す。
    if dp[num][flag] != 0:
        return dp[num][flag]
    if num == 0:
        dp[num][flag] = ABC[num][flag]
        return dp[num][flag]
    else:
        res = 0
        if flag == 0:
            res = max(rec(1,num-1),rec(2,num-1))+ABC[num][flag]
        elif flag == 1:
            res = max(rec(0,num-1),rec(2,num-1))+ABC[num][flag]
        else:
            res = max(rec(1,num-1),rec(0,num-1))+ABC[num][flag]
        dp[num][flag] = res
        return dp[num][flag]

rec(0,n-1)
rec(1,n-1)
rec(2,n-1)

print(max(dp[n-1]))
MIN = -(10**7)-1

def solve():
    cnt = 0
    i = 0
    for lst in f_lst:
        chk_range = sum(lst)
        cnt += max(p_lst[i][1:chk_range])
        i += 1
    if cnt < 0:
        cnt = min(min(p_lst))
    return cnt


n = int(input())
f_lst = [[] for _ in range(n)]
p_lst = [[] for _ in range(n)]
for i in range(n):
    f_lst[i].extend(map(int,input().split()))
for i in range(n):
    p_lst[i].extend(map(int,input().split()))

ans = solve()
print(ans)


### FIXED CODE ###

n = int(input())
f = [list(map(int,input().split())) for _ in range(n)]
p = [list(map(int,input().split())) for _ in range(n)]
res = -float('inf')
for i in range(1,1<<10):
    cnt = [0 for _ in range(n)]
    for j in range(10):
        for k in range(n):
            if (i>>j)&1 and f[k][10-j-1]:
                cnt[k] += 1
    total = 0
    for k in range(n):
        total += p[k][cnt[k]]
    res = max(res,total)
print(res)
n = int(input())
S = list(map(int, input().split()))
SENTINEL = 10 ** 9 + 1
count = 0

def merge(S, left, mid, right):
    n1 = mid - left
    n2 = right - mid
    L = S[left:mid] + [SENTINEL]
    R = S[mid:right] + [SENTINEL]
    for i in range(n1):
        L[i] = S[left + i]
    for i in range(n2):
        R[i] = S[mid + i]
    L[n1] = R[n2] = SENTINEL
    i = j = 0
    for k in range(left, right):
        count += 1
        if(L[i] <= R[i]):
            S[k] = L[i]
            i += 1
        else:
            S[k] = R[j]
            j += 1

mergeSort(S, left, right):
    if(left + 1 < right):
        mid = (left + right) // 2
        mergeSort(S, left, mid)
        mergeSort(S, mid, right)
        merge(S, left, mid, right)

mergeSort(S, 0, n)
print(*S)
print(count)

### FIXED CODE ###

n = int(input())
S = list(map(int, input().split()))
SENTINEL = 10 ** 9 + 1
count = 0
 
def merge(S, left, mid, right):
    L = S[left:mid] + [SENTINEL]
    R = S[mid:right] + [SENTINEL]
    i = j = 0
    global count
    for k in range(left, right):
        count += 1
        if (L[i] <= R[j]):
            S[k] = L[i]
            i += 1
        else:
            S[k] = R[j]
            j += 1
 
def mergeSort(S, left, right):
    if(left + 1 < right):
        mid = (left + right) // 2
        mergeSort(S, left, mid)
        mergeSort(S, mid, right)
        merge(S, left, mid, right)
 
mergeSort(S, 0, n)
print(*S)
print(count)
k=int(input())
print(int(n/2))k=int(input())
if n%2==0:
  print(int((n/2)*(n/2)))
else:
  print(int(n/2)*(int(n/2)+1))

### FIXED CODE ###

n=int(input())
if n%2==0:
  print(int((n/2)*(n/2)))
else:
  print(int(n/2)*(int(n/2)+1))
import sys
x, y = sys.stdin()
z=x*y
a=(x+y)*2
print(z,a)

### FIXED CODE ###

x = map(int,raw_input().split())
z=x[0]*x[1]
a=(x[0]+x[1])*2
print z,a
import numpy as np

N, M = map(int, input().split())
a = np.array(list(map(int, input().split())))

if N == 1:
    for i in range(M):
        a //= 2
    print(a[0])
    exit()

a.sort()
cur = M - 1
for i in range(M):
    if i == 0:
        a[-1] //= 2
    else:
        if (a[cur-1] > a[cur]):
            cur -= 1
            a[a[cur:].argmax()] //= 2
        else:
            a[-1] //= 2
print(sum(a))

### FIXED CODE ###

import heapq

N, M = map(int, input().split())
a = list(map(int, input().split()))

q = []
for i in range(N):
    # 最も大きい値を取り出して1/2したいので、ここで反転させておき、最終的に足す時に戻す
    heapq.heappush(q, -a[i])
for i in range(M):
    l = heapq.heappop(q)
    heapq.heappush(q, -(-l//2))
print(-sum(q))
n, K = map(int, input().split())
a = list(map(int, input().split()))

MAX = 40

k = [0 for _ in range(MAX)]
c = [0 for _ in range(MAX)]
b = [0 for _ in range(MAX)]
v = [[0 for _ in range(MAX)] for _ in range(2)]

d = 0
while K > 0:
    if K % 2 == 1:
        k[d] = 1
    d += 1
    K //= 2

for p in a:
    counter = 0
    while p > 0:
        if p % 2 == 1:
            c[counter] += 1
        counter += 1
        p //= 2

temp = 1
for i in range(MAX):
    if c[i] > n - c[i]:
        b[i] = 0
        v[0][i] = temp * c[i]
        v[1][i] = temp * (n - c[i])
    else:
        b[i] = 1
        v[0][i] = temp * c[i]
        v[1][i] = temp * (n - c[i])

    temp *= 2

#print(c)
#print(k)
#print(b)
#print(v[0])
#print(v[1])

ans = 0
for i in range(d, -1, -1):
    if k[i] == 0:
        continue

    temp_ans = 0
    for j in range(i+1, MAX):
        temp_ans += v[k[j]][j]

    temp_ans += v[0][i]

    for j in range(i):
        temp_ans += v[b[j]][j]

    #print(i, temp_ans)

    ans = max(ans, temp_ans)

print(ans)


### FIXED CODE ###

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

MAX = 41

k = [0 for _ in range(MAX)]
c = [0 for _ in range(MAX)]
b = [0 for _ in range(MAX)]
v = [[0 for _ in range(MAX)] for _ in range(2)]

K = input_k + 1
d = 0
while K > 0:
    if K % 2 == 1:
        k[d] = 1
    d += 1
    K //= 2

for p in a:
    counter = 0
    while p > 0:
        if p % 2 == 1:
            c[counter] += 1
        counter += 1
        p //= 2

temp = 1
for i in range(MAX):
    if c[i] > n - c[i]:
        b[i] = 0
    else:
        b[i] = 1
    v[0][i] = temp * c[i]
    v[1][i] = temp * (n - c[i])
    temp *= 2

if input_k == 0:
    print(sum(v[0]))
    exit()

ans = 0
for i in range(MAX - 1, -1, -1):
    if k[i] == 0:
        continue

    temp_ans = 0
    for j in range(i+1, MAX):
        temp_ans += v[k[j]][j]

    temp_ans += v[0][i]

    for j in range(i):
        temp_ans += v[b[j]][j]

    #print(i, temp_ans)
    ans = max(ans, temp_ans)

print(ans)
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
import numpy as np
def resolve():
    N, M, K = map(int, input().split())
    fri = np.zeros((N, N), np.int64)
    for i in range(M):
        a, b = map(int, input().split())
        fri[a-1][b-1] = 1
        fri[b-1][a-1] = 1
    blo = np.zeros((N, N), np.int64)
    for i in range(K):
        c, d = map(int, input().split())
        blo[c-1][d-1] = 1
        blo[d-1][c-1] = 1

    can = np.zeros((N, N), np.int64)
    for i in range(N):
        vis = [False for _ in range(N)]
        s = [i]
        while len(s) > 0:
            v = s.pop()
            vis[v] = True
            for j, k in enumerate(fri[v]):
                if vis[j] or k == 0:
                    continue
                s.append(j)
                if fri[i][j] != 1 and blo[i][j] != 1 and can[i][j] == 0:
                    can[i][j] = 1
    ans = []
    for i in range(N):
        ans.append(can[i].sum())
    print(*ans, sep=' ')
resolve()

### FIXED CODE ###

import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

def resolve():
    N, M, K = lr()
    uf = UnionFind(N)
    fr = [0]*N
    for i in range(M):
        a, b = lr()
        uf.union(a-1, b-1)
        fr[a-1] += 1
        fr[b-1] += 1
    ans = [uf.size(x) - fr[x] - 1 for x in range(N)]
    for i in range(K):
        c, d = lr()
        if uf.same(c-1, d-1):
            ans[c-1] -= 1
            ans[d-1] -= 1
    print(*ans, sep=' ')
resolve()
# -*- coding: utf-8 -*-

def move(S, before_a, before_b, a_index, b_index, g_a, g_b):
    if (len(S)>a_index and len(S) > b_index)==False:
        return -1
    if S[a_index]=='#' or S[a_index]=='B':
        return 0
    elif S[b_index]=='#' or S[b_index]=='A':
        return 0
    if a_index==g_a and b_index==g_b:
        return 100
    S[before_a] = '.'
    S[before_b] = '.'

    S[a_index] = 'A'
    S[b_index] = 'B'
    rr1 = 0
    rr2 = 0
    rr3 = 0
    rr4 = 0
    if len(S)>a_index:
        rr1 = move(S, a_index, b_index, a_index+1, b_index, g_a, g_b)
    if len(S)-1>a_index:
        rr2 =  move(S, a_index, b_index, a_index+2, b_index, g_a, g_b)
    if len(S)>b_index:
        rr3 = move(S, a_index, b_index, a_index, b_index+1, g_a, g_b)
    if len(S)-1>b_index:
        rr4 = move(S, a_index, b_index, a_index, b_index+2, g_a, g_b)
    return max([rr1,rr2,rr3,rr4])
#    return 1

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

S = list(input())

S[A-1] = 'A'
S[B-1] = 'B'

a_index = A-1
b_index = B-1

if len(S)>a_index:
    r1 = move(S, a_index, b_index, a_index+1, b_index, C-1, D-1)
if len(S)-1>a_index:
    r2 = move(S, a_index, b_index, a_index+2, b_index, C-1, D-1)
if len(S)>b_index:
    r3 = move(S, a_index, b_index, a_index, b_index+1, C-1, D-1)
if len(S)-1>b_index:
    r4 = move(S, a_index, b_index, a_index, b_index+2, C-1, D-1)


if r1==100 or r2==100 or r3==100 or r4==100:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

#!/usr/bin/env python3

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

#hunuke

h = S[A-1:D+1].count('##')
m3 = S[B-2:D+1].count('...')

if C < D:
    if h == 0: print('Yes')
    else: print('No')
else:
    if m3 != 0 and h == 0:
        print('Yes')
    else: print('No')
import numpy as np
a = int(input())
sum = 0
for i in range(a):
  bb = int(input())
  sum += b
np.reciprocal(sum)
np.reciprocal(sum)
print(sum)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
sam = 0
for i in range(N):
  sam += A[i]**-1
print(sam**-1)
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

# bを読むのにかかる時間
t = 0

for i in range(m):
    t += b[i]

# bを全部読む
j = m
ans = 0

for i in range(n+1):
    # bで読む本を1冊ずつ諦めていく
    while j > 0 and t > k:
        j -= 1
        t -= b[i]
    
    # 諦められる本すらない場合
    if t > k:
        break

    ans = max(ans, i+j)
    
    # 配列外参照を防ぐ
    if i == n:
        break
    
    # aで読む本を1冊増やす
    t += a[i]

print(ans)




### FIXED CODE ###

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

a, b = [0], [0]

# 累積和を求める
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans = 0
# bを全部読む
j = M

for i in range(N + 1):
    # aは0冊から始まる
    if a[i] > K:
        break

    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
    
    
print(ans)
n,k=map(int,input().split())
s=input()
a=[]
a.append(0)
tmp=1
for i in range(len(s)-1):
	if s[i] != s[i+1]:
		a.append(i+1)
a.append(n)

#print(a)

if len(a)==2:
	print(a[1])
else:
	if s[0]=='0':
		m=2*k
	else:
		m=2*k+1
	_max=a[m]
	i=1
	while m+i<len(a):
		tmp=a[i+m]-a[i]
		print(tmp)
		if tmp>_max:
			_max=tmp
		i+=1
	print(_max)


### FIXED CODE ###

n,k=map(int,input().split())
s=input()
a=[]
a.append(0)
for i in range(len(s)-1):
	if s[i] != s[i+1]:
		a.append(i+1)
a.append(n)
if s[-1]=='0':
	m=2*k
else:
	m=2*k+1
t=4*k+1
_max=0
i=len(a)-1
if i- m<0:
	print(n)
else:
	while i-m>=0:
		tmp=a[i]-a[i-m]
		#print('i:{} tmp:{}'.format(i,tmp))
		if tmp>_max:
			_max=tmp
		m=t-m
		i-=1
	if a[i]>_max:
		_max=a[i]
	print(_max)
O = input()
E = input()
s = ""
if len(O)>len(S):
  for i in range(len(S)):
    s = s + O[i] + E[i]
  print(s + O[len(O)-1])
else:
  for i in range(len(S)):
    s = s + O[i] + E[i]
  print(s)

### FIXED CODE ###

O = input()
E = input()
s = ""
if len(O)>len(E):
  for i in range(len(E)):
    s = s + O[i] + E[i]
  print(s + O[len(O)-1])
else:
  for i in range(len(E)):
    s = s + O[i] + E[i]
  print(s)
# coding: utf-8
import math

def main():
    a, b = input().split()
    a, b = int(a), int(b)

    if b > a:
        a, b = b, a

    gcd = math.gcd(a, b)
    relative_primes = []
    for i in range(2, gcd+1):
        if gcd % i > 0:
            continue
            
        flg = True
        for rp in relative_primes:
            if i % rp == 0:
                flg = False
                continue
        if flg:
            relative_primes.append(i)
    print(len(relative_primes)+1)
    

main()

### FIXED CODE ###

# coding: utf-8

def greatest_common_divisor(N, M):
    assert N >= M
    while M != 0:
        N, M = M, N%M
    return N

def prime_divisor(N):
    temp = N
    for n in range(2, int(-(-N**0.5//1))+1):
        if temp % n == 0:
            while temp % n == 0:
                temp //= n
            yield n
    if temp != 1:
        yield temp
        

def main():
    a, b = input().split()
    a, b = int(a), int(b)

    if a > b:
        a, b = b, a

    gcd = greatest_common_divisor(b, a)
    pdiv = [pd for pd in prime_divisor(gcd)]
    print(len(pdiv)+1)

main()
from collections import defaultdict

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

if N == 2:
    if V[0] == V[1]:
        print(0)
    else:
        print(1)
    exit()

d_even = defaultdict(int)
d_odd = defaultdict(int)

for i in range(N):
    v = V[i]
    if i % 2 == 0:
        d_even[v] += 1
    else:
        d_odd[v] += 1

l_even = sorted(d_even.items(), key=lambda x: -x[1])
l_odd = sorted(d_odd.items(), key=lambda x: -x[1])

if l_even[0][0] != l_odd[0][0]:
    print(N - l_even[0][1] - l_odd[0][1])
else:
    ans1 = N - l_even[0][1] - l_odd[1][1]
    ans2 = N - l_even[1][1] - l_odd[0][1]
    print(min(ans1, ans2))


### FIXED CODE ###

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

vo = [0]*(10**5+1)
ve = [0]*(10**5+1)

for i in range(n):
    if i % 2 == 0:
        vo[v[i]] += 1
    else:
        ve[v[i]] += 1

if vo.index(max(vo)) == ve.index(max(ve)):
    ans1 = sum(vo) - max(vo) + sum(ve) - sorted(ve)[-2]
    ans2 = sum(vo) - sorted(vo)[-2] + sum(ve) - max(ve)
    print(min(ans1, ans2))
else:
    print(sum(vo) - max(vo) + sum(ve) - max(ve))