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):
from collections import Counter
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))
Tcount = Counter(T)
flag = 'YES'
Dcount = Counter(D)
for n,c in Tcount.items():
    if n not in Dcount:
        flag = 'NO'
        break
    if c > Dcount[n]:
        flag = 'NO'
        break
print(flag)

Solution (Python):
from collections import Counter
n = int(input())
L1 = list(map(int,input().split()))
m = int(input())
L2 = list(map(int,input().split()))
li1 = Counter(L1)
li2 = Counter(L2)

flag = False
for i in range(m):
    if li1[L2[i]] >= li2[L2[i]]:
        flag = True
    else:
        flag = False
        break
if flag:
    print("YES")
else:
    print("NO")

Solution (Python):
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def S_():
    return input()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

from functools import reduce
ans=0
n=I()
d=Counter(LI())
m=I()
t=Counter(LI())

ans='YES'
for i,j in t.items():
    if d[i]<j:
        ans='NO'
print(ans)

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

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

for test in T.keys():
	if D[test] >= T[test]:
		continue
	else:
		print("NO")
		sys.exit()

print("YES")

Solution (Python):
import collections

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

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

for k, v in cT.items():
    if k not in cD or cD[k] < v:
        print('NO')
        break
else:
    print('YES')

Solution (Python):
def main():
    N = int(input())
    D = [int(i) for i in input().split()]
    from collections import Counter, defaultdict
    D_c = defaultdict(int, Counter(D))
    M = int(input())
    T = [int(i) for i in input().split()]
    for t in T:
        if D_c[t] > 0:
            D_c[t] -= 1
        else:
            return print("NO")
    print("YES")


if __name__ == '__main__':
    main()

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

c = M
for i in range(N):
    
    if c == 0:
        break
    elif D[i] == T[M - c]:
        
        c -= 1

if c == 0:
    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()))

from collections import Counter

a=Counter(D)
b=Counter(T)

for keys in b:
  if keys not in a:
    print("NO")
    break
  else:
    if b[keys]>a[keys]:
      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()))
a={}
if m>n:
  print('NO')
else:
  for i in range(n):
    if d[i] not in a:
      a[d[i]]=1
    else:
      a[d[i]]+=1
  for i in range(m):
    if t[i] in a:
      a[t[i]]-=1
      if a[t[i]]==0:
        del a[t[i]]
    else:
      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()))

from collections import Counter
cD = Counter(D)
cT = Counter(T)

ans = 'YES'
for k in cT:
    if (k not in cD.keys()) or (cT[k] > cD[k]):
        ans = 'NO'
        break
print(ans)

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

if N < M:
    print('NO')
else:
    D.sort()
    T.sort()
    cnt = 0
    i = 0
    for t in T:
        while i < N:
            if D[i] == t:
                cnt += 1
                i += 1
                break
            i += 1
    if cnt == M: print('YES')
    else: print('NO')

Solution (Python):
import collections

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

D_count = collections.Counter(D)
T_count = collections.Counter(T)
flag = 0
for key, value in T_count.items():
    if key not in D_set:
        flag = 1
        print("NO")
        break
    else:
        if D_count[key] < value:
            flag = 1
            print("NO")
            break










if flag == 0:
    print("YES")

Solution (Python):
def check(s_di):
  for di in range(s_di,N):
    if D[di] == t:
      return di+1
  return None

N = int(input())
D = sorted(list(map(int,input().split())))
M = int(input())
T = sorted(list(map(int,input().split())))
s_di = 0
for t in T:
  res = check(s_di)
  if res is None:
    print('NO')
    exit()
  else:
    s_di = res
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()
j = 0
for i in range(N):
    if D[i] == T[j]:
        j += 1
    if j == M:
        print('YES')
        exit()
print('NO')

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
M=int(input())
t=list(map(int,input().split()))
import collections
ac=collections.Counter(a)
tc=collections.Counter(t)

for task in tc.items():
  if task[0] not in ac or ac[task[0]]<task[1]:
    print("NO")
    break
else:
  print("YES")

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
M=int(input())
t=list(map(int,input().split()))
import collections
ac=collections.Counter(a)
tc=collections.Counter(t)

for task in tc.items():
  if task[0] not in ac:
    print("NO")
    exit(0)
  elif ac[task[0]]<task[1]:
    print("NO")
    exit(0)
print("YES")

Solution (Python):
input()
D = {}
for a in [int(a) for a in input().split()]:
    if a not in D: D[a] = 0
    D[a] += 1

