Problem:
 Score : 200 points    Problem Statement Rng is preparing a problem set for a qualification round of CODEFESTIVAL.  He has N candidates of problems. The difficulty of the i -th candidate is D_i .  There must be M problems in the problem set, and the difficulty of the i -th problem must be T_i . Here, one candidate of a problem cannot be used as multiple problems.  Determine whether Rng can complete the problem set without creating new candidates of problems.      Constraints  1 \leq N \leq 200,000  1 \leq D_i \leq 10^9  1 \leq M \leq 200,000  1 \leq T_i \leq 10^9  All numbers in the input are integers.       Partial Score  100 points will be awarded for passing the test set satisfying N \leq 100 and M \leq 100 .         Input Input is given from Standard Input in the following format:  N  D_1  D_2  ...  D_N  M  T_1  T_2  ...  T_M       Output Print YES if Rng can complete the problem set without creating new candidates of problems; print NO if he cannot.        Sample Input 1 5
3 1 4 1 5
3
5 4 3      Sample Output 1 YES       Sample Input 2 7
100 200 500 700 1200 1600 2000
6
100 200 500 700 1600 1600      Sample Output 2 NO  Not enough 1600 s.       Sample Input 3 1
800
5
100 100 100 100 100      Sample Output 3 NO       Sample Input 4 15
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
9
5 4 3 2 1 2 3 4 5      Sample Output 4 YES

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
d.sort()
t.sort()
flag = True
num = 0
for i in range(m):
    while d[num] != t[i]:
        if d[num] > t[i]:
            flag = False
            break
        else:
            num += 1
    else:
        num += 1
    if flag == False:
        break
if flag == True:
    print("YES")
else:
    print("NO")

Solution (Python):
import sys
n=int(input())
d=list(map(int,input().split()))
m=int(input())
t=list(map(int,input().split()))
if n < m:
  
  print('NO')
  sys.exit()
d.sort()
t.sort()
j=0
for i in range(n):
  if d[i] == t[j]:
    
    j += 1
  elif d[i] > t[j]:
    print('NO')
    break
  if j == m:
    print('YES')
    break
else:
  print('NO')

Solution (Python):
from collections import Counter

n = int(input())
d = Counter(list(map(int, input().split())))
m = int(input())
t = Counter(list(map(int, input().split())))

ans = 'YES'
for key, value in t.items():
    if value > d[key]:
        ans = 'NO'
        break
    else:
        pass
print(ans)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
x = {}
for i in d:
    if i in x:
        x[i] += 1
    else:
        x[i] = 1
t.sort()
j, cnt = t[0], 0
for i in t:
    if i == j:
        cnt += 1
    else:
        if not j in x:
            print("NO")
            exit()
        else:
            if cnt > x[j]:
                print("NO")
                exit()
            j, cnt = i, 1
if not j in x:
    print("NO")
    exit()
else:
    if cnt > x[j]:
        print("NO")
        exit()
    j, cnt = i, 1
print("YES")

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
d.sort()
m=int(input())
t=list(map(int,input().split()))
t.sort()
dd=d.pop()
tt=t.pop()
while d or t:
    if tt==dd:
        if t:
            tt=t.pop()
        else:
            print("YES")
            exit()
        if d:
            dd=d.pop()
        else:
            print("NO")
            exit()
        
    elif tt!=dd:
        if len(d)==0:
            print("NO")
            exit()
        dd=d.pop()
if dd==tt:
    print("YES")
else:
    print("NO")

Solution (Python):
n=int(input())
d=sorted(map(int,input().split()))
m=int(input())
t=sorted(map(int,input().split()))

d_dic = dict()
t_dic = dict()

for i in range(n):
    d1 = d[i]
    if d1 not in d_dic.keys():
        d_dic[d1] = 1
    else:
        d_dic[d1] += 1

ans = 0

for i in range(m):
    t1 = t[i]
    if t1 in d_dic.keys():
        d_dic[t1] -= 1
        if d_dic[t1] < 0:
            ans = 1
            break
    else:
        ans = 1
        break
    
if ans == 1:
    print("NO")
else:
    print("YES")

Solution (Python):
from typing import Counter


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

nc  =Counter(nlis)
mc = Counter(mlis)

flag = 1
for k, v in mc.items():
    if mc[k] > nc[k]:
        flag = 0
        break

