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):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N = k()
D = l()
M = k()
T = l()

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

for i in t:
    if t[i] > d[i]:
        print("NO")
        sys.exit()

print("YES")

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

from collections import*
d=Counter(D)
t=Counter(T)

print(['NO','YES'][(d&t)==t])

Solution (Python):
import math
import collections
import fractions
import itertools

def solve():
    n = int(input())
    d = list(map(int, input().split()))
    m = int(input())
    t = list(map(int, input().split()))
    t = collections.Counter(t)
    d = collections.Counter(d)
    for i in t:
        if t[i] > d[i]:
            print("NO")
            break
    else:
        print("YES")
    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
from collections import Counter
def main():
    n = int(input())
    D = list(map(int, input().split()))
    c1 = Counter(D)
    m = int(input())
    T = list(map(int, input().split()))
    c2 = Counter(T)
    for k, v in c2.items():
        if c1[k] < v:
            print('NO')
            exit()
    print('YES')

if __name__ == '__main__':
    main()

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


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


def solve(N, D, M, T):
    D.sort()
    T.sort()
    ix = 0
    for t in T:
        while D[ix] < t and ix < N-1:
            ix += 1
        if D[ix] == t:
            ix += 1
        else:
            return "NO"
    return "YES"


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

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)

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

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
import sys
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
d = LIST()
m = INT()
t = LIST()
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):
import sys
from collections import defaultdict
input = lambda: sys.stdin.readline().rstrip()
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dd = defaultdict(int)
tt = defaultdict(int)

for i in d:
    dd[i] += 1
for i in t:
    tt[i] += 1

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

Solution (Python):
from collections import Counter

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

d_count = Counter(d_input)
t_count = Counter(t_input)

for key,value in t_count.items():
    if key not in d_count:
        print('NO');exit()
    if d_count[key]<value:
        print('NO');exit()
print('YES')

Solution (Python):
from collections import Counter

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

d_count = Counter(d_input)
t_count = Counter(t_input)

for key,value in t_count.items():
    if key not in d_count:
        print('NO');exit()
    if d_count[key]<value:
        print('NO');exit()
print('YES')

Solution (Python):
from collections import Counter

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

d_count = Counter(d_input)
t_count = Counter(t_input)

for key,value in t_count.items():
    if key not in d_count:
        print('NO');exit()
    if d_count[key]<value:
        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())))

Make = True
for i, j in t.items():
    if d[i] < j:
        Make = False

if Make:
    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()))

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

from collections import Counter
Dc = Counter(D)

for m in T:
    if m in Dc.keys():
        Dc[m] -= 1
        if Dc[m] < 0:
            print("NO")
            exit(0)
    else:
        print("NO")
        exit(0)

print("YES")

Solution (Python):

import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(text: str):
    print(text)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))



def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


from collections import Counter
N = a_int()
D = ints()
M = a_int()
T = ints()

cnt = Counter(D)
for t in T:
    cnt[t] -= 1
    if cnt[t] < 0:
        exit('NO')

print('YES')

Solution (Python):

import collections
N = int(input())

d = collections.Counter(list(map(int,input().split())))

M = int(input())
t = list(map(int,input().split()))
t_num = t.copy()
t_num = set(list(t_num))
t = collections.Counter(t)

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

for key in t_num:
    if d[key] < t[key]:
        print('NO')
        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()))

c = Counter(d)
for i in t:
    if c[i] > 0:
        c[i] -= 1
    else:
        print('NO')
        sys.exit()
print('YES')

Solution (Python):
n=int(input())
d=sorted(list(map(int,input().split())))
m=int(input())
t=sorted(list(map(int,input().split())))
j=0
for i in range(m):
  while d[j]<t[i]:
    j+=1
  if d[j]>t[i]:
    print("NO")
    break
  j+=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()))
Dc = Counter(D)
Tc = Counter(T)
for t in Tc.keys():
    if Dc.get(t) == None:
        print('NO')
        exit()
    if Tc[t] > Dc[t]:
        print('NO')
        exit()
print('YES')

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

j = -1
for i in T:
	j += 1
	while j<N and D[j]!=i:
		j += 1
	if j == N:
		print('NO')
		exit()
		
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()))



flg = True
for i in t.keys():
    if t[i] > d[i]:
        print('NO')
        flg = False
        break
        
if flg:
    print('YES')

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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):
    while j<n and d[j]<t[i]:
        j += 1
    if j>=n or d[j]!=t[i]:
        print("NO")
        break
    else:
        j += 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()))