input()
for a in [int(a) for a in input().split()]:
    if a not in D: D[a] = 0
    D[a] -= 1

for a in D:
    if D[a] < 0:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
from collections import defaultdict
def main():
    N = int(input())
    D = defaultdict(int)
    for d in input().split():
        D[int(d)] += 1
    M = int(input())
    T = defaultdict(int)
    for t in input().split():
        T[int(t)] += 1
    
    for diff,num in T.items():
        if D[diff]>=num:
            pass
        else:
            print("NO")
            exit()
    print("YES")

    

if __name__ == "__main__":
    main()

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

for i in b.keys():
	if i not in a:
		print ("NO")
		exit()
	if b[i] > a[i]:
		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.sort()
t.sort()

cnt=0
 
for i in range(n):
    if d[i]==t[cnt]:
        cnt+=1
    elif d[i]<t[cnt]:
        pass
    else:
        print('NO')
        exit()
    
    if cnt==m:
        print('YES')
        exit()

Solution (Python):

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

label = 0
count = 0
ans = 1
for i in t:
    check = 0
    for j in range(label,n):
        if i == d[j]:
            label = j + 1
            check = 1
            break
    if check == 0:
        ans = 0
        break
if ans == 0:
    print('NO')
else:
    print('YES')

Solution (Python):
from collections import Counter
n = int(input())
d = Counter(map(int,input().split()))
m = int(input())
t = Counter(map(int,input().split()))
for i in t:
  if d[i] < t[i]:
    print('NO')
    exit()
print('YES')

Solution (Python):
n = int(input())
d = [int(i) for i in input().split()]
m = int(input())
t = [int(i) for i in input().split()]

d = sorted(d)
t = sorted(t)

left = 0
ans = 'YES'
for i in range(m):
    if t[i] < d[left]:
        ans='NO'
        break
    elif t[i] == d[left]:
        left+=1
        if i!= m-1 and left >=n:
            ans = 'NO'
            break
    else:
        while t[i] != d[left]:
            left+=1
            if left >= n:
                ans='NO'
                break
        left+=1
        if left>=n:
            ans = 'NO'
            break
print(ans)

Solution (Python):
from collections import Counter

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

cnt = Counter(D)
for t in T :
  if cnt[t] == 0 :
    print('NO')
    break
  else :
    cnt[t] -= 1
else :
  print('YES')

Solution (Python):
N = int(input())
D = sorted(list(map(int,input().split())))
M = int(input())
T = sorted(list(map(int,input().split())))
cur = 0
flag = 0
for i in range(N):
    if cur<M and D[i]==T[cur]:
        cur += 1
    elif cur<M and D[i]<T[cur]:
        continue
    elif cur==M:
        break
    else:
        flag = 1
        break
if flag==0:
    print("YES")