if flag:
    print('YES')
else:
    print('NO')

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))

ddict = {}
for di in d:
    if di in ddict:
        ddict[di] += 1
    else:
        ddict[di] = 1

tdict = {}
for ti in t:
    if ti in tdict:
        tdict[ti] += 1
    else:
        tdict[ti] = 1

ans = True
for key, value in tdict.items():
    if key in ddict:
        if value > ddict[key]:
            ans = False
            break
    else:
        ans = False
        break

print("YES" if ans else "NO")

Solution (Python):
from collections import defaultdict
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

p = defaultdict(int)
for d in D:
  p[d] += 1

for t in T:
  if p[t] == 0:
    print("NO")
    exit(0)
  else:
    p[t] -= 1

print("YES")

Solution (Python):
N=int(input())
D=list(map(int,input().split()))
M=int(input())
T=list(map(int,input().split()))
D=sorted(D)
T=sorted(T)
i,j=0,0
count=0
while True:
  now=T[i]
  tmp=0
  for k in range(j,N):
    if D[k]==now:
      j=k+1
      count+=1
      i+=1
      break
  else:
    tmp=k
  if count==M:
    print("YES")
    exit()
  if tmp==N-1:
    print("NO")
    exit()

Solution (Python):
from collections import Counter

N=int(input())
d=input().split()
D=[int(a) for a in d]
M=int(input())
t=input().split()
T=[int(b) for b in t]

D_count=Counter(D)
T_count=Counter(T)

answer=0
for key,value in T_count.items():
    if D_count[key]==None:
        answer=1
        break
    elif D_count[key]<value:
        answer=1
        break

if answer==0:
    print('YES')
else:
    print(('NO'))

Solution (Python):
from collections import Counter
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

c = Counter(D)
flag = True
for t in T:
  if c[t] > 0:
    c[t] -= 1
  else:
    flag = False
    break
    
if flag:
  print('YES')
else:
  print('NO')

Solution (Python):
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    dList = list(map(int, readline().rstrip().split()))
    m = int(readline().rstrip())
    tList = list(map(int, readline().rstrip().split()))
    dc = collections.Counter(dList)
    tc = collections.Counter(tList)
    tcKeys = list(tc.keys())
    for tcKey in tcKeys:
        if dc[tcKey] < tc[tcKey]:
            print("NO")
            return
    print("YES")


if __name__ == '__main__':
    main()

Solution (Python):
import collections
 
n = int(input())
d = sorted(list(map(int,input().split())))
m = int(input())
t = list(map(int,input().split()))

cd = collections.Counter(d)
ct = collections.Counter(t)

flg = True
for k in ct.items():
  if k[1] > cd[k[0]]:
    flg = False

print('YES' if flg else 'NO')

Solution (Python):
N = int(input())
D = sorted(list(map(int, input().split())))
M = int(input())
T = sorted(list(map(int, input().split())))

if N < M:
    print('NO')
    exit()

fnd = 0
nw = 0
isok = True
for t in T:
    for i in range(nw, N):
        nw += 1
        if t == D[i]:
            fnd += 1
            break
        elif t < D[i]:
            isok = False
            break

print('YES' if (isok and fnd==len(T)) else 'NO')

Solution (Python):
import collections

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

c = collections.Counter(D)

flg = True
for t in T:
    tmp = c.get(t)
    if tmp == None or tmp == 0:
        flg = False
    else:
        c[t] = tmp - 1

print('YES' if flg else 'NO')

Solution (Python):
import collections
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))
D_1 = collections.Counter(D)
T_1 = collections.Counter(T)
for i in set(T):
    if D_1[i] < T_1[i]:
        print("NO")
        exit()
print("YES")

Solution (Python):




from collections import Counter






def solve(n,d,m,t):
  dd = Counter(d)
  dt = Counter(t)
  for k,v in dt.items():
    if k in dd.keys() and dd[k] >= v:
      pass
    else:
      return "NO"
  return "YES"



def main():
  N = int(input())
  d = list(map(int,input().split()))
  M = int(input())
  t = list(map(int,input().split()))
  print(solve(N,d,M,t))
  return

if __name__ == '__main__':
  main()

