Harryxun/stf_run huggingface dataset:
def factorization(n):
    arr = {}
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr[i] = cnt

    if temp!=1:
        arr[temp] = 1

    if not arr:
        arr[n] = 1

    return arr

import math

n, m = map(int, input().split())
a = list(map(int, input().split()))
# a2 = [num//2 for num in a]
acount = [None]*n # aを2で割れる回数
anum = [None]*n # 割ったあとの残り(=奇数)
for i,num in enumerate(a):
    c = 0
    while num%2==0:
        num //=2
        c += 1
    acount[i] = c
    anum[i] = num
if all(item==acount[0] for item in acount):
    cc = {}
    lcm = anum[0]
    for num in anum[1:]:
        g = math.gcd(lcm, num)
        lcm = lcm * num / g
    num0 = lcm * (pow(2, (acount[0]-1)))
    span = num0*2
    if m<num0:
        print(0)
    else:
        print(int((m-num0)//span + 1))
else:
    print(0)

### FIXED CODE ###


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

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

def lcms(a):
    l = a[0]
    for num in a[1:]:
        l = lcm(l, num)
    return l

n, m = map(int, input().split())
a = list(map(int, input().split()))
# a2 = [num//2 for num in a]
acount = [None]*n # aを2で割れる回数
anum = [None]*n # 割ったあとの残り(=奇数)
for i,num in enumerate(a):
    c = 0
    while num%2==0 and num>1:
        num //=2
        c += 1
    acount[i] = c
    anum[i] = num
if all(item==acount[0] for item in acount):
    l = lcms(anum)
    num0 = l * (pow(2, (acount[0]-1)))
    span = num0*2
    if m<num0:
        print(0)
    else:
        print(int((m-num0)//span + 1))
else:
    print(0)
from collections import deque


H,W=map(int,input().split())
A=[list(input()) for _ in range(H)]   # (i,j) = A[i][j]
seen = [[False] * W for _ in range(H)] 
queue = collections.deque([])

for i in range(H):
    for j in range(W):
        if A[i][j]=='#':
            queue.append((i,j,0))
            seen[i][j]=True

while queue:
    i,j,k=queue.popleft()
    if i!=0   and seen[i-1][j] == False: 
        queue.append((i-1,j,k+1))
        seen[i-1][j]=True
    if i!=H-1 and seen[i+1][j] == False:
        queue.append((i+1,j,k+1))
        seen[i+1][j]=True
    if j!=0   and seen[i][j-1] == False:
        queue.append((i,j-1,k+1))
        seen[i][j-1]=True
    if j!=W-1 and seen[i][j+1] == False:
        queue.append((i,j+1,k+1))
        seen[i][j+1]=True

print(k)


### FIXED CODE ###

import numpy as np
import sys
# 距離K以内にxが居ない
# xからの距離を測る

buf = sys.stdin.buffer
R,C = map(int,buf.readline().split())
black = np.zeros((R+2,C+2),dtype=np.bool)
black[1:-1,1:] = (np.frombuffer(buf.read(R*(C+1)),dtype='S1') == b'#').reshape(R,C+1)

INF = 10 ** 9
dist = np.zeros((R,C),dtype=np.int32)
dist[~black[1:-1,1:-1]] = INF

for n in range(1,R):
  np.minimum(dist[n-1]+1,dist[n],out=dist[n])
for n in range(R-2,-1,-1):
  np.minimum(dist[n+1]+1,dist[n],out=dist[n])

for n in range(1,C):
  np.minimum(dist[:,n-1]+1,dist[:,n],out=dist[:,n])
for n in range(C-2,-1,-1):
  np.minimum(dist[:,n+1]+1,dist[:,n],out=dist[:,n])

answer = dist.max()
print(answer)
def is_prime(x):
  if x <= 1:
    return False
  max_judge = sqrt(x)
  count = 2
  while(count < max_judge):
    if x % count == 0:
      return True
  return False

x = int(input())

judge_prime = False
while(!judge_prime):
  judge_prime = is_prime(x)
  
return x

### FIXED CODE ###

import math

def is_prime(x):
  if x <= 1:
    return False
  max_judge = math.sqrt(x)
  count = 2
  while(count < max_judge):
    if x % count == 0:
      return False
    count+=1
  return True
 
x = int(input())
 
judge_prime = False

while(True):
  if is_prime(x):
    break
  x+=1

print(x)
x,n = map(int, input().split())
valid = [1] *101
p = list(map(int, input().split()))
for i in range(n):
	valid[p[i]] = 0

for j in range(x):
	#print(x,j,x-j,x+j)
	if(valid[x-j] == 1):
		print(x-j)
		break
	elif(valid[x+j] == 1):
		print(x+j)
		break


### FIXED CODE ###

x,n = map(int, input().split())
valid = [1] *101
p = list(map(int, input().split()))
for i in range(n):
	valid[p[i]] = 0

#print(valid)

for j in range(100):
#	print(x,j,x-j,x+j)
#	print(valid[x-j])
#	print(valid[x+j])
	if((x-j) >= 1):
		if(valid[x-j] == 1):
			print(x-j)
			break
	else:
		print(0)
		break
	if((x+j) <= 100):
#		print("aaa")
		if(valid[x+j] == 1):
			print(x+j)
			break
	else:
		print(101)
		break
i=0
while i<1000:
   print "Hello World"
   i++ 

### FIXED CODE ###

i=0
while i<1000:
   print "Hello World"
   i+=1
a = int(input())
b = int(input())
if a % 2 == 0 or 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")
def Search(n):
  L[n-1] = 1
  for i in R[n]:
    if L[i-1] == 0:
      Search(i)

N, M = map(int, input().split())
L = [1] * N
R = {}
ans = -1
for i in range(M):
  A, B = map(int, input().split())
  if A not in R:
    R[A] = set()
  if B not in R:
    R[B] = set()
  R[A].add(B)
  R[B].add(A)
  L[A-1] = 0
  L[B-1] = 0
for i in range(N):
  if L[i] == 1:
    ans += 1
    R[i+1] = set()
    if i == 0:
      R[i+1].add(2)
      R[2].add(i+1)
    else:
      R[i+1].add(1)
      R[1].add(i+1)
    L[i] = 0
while sum(L) != N:
  ans += 1
  Search(L.index(0) + 1)
print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
L = [0] * N
D = {}
c = 1
for i in range(M):
  A, B = map(int, input().split())
  if L[A - 1] == L[B - 1] == 0:
    D[c] = set()
    D[c].add(A)
    D[c].add(B)
    L[A - 1] = c
    L[B - 1] = c
    c += 1
  elif L[A - 1] == 0:
    D[L[B - 1]].add(A)
    L[A - 1] = L[B - 1]
  elif L[B - 1] == 0:
    D[L[A - 1]].add(B)
    L[B - 1] = L[A - 1]
  elif L[A - 1] != L[B - 1]:
    if len(D[L[A - 1]]) < len(D[L[B - 1]]):
      A, B = B, A
    D[L[A - 1]] |= D[L[B - 1]]
    for j in D.pop(L[B - 1]):
      L[j - 1] = L[A - 1]
  #print(L, D, sep = "\n")
print(len(D) + L.count(0) - 1)
from math import gcd

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

lgcd, rgcd = [], []
for i in range(n):
    if i == 0:
        lgcd.append(a[0])
        rgcd.append(a[n-1])
        continue

    lgcd.append(gcd(lgcd[i-1], a[i]))
    rgcd.append(gcd(rgcd[i-1], a[-1-i]))

maxgcd = 1
for i in range(n):
    if i == 0:
        tempgcd = rgcd[n-1]
    elif i == n-1:
        tempgcd = lgcd[n-1]
    else:
        tempgcd = gcd(lgcd[i-1], rgcd[n-2-i])
    maxgcd = max(maxgcd, tempgcd)
print(maxgcd)
        

### FIXED CODE ###

from fractions import gcd

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

lgcd, rgcd = [], []
for i in range(n):
    if i == 0:
        lgcd.append(a[0])
        rgcd.append(a[n-1])
        continue

    lgcd.append(gcd(lgcd[i-1], a[i]))
    rgcd.append(gcd(rgcd[i-1], a[-1-i]))

maxgcd = 1
for i in range(n):
    if i == 0:
        tempgcd = rgcd[n-2]
    elif i == n-1:
        tempgcd = lgcd[n-2]
    else:
        tempgcd = gcd(lgcd[i-1], rgcd[n-2-i])
    maxgcd = max(maxgcd, tempgcd)
print(maxgcd)
# -*- coding : utf-8 -*-

S = str(input())

w = ""
for i in range(len(S)):
  if S[i] = "B":
    if w != "":
      w = ""
    else :
      w = w.rstrip()
  else:
    w + S[i]

print(w)


### FIXED CODE ###

# -*- coding : utf-8 -*-

S = str(input())

w = ""

for i in range(len(S)) :
  if S[i] == "B" :
    if w == "":
      w = ""
    else :
      w = w[:-1]
  else :
    w = w + S[i]
    
print(w)
def sigma(n):
    if n <= 1:
        return n
    else:
        return n + sigma(n-1)


N = int(input())
s = [input() for i in range(N)]

s_sorted = list(map(''.join, list(map(sorted, s))))

s_dict = dict()
for k in s_sorted:
    if k in s_dict:
        s_dict[k] += 1
    else:
        s_dict[k] = 1

cnt = 0
for k in s_dict:
    cnt += sigma(s_dict[k] - 1)

print(cnt)


### FIXED CODE ###

N = int(input())
s = [input() for i in range(N)]

s_sorted = list(map(''.join, list(map(sorted, s))))

s_dict = dict()
for k in s_sorted:
    if k in s_dict:
        s_dict[k] += 1
    else:
        s_dict[k] = 1

cnt = 0
for k in s_dict:
    cnt += sum(range(s_dict[k]))

print(cnt)
a,b =input().split()

d={'H':0, 'D':1}
print(['H','D'][d[a]^d[b]]

### FIXED CODE ###

a,b =input().split()

d={'H':0, 'D':1}
print(['H','D'][d[a]^d[b]])
# coding: cp932
A=input('数字を入力＞')
op=raw_input('＋又はーを入力＞')
B=input('数字を入力>')
if op == '+':
    print(int(A)+int(B))
else:
    print(int(A)-int(B))

### FIXED CODE ###

# -*- coding: utf-8 -*-

a, op, b = input().split()

if op == '+':
    print(int(a) + int(b))
else:
    print(int(a) - int(b))
h,w,k = map(int, input().split())
s = [list(input()) for _ in range(h)]

ans = []
n = 1
cnt = 0
for i in range(h):
    if "#" in s[i]:
        ans = []
        for s[i][j] == "#":
            for _ in range(j+1-len(ans)):
                ans.append(str(n))
            n += 1
        if len(ans) < w:
            x = ans[-1]
            for _ in range(w-len(ans)):
                ans.append(x)
    if ans:
        for _ in range(i+1-cnt):
            print(" ".join(ans))
            cnt += 1

### FIXED CODE ###

h,w,k = map(int, input().split())
S = [list(input()) for _ in range(h)]
ans = []
n = 1
cnt = 0
for i in range(h):
    if "#" in S[i]:
        ans = []
        for j in range(w):
            if S[i][j] == "#":
                for _ in range(j+1-len(ans)):
                    ans.append(str(n))
                n += 1
        if len(ans) < w:
            x = ans[-1]
            for _ in range(w-len(ans)):
                ans.append(x)
    if ans:
        for _ in range(i+1-cnt):
            print(" ".join(ans))
            cnt += 1
n=int(input())
s=list(input())
w=0
for i in s:
    if i=='.':
        w+=1
b=n-a
if s[-1]=='#':
    print(min(w,b-1))
else:
    print(min(w,b))

### FIXED CODE ###

n=int(input())
s=list(input())
rw=[0]*(n+1)
lb=[0]*(n+1)
for i in range(n):
    if s[i]=='#':
        lb[i+1]=lb[i]+1
    else:
        lb[i+1]=lb[i]
for i in range(n):
    if s[n-i-1]=='.':
        rw[n-i-1]=rw[n-i]+1
    else:
        rw[n-i-1]=rw[n-i]
ans=100000000000
for i in range(n+1):
    ans=min(ans,lb[i]+rw[i])
print(ans)
import collections
N = int(input())
xy = [[int(i) for i in input().split()] for _ in range(N)]

diff = []

for i in range(N):
    for j in range(N):
        if i == j:
            continue
        else:
            if xy[i][0] > xy[j][0]:
                diff.append((xy[i][0] - xy[j][0], xy[i][1] - xy[j][1]))
            elif xy[i][0] == xy[j][0] and xy[i][1] >= xy[j][1]:
                diff.append((xy[i][0] - xy[j][0], xy[i][1] - xy[j][1]))
            elif xy[i][0] == xy[j][0] and xy[i][1] < xy[j][1]:
                diff.append((xy[j][0] - xy[i][0], xy[j][1] - xy[i][1]))
            else:
                diff.append((xy[j][0] - xy[i][0], xy[j][1] - xy[i][1]))
c = collections.Counter(diff)
ans = N - sorted(list(c.values()))[-1] // 2
print(ans)


### FIXED CODE ###

import collections
N = int(input())
xy = [[int(i) for i in input().split()] for _ in range(N)]

diff = []

for i in range(N):
    for j in range(N):
        if i == j:
            continue
        else:
            if xy[i][0] > xy[j][0]:
                diff.append((xy[i][0] - xy[j][0], xy[i][1] - xy[j][1]))
            elif xy[i][0] == xy[j][0] and xy[i][1] >= xy[j][1]:
                diff.append((xy[i][0] - xy[j][0], xy[i][1] - xy[j][1]))
            elif xy[i][0] == xy[j][0] and xy[i][1] < xy[j][1]:
                diff.append((xy[j][0] - xy[i][0], xy[j][1] - xy[i][1]))
            else:
                diff.append((xy[j][0] - xy[i][0], xy[j][1] - xy[i][1]))

if N == 1:
    ans = 1
else:
    c = collections.Counter(diff)
    ans = N - sorted(list(c.values()))[-1] // 2
print(ans)
r,g=[int(input()) for i range(2)]
print(g*2-r)

### FIXED CODE ###

r,g=[int(input()) for i in range(2)]
print(g*2-r)
N, M = map(int, input().split())
i = 1
lis = []
while M//i>=N and i<M**0.5:
  if M % i == 0:
    lis.append(i)
  i += 1
print(lis[-1])

### FIXED CODE ###

N, M = map(int, input().split())
i = 1
lis = []
while M//i>=N and i<=M**0.5:
  if M % i == 0:
    lis.append(i)
  i += 1
for l in lis[::-1]:
  ans = M//l
  if M//ans>=N:
    lis.append(ans)
print(lis[-1])
W=int(input())
H=int(input())
x=int(input())
y=int(input())
r=int(input())
if x-r<0||y-r<0||x+r>W||y+r>H :
    print("NO")
else:
    print("NO")



### FIXED CODE ###

W,H,x,y,r=map(int,input().split())
if x-r<0 or y-r<0 or x+r>W or y+r>H :
    print("No")
else:
    print("Yes")
import sys
import numpy as np
import math

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

for i in range(M):
    A[i] = int(input())


# a が連続しているとだめ
for i in range(M-1):
    if A[i] == A[i+1]-1:
        print(0)
        sys.exit()

# 穴同士の間隔を考えて，積を取る
d = np.zeros(M+1)

for i in range(M-1):
    d[i+1] = A[i+1] - A[i] - 2

d[0] = A[0] - 1
d[-1] = N - A[-1] - 1


p = np.zeros(M+1)

for i in range(M+1):

    n = int(d[i] // 2)

    for j in range(1,n+1):
        # 2の数 j個
        # 1の数 n1 = d - 2j
        n1 = d[i] - 2*j
        pp = math.factorial(n1+j)/(math.factorial(j) * math.factorial(n1))
        p[i] += pp

    p[i] += 1

mm = 1000000007
p = p % mm

print(int(np.prod(p) % mm))

### FIXED CODE ###

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

if N == 1:
    if M == 0:
        print(1)
    elif M == 1:
        print(0)
else:
    cost = [0 for _ in range(N + 1)]
    cost[0] = 1

    cnt = 0
    A.append([0])
    for i in range(1, N + 1):
        if i == A[cnt]:
            cost[i] = 0
            cnt += 1
        else:
            cost[i] = (cost[i - 1] + cost[i - 2]) % q

    print(cost[-1])
s=input()
n=len(s)
a=str()
b=str()
k='keyence'
l='ecneyek'
for i in range(n):
  if a+s[i] in k:
    a+=s[i]
    j=i
  else:
    break
for i in range(6-j):
  if b+s[n-i-1] in l:
    b+=s[n-i-1]
  else:
    break
if a+b[::-1]==k or a==k or b[::-1]==k:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

s=input()
n=len(s)
a=str()
b=str()
k='keyence'
l='ecneyek'
j=0
for i in range(n):
  if a+s[i] in k:
    a+=s[i]
    j=i+1
  else:
    break
for i in range(7-j):
  if b+s[n-i-1] in l:
    b+=s[n-i-1]
  else:
    break
if a+b[::-1]==k:
  print('YES')
else:
  print('NO')
import math
import random
from operator import itemgetter
import re
import sys
from itertools import accumulate
from collections import defaultdict
from collections import deque
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
X,Y = map(int,input().split())
if X+Y == 2:
    print(1000000)
elif X+Y == 3:
    print(500000)
elif X+Y == 4:
    print(400000)
elif X == 3 or Y == 3:
  	if X == 2 or Y == 2:
    	print(300000)
    elif X == 3 and Y == 3:
      	print(200000)
    else:
    	print(100000)
elif X == 2 or Y ==2:
    print(200000)
elif X == 1 or Y == 1:
    print(300000)
else:
    print(0)

### FIXED CODE ###

import math
import random
from operator import itemgetter
import re
import sys
from itertools import accumulate
from collections import defaultdict
from collections import deque
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
X,Y = map(int,input().split())
if X+Y == 2:
    print(1000000)
elif X+Y == 3:
    print(500000)
elif X+Y == 4:
    print(400000)
elif X == 3 or Y == 3:
    if X == 2 or Y == 2:
        print(300000)
    elif X == 3 and Y == 3:
        print(200000)
    else:
        print(100000)
elif X == 2 or Y ==2:
    print(200000)
elif X == 1 or Y == 1:
    print(300000)
else:
    print(0)
S = input()
N = len(S)
i = list(S)
if i[0:((N+2)//2)] == [(N+4)//2:N]:
  print('Yes')
elif:
  print('No')

### FIXED CODE ###

S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')
while True:
&#160;&#160;&#160;&#160;num_hoseki=input()
&#160;&#160;&#160;&#160;if num_hoseki==0:
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;break
&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;hoseki_list=[]
&#160;&#160;&#160;&#160;for i in range(num_hoseki):
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;hoseki_list.append(map(int,raw_input().split()))
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;num_meirei=input()
&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;keiro=[]
&#160;&#160;&#160;&#160;x,y=[10,10]
&#160;&#160;&#160;&#160;for i in range(num_meirei):
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;meirei=raw_input()
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;d, l=meirei.split()
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;l=int(l)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if d=='N':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dx,dy=0,1
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;elif d=='S':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dx,dy=0,-1
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;elif d=='W':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dx,dy=-1,0
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;elif d=='E':
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dx,dy=1,0
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;for j in range(l):
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;keiro.append([x+(j+1)*dx,y+(j+1)*dy])
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;x,y=keiro[-1]
&#160;&#160;&#160;&#160;flag=True
&#160;&#160;&#160;&#160;for hoseki in hoseki_list:
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if not hoseki in keiro:
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;flag=False
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;break
    if flag:
        print 'Yes'
    else:
        print 'No'

### FIXED CODE ###

while True:
    num_hoseki=input()
    if num_hoseki==0:
        break
    
    hoseki_list=[]
    for i in range(num_hoseki):
        hoseki_list.append(map(int,raw_input().split()))
        
    num_meirei=input()
    
    keiro=[]
    x,y=[10,10]
    for i in range(num_meirei):
        meirei=raw_input()
        
        d, l=meirei.split()
        l=int(l)
        if d=='N':
            dx,dy=0,1
        elif d=='S':
            dx,dy=0,-1
        elif d=='W':
            dx,dy=-1,0
        elif d=='E':
            dx,dy=1,0

        for j in range(l):
            keiro.append([x+(j+1)*dx,y+(j+1)*dy])
        x,y=keiro[-1]
    flag=True
    for hoseki in hoseki_list:
        if not hoseki in keiro:
            flag=False
            break
    if flag:
        print 'Yes'
    else:
        print 'No'
n = int(input())
a = list(map(int,input().split())
for i in range(1,n):
    if a[i] > 0:
        a[i] += a[i-1]
print(max(a[i])+1)


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
for i in range(1,n):
    if a[i] > 0:
        a[i] += a[i-1]
print(max(a)+1)
L,R = input().split()
print R + L

### FIXED CODE ###

L,R = input().split()
k = R + L
print (k)
import numpy as np

N, D = map(int, input().split())
xy = np.array([list(map(int, input().split())) for xy in range(N)])
o = np.array([0, 0])
count = 0

for i in range(N):
    if np.linalg.norm(xy[i] - o) <= D:
        count += 1
    else:
        pass

print(count)


### FIXED CODE ###

import numpy as np

N, D = map(int, input().split())
xy = np.array([list(map(int, input().split())) for xy in range(N)])
o = np.array([0, 0])
count = 0

for i in range(N):
    if np.linalg.norm(xy[i] - o) <= D:
        count += 1
    else:
        pass

print(count)
import collections
n, k = map(int, input().split())
a = list(map(int, input().split()))
t = 0
ans = n

l = collections.Counter(a)
x = l.most_common(k)

for i in range(k):
    t += x[i][1]

ans -= t
if ans < 0:
    ans = 0
print(ans)


### FIXED CODE ###

import collections
n, k = map(int, input().split())
a = list(map(int, input().split()))
t = 0
ans = n

l = collections.Counter(a)
x = l.most_common(k)

for i in range(len(x)):
    t += x[i][1]

ans -= t
if ans < 0:
    ans = 0
print(ans)
def print_max():
	N = int(input())
	S = [int(input()) for i in range(N)]
	
	if sum(S)%10 != 0:
		print(sum(S))
		return
	S.sort()
	S_n = S[:]
	for i in range(len(S)):
		S_n.pop(i)
		if sum(S_n)%10 != 0:
			print(sum(S_n))
			return
		S_n = S[:]
	print(0)
	return
	
print_max()

### FIXED CODE ###

def print_add():
	A, B = [int(i) for i in input().split()]

	if A+B > 9:
		print('error')
		return 
	print(A+B)
	return
	
print_add()
while True:
    n = input('N = ')
    try:
        n = int(n)
    except ValueError:
        print(n, 'は数値に変換できません。')
        continue
    except:
        print("予期しないエラー")
        exit()
    if (n <=0 or n >999):
        print(n,"は範囲外の数値です。")
        continue

    while n>=100:
        n -= 100
    while n>=10:
        n -= 10

    if n==3:
        print('bon')
    elif n==0 or n==1 or n==6 or n==8:
        print('pon')
    else:
        print('hon')

### FIXED CODE ###

N = int(input())
while N>=100:
    N -= 100
while N>=10:
    N -= 10

if N==3:
    print('bon')
elif N==0 or N==1 or N==6 or N==8:
    print('pon')
else:
    print('hon')
s=input()
t=input()
a=[]
import bisect
for i in range(len(s)):
	a.append([ord(s[i]),i])
a.sort()
c=[]
d=[]
for i in range(len(s)):
	c.append(a[i][0])
	d.append(a[i][1])
b=[]
e=[]
for i in range(len(t)):
	if c[0]<=ord(t[i])<=c[-1]:
		b.append(bisect.bisect_left(c,ord(t[i])))
	else:
		print(-1)
		exit()
for i in range(len(t)):
	e.append(d[b[i]])
ans=e[0]+1
cnt=0
for i in range(len(e)-1):
	if e[i]<e[i+1]:
		ans+=e[i+1]-e[i]
		cnt=0
	elif e[i]==e[i+1] and s[i]==s[i+1]:
		ans+=1
	else:
		ans+=len(s)-e[i]+e[i+1]
		cnt=0
print(ans)

### FIXED CODE ###

s=input()
t=input()
s*=2
next=[[-1]*26 for _ in range(len(s))]
alph=[[]for _ in range(26)]
for i in range(len(s)):
	alph[ord(s[i])-ord("a")].append(i)
from bisect import bisect_right
for i in range(len(s)//2):
	for j in range(26):
		if len(alph[j])>bisect_right(alph[j],i):
			next[i][j]=alph[j][bisect_right(alph[j],i)]
ans=1
now=len(s)//2-1
for x in t:
	r=ord(x)-ord("a")
	now=next[now][r]
	if now==-1:
		print(-1)
		exit()
	if now>=len(s)//2:
		ans+=len(s)//2
		now-=len(s)//2
print(ans+now-len(s)//2)
r,g,b=map(int,input().split())
print('YES' if (10*g+b)%4==0 else 'NO'


### FIXED CODE ###

r, g, b = map(int, input().split())
if (g * 10 + b) % 4 == 0:
  print("YES")
else:
  print("NO")
import numpy as np

n = int(input())
L = [int(i) for i in input().split()]
LL = [0 for i in range(pow(10,5)+1)]
LLL = np.ones(pow(10,5)+1, dtype = "uint64")
 
for i in range(n):
  LL[L[i]] += 1
  
out = 1
for i in range(len(LL)-1):
  LLL[i+1] = pow(i+1, LL[i+1])

out = int(int(np.prod(LLL)) % 998244353)
if L[0] != 0 or L.count(0) != 1:
  out = 0
print(out)

### FIXED CODE ###

n = int(input())
L = [int(i) for i in input().split()]
LL = [0 for i in range(pow(10,5)+1)]
 
for i in range(n):
  LL[L[i]] += 1
  
MOD = 998244353
out = 1
maximum = max(L)
for i in range(maximum):
  out = (out * pow(LL[i], LL[i+1], MOD)) % MOD
 
if L[0] != 0 or LL[0] != 1:
  out = 0

for i in range(maximum):
  if L[i+1] == 0:
    out = 0
  
print(out)
s=input()

win=0
lose=0

for c in s:
  if c = "o":
    win+=1
  else:
    lose+=1

if win + ( 15 - ( win + lose ) ) > 8:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

s = input()

win = 0
lose = 0

for c in s:
    if c == "o":
        win += 1
    else:
        lose += 1

days = 15 - (win + lose)

if win + days >= 8:
    print("YES")
else:
    print("NO")
def resolve():
    N,M = map(int,input().split())
    for i in range(M):
        print(str(N//2 - i) + " " + str(N//2+1 + i))
resolve():

### FIXED CODE ###

def resolve():
    N,M = map(int,input().split())
    if N % 2 == 1:
        for i in range(M):
            print(str(i+1) + " " + str(N-i))
    else:
        for i in range((M-1) // 2 + 1):
            print(str(i+1) + " " + str(N-i))
        for i in range((M-1) // 2 + 1 , M):
            print(str(i+1) + " " + str(N-i-1))
resolve()