else:
    print("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()))
if N < M:
  print("NO")
  exit()
d = defaultdict(int)
for i in range(N):
  d[D[i]] += 1

for i in range(M):
  if not d[T[i]]:
    print("NO")
    exit()
  d[T[i]] -= 1
print("YES")

Solution (Python):
from collections import Counter, defaultdict

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

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

for i in range(M):
    ti = T[i]
    if ti not in memo:
        print("NO")
        exit()
    if memo[ti] == 0:
        print("NO")
        exit()
    memo[ti] -= 1

print("YES")

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

D.sort()
T.sort()
l = 0
for i in range(M):
    while True:
        if D[l] == T[i]:
            l += 1
            break
        elif D[l] > T[i]:
            print("NO")
            sys.exit()
        l += 1
        
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()
j = 0
for i in range(M):
    if j==N:
        print('NO')
        break
    if T[i]>=D[j]:
        while T[i]>D[j]:
            j += 1
        if T[i]==D[j]:
            j += 1
        else:
            print('NO')
            break
    else:
        print('NO')
        break
else:
    print('YES')

Solution (Python):
import heapq

def heap(h):
    hlst = list(map(int, input().split()))
    for i in hlst:
        heapq.heappush(h, i)
N = int(input())
d = []
heap(d)
M = int(input())
t = []
heap(t)

ans = 'YES'
for j in range(M):
    tmpT = heapq.heappop(t)
    for i in range(N):
        tmpD = heapq.heappop(d)
        if tmpT == tmpD:
            break
        if tmpT < tmpD:
            ans = 'NO'
            break
    if ans == 'NO':
        break

print(ans)

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

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

memo = {}
for i in range(n):
    if d[i] not in memo:
        memo[d[i]] = 1
    else:
        memo[d[i]] += 1

for i in range(m):
    if t[i] not in memo:
        print("NO")
        exit()
    if memo[t[i]] == 0:
        print("NO")
        exit()
    memo[t[i]] -= 1
print("YES")

Solution (Python):

import sys
sys.setrecursionlimit(10000)
INF = 1<<32

YES = "YES"  
NO = "NO"  

def solve(N: int, D: "List[int]", M: int, T: "List[int]"):
    
    D.sort()
    T.sort()

    from bisect import bisect_left, bisect_right

    if M > N:
        print(NO)
        exit()


    for i in range(M):
        lf = bisect_left(D, T[i])
        ri = bisect_right(D, T[i])
        if lf != ri:
            D[lf] = 0
        else:
            print(NO)
            exit()

    print(YES)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    D = [int(next(tokens)) for _ in range(N)]  
    M = int(next(tokens))  
    T = [int(next(tokens)) for _ in range(M)]  
    solve(N, D, M, T)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
d_li = list(map(int,input().split()))
m = int(input())
t_li = list(map(int,input().split()))

d_li.sort()
t_li.sort()

check = 0

for i in range(n):
    if d_li[i] == t_li[check]:
        check += 1
        
    if check == m:
        print("YES")
        exit()
else:
    print("NO")

Solution (Python):
n = int(input())
d_li = list(map(int,input().split()))
m = int(input())
t_li = list(map(int,input().split()))

d_li.sort()
t_li.sort()

check = 0

for i in range(n):
    if d_li[i] == t_li[check]:
        check += 1
        
    if check == m:
        print("YES")
        exit()
else:
    print("NO")

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

d.sort()
t.sort()

count=0

for i in range(n):
    if d[i]==t[count]:
        count+=1
    elif d[i]<t[count]:
        pass
    else:
        print('NO')
        exit()
    
    if count==m:
        print('YES')
        exit()

Solution (Python):
from collections import Counter as c
n=int(input())
d=[int(i) for i in input().split()]
m=int(input())
t=[int(i) for i in input().split()]
D=c(d)
T=c(t)
print("NO" if sum(T[i]>D[i] for i in T) else "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()))

d_c=Counter(d)
t_c=Counter(t)
for i in t_c.keys():
    if t_c[i]>d_c[i]:
        print('NO')
        exit()
print('YES')

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

ok = True
for k, v in B.items():
    if not k in A.keys():
        ok = False
        break
    elif A[k] < v:
        ok = False
        break
print("YES" if ok else "NO")

Solution (Python):
from collections import Counter

input()
d = Counter(input().split())
input()
t = Counter(input().split())

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

Solution (Python):
from collections import Counter
n = int(input())
D = Counter(input().split())
m = int(input())
for i, j in Counter(input().split()).items():
    if i not in D or D[i] < j:
        print("NO")
        exit()
print("YES")

Solution (Python):
n = int(input())

x = dict()
for i in input().split():
    x[i] = x.get(i, 0) + 1

m = int(input())

for i in input().split():
    if i not in x or x[i] == 0:
        print("NO")
        exit()
    else:
        x[i] -= 1
print("YES")

Solution (Python):
n = int(input())

x = dict()
for i in input().split():
    x[i] = x.get(i, 0) + 1

m = int(input())

y = dict()
for i in input().split():
    y[i] = y.get(i, 0) + 1

for i, j in y.items():
    if x.get(i, 0) < j:
        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()))

x = dict()
for i in d:
    x[i] = x.get(i, 0) + 1

y = dict()
for i in t:
    y[i] = y.get(i, 0) + 1

for i, j in y.items():
    if x.get(i, 0) < j:
        print("NO")
        exit()
print("YES")

Solution (Python):
from collections import Counter
n = int(input())
D = Counter(input().split())
m = int(input())
T = Counter(input().split())
for i in T.keys():
  if i not in D or D[i] < T[i]:
    print("NO")
    exit()
print("YES")

Solution (Python):
from collections import Counter

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

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


f=True
for Ti in CT.keys():
    if CD[Ti]<CT[Ti]:
        f=False
        break

print('YES' if f 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()))

d_c=Counter(d)
t_c=Counter(t)
for i in t_c.keys():
    if t_c[i]>d_c[i]:
        print('NO')
        exit()
print('YES')

Solution (Python):
from collections import defaultdict

n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dic = defaultdict(lambda: 0)
ans = "YES"
for i in d:
  dic[i] += 1