Solution (Python):
from collections import deque
def main():
    n=int(input())
    d=sorted(map(int,input().split()))
    m=int(input())
    t=deque(sorted(map(int,input().split())))
    
    for i in d:
        if t[0] == i:
            t.popleft()
            if len(t) == 0:
                print("YES")
                break
        elif t[0] < i:
            print("NO")
            break
    else:
        print("NO")
        
if __name__ == "__main__":
    main()

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import Counter
    n = int(readline())
    d = list(map(int, readline().split()))
    m = int(readline())
    t = list(map(int, readline().split()))

    cd = Counter(d)
    ct = Counter(t)

    cd.subtract(ct)

    for key, val in cd.items():
        if val < 0:
            return print("NO")

    print("YES")


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
d.sort()
t.sort()
j = 0
for i in range(n):
    if d[i] == t[j]:
        j += 1
    if j == m:
        break

if j == m:
    print('YES')
else:
    print('NO')

Solution (Python):

from collections import Counter
input()
d = Counter(input().split())
input()
t = Counter(input().split())
for k, v in t.items():
    if k not in d or d[k] < v:
        print("NO")
        exit()
print("YES")

Solution (Python):
from collections import Counter

N=int(input())
D=Counter((list(map(int,input().split()))))
M=int(input())
T=Counter((list(map(int,input().split()))))

for difficult,count in T.items():
    if difficult in D and D[difficult]>=count:
        pass
    else:
        print("NO")
        exit()
print("YES")

Solution (Python):
from collections import defaultdict
n = int(input())
d_ls = list(map(int, input().split()))
m = int(input())
t_ls = list(map(int, input().split()))

have_dict = defaultdict(int)
must_dict = defaultdict(int)
for i in range(n):
    have_dict[d_ls[i]] += 1
for i in range(m):
    must_dict[t_ls[i]] += 1
ans = 'YES'
for i in range(m):
    if must_dict[t_ls[i]] > have_dict[t_ls[i]]:
        ans = 'NO'
print(ans)

Solution (Python):
import collections
N = int(input())
D_list = [int(e) for e in input().split()]
M = int(input())
T_list = [int(e) for e in input().split()]
D_counted = collections.Counter(D_list)
T_counted = collections.Counter(T_list)

for difficult,count in T_counted.items():
    if difficult in D_counted and D_counted[difficult] >= count:
        pass
    else:
        print("NO")
        break
else:
    print("YES")

Solution (Python):

from collections import Counter
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
d = LI()
m = I()
t = LI()
d.sort()
t.sort()
c_t = Counter(t)
c_d = Counter(d)


ans = 'YES'
i = 0
c_d = dict([(k, v) for k, v in c_d.items() if k in c_t.keys()])
if len(c_d) != len(c_t):
    ans = 'NO'
    print(ans)
    exit()
for (k_t, v_t), (k_d, v_d) in zip(c_t.items(), c_d.items()):
    if v_t > v_d:
        ans = 'NO'
        break
print(ans)

Solution (Python):



from collections import Counter

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

D_count = Counter(D)
T_count = Counter(T)

for t_key, t_val in T_count.items():
    if(t_key in D_count):
        if(t_val > D_count[t_key]):
            print("NO") 
            exit()
    else:
        print("NO")
        exit()

print("YES")

Solution (Python):
import sys
from collections import Counter

N = int(sys.stdin.readline())
D = map(int, sys.stdin.readline().split())
M = int(sys.stdin.readline())
T = map(int, sys.stdin.readline().split())

diffs = Counter(D)
problems = Counter(T)

for diff, count in problems.items():
    if diff not in diffs:
        break
    if diffs[diff] < count:
        break
else:
    print("YES")
    sys.exit()

print("NO")

Solution (Python):
import sys
from collections import Counter
N = int(input())
D = Counter(list(map(int, input().split())))
M = int(input())
T = list(map(int, input().split()))
for t in T:
    if D[t] <= 0:
        print('NO')
        sys.exit()
    else:
        D[t] -= 1
print('YES')

Solution (Python):
N=int(input())
D=list(map(int,input().split()))
M=int(input())
T=list(map(int,input().split()))

E={}
for d in D:
    if d in E:
        E[d]+=1
    else:
        E[d]=1

U={}
for t in T:
    if t in U:
        U[t]+=1
    else:
        U[t]=1

F=True
for u in U:
    if u in E:
        F&=(U[u]<=E[u])
    else:
        F=False

if F:
    print("YES")
