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

n = int(input())

from fractions import Fraction

for i in range(1,3501):
    for j in range(i,3501):
        k = Fraction(4, n) - Fraction(1, i) - Fraction(1, j)
        if k < 0:
            continue
        if k.numerator == 1:
            print(i, j, k.denominator)
            import sys
            sys.exit()


### FIXED CODE ###

n = int(input())

from fractions import Fraction

for i in range(1,3501):
    for j in range(1,3501):
        if 4*i*j - n*i - n*j > 0:
            if (i * j * n) % (4*i*j - n*i - n*j) == 0 and (i * j * n) // (4*i*j - n*i - n*j) > 0:
                print(i,j, (i * j * n) // (4*i*j - n*i - n*j))
                import sys
                sys.exit()
### BUGGY CODE ###

s = input()
ans = 0
while '01' in s or '10' in s:
    # print('yes')
    if '01' in s:
        s = s.replace('01', '', 1)
        ans += 2
    if '10' in s:
        s = s.replace('10', '', 1)
        ans += 2
    # print(s, ans)

print(ans)

### FIXED CODE ###

s = input()
# ans = 0
# while '01' in s or '10' in s:
#     # print('yes')
#     if '01' in s:
#         s = s.replace('01', '', 1)
#         ans += 2
#     if '10' in s:
#         s = s.replace('10', '', 1)
#         ans += 2
#     # print(s, ans)

# # print(ans)

ans = min(s.count('0'), s.count('1'))*2
print(ans)
### BUGGY CODE ###

n=int(input())
inn=[]

times=0

for i in range(5):
    inn.append(int(input()))

hoge=[0 for i in range(6)]
hoge[0]=n

while(hoge[5]!=n):
    times+=1
    for i in range(5):
        ind=4-i
        if(hoge[ind]>0):
            a=hoge[ind]
            hoge[ind] = max(0, hoge[ind]-inn[ind])
            if hoge[ind]>0:
                hoge[ind+1] += inn[ind]
            else:
                hoge[ind+1] += a


print(times)


### FIXED CODE ###

n=int(input())
inn=[]

times=0

for i in range(5):
    inn.append(int(input()))

mini=min(inn)

if n/mini==int(n/mini):
    print(n//mini + 4)
else:
    print(int(n//mini)+1 + 4)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
B = [0 for i in range(N)]
for i in range(N):
    for j in range(i,N-1):
        if A[j]>=A[j+1]:
            B[i]+=1
        else:
            break
print(max(B))
        

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = 0
count = 0
for i in range(N-1):
    if A[i]>=A[i+1]:
        count += 1
    else:
        ans = max(ans,count)
        count = 0
ans = max(ans,count)
print(ans)
### BUGGY CODE ###

import sys
n,m=map(int,input().split())
ans=0

if n==1:
    print(m)
    sys.exit()

for i in range(1,(m//n)+1):
    if m%i==0:
        ans=i
        
print(ans)

### FIXED CODE ###

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

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)
    divisors.sort()
    divisors.reverse()
    return divisors

l=make_divisors(m)

for i in l:
    if i*n<=m:
        print(i)
        import sys
        sys.exit()
### BUGGY CODE ###

N = int(input())
A = [int(_) for _ in input().split()]
mod = 10**9+7


def comb(x, y):
    if y > x:
        return 0
    elif y * 2 > x:
        y = x - y
    result = 1
    for j in range(1, y + 1):
        result *= (x + j - y) * pow(j, mod - 2, mod)
        result %= mod
    return result


dupl = sum(A)-N*(N+1)//2
ds = []
for _ in range(N+1):
    if A[_] == dupl:
        ds += [_]
i, j = ds

print(N)
for k in range(2, N+2):
    print((comb(N-1, k)+comb(N-1, k-2)+2*comb(N-1, k-1)-comb(N-j+i, k-1)) % mod)


### FIXED CODE ###

N = int(input())
A = [int(_) for _ in input().split()]
mod = 10**9 + 7

f = [1] * (N + 2)
fi = [1] * (N + 2)
for i in range(2, N + 2):
    f[i] = i * f[i - 1]
    f[i] %= mod
for i in range(2, N + 2):
    fi[i] = fi[i - 1] * pow(i, mod - 2, mod)
    fi[i] %= mod


def comb(n, r):
    if 0 <= n and 0 <= r and 0 <= n - r:
        return (f[n] * fi[r] * fi[n - r]) % mod
    else:
        return 0


b = set()
for a in A:
    if a in b:
        break
    b.add(a)
c = []
for i in range(N + 1):
    if A[i] == a:
        c += [i]
i, j = c
for x in range(1, N + 2):
    print((comb(N + 1, x) - (comb(N - j + i, x - 1))) % mod)
### BUGGY CODE ###

S = input()

s = S
index = 0
ans = 0
while index < len(s)-1:
    c = s[index]
    next_c = s[index+1]
    if c != next_c:
        s = s[:index] + s[index+2:]
        index = 0
        ans += 2
    else:
        index += 1

print(ans)


### FIXED CODE ###

S = input()

red = 0
blue = 0
for c in S:
    if c == '0':
        red += 1
    elif c == '1':
        blue += 1

print(min(red, blue)*2)
### BUGGY CODE ###

N, K = map(int, input().split())
min = N

while True:
  N = abs(N-K)
  min = N
  if min <= 2:
    break  
    
print(min)

### FIXED CODE ###

N, K = map(int, input().split())
print(min(N % K, K - N % K))
### BUGGY CODE ###

def main():
    n,m=map(int,input().split())
    ab = {}
    for _ in range(m):
        a,b=map(int,input().split())
        ab.setdefault(a,[]).append(b)
        ab.setdefault(b,[]).append(a)
    result = [None] * n
    result[0] = (-1, 0)
    d = 0
    while ab:
        for i,t in enumerate(result):
            if t and t[1] == d:
                if i+1 in ab:
                    for k in ab[i+1]:
                        if not result[k-1]:
                            result[k-1] = (i+1,d+1)
                    del ab[i+1]
        d+=1
    if None in result:
        print('No')
        return
    print('Yes')
    for i in range(1,n):
        print(result[i][0])

main()

### FIXED CODE ###

def main():
    n,m=map(int,input().split())
    ab = {}
    ab1 = {}
    for _ in range(m):
        a,b=map(int,input().split())
        ab.setdefault(a,set()).add(b)
        ab.setdefault(b,set()).add(a)
        ab1.setdefault(a,set()).add(b)
        ab1.setdefault(b,set()).add(a)
    g = []
    g.append(set([1]))
    marked = set()
    marked.add(1)
    while ab:
        g_add = set()
        for k in g[-1]:
            for x in ab[k]:
                if x not in marked:
                    g_add.add(x)
                    marked.add(x)
            del ab[k]
        g.append(g_add)
    if len(marked) < n:
        print('No')
        return
    print('Yes')
    result = [None] * n
    for i,s in enumerate(g):
        if not i:
            continue
        for k in s:
            result[k-1] = (g[i-1]&ab1[k]).pop()
    for i in range(1,n):
        print(result[i])

main()
### BUGGY CODE ###

n=int(input())
m=n-1
for a in range(1,n//2+1):
    if n%a==0:
        i=a
        j=n//a
        if i+j-2<m:
            m=i+j-2
print(m)

### FIXED CODE ###

import math
n=int(input())
s=int(math.sqrt(n))
m=n-1
for a in range(1,s//1+1):
    if n%a==0:
        i=a
        j=n//a
        if i+j-2<m:
            m=i+j-2
print(m)
### BUGGY CODE ###

from collections import deque
h, w = map(int,input().split())
ch, cw = map(int,input().split())
Dh, Dw = map(int,input().split())

M = ['##' + input() + '##' for _ in range(h)]
for i in range(2):
    M.insert(0,'#'*(w+4))
    M.append('#'*(w+4))

INF = float('inf')
cost = [[INF for _ in range(w+4)] for _ in range(h+4)]
cost0 = deque()
ans = -1

cost0.append((ch+1, cw+1, 0))
cost[ch+1][cw+1] = 0

move = [(1,0),(0,1),(-1,0),(0,-1)]
warp = [(i,j) for i in range(-2,3) for j in range(-2,3) if (i,j) not in [(0,0)] + move]

cost1 = deque()

while cost0:
    h, w, c = cost0.popleft()
    cost1.append((h, w, c))
    
    for i,j in move:
        dh = h + i
        dw = w + j
        if M[dh][dw] == '.' and c < cost[dh][dw]: #コストが高いところから低いところに戻らないようにするため
            cost[dh][dw] = c
            cost0.appendleft((dh, dw, cost[dh][dw]))
    
    if len(cost0) == 0:
        while cost1:
            h, w, c = cost1.popleft()
            for i,j in warp:
                dh = h + i
                dw = w + j
                if M[dh][dw] == '.' and c+1 < cost[dh][dw]:  #無駄なワープをなくすため
                    cost[dh][dw] = c+1
                    cost0.append((dh, dw, cost[dh][dw]))
    if cost[Dh+1][Dw+1] != INF:
        ans = cost[Dh+1][Dw+1]

print(ans)
                    
           

### FIXED CODE ###

from collections import deque
def solve():  
    h, w = map(int,input().split())
    ch, cw = map(int,input().split())
    Dh, Dw = map(int,input().split())
    
    M = ['##' + input() + '##' for _ in range(h)]
    for i in range(2):
        M.insert(0,'#'*(w+4))
        M.append('#'*(w+4))
    
    INF = float('inf')
    cost = [[INF for _ in range(w+4)] for _ in range(h+4)]
    cost0 = deque()
    ans = -1
    
    cost0.append((ch+1, cw+1, 0))
    cost[ch+1][cw+1] = 0
    
    move = [(1,0),(0,1),(-1,0),(0,-1)]
    warp = [(i,j) for i in range(-2,3) for j in range(-2,3) if (i,j) not in [(0,0)] + move]
    
    cost1 = deque()
    
    while cost0:
        h, w, c = cost0.popleft()
        cost1.append((h, w, c))
        
        for i,j in move:
            dh = h + i
            dw = w + j
            if M[dh][dw] == '.' and c < cost[dh][dw]: #コストが高いところから低いところに戻らないようにするため
                cost[dh][dw] = c
                cost0.appendleft((dh, dw, cost[dh][dw]))
        
        if len(cost0) == 0:
            while cost1:
                h, w, c = cost1.popleft()
                for i,j in warp:
                    dh = h + i
                    dw = w + j
                    if M[dh][dw] == '.' and c+1 < cost[dh][dw]:  #無駄なワープをなくすため
                        cost[dh][dw] = c+1
                        cost0.append((dh, dw, cost[dh][dw]))
        if cost[Dh+1][Dw+1] != INF:
            ans = cost[Dh+1][Dw+1]
    
    print(ans)

if __name__ == "__main__":
    solve()
### BUGGY CODE ###

def kaijo(n):
    fact = 1
    for i in range(1, n+1):
        fact *=i
    return fact
    
n, m=map(int, input().split())
if n-m>=2 or m-n>=2:
    print(0)
elif n!=m:
    print(kaijo(m)*kaijo(n)%(10**9+7))
else:
    print(2*kaijo(m)*kaijo(n)%(10**9+7))

### FIXED CODE ###

import math

n, m=map(int, input().split())
if n-m>=2 or m-n>=2:
    print(0)
elif n!=m:
    print(math.factorial(m)*math.factorial(n)%(10**9+7))
else:
    print(2*math.factorial(m)*math.factorial(n)%(10**9+7))
### BUGGY CODE ###

from itertools import combinations_with_replacement
import math
from functools import reduce

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

sum = 0
k = int(input())

for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            sum += gcd(a,b,c)

print(sum)

### FIXED CODE ###

from itertools import combinations_with_replacement
import math
from functools import reduce

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

sum = 0
k = int(input())
l = range(1,k+1)

for a,b,c in combinations_with_replacement(l, 3):
    ans = gcd(a,b,c)
    if a == b and a == c:
        sum += ans
    elif a == b or b == c or c == a:
        sum += 3 * ans
    else:
        sum += 6 * ans

print(sum)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
n,q = map(int, input().split())
edge = [[] for _ in range(n)]
counter = [0]*n
for _ in range(n-1):
    a, b = map(int, input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
for _ in range(q):
    a, b = map(int, input().split())
    counter[a-1] += b
def dfs(start, prev=-1):
    for i in edge[start]:
        if i == prev: continue
        counter[i] += counter[start]
        dfs(i, start)
dfs(0)
print(*counter)

### FIXED CODE ###

from collections import deque
n, q = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
count = [0]*n
for i in range(q):
    p, x = map(int, input().split())
    count[p-1] += x
q = deque([0])
d = [0]*n
while q:
    v = q.popleft()
    d[v] = 1
    for i in g[v]:
        if d[i]:
            continue
        count[i] += count[v]
        q.append(i)
print(*count)
### BUGGY CODE ###

import sys

n = int(raw_input())
a = map(int, raw_input().split())
q = int(raw_input())
t = map(int, raw_input().split())
cnt = 0
for i in xrange(q-1, -1, -1):
    if t[i] in a:
        t.remove(t[i])
        cnt += 1
print cnt

### FIXED CODE ###

import sys

n = int(raw_input())
a = set(map(int, raw_input().split()))
q = int(raw_input())
t = set(map(int, raw_input().split()))
cnt = 0
print len(t)-len(t-a)
### BUGGY CODE ###

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

def solve():
    N, M = map(int, input().split())
    *S, = map(int, input().split())
    *T, = map(int, input().split())
    dph = [[0]*(M+1), [0]*(M+1)]
    dpv = [[0]*(M+1), [0]*(M+1)]
    dpr = [[0]*(M+1), [0]*(M+1)]
    for j, s in enumerate(S, start=1):
        for i, t in enumerate(T, start=1):
            dph[j%2][i] = dph[(j-1)%2][i] + dpv[(j-1)%2][i] + dpr[(j-1)%2][i]
            dpv[j%2][i] = dpv[j%2][i-1] + dpr[j%2][i-1]
            dpr[j%2][i] = dph[(j-1)%2][i-1] + dpv[(j-1)%2][i-1] + dpr[(j-1)%2][i-1] + 1 if t == s else 0
    res = (dph[N%2][-1] + dpv[N%2][-1] + dpr[N%2][-1] + 1)%(10**9+7)


    return str(res)

if __name__ == '__main__':
    print(solve())


### FIXED CODE ###

# -*- coding: utf-8 -*-
def solve():
    N, M = map(int, input().split())
    S = map(int, input().split())
    *T, = map(int, input().split())
    dp = [1]*(M+1)
    for s in S:
        is_s = s.__eq__
        dp_ = dp[:]
        acc = 0
        for i, t in enumerate(T):
            if is_s(t):
                acc += dp_[i]
            dp[i+1] = dp_[i+1] + acc
    res = (dp[-1])%(10**9+7)
    return str(res)

if __name__ == '__main__':
    print(solve())
### BUGGY CODE ###

S = input()
Q = int(input())
Switch = False
Query = []
for i in range(Q):
    Query.append(input())
    
head = ''
tail = ''
for s in Query:
    if s[0] == '1':
        if Switch:
            Switch = False
        else:
            Switch = True
    if s[0] == '2':
        if s[2] == '1' and Switch==False:
            head = s[4]+head
        elif s[2]=='1' and Switch==True:
            tail = tail+s[4]
        elif s[2] == '2' and Switch==False:
            tail = tail+s[4]
        else:
            head = s[4]+head
S = head+S+tail
if Switch == False:
    print(S)
else:
    print(S[::-1])

### FIXED CODE ###

S = input()
Q = int(input())
Switch = False
Query = []

import collections
dq = collections.deque(S)

for i in range(Q):
    s = input()
    if s[0] == '1':
        if Switch:
            Switch = False
        else:
            Switch = True
    if s[0] == '2':
        if s[2] == '1' and Switch==False:
            dq.appendleft(s[4])
#             S = s[4]+S
        elif s[2]=='1' and Switch==True:
            dq.append(s[4])
#             S = S+s[4]
        elif s[2] == '2' and Switch==False:
            dq.append(s[4])
#             S = S+s[4]
        else:
#             S = s[4]+S
            dq.appendleft(s[4])

if Switch == False:
    print(''.join(dq))
else:
    print(''.join(dq)[::-1])
### BUGGY CODE ###

#!/usr/bin/env python3
n = int(input()) 
l = list(map(int, input().split()))
for i in range(1, n+1):
    print(l.count(i))

### FIXED CODE ###

#!/usr/bin/env python3
import collections
n = int(input()) 
l = sorted(list(map(int, input().split())))
c = collections.Counter(l)
[print(c[i]) for i in range(1, n+1)]
### BUGGY CODE ###

from collections import Counter
import sys
s = input()
N = len(s)
sc = Counter(s)
odds = sum([1 for x in sc if sc[x] % 2 == 1])
if odds > 1:
    print(-1)
    sys.exit(0)

class BIT:
    def __init__(self, size):
        self.bit = [0] * (size+1)
    def add(self, index, elem):
        index += 1
        while index < len(self.bit):
            self.bit[index] += elem
            index += index & -index
    def get(self, index):
        index += 1
        ret = 0
        while 0 < index:
            ret += self.bit[index]
            index -= index & -index
        return ret



indices = [-1] * N
tb = {c: [None] * sc[c] for c in sc}
lens = {c: 0 for c in sc}
p = 0
for i in range(N):
    c = s[i]
    l = lens[c]
    if 2 * l < sc[c]:
        indices[p] = i
        tb[c][l] = p
        lens[c] += 1
        p += 1
    elif 2 * l == sc[c] + 1:
        indices[N//2] = i
    else:
        indices[N-1-tb[c][sc[c]-l-1]] = i
        lens[c] += 1

ans = 0
bit = BIT(N)
for i in indices:
    bit.add(i, 1)
    ans += bit.get(N-1) - bit.get(i)
print(ans)


### FIXED CODE ###

from collections import Counter
import sys
s = input()
N = len(s)
sc = Counter(s)
odds = [1 for x in sc if sc[x] % 2 == 1]
if len(odds) > 1:
    print(-1)
    sys.exit(0)

class BIT:
    def __init__(self, size):
        self.bit = [0] * (size+1)
    def add(self, index, elem):
        index += 1
        while index < len(self.bit):
            self.bit[index] += elem
            index += index & -index
    def get(self, index):
        index += 1
        ret = 0
        while 0 < index:
            ret += self.bit[index]
            index -= index & -index
        return ret

indices = [-1] * N
tb = {c: [None] * (sc[c]//2) for c in sc}
lens = {c: 0 for c in sc}
p = 0
for i in range(N):
    c = s[i]
    l = lens[c]
    if 2 * (l+1) <= sc[c]:
        indices[p] = i
        tb[c][l] = p
        lens[c] += 1
        p += 1
    elif 2 * (l+1) == sc[c] + 1:
        indices[N//2] = i
        lens[c] += 1
    else:
        indices[N-1-tb[c][sc[c]-l-1]] = i
        lens[c] += 1

ans = 0
bit = BIT(N)
for i in indices:
    bit.add(i, 1)
    ans += bit.get(N-1) - bit.get(i)
print(ans)
### BUGGY CODE ###

import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
f=list(map(int,input().split()))
a=sorted(a)
f=sorted(f,reverse=True)
l=-1
r=2*10**12+1
while l+1<r:
  c=(l+r)//2
  s=0
  for i in range(n):
    m=max(0,math.ceil((a[i]*f[i]-c)/f[i]))
    s=s+m
  if s>k:
  	l=c
  else:
    r=c
print(r)

### FIXED CODE ###

import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
f=list(map(int,input().split()))
a=sorted(a)
f=sorted(f,reverse=True)
l=-1
r=2*10**12+1
while l+1<r:
  c=(l+r)//2
  s=0
  for i in range(n):
    m=max(0,math.ceil((a[i]*f[i]-c)/f[i]))
    s=s+m
  if s>k:
  	l=c
  else:
    r=c
print(r)
### BUGGY CODE ###

n = int(input())
s = list(input())
ans = 0
list1 = ["", "", ""]
for i in range(n):
    for j in range(n):
        for k in range(n):
            if i < j < k:
                if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
                    if j - i != k - j:
                        ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
s = list(input())

ans = s.count("R") * s.count("G") * s.count("B")

for i in range(n):
    for d in range(n):
        j = i + d
        k = i + 2 * d
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
            ans -= 1

print(ans)
### BUGGY CODE ###

import heapq as hq
def main():
    n,m = map(int,input().split(' '))
    w = [list(map(int,input().split(' '))) for i in range(n)]
    w=sorted(w)
    ans = 0
    l = []
    tmp = 0
    for i in range(1,m+1):
        while w and w[0][0] <= i:
            hq.heappush(l,-w.pop(0)[1])
        if l:
            ans -=hq.heappop(l)
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import heapq as hq
def main():
    n,m = map(int,input().split(' '))
    w = [list(map(int,input().split(' '))) for i in range(n)]
    w=sorted(w,reverse=True)
    ans = 0
    l = []
    tmp = 0
    for i in range(1,m+1):
        while w and w[-1][0] <= i:
            hq.heappush(l,-w.pop()[1])
        if l:
            ans -=hq.heappop(l)
    print(ans)

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

# D - Good Grid

import numpy as np

N, C =  map(int, input().split())
D = [list(map(int, input().split())) for _ in range(C)]
c = np.array([list(map(int, input().split())) for _ in range(N)]) -1

group0, group1, group2 = [], [], []
for row in range(N):
    for col in range(N):
        if (row + col) % 3 == 0:
            group0.append(c[row][col])
        elif (row + col) % 3 == 1:
            group1.append(c[row][col])
        else:
            group2.append(c[row][col])

ans = []
for color0 in range(C):
    for color1 in range(C):
        for color2 in range(C):
            if len(set([color0, color1, color2])) == 3:
                tmp = 0
                for x in group0:
                    tmp += D[x][color0]
                for x in group1:
                    tmp += D[x][color1]
                for x in group2:
                    tmp += D[x][color2]
                ans.append(tmp)

print(min(ans))

### FIXED CODE ###

# D - Good Grid

N, C =  map(int, input().split())
D = [list(map(int, input().split())) for _ in range(C)]
c = [list(map(int, input().split())) for _ in range(N)]

group0, group1, group2 = [0]*C, [0]*C, [0]*C
for row in range(N):
    for col in range(N):
        if (row + col) % 3 == 0:
            group0[c[row][col] -1] += 1
        elif (row + col) % 3 == 1:
            group1[c[row][col] -1] += 1
        else:
            group2[c[row][col] -1] += 1

ans = []
for color0 in range(C):
    for color1 in range(C):
        for color2 in range(C):
            if len(set([color0, color1, color2])) == 3:
                tmp = 0
                for idx in range(C):
                    tmp += D[idx][color0] * group0[idx]
                    tmp += D[idx][color1] * group1[idx]
                    tmp += D[idx][color2] * group2[idx]
                ans.append(tmp)

print(min(ans))
### BUGGY CODE ###

import collections

N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
c = collections.Counter(A)

if (K - Q) > 0:
    for _ in range(N):
        print('Yes')
else:
    l = []
    for i,v in dict(c).items():
        if v >(Q - K):
            l.append(i-1)
    for j in range(N):
        if j in l:
            print('Yes')
#             l.pop()
        else:
            print('No')

### FIXED CODE ###

import collections

N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
c = collections.Counter(A)

if (K - Q) > 0:
    for _ in range(N):
        print('Yes')
else:
    l = ['No'] * N
    for i,v in dict(c).items():
        if v >(Q - K):
            l[i-1] = 'Yes'
    for j in l:
        print(j)
### BUGGY CODE ###

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

for i in range(m):
    b,c = map(int,input().split())
    a += [c] * b

print(sum(sorted(a,reverse=True)[:n]))


### FIXED CODE ###

ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n, m = nm()

a = sorted(nl())

pos = 0

changer = []

for i in range(m):
    b, c = nm()
    changer.append((c, b))

changer = sorted(changer)[::-1]


for i in range(m):

    c = changer[i]
    for j in range(c[1]):
        while pos < n:
            if a[pos] < c[0]:
                a[pos] = c[0]
                break
            pos += 1
    if pos >= n:
        break

print(sum(a))
### BUGGY CODE ###

#11:44
n = int(input())
a = list(map(int,input().split()))
scale = 62
#scale = 5
z0 = [0 for _ in range(scale)]
for x in a:
  for d in range(scale):
    if x % 2 == 1:
      z0[d] += 1
    x //= 2
ans = 0
for d in range(scale):
  ans += z0[d] * (n-z0[d]) * 2**d
mod = 10**9+7
ans %= mod
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  tmp = bin(a[i])[2:]
  tmp = '0' * (64-len(tmp)) + tmp
  b.append(tmp)
ans = 0
bit = 1
mod = 10 ** 9 + 7
for k in range(64):
  z1 = 0
  for i in range(n):
    if b[i][-k-1] == '1':
      z1 += 1
  add = z1 * (n-z1) * bit
  add %= mod
  ans += add
  ans %= mod
  bit *= 2
  bit %= mod
  #print(z1,add,ans)
print(ans)