Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import math

def factor(n):
    i = 2
    r = []
    while i * i <= n:
        if n % i == 0:
            c = 0
            while n % i == 0:
                c += 1
                n //= i
            r.append((i, c))
    if n > 1:
        r.append((n, 1))
    return r

class nCrMod():
    def __init__(self, mod):
        self.mod = mod
        self.fac = [1, 1]
        self.finv = [1, 1]
        self.inv = [0, 1]

    def prep(self, n):
        mod = self.mod
        f, fi = self.fac[-1], self.finv[-1]
        for i in range(len(self.fac), n + 1):
            fn = f * i % mod
            v = -self.inv[mod % i] * (mod // i) % mod
            fin = fi * v % mod
            f, fi = fn, fin
            self.fac.append(f)
            self.finv.append(fi)
            self.inv.append(v)

    def __call__(self, n, r):
        if len(self.fac) <= n:
            self.prep(n)
        return self.fac[n] * self.finv[r] * self.finv[n - r] % self.mod

def main():
    N, M = map(int, input().split())
    mod = 10**9 + 7
    nCr = nCrMod(mod)
    f = factor(M)
    r = 1
    for p, q in f:
        r = r * nCr(N + q - 1, q) % mod
    return r

print(main())


### FIXED CODE ###

import math

def factor(n):
    i = 2
    r = []
    while i * i <= n:
        if n % i == 0:
            c = 0
            while n % i == 0:
                c += 1
                n //= i
            r.append((i, c))
        i += 1
    if n > 1:
        r.append((n, 1))
    return r

class nCrMod():
    def __init__(self, mod):
        self.mod = mod
        self.fac = [1, 1]
        self.finv = [1, 1]
        self.inv = [0, 1]

    def prep(self, n):
        mod = self.mod
        f, fi = self.fac[-1], self.finv[-1]
        for i in range(len(self.fac), n + 1):
            fn = f * i % mod
            v = -self.inv[mod % i] * (mod // i) % mod
            fin = fi * v % mod
            f, fi = fn, fin
            self.fac.append(f)
            self.finv.append(fi)
            self.inv.append(v)

    def __call__(self, n, r):
        if len(self.fac) <= n:
            self.prep(n)
        return self.fac[n] * self.finv[r] * self.finv[n - r] % self.mod

def main():
    N, M = map(int, input().split())
    mod = 10**9 + 7
    nCr = nCrMod(mod)
    f = factor(M)
    r = 1
    for p, q in f:
        r = r * nCr(N + q - 1, q) % mod
    return r

print(main())
### BUGGY CODE ###

import numpy as np
import itertools
N, M=map(int, input().split())
a =[]
c = []
for i in range(2*M):
  if i%2 == 0:
    temp,_=map(int, input().split()) 
    a.append(temp)
  else:
    temp=list(map(int, input().split()))
    c.append(temp)
a = np.array(a) 

row = 2**M 
boo = np.array([[int(j[i]) for i in range(M)] for j in  [bin(i)[2:].zfill(M) for i in range(row)]])
table = np.zeros((row,N), dtype = 'int8')

for i in range(row):
    ind_temp = np.array(list(set(itertools.chain.from_iterable(c*boo[i]))),dtype = int) -1
    table[i][ind_temp] = 1

ind = np.where(np.all(table, axis=1))
price = np.array([np.sum(a*boo[ind], axis = 1)])

if price.any():
    print(np.min(price))
else:
    print(-1)



### FIXED CODE ###

N, M = map(int, input().split())
Inf = 10**8
Dp = [Inf]*(2**N)
Dp[0] = 0

for i in range(M): #カギiで
    a,_=map(int, input().split())
    c = list(map(int, input().split()))
    d = sum((1<<p-1) for p in c) #iで開けられる宝箱の2bit表記
    for j in range(2**N):
        ope = j|d
        Dp[ope] = min(Dp[ope], Dp[j] + a)

if Dp[-1] == Inf:
    print(-1)
else:
    print(Dp[-1])
### BUGGY CODE ###

from sys import stdin
from fractions import gcd
from functools import reduce
def gcd_list(numbers):
    return reduce(gcd, numbers)
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
set_A = set(A)
ans=0

for i in range(N):
    for j in set_A:
        tmp = gcd_list([j]+A[0:i]+A[i+1:])
        if tmp > ans:
            ans = tmp
print(ans)

### FIXED CODE ###

from fractions import gcd
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
L=[0]
R=[0]
MAX=0
for i in range(N-1):
    L.append(gcd(L[i],A[i]))
    R.append(gcd(R[i],A[-1-i]))
for i in range(N):
    MAX=max(MAX,gcd(L[i],R[-1-i]))
print(MAX)
### BUGGY CODE ###

a=list(map(int,input().split()))
b=[]
for i in input().split():
  b.append(abs(int(i)-a[1]))
def ucl(a,b):
  if a%b==0:
    return b
  else:
    return ucl(b,a%b)
while len(b)>1:
  b.append(ucl(b[0],b[1]))
  del b[0],b[1]
print(b[0])  

### FIXED CODE ###

a=list(map(int,input().split()))
x=[]
for i in input().split():
  x.append(abs(int(i)-a[1]))
def ucl(a,b):
  if a%b==0:
    return b
  else:
    return ucl(b,a%b)
while len(x) > 1:
  x2 = []
  mn_x = min(x)
  for n in range(len(x)):
    mod = x[n] % mn_x
    if mod != 0:
      x2.append(mod)
  x2.append(mn_x)
  x = x2
print(x[0])
### BUGGY CODE ###

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

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

for i in range(N):
    for j in range(N-i):
        k=i+j
        if A[i]+A[k]==abs(i-k):
            count = count+1
            #print("{} {}".format(i+1,k+1))



print("{}".format(count))


### FIXED CODE ###

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

N = int(input())
A = list(map(int, input().split()))
count=0
L = [0]*N
R = [0]*N
N2=2*N
hash_L=[0]*N2
hash_R=[0]*N2

sheet_L=[0]*N2
sheet_R=[0]*N2
for i in range(N):
    L[i]=A[i]+i+1
    if L[i]<N2:
        if sheet_L[L[i]]==0:
            hash_L[L[i]]=L[i]
            sheet_L[L[i]]=1
        else:
            sheet_L[L[i]]=sheet_L[L[i]]+1

    R[i]=-A[i]+i+1
    if R[i]>0:
        if sheet_R[R[i]]==0:
            hash_R[R[i]]=R[i]
            sheet_R[R[i]]=1
        else:
            sheet_R[R[i]]=sheet_R[R[i]]+1


for i in range(2*N):
    if not hash_L[i]==0:
        if hash_L[i]==hash_R[i]:
            count=count+sheet_L[i]*sheet_R[i]
#print("{}".format(hash_L))
#print("{}".format(hash_R))
print("{}".format(count))
### BUGGY CODE ###

import math

def C(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

for i in range(N-K+1):
    ans += (A[-i-1] - A[i]) * C(N-i-1, K-1)

print(ans % 1000000007)

### FIXED CODE ###

N, K = map(int, input().split())
MOD = 10**9+7
A = [a % MOD for a in sorted(list(map(int, input().split())))]
MIN, MAX = 0, 0

def div_MOD(a):     # (a^{-1} mod MOD) をフェルマーの小定理より求める
    return pow(a, MOD - 2, MOD)     # a^{-1} = a^{p-2} (mod p)

C = [0]*(K-1) + [1]
for n in range(K, N):
    C.append((C[n-1] * n * div_MOD(n-(K-1))) % MOD)

for i in range(N-K+1):
    MIN = (MIN + (A[i] * C[N-i-1]) % MOD) %MOD
for i in range(N-K+1):
    MAX = (MAX + (A[N-1-i] * C[N-i-1]) % MOD) %MOD

print((MAX - MIN) % MOD)
### BUGGY CODE ###

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

latest_score = 0
before_score = 0

for cnt_k in range(k):
    if latest_score == 0:
        latest_score = a[cnt_k]
    else:
        latest_score *= a[cnt_k]

for cnt in range(1, n - k + 1):
    before_score = latest_score
    latest_score /= a[cnt-1]
    latest_score = int(latest_score)
    latest_score *= a[cnt + k - 1]

    if before_score < latest_score:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

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

for cnt in range(1, n - k + 1):
    if a[cnt-1] < a[cnt + k - 1]:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

import sys
import heapq
from collections import deque
sys.setrecursionlimit(10 ** 8)
 
H, W, K = map(int, sys.stdin.readline().strip().split())
xs, ys, xg, yg = map(int, sys.stdin.readline().strip().split())
 
m = []
for _ in range(H):
    m.append(list(map(str, sys.stdin.readline().strip())))
 
M = [[float('inf')] * W for _ in range(H)]
 
 
def bfs(x1, y1, d):
    q = deque()
    # heapq.heapify(q)
    # heapq.heappush(q, (d, (x1, y1)))
    q.append((d, (x1, y1)))
 
    while q:
        # d, u = heapq.heappop(q)
        d, u = q.popleft()
        x1 = u[0]
        y1 = u[1]
 
        M[x1][y1] = d
 
        if (x1 == xg - 1) and (y1 == yg - 1):
            break
 
        for dx, dy in [[0, 1], [1, 0], [0, -1], [-1, 0]]:
            k = 1
            while k <= K:
                x2 = x1 + dx * k
                y2 = y1 + dy * k
                if x2 < 0 or x2 >= H:
                    break
                if y2 < 0 or y2 >= W:
                    break
                if m[x2][y2] == '@':
                    break
                if M[x2][y2] != float('inf'):
                    break
 
                # heapq.heappush(q, (d + 1, (x2, y2)))
                q.append((d + 1, (x2, y2)))
 
                k += 1
 
 
if m[xs - 1][ys - 1] != '@':
    bfs(xs - 1, ys - 1, 0)
 
# for i in range(len(M)):
#     print(M[i])
 
 
ans = M[xg - 1][yg - 1]
if ans == float('inf'):
    print(-1)
else:
    print(ans)

### FIXED CODE ###

from collections import deque


def bfs(maze, visited, sy, sx, gy, gx):
    queue = deque([[sy, sx]])
    visited[sy][sx] = 0
    while queue:
        # queueには訪れた地点が入っている。そこから、4方向に移動できるか考え、queueから消す。
        y, x = queue.popleft()  # queueに入っていたものを消す。
        if [y, x] == [gy, gx]:  # もしゴールについていたならば、そのときの手数を出す。
            return visited[y][x]
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            l = 1
            while True:
                new_y, new_x = y + j * l, x + k * l
                if (0 <= new_y < H) and (0 <= new_x < W):
                    if maze[new_y][new_x] == "@":
                        break
                    elif visited[new_y][new_x] == -1:  # まだ来たことない点だったという条件
                        visited[new_y][new_x] = visited[y][x] + 1
                        queue.append([new_y, new_x])  # 新しい点を足す。
                    elif visited[new_y][new_x] < visited[y][x] + 1:
                        break
                else:
                    break
                l += 1
                if l == K + 1:
                    break


H, W, K = map(int, input().split())
# K = min(K, max(H, W))
x1, y1, x2, y2 = map(int, input().split())
x1, y1, x2, y2 = x1 - 1, y1 - 1, x2 - 1, y2 - 1
C = [0] * H
for i in range(H):
    C[i] = str(input())
visited = [[-1] * W for i in range(H)]
bfs(C, visited, x1, y1, x2, y2)
# print(visited)
print(visited[x2][y2])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

def main():
  from collections import Counter
  n = int(input())
  A = list(map(int, input().split()))
  C = Counter(A)
  def f(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 divisors

  ans = 0
  for a in A:
      for j in f(a):
          if j == a:
              if C[j] > 1:
                  break
          else:
              if C[j] > 0:
                  break
      else:
          ans += 1
  print(ans)
if __name__ == "__main__":
  main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import Counter

n = int(input())
A = sorted(map(int, input().split()))
U = 10**6
B = [0]*(U+1)
C = Counter(A)
ans = 0
for a in A:
  if B[a]:
    continue
  if C[a] == 1:
    ans += 1
  for j in range(a, U+1, a):
    B[j] = 1
print(ans)
### BUGGY CODE ###

from heapq import heappop, heappush
from collections import defaultdict
N,M = map(int,input().split(' '))
g = defaultdict(list)
for i in range(1,M+1):
    l,r,c= list(map(int,input().split(' ')))
    g[l].append((r,c))
    for i in range(l+1,r):
        g[r].append((i,0))

INF = 10**20
d = [INF] * (N+1)
d[1] = 0
que = []
heappush(que,(1,0))
while que:
    s, dist = heappop(que)
    if d[s] < dist:
        continue
    for t,c in g[s]:
        if d[t] > d[s] + c:
            d[t] = d[s] + c
            heappush(que,(t,d[t]))
if d[N] == INF:
    print(-1)
    exit()
print(d[N])
        



### FIXED CODE ###

import sys
from heapq import heappop, heappush
from collections import defaultdict
input = sys.stdin.buffer.readline

INF = 10**20
N,M = map(int,input().split())
g = defaultdict(list)
for i in range(2,N+1):
    g[i].append((i-1,0))
for i in range(1,M+1):
    l,r,c = list(map(int,input().split()))
    g[l].append((r,c))

d = [INF] * (N+1)
d[1] = 0
que = []
heappush(que,(1,0))
while que:
    s, dist = heappop(que)
    if d[s] < dist:
        continue
    for t,c in g[s]:
        if d[t] > d[s] + c:
            d[t] = d[s] + c
            heappush(que,(t,d[t]))
if d[N] == INF:
    print(-1)
    exit()
print(d[N])
### BUGGY CODE ###

N,C = map(int,input().split())
A = [[0 for _ in range(C)] for j in range(200001)]
for i in range(N):
    s,t,c = map(int,input().split())
    for j in range(s*2-1,t*2):
        A[j][c-1] = 1
R = 0
for i in range(200001):
    sumA = sum(A[i])
    if R < sumA:
        R = sumA
print(R)


### FIXED CODE ###

N,C = map(int,input().split())
A = [[0 for _ in range(C)] for j in range(100001)]
for i in range(N):
    s,t,c = map(int,input().split())
    for j in range(s-1,t):
        A[j][c-1] = 1
R = 0
for i in range(100001):
    sumA = sum(A[i])
    if R < sumA:
        R = sumA
print(R)
### BUGGY CODE ###

from sys import setrecursionlimit
setrecursionlimit(1000000)
def ans(n,l,p,c):
    if p>n:
        return ((p-n)*l[3])+c
    elif p==n:
        return c
    elif n/p <= 2:
        return min([ans(n,l,p*2,c+l[0]),ans(n,l,p*3,c+l[1]),ans(n,l,p*5,c+l[2]),((n-p)*l[3])+c])
    else:
        return min([ans(n,l,p*2,c+l[0]),ans(n,l,p*3,c+l[1]),ans(n,l,p*5,c+l[2]),ans(n,l,p+1,c+l[3])])
for _ in range(int(input())):
    n,a,b,c,d = map(int, input().split())
    Ans = ans(n,[a,b,c,d],0+1,0+d)
    print(Ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
T = int(input())
for _ in range(T):
    N,A,B,C,D = map(int,input().split())
    INF = float('inf')
    mem = {}
    def solve(n):
        if n==0: return 0
        if n==1: return D
        if n in mem: return mem[n]
        tmp = n*D
        if n%2==0:
            tmp = min(tmp, solve(n//2) + A)
        else:
            tmp = min(tmp, solve(n//2) + A+D, solve(n//2+1) + A+D)
        if n%3==0:
            tmp = min(tmp, solve(n//3) + B)
        else:
            d = n%3
            u = 3-d
            tmp = min(tmp, solve(n//3) + B+d*D, solve(n//3+1) + B+u*D)
        if n%5==0:
            tmp = min(tmp, solve(n//5) + C)
        else:
            d = n%5
            u = 5-d
            tmp = min(tmp, solve(n//5) + C+d*D, solve(n//5+1) + C+u*D)
        mem[n] = tmp
        return tmp
    print(solve(N))
### BUGGY CODE ###

import collections

def combination(n, r, mod=10**9+7):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod
    
n = int(input())
li = list(map(int,input().split()))
c = collections.Counter(li)    
s = list(set(li))
ans = 0

for j in range(len(s)):
    if c[s[j]] <= 1:
        continue
    ans += combination(c[s[j]], 2)

for i in range(n):
    ans_a = ans
    if c[li[i]] <= 1:
        print(ans_a)
        continue
    ans_a -= combination(c[li[i]], 2)
    c[li[i]] -= 1
    if c[li[i]] <= 1:
        print(ans_a)
        c[li[i]] += 1
        continue
    ans_a += combination(c[li[i]], 2)
    c[li[i]] += 1
    # print(c)
    # print(c[s[1]])
    # print(s)
    print(ans_a)

### FIXED CODE ###

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

ans_li = [0]*(n+10)

for i in li:
    ans_li[i] += 1
    
result = 0    
for i in ans_li:
    result += (i * (i-1)) // 2
    
for i in li:
    ans = result
    ans += ((ans_li[i] - 1) * (ans_li[i] - 2)) // 2- (ans_li[i] * (ans_li[i] - 1)) // 2
    print(ans)
### BUGGY CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    N = int(input())
    L = 0
    print(L)
    Ls = input()
    if Ls == "Vacant":
        exit()
    else:
    U = N-1
    print(U)
    Us = input()
    if Us == "Vacant":
        exit()
    for i in range(18):
        mid = (U+D)//2
        if mid%2==1:
            mid-=1
        print(mid)
        ms = input()
        if ms == "Vacant":
            exit()
        if Ls==ms:
            L=mid
        if Us==ms:
            U=mid

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys

def main():
    N = int(input())
    L = 0
    print(L)
    sys.stdout.flush()
    Ls = input()
    if Ls == "Vacant":
        exit()
    U = N-1
    print(U)
    sys.stdout.flush()
    Us = input()
    if Us == "Vacant":
        exit()
    for _ in range(18):
        mid = (U+L)//2
        if mid%2==1:
            mid-=1
        if mid==L:
            mid+=1
        print(mid)
        sys.stdout.flush()
        ms = input()
        if ms == "Vacant":
            exit()
        if Ls==ms:
            L=mid
        if Us==ms:
            U=mid

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

h,n = m()

a = [l() for i in range(n)]

a.sort(reverse = True)

dp = [mod for i in range(h+1)]

dp[0] = 0

for i in range(n):
    z,x = a[i]
    
    for j in range(z,h+1):
        dp[j] = min(dp[j],dp[j-z] + x)
    mi = mod
    for j in range(max(0,h-z),h+1):
        mi = min(mi,dp[j])

    dp[-1] = min(dp[-1],mi+x)
print(dp[-1])



### FIXED CODE ###

import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

h,n = m()

a = [l() for i in range(n)]

a.sort(reverse = True)

dp = [mod for i in range(h+1)]

dp[0] = 0

for i in range(n):
    z,x = a[i]
    
    for j in range(z,h+1):
        dp[j] = min(dp[j],dp[j-z] + x)
    mi = mod
    for j in range(max(0,h-z),h+1):
        mi = min(mi,dp[j])

    dp[-1] = min(dp[-1],mi+x)
print(dp[-1])
### BUGGY CODE ###

from collections import Counter
N = int(input())
Ass = [list(map(int, input().split())) for _ in range(N)]
ct = Counter()
q = set([(i, 0) for i in range(N)])
idxs = [0] * N
n = 0
ans = 0
while q:
  nq = set()
  for i, k in q:
    a = i+1
    b = Ass[i][k]
    if a > b: a, b = b, a
    ct[(a, b)] += 1
    if ct[(a, b)] == 2:
      n += 1
      idxs[a-1] += 1
      if idxs[a-1] < N-1:
        nq.add((a-1, idxs[a-1]))
      idxs[b-1] += 1
      if idxs[b-1] < N-1:
        nq.add((b-1, idxs[b-1]))
  ans += 1
  q = nq
if n == N * (N-1) // 2:
  print(ans)
else:
  print(-1)

### FIXED CODE ###

from collections import Counter
N = int(input())
Ass = [list(map(int, input().split())) for _ in range(N)]
ct = Counter()
q = set([(i, 0) for i in range(N)])
idxs = [0] * N
n = 0
ans = 0
while q:
  nq = set()
  for i, k in q:
    a = i+1
    b = Ass[i][k]
    if a > b: a, b = b, a
    ct[(a, b)] += 1
    if ct[(a, b)] == 2:
      n += 1
      idxs[a-1] += 1
      if idxs[a-1] < N-1:
        nq.add((a-1, idxs[a-1]))
      idxs[b-1] += 1
      if idxs[b-1] < N-1:
        nq.add((b-1, idxs[b-1]))
  ans += 1
  q = nq
if n == N * (N-1) // 2:
  print(ans)
else:
  print(-1)
### BUGGY CODE ###

from itertools import product

# input
X, Y = map(int, input().split())

# check
if Y in set([sum(p) for p in set(product([2, 4], repeat=X))]):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

# input
X, Y = map(int, input().split())

# check
if Y < 2 * X or Y > 4 * X or abs(Y - 2 * X) % 2 != 0:
    print("No")
else:
    print("Yes")
### BUGGY CODE ###

n=int(input())
lst=[input() for i in range(n)]
xs=list(set(lst))
ans=[]
for i in xs:
  cnt=lst.count(i)
  ans.append([i,cnt])
ans.sort(key=lambda x:x[1])
pin=ans[-1][1]
ans2=[]
for i in ans:
  if i[1]==pin:
    ans2.append(i[0])
ans2.sort()
for i in ans2:
  print(i)

### FIXED CODE ###

n=int(input())
dict={}
xs=[]
for i in range(n):
  s=input()
  xs+=[s]
  if s not in dict:
    dict[s]=1
  else:
    dict[s]+=1
pin=0
xs=list(set(xs))
for i in xs:
  pin=max(pin,dict[i])
ans=[]
for i in xs:
  if dict[i]==pin:
    ans+=[i]
ans.sort()
for i in ans:
  print(i)
### BUGGY CODE ###

r, g, b, n = map(int, input().split())

ans = 0
for i in range(3001):
    for j in range(3001):
        if n - r * i - g * j < 0:
            break
        if  (n - r * i - g * j) % b == 0 and n - r * i - g * j >= 0:
            ans += 1
print(ans)

### FIXED CODE ###

r, g, b, n = map(int, input().split())

import math
ans = 0
for i in range(math.ceil(n / r)+1):
    for j in range(math.ceil(n / g)+1):
        if n - r * i - g * j < 0:
            break
        if  (n - r * i - g * j) % b == 0:
            ans += 1
print(ans)
### BUGGY CODE ###

N, M = map(int, input().split())
A = [int(a) for a in input().split()]

for m in range(M):
    index = A.index(max(A))
    A[index] //= 2

ans = 0
for i in range(N):
    ans += A[i]

print(ans)


### FIXED CODE ###

import heapq

N, M = map(int, input().split())
A = [-int(x) for x in input().split()]

# 優先度付きキューに変換
heapq.heapify(A)

# 最小値（最大値）の値を半分にしていく
for i in range(M):
    tmp = -heapq.heappop(A) // 2
    heapq.heappush(A, -tmp)

print(-sum(A))
### BUGGY CODE ###

n, k = map(int, input().split())
cou = 0
i = 0
flag = 0
if  k == 1:
  n = 0
elif k == 0:
  n = n
else:
  while flag < 1:
    if n < abs(n-k):
      flag = 1
    else:
      n = abs(n-k)
      i += 1

print(n)

### FIXED CODE ###

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

q = n // k
mod = n % k
ans_mod = k-mod

if mod<ans_mod:
  print(mod)
else:
  print(ans_mod)
### BUGGY CODE ###

S = input()
intS = list(map(int, S))
n = len(S)

fl = [False]*(n+1)
l = 0
res = 0

for i in range(n-3):
    if fl[i]:
        continue
    
    x = int(S[i:i+3])
    l = 0
    cnt = 0
    for j in range(i+3, n):
        x *= 10
        x += intS[j]
        x %= 2019
        if x == 0:
            cnt += 1
            l = j+1
            fl[l] = True
            
    
    res += (cnt+1)*cnt//2

print(res)

### FIXED CODE ###

S = list(map(int, list(input())))
S.reverse()
a = [0]*len(S)
y = 2019
x = 1
t = 0
cnt = [0]*y
res = 0
for i in range(len(S)):
    cnt[t] += 1
    t += S[i]*x
    t %= y
    res += cnt[t]
    x = x*10%y
print(res)
### BUGGY CODE ###

N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
point = [K] * N

for i in range(Q):
    point = [j - 1 for j in point]
    point[A[i] - 1] += 1

for i in range(N):
    print("Yes") if point[i] > 0 else print("No")

### FIXED CODE ###

N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]

point = [K] * N
point = [j - Q for j in point]

for i in range(Q):
    point[A[i] - 1] += 1

for i in range(N):
    print("Yes") if point[i] > 0 else print("No")