else:
    print("NO")

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
cnt = {}
for i in d:
  if i not in cnt:
    cnt[i] = 1
  else:
    cnt[i] += 1
m = int(input())
t = list(map(int,input().split()))
flag = True
for i in t:
  if i in cnt:
    if cnt[i]>0:
      cnt[i] -= 1
    else:
      flag = False
      break
  else:
    flag = False
    break
if flag:
  print("YES")
else:
  print("NO")

Solution (Python):
import collections
import sys

N = int(input())
*D, = map(int, input().split())
M = int(input())
*T, = map(int, input().split())

d = collections.Counter(D)
t = collections.Counter(T)

for k,v in t.items():
    if d[k] >= v:
        pass
    else:
        print('NO')
        sys.exit()
print('YES')

Solution (Python):
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))
D.sort()
T.sort()
from collections import deque
D = deque(D)
T = deque(T)
while T:
    t = T.popleft()
    flag = False
    while D:
        new = D.popleft()
        if new == t:
            flag = True
            break
    if not flag:
        print('NO')
        exit()
print('YES')

Solution (Python):
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

D = sorted(D)
T = sorted(T)

i, j = 0, 0
count = 0
while True:
    now = T[i]
    tmp = 0
    for k in range(j, N):
        if D[k] == now:
            j = k+1
            count += 1
            i += 1
            break
        else:
            tmp = k
    if count == M:
        print("YES")
        exit()
    if tmp == N-1:
        print("NO")
        exit()

Solution (Python):
from collections import Counter

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

Count = Counter(D)

for t in T:
    if not Count[t]:
        print("NO")
        exit()
    else:
        Count[t] -= 1
print("YES")

Solution (Python):
N = int(input())
Ds = [int(i) for i in input().split(' ')]
M = int(input())
Ts = [int(i) for i in input().split(' ')]

if M > N:
     print('NO')
else:
    dic = {}
    for d in Ds:
        if d in dic:
            dic[d] += 1
        else:
            dic[d] = 1
    for t in Ts:
        flag = 0
        if t in dic:
            dic[t] -= 1
            if dic[t] < 0:
                flag = 1
                break
        else:
            flag = 1
            break
    if flag == 1:
        print('NO')
    else:
        print('YES')

Solution (Python):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    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.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr



def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod



def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


class UnionFind():
    def __init__(self, n):
        self.n = 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 members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


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


inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
d = lr()
m = ir()
t = lr()
dic = collections.Counter(d)
flag = True
for num in t:
    if num in dic:
        if dic[num] == 0:
            flag = False
            break
        else:
            dic[num]-=1
    else:
        flag = False
        break
if flag:
    print('YES')
else:
    print('NO')

Solution (Python):
from collections import Counter
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))

d_count = Counter(d)
t_count = Counter(t)
for x,y in t_count.items():
  if x in d_count:
    if y > d_count[x]:
      print("NO")
      break
  else:
    print("NO")
    break
else: print("YES")

Solution (Python):
from collections import Counter

N = int(input())
D = [int(_) for _ in input().split()]
M = int(input())
T = [int(_) for _ in input().split()]

cntd = Counter(D)
cntt = Counter(T)

for t in cntt:
    if cntt[t] > cntd[t]:
        print("NO")
        exit(0)
print("YES")

Solution (Python):
from collections import Counter
n = int(input())
d = Counter(list(map(int, input().split())))
m = int(input())
t = Counter(list(map(int, input().split())))
key = t.keys()
ans = True
for i in key:
    if t[i] > d[i]:
        ans = False
        break
if ans:
    print("YES")
else:
    print("NO")

Solution (Python):
from collections import Counter
_ = input()
D = map(int, input().split())
_ = input()
T = Counter(map(int, input().split()))
for d in D:
  if d in T and T[d] > 0:
    T[d] -= 1
print('YES' if all(v==0 for v in T.values()) else 'NO')

Solution (Python):
from collections import Counter
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))

count_d = Counter(d)
count_t = Counter(t)

for i in count_t.items():
  if i[0] not in count_d:
    print("NO")
    exit()
  if i[0] in count_d: count_d[i[0]] -= i[1]
else:
  for x in count_d.values():
    if x < 0:
      print("NO")
      exit()
  print("YES")

Solution (Python):
import collections