for i in t:
  dic[i] -= 1
  if dic[i] == -1:
    ans = "NO"
    break
print(ans)

Solution (Python):
from collections import Counter


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

    d = Counter(D)
    t = Counter(T)
    for key, value in t.items():
        if d[key] < value:
            print('NO')
            exit()
    else:
        print('YES')


if __name__ == '__main__':
    main()

Solution (Python):

from collections import defaultdict
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
n = input()
D = list(map(int,input().split()))
m = input()
T = list(map(int,input().split()))

DD = defaultdict(int)

for d in D:
    DD[d] += 1

for t in T:
    DD[t] -= 1
    if DD[t]<0:
        print('NO')
        exit()

print('YES')

Solution (Python):
import sys

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

dic = {}
for i in range(N):

    if D[i] not in dic:
        dic[D[i]] = 1
    else:
        dic[D[i]] += 1

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

for i in T:

    if i not in dic:
        print ("NO")
        sys.exit()

    elif dic[i] == 0:
        print ("NO")
        sys.exit()

    else:
        dic[i] -= 1

print ("YES")

Solution (Python):
from sys import exit, stdin
from collections import Counter
N = int(stdin.readline().rstrip())
D = Counter([int(_) for _ in stdin.readline().rstrip().split()])
M = int(stdin.readline().rstrip())
T = Counter([int(_) for _ in stdin.readline().rstrip().split()])
for k, v in T.items():
    if k not in D or D[k] < v:
        print('NO')
        exit()
print('YES')

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

if N < M:
    print("NO")
    exit(0)
tableD = collections.defaultdict(int)
tableT = collections.defaultdict(int)
for i in range(N):
    tableD[D[i]] += 1
for i in range(M):
    tableT[T[i]] += 1

for x in tableT:
    if tableD[x] >= tableT[x]:
        continue
    else:
        print("NO")
        exit(0)
print("YES")

Solution (Python):
from collections import Counter


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

    d = Counter(D)
    t = Counter(T)
    for key, value in t.items():
        if d.get(key, 0) < value:
            print('NO')
            exit()
    else:
        print('YES')


if __name__ == '__main__':
    main()

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)
for key, value in t.items():
    if d.get(key, 0) < value:
        print('NO')
        exit()
else:
    print('YES')

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

grA = dict(collections.Counter(d))
grB = dict(collections.Counter(t))


for numB,cntB in grB.items():
  
  try:
    if grA[numB] < cntB:
      print("NO")    
      exit()
  except KeyError:
    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 i, v in t.items():
    if d[i] < v:
        print("NO")
        exit()
print("YES")

Solution (Python):
from collections import deque
n=int(input())
dl=deque(sorted(list(map(int,input().split()))))
m=int(input())
tl=deque(sorted(list(map(int,input().split()))))
while tl:
    t=tl.popleft()
    while(dl):
        d=dl.popleft()
        if t==d:
            break
    else:
        break
else:
    print('YES')
    exit()
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()))

cntD = Counter(D)
for t in T:
    if cntD[t] <= 0:
        print('NO')
        break
    cntD[t] -= 1
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()))

cD = Counter(D)
cT = Counter(T)

kD = set(cD.keys())

for k, v in cT.items():
  if k not in kD or cD[k] < v:
    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.sort()
t.sort()

a = 0
b = 0
cnt = 0
last = t[-1]
for i in range(a, n):
    for j in range(b, m):
        if d[i] == t[j]:
            cnt += 1
            b = j+1
            break
        elif d[i] < t[j]:
            break

if cnt == m:
    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()))
cd = Counter(D)
ct = Counter(T)
flag = True
for k, v in ct.items():
    if v > cd[k]:
        flag = False
print('YES' if flag else 'NO')

Solution (Python):
from collections import Counter
n = int(input())
d = [int(i) for i in input().split()]
m = int(input())
t = [int(i) for i in input().split()]
d_count = Counter(d)
for k, v in Counter(t).items():
    if k not in d_count.keys():
        print("NO")
        exit()
    elif d_count[k] < v:
        print("NO")
        exit()
print("YES")

Solution (Python):
from collections import Counter


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

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

    ans = "YES"
    for k, v in ct.items():
        if not k in cd:
            ans = "NO"
            break
        if v > cd[k]:
            ans = "NO"
            break
    return ans


print(isOk())

Solution (Python):
def main():
    from collections import defaultdict

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

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

    for T_ in T:
        d[T_] -= 1
        if d[T_] < 0:
            return 'NO'

    return 'YES'


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