D = Counter(D)
T = Counter(T)

for i in T:
    D_count = D[i]
    T_count = T[i]
    if T_count > D_count:
        print("NO")
        exit()
print("YES")

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

for i in t:
    while d:
        tmp_d = d.pop()
        if i == tmp_d:
            break
    else:
        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()))

dicta=defaultdict(lambda:0)
dictb=defaultdict(lambda:0)

for i in range(n):
    dicta[D[i]]+=1

for i in range(m):
    dictb[T[i]]+=1


ans="YES"
for i in range(m):
    if dicta[T[i]]<dictb[T[i]]:
        ans="NO"
        break

print(ans)

Solution (Python):

import collections

N = int(input().split()[0])
d_list = list(map(int, input().split()))
M = int(input().split()[0])
t_list = list(map(int, input().split()))

d_counter = collections.Counter(d_list)
t_counter = collections.Counter(t_list)
is_ok = True
for k, v in t_counter.items():
    if d_counter[k] < v:
        is_ok = False

ans = "YES" if is_ok else "NO"

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()))
ans = "YES"
dc = Counter(d)
tc = Counter(t)
for k,v in tc.items():
    if dc[k]<v:
        ans = "NO"
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()))

CD = Counter(D)
CT = Counter(T)
ans = CT - CD

if ans:
  print('NO')
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)

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

for i, c in Tc.items():
    if (Dc[i] < c):
        print('NO')
        exit()
    else:
        continue

print('YES')

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7


N = INT()
D = LIST()
M = INT()
T = LIST()

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

for x in t:
	if d[x] < t[x]:
		print("NO")
		break
else:
	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())))
flag=0
for key in t.keys():
    if key in d.keys():
        if d[key] < t[key]:
            flag=1
            break
    else:
        flag=1
        break
if flag: print("NO")
else: 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)

from collections import deque
D = deque(D)
T = deque(T)

if N < M:
    print('NO')
else:
    t = T.popleft()
    for d in D:

        if d == t:

            if len(T) == 0:
                print('YES')
                break
            else:
                t = T.popleft()
    else:
        print('NO')

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
m=int(input())
t=list(map(int,input().split()))
import collections
d=collections.Counter(d)
t=collections.Counter(t)
for i in t.items():
  if i[0] not in d:
    print("NO")
    break
  elif i[0] in d and i[1]>d[i[0]]:
    print("NO")
    break
else:
  print("YES")

Solution (Python):
import math
import sys
import collections 
N=int(input())
D = list(map(int, input().split()))
M=int(input())
T = list(map(int, input().split()))
new_D=sorted(D)
new_T=sorted(T)
a=collections.Counter(new_D)
b=collections.Counter(new_T)


for i in new_T:
    if a[i]<b[i]:
        print("NO")
        sys.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 = list(map(int, input().split()))



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


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)

for k,v in ct.items():
    if cd[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=list(map(int,input().split()))
for i in t:
 if d[i]==0:print("NO");exit()
 else:d[i]-=1
print("YES")

Solution (Python):
from collections import defaultdict
N = int(input())
D = [int(x) for x in input().split()]
M = int(input())
T = [int(x) for x in input().split()]

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

if min(cnt.values()) >= 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()))

if n<m:
    print('NO')
    exit(0)

pro={}
for i in d:
    if i in pro:
        pro[i]+=1
    else:
        pro[i]=1

for j in t:
    if j in pro:
        if pro[j]>0:
            pro[j]-=1
        else:
            print('NO')
            exit(0)
    else:
        print('NO')
        exit(0)

print('YES')

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


for key, value in zip(T.keys(), T.values()):
    if D.get(key, 0) < value:
        print('NO')
        exit()
print('YES')

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

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

print("YES")

Solution (Python):
import collections

N = int(input())
Ds = list(map(int, input().split()))
M = int(input())
Ts = list(map(int, input().split()))

Ds = collections.Counter(Ds)
Ts = collections.Counter(Ts)

if N < M:
  print('NO')
  exit()
  
for k in Ts:
  if Ts[k] > Ds[k]:
    print('NO')
    exit()

print('YES')

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


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


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


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


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


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




N = I()
A = IL()
M = I()
B = IL()
dic1 = DD(int)
dic2 = DD(int)
for a in A:
  dic1[a] += 1
for b in B:
  dic2[b] += 1
for k in dic2:
  if dic2[k] > dic1[k]:
    print("NO")
    exit()
print("YES")