def main():
    N = int(input())
    D = list(map(int, input().split()))
    M = int(input())
    T = list(map(int, input().split()))

    cD = dict(collections.Counter(D))
    cT = dict(collections.Counter(T))

    for k, v in cT.items():
        if k not in cD:
            print("NO")
            exit()
        else:
            if v > cD[k]:
                print("NO")
                exit()

    print("YES")


if __name__ == "__main__":
    main()

Solution (Python):

import sys
from collections import deque, defaultdict
from math import sqrt, factorial





def solve():
    n = int(input())
    d = defaultdict(int)
    a = [int(x) for x in input().split()]
    for e in a:
        d[e] += 1
    m = int(input())
    t = [int(x) for x in input().split()]
    for e in t:
        if d[e]:
            d[e] -= 1
        else:
            print("NO")
            return
    print("YES")
    

t = 1

for case in range(1,t+1):
    ans = solve()


"""

1 + k



"""

Solution (Python):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    D=LI()
    M=I()
    T=LI()
    
    from collections import defaultdict
    dd = defaultdict(int)
    
    for i in range(N):
        dd[D[i]]+=1
        
    flag=1
    for i in range(M):
        dd[T[i]]-=1
        
    for k,v in dd.items():
        if v<0:
            flag=0
            
    if flag:
        print("YES")
    else:
        print("NO")
    

main()

Solution (Python):
n=int(input())
d=sorted(map(int,input().split()))
m=int(input())
t=sorted(map(int,input().split()))
cnt=0
for i in range(n):
    if t[cnt]==d[i]:
        cnt+=1
    if cnt>=m:
        print("YES")
        exit()
print("NO")

Solution (Python):
from collections import Counter
from sys import exit
N = int(input())
D = Counter(map(int, input().split()))
M = int(input())
T = tuple(map(int, input().split()))
for t in T:
  if D.get(t):
    D[t] -= 1
  else:
    print("NO")
    exit()
print("YES")

Solution (Python):
import collections
import sys

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

ct=collections.Counter(t)
cd=collections.Counter(d)
cct=list(ct.items())

if n < m:
    print('NO')
else:
    for i in range(len(cct)):
        if cd[cct[i][0]]<cct[i][1]:
            print('NO')
            sys.exit()
    print('YES')

Solution (Python):
import sys
from collections import Counter
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))

dc = Counter(d)
tc = Counter(t)

for i in tc.keys():
    if dc[i]<tc[i]:
        print('NO')
        sys.exit()
print('YES')

Solution (Python):
n=int(input())
d=list(map(int, input().split()))
m=int(input())
t=list(map(int, input().split()))

from collections import Counter
d_c=Counter(d)
t_c=Counter(t)

flag=True
for key in t_c:
    if d_c[key]<t_c[key]:
        flag=False
print('YES' if flag else 'NO')

Solution (Python):


from sys import stdin, setrecursionlimit
from collections import deque


def main():
    input = stdin.buffer.readline
    n = int(input())
    d = list(map(int, input().split()))
    m = int(input())
    t = list(map(int, input().split()))
    if m > n:
        print('NO')
    else:
        d.sort()
        t.sort()
        dq = deque(d)
        tq = deque(t)
        while tq:
            ti = tq.popleft()
            di = dq.popleft()
            while di < ti:
                di = dq.popleft()
            if di > ti:
                print('NO')
                exit()
        print('YES')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Solution (Python):
n = int(input())
dlst = list(map(int, input().split()))
m = int(input())
tlst = list(map(int, input().split()))

dlst.sort()
tlst.sort()
posd = 0
post = 0

while 1:
    if dlst[posd] == tlst[post]:
        posd += 1
        post += 1
    else:
        posd += 1
    if post == m:
        print("YES")
        exit()
    elif posd == n:
        print("NO")
        exit()

Solution (Python):
from collections import Counter

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

d = Counter(D)
t = Counter(T)

f = True
for df in t.keys():
    f &= (d[df] >= t[df])

print(["NO", "YES"][f])

Solution (Python):
from collections import Counter

N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))
cd = Counter(D)
ct = Counter(T)

for k, v in ct.items():
  if cd[k] < v:
    print('NO')
    exit()
    
print('YES')

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
m = inp()
b = inpl()
ca = Counter(a)
cb = Counter(b)
for key in list(cb):
    if cb[key] > ca[key]:
        print('NO')
        break