Solution (Python):
import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    d = collections.Counter(list(map(int, input().rstrip('\n').split())))
    m = int(input().rstrip('\n'))
    t = collections.Counter(list(map(int, input().rstrip('\n').split())))
    for k, v in t.items():
        if v > d[k]:
            print("NO")
            exit()
    print("YES")


if __name__ == '__main__':
    solve()

Solution (Python):
from collections import defaultdict as dd
n=int(input())
a=list(map(int,input().split()))
m=int(input())
b=list(map(int,input().split()))
d = dd(int)
d2=dd(int)
for i in range(n):
  d[a[i]]+=1
for i in range(m):
  d2[b[i]]+=1
for k in sorted(d2.keys()):
  if d2[k] > d[k]:
    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()))


List = {}
for i in D:
    if List.get(i,None)==None:
        List[i]=1
    else:
        List[i]+=1


for i in T:
    if List.get(i,None)==None:
        print("NO")
        exit()
    else:
        if(List[i]==1):
            del List[i]
        else:
            List[i]-=1
        

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 i in range(m):
    if c[t[i]]==0:
        print("NO")
        exit()
    else:
        c[t[i]]-=1

print("YES")

Solution (Python):
n = int(input())
d_list = list(map(int,input().split()))
m = int(input())
t_list = list(map(int,input().split()))
d_list.sort()
t_list.sort()
i = 0
j = 0
while True: 
    if j == m:
        print("YES")
        exit()
    elif i == n:
        print("NO")
        exit()
    if t_list[j] == d_list[i]:
        j += 1
        i += 1
    else:
        i += 1

Solution (Python):
import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    d = collections.Counter(list(map(int, input().rstrip('\n').split())))
    m = int(input().rstrip('\n'))
    t = collections.Counter(list(map(int, input().rstrip('\n').split())))
    for k, v in t.items():
        if k not in d:
            print("NO")
            exit()
        else:
            if v > d[k]:
                print("NO")
                exit()
    print("YES")


if __name__ == '__main__':
    solve()

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

import  bisect
from collections import  Counter
D.sort()
T.sort()
tmpa=Counter(D)
tmpt=Counter(T)
cnt=0
for i in range(M):
    hnt=T[i]
    v=True
    if tmpt[hnt]<=tmpa[hnt]:
        continue
    else:
        v=False
        print("NO")
        exit()

if v:
    print("YES")

Solution (Python):
def solve(n, d, m, t):
    d = sorted(d)
    t = sorted(t)
    i = 0
    for j in range(m):
        while (i < n) and (d[i] < t[j]):
            i += 1
        if (i == n) or (d[i] != t[j]):
            return "NO"
        i += 1
    return "YES"

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

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

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

counts = defaultdict(int)
for d in D:
    counts[d] += 1
for t in T:
    counts[t] -= 1

ok = True
for c in counts.values():
    ok &= c >= 0
if ok:
    print('YES')
else:
    print('NO')

Solution (Python):
from collections import Counter
n=int(input())
d=Counter(map(int,input().split()))
m=int(input())
t=Counter(map(int,input().split()))
for i in t.keys():
    if d[i]<t[i]:
        print('NO')
        break
else:
    print('YES')

Solution (Python):
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
d = inpl()
m = inp()
t = inpl()
cntd = Counter(d)
cntt = Counter(t)
for key in cntt:
    if cntt[key] > cntd[key]:
        print('NO')
        break
else:
    print('YES')

Solution (Python):
from sys import stdin
from collections import defaultdict
dic_d = defaultdict(int)
dic_t = defaultdict(int)
N = int(stdin.readline().rstrip())
for D in stdin.readline().rstrip().split():
    if D in dic_d:
        dic_d[D] += 1
    else:
        dic_d[D] = 1

M = int(stdin.readline().rstrip())
for T in stdin.readline().rstrip().split():
    if T in dic_t:
        dic_t[T] += 1
    else:
        dic_t[T] = 1
flag = True
for i in dic_t.keys():
    if dic_t[i] > dic_d[i]:
        flag = False
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()))	
data={}
for i in range(n):
    if d[i] not in data:
        data[d[i]]=1
    else:
        data[d[i]]+=1
key=0
for i in range(m):
    if t[i] not in data:
        key=1
        break
    else:
        if data[t[i]]>0:
            data[t[i]]-=1
        else:
            key=1
            break
if key==0:
    print("YES")
else:
    print("NO")