Solution (Python):
n=int(input())
d={}
dlist=list(map(int,input().split()))
for i in range(len(dlist)):
    d[dlist[i]]=d.get(dlist[i], 0)+1


m=int(input())
t={}
tlist=list(map(int,input().split()))
for i in range(len(tlist)):
    t[tlist[i]]=t.get(tlist[i], 0)+1


for tk,tv in t.items():
    if(d.get(tk, 0)<tv):
        print("NO")
        break
else:
    print("YES")

Solution (Python):
import collections
 
n = int(input())
ln = list(map(int, input().split()))
m = int(input())
lm = list(map(int, input().split()))
 
c1 = collections.Counter(lm)
c2 = collections.Counter(ln)
 
for i in c1.keys():
    if c2[i] < c1[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()))
import bisect
D=sorted(D)
T=sorted(T)
idx=0
for i in range(M):
    t=T[i]
    while D[idx]<t:
        idx+=1
    if D[idx]!=t:
        print("NO")
        exit()
    idx+=1
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()))

dd=Counter(D)
td=Counter(T)

ddl=list(dd.items())
tdl=list(td.items())

for k, v in tdl:
  if dd[k]<v:
    print("NO")
    exit()

print("YES")

Solution (Python):
def f():
    n=int(input())
    from collections import Counter as co
    p=co(list(map(int,input().split())))
    m=int(input())
    q=co(list(map(int,input().split())))
    for k in q:
        if k not in p or p[k]<q[k]:
            print("NO");break
    else:print("YES")
if __name__ == "__main__":
    f()

Solution (Python):
from collections import defaultdict
def main():
    N = int(input())
    D = [int(d) for d in input().split()]
    M = int(input())
    T = [int(t) for t in input().split()]

    diff = defaultdict(int)

    for i in range(len(D)):
        diff[D[i]] += 1

    ok = True
    for i in range(len(T)):
        if diff[T[i]] >= 1:
            diff[T[i]] -= 1
        else:
            ok = False
            break

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

if __name__ == "__main__":
    main()

Solution (Python):
from collections import defaultdict
n = int(input())
d = tuple(map(int, input().split()))
m = int(input())
t = tuple(map(int, input().split()))
l = defaultdict(int)
for x in d:
    l[x] += 1
for y in t:
    if l[y] == 0:
        print('NO')
        exit()
    l[y] -= 1
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()))

d=Counter(D)
for i in range(M):
    if T[i] not in d or d[T[i]]==0:
        print('NO')
        exit()
    d[T[i]]-=1
print('YES')

Solution (Python):
import collections

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

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


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

Solution (Python):
from collections import Counter
input()
D = Counter(map(int, input().split()))
input()
for n in map(int, input().split()):
    appear = D.get(n, 0)
    if not appear:
        print("NO")
        break
    D[n] -= 1
else:
    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()))
    Dcounter = collections.Counter(D)
    Tcounter = collections.Counter(T)
    for t in T:
        if Dcounter[t] - Tcounter[t] < 0:
            print('NO')
            return
    print('YES')

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
dl = list(map(int,input().split()))
m = int(input())
tl = list(map(int,input().split()))
d_dic = dict()
t_dic = dict()
for d in dl:
  if d in d_dic:
    d_dic[d] += 1
  else:
    d_dic[d] = 1
for t in tl:
  if t in t_dic:
    t_dic[t] += 1
  else:
    t_dic[t] = 1
for v in t_dic.keys():
  if not v in d_dic.keys():
    print('NO')
    exit()
  if t_dic[v] > d_dic[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()))
count=0
if m>n:
    print("NO")
else:
    d.sort()
    t.sort()
    for i in range(n):
        if count==m:
            break
        if t[count]==d[i]:
            count+=1
    if count==m:
        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
DC = Counter(D)
TC = Counter(T)
for k, v in TC.items():
	if v > DC[k]:
		print("NO")
		exit()
else:
	print("YES")

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]





n=ii()
arr=Counter(limii())
m=ii()
mat=limii()

for i in mat:
    arr[i]-=1

chk=True
for i in arr:
    if arr[i]<0:
        chk=False

if chk:
    print("YES")

else:
    print("NO")

Solution (Python):
import collections

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

d_c = collections.Counter(d)
t_c = collections.Counter(t)

ans = 'YES'
for e in t_c.items():
    if d_c[e[0]]:
        if d_c[e[0]] < e[1]:
            ans = 'NO'
            break
    else:
        ans = 'NO'
        break
    
print(ans)

Solution (Python):
import collections

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