else:
    print('YES')

Solution (Python):
from collections import Counter

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

Dc = Counter(D)
Tc = Counter(T)

for k, v in Tc.items():
    if Dc[k] < v:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
n= int(input())
D = list(map(int, input().split()))
m = int(input())
T = list(map(int, input().split()))

from collections import Counter
C = Counter(D)
for t in T:
    if t not in C:
        print('NO')
        exit()
    else:
        if C[t] == 0:
            print('NO')
            exit()
        else:
            C[t] -= 1
else:
    print('YES')

Solution (Python):
from collections import Counter
def check():
  N = int(input())
  D = list(map(int, input().split()))
  M = int(input())
  T = list(map(int, input().split()))
  d = Counter(D)
  t = Counter(T)
  for k,v in t.items():
    if d[k]<v:
      return 'NO'
  return 'YES'
print(check())

Solution (Python):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
n=I()
lis1=LI()
m=I()
lis2=LI()
c1=Counter(lis1)
c2=Counter(lis2)
for x in c2.keys():
    if c1[x]<c2[x]:
        print("NO")
        sys.exit()
print("YES")

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate 

from collections import deque,defaultdict,Counter
import decimal
import re











import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
d = Counter(readInts())
m = I()
t = Counter(readInts())


print('YES' if all(ti in d and d[ti] >= tc for ti, tc in t.items()) else 'NO')

Solution (Python):
from collections import Counter
n = int(input())
d = Counter(list(map(int, input().split())))
m = int(input())
T = list(map(int, input().split()))

ans = "YES"
for t in T:
    if t in d and d[t] > 0:
        d[t] -= 1
    else:
        ans = "NO"
        break
print(ans)

Solution (Python):
N = int(input())
D = list(map(int,input().split()))
CD = {}
for i in range(N):
    d = D[i]
    if d not in CD:
        CD[d] = 0
    CD[d] += 1
M = int(input())
T = list(map(int,input().split()))
CT = {}
for j in range(M):
    t = T[j]
    if t not in CT:
        CT[t] = 0
    CT[t] += 1
flag = 0
for t in CT:
    if t not in CD:
        flag = 1
        break
    else:
        if CT[t]>CD[t]:
            flag = 1
            break
if flag==0:
    print("YES")
else:
    print("NO")

Solution (Python):
import sys

import collections

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

N = ini()
D = inl()
M = ini()
T = inl()


def solve():
    cd = collections.Counter(D)
    ct = collections.Counter(T)
    for t, cnt in ct.items():
        if cd[t] >= cnt:
            cd[t] -= cnt
        else:
            return False
    return True


print("YES" if solve() else "NO")

Solution (Python):
def resolve():
    '''
    code here
    '''
    import bisect
    N = int(input())
    Ds = [int(item) for item in input().split()]
    M = int(input())
    Ts = [int(item) for item in input().split()]
    Ds.sort()
    Ts.sort()

    for item in Ts:
        index = bisect.bisect_left(Ds, item)
        if Ds[index] != item:
            print('NO')
            break
        else:
            Ds[index] = -1
    else:
        print('YES')
        



if __name__ == "__main__":
    resolve()

Solution (Python):






import collections





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





t_count = collections.Counter(T)
d_count = collections.Counter(D)

for key,c in t_count.items():
    if key in d_count.keys():
        if d_count[key] < c:
            print("NO")
            break
    else:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
d = defaultdict(int)
for i in readChars():
	d[i]+=1
m =readInt()
t = defaultdict(int)
for i in readChars():
	t[i]+=1

for key in t:
	if d[key]-t[key]<0:
		print("NO")
		exit()
print("YES")

Solution (Python):
from collections import Counter

n = int(input())
d = list(map(int, input().split()))
d_c = Counter(d)
m = int(input())
t = sorted(list(map(int, input().split())), reverse=True)

for i in range(m):
    if d_c[t[i]] > 0:
        d_c[t[i]] -= 1
    else:
        print('NO')
        exit()
print('YES')

Solution (Python):
import collections
import sys
N=int(input())
D = list(map(int, input().split())) 
M=int(input())
T = list(map(int, input().split())) 
D_count=collections.Counter(D)
T_count=collections.Counter(T)
for i in T:
    if D_count[i]<T_count[i]:
        print("NO")
        sys.exit()
print("YES")