d_c = collections.Counter(d)
t_c = collections.Counter(t)

ans = 'YES'
for e in t_c.items():
    diff, cnt = e[0], e[1]
    if d_c[diff]:
        if d_c[diff] < cnt:
            ans = 'NO'
            break
    else:
        ans = 'NO'
        break
    
print(ans)

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

d_counter = Counter(d_li)
t_counter = Counter(t_li)
t_most_counter = t_counter.most_common()
t_len = len(t_most_counter)
for i in range(t_len):
    dum = t_most_counter[i][0]
    if d_counter[dum] >= t_most_counter[i][1]:
        pass
    else:
        print("NO")
        exit()
print("YES")

Solution (Python):
import heapq

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

heapq.heapify(d)
heapq.heapify(t)
cnt=0


if n>1 and m>1:
    for i in range(m):
        a=heapq.heappop(t)
        if len(d)>0:
            b=heapq.heappop(d)
        
        while b<a and len(d)>0:
            b=heapq.heappop(d)
        if b==a:
            cnt+=1
    if cnt==m:
        print("YES")
    else:
        print("NO")

else:
    if n==1:
        if m==1 and t[0]==d[0]:
            print("YES")
        else:
            print("NO")
    else:
        if t[0] in d:
            print("YES")
        else:
            print("NO")

Solution (Python):
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

INF = 10**18
eps = 10**-7

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

from collections import defaultdict
d_dict = defaultdict(int)
for t in T:
    d_dict[t] += 1
for d in D:
    if d_dict[d] > 0:
        d_dict[d] -= 1

print('YES' if sum(v for v in d_dict.values()) == 0 else 'NO')

Solution (Python):
import collections

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

c1 = collections.Counter(lm)
c2 = collections.Counter(ln)

for i in c1.keys():
    if c2[i] < c1[i]:
        print("NO")
        exit()

print("YES")

Solution (Python):
import collections

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

c1 = collections.Counter(lm)
c2 = collections.Counter(ln)

for i in c1.keys():
    if c2[i] < c1[i]:
        print("NO")
        exit()

print("YES")

Solution (Python):
import sys
from collections import Counter
 
N = int(input())
s1 = list(map(int,input().split()))
M = int(input())
s2 = list(map(int,input().split()))
 
c1 = Counter(s1)
c2 = Counter(s2)
 
for k,v in c2.items():
    if k in c1:
        if v > c1[k]:
            print('NO')
            sys.exit()
    else:
        print('NO')
        sys.exit()
print('YES')

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
m=int(input())
b=list(map(int,input().split()))
d_a={}
d_b={}
flg=0
for i in range(n):
  d_a[a[i]]=d_a.get(a[i],0)+1
for i in range(m):
  d_b[b[i]]=d_b.get(b[i],0)+1
for i in b:
  c=d_a.get(i,0)
  if c < d_b[i]:
    flg=1
if flg == 1:
  print('NO')
else:
  print('YES')

Solution (Python):
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction



mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]







N=l()[0]
D=l()
M=l()[0]
T=l()
d={}
t={}
for i in range(N):
    if(D[i] not in d):
        d[D[i]]=0
    d[D[i]]+=1

for i in range(M):
    if(T[i] not in t):
        t[T[i]]=0
    t[T[i]]+=1
ans="YES"
for ks  in  t:
    if(ks not in d or d[ks]<t[ks]):
        ans="NO"
        break
print(ans)

Solution (Python):
import sys
from collections import defaultdict

N = int(input())
D = list(map(int, sys.stdin.readline().rsplit()))
M = int(input())
T = list(map(int, sys.stdin.readline().rsplit()))
q = defaultdict(int)

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

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

print("YES")

Solution (Python):
import collections

def answer(ds, ts):
    dsDic = collections.Counter(ds)
    tsDic = collections.Counter(ts)
    for k, v in tsDic.items():
        if dsDic.get(k) is None: return 'NO'
        if tsDic[k] > dsDic[k]:
            return 'NO'
    return 'YES'

n = int(input())
ds = list(map(int, input().split()))
m = int(input())
ts = list(map(int, input().split()))
print(answer(ds, ts))

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

d.sort()
t.sort()
flg_no = 0
index_start=0
for i in range(m):
  index=index_start
  flg_fin=0
  while index < n:
    if d[index] == t[i]:
      index_start=index+1
      flg_fin=1
      break
    index+=1
  if flg_fin == 0:
    print('NO')
    flg_no = 1
    break
if flg_no == 0:
  print('YES')