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
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from collections import Counter

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

for k in t:
    if k not in d:
        print('NO')
        sys.exit(0)
    elif t[k] > d[k]:
        print('NO')
        sys.exit(0)
print('YES')

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

from collections import Counter
CD = Counter(D)
CT = Counter(T)
for t, ct in CT.items():
    cd = CD[t]
    if ct > cd:
        print('NO')
        break
else:
    print('YES')

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

from collections import Counter
CD = Counter(D)
CT = Counter(T)
for t, ct in CT.items():
    cd = CD[t]
    if ct > cd:
        print('NO')
        break
else:
    print('YES')

Solution (Python):
import sys
n = int(input())
ls = list(map(int,input().split()))
m = int(input())
di = list(map(int,input().split()))
dic = {}
for i in range(n):
    if dic.get(ls[i],0) == 0:
        dic[ls[i]] = 1
    else:
        dic[ls[i]] += 1
for k in range(m):
    if dic.get(di[k],0) == 0:
        print("NO")
        sys.exit()
    else:
        dic[di[k]] -= 1
print("YES")

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

Solution (Python):
import sys
import itertools

import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


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

cnt_d = Counter(D)
cnt_t = Counter(T)

for k, v in cnt_t.items():
    cnt_d[k] -= v
    if cnt_d[k] < 0:
        print("NO")
        exit()
print("YES")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
M = int(input())
B = list(map(int, input().split()))
d = {}
for a in A:
  d[a] = d.get(a, 0) + 1
f = 0
for b in B:
  d[b] = d.get(b, 0) - 1
  if d[b] < 0:
    print("NO")
    f = 1
    break
if f == 0:
  print("YES")

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

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

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

for t in T:
    if t not in p:
        print('NO')
        exit()
    if p[t] == 0:
        print('NO')
        exit()
    p[t] -= 1
    
print('YES')

Solution (Python):
N = int(input())
d_dict = {}
D = list(map(int, input().split()))
for d in D:
  if not d in d_dict:
    d_dict[d] = 1
  else:
    d_dict[d] += 1

M = int(input())
T = list(map(int, input().split()))
for t in T:
  if not t in d_dict or d_dict[t] == 0:
    print('NO')
    exit()
  else:
    d_dict[t] -= 1
print('YES')

Solution (Python):
import collections

n = int(input())
dd = list(map(int, input().split()))
m = int(input())
tt = list(map(int, input().split()))
cd = collections.Counter(dd)
ct = collections.Counter(tt)

if m > n:
  print('NO')
  exit()
        
for t in ct: 
  if ct[t] <= cd[t]:
    continue
  else:
    print('NO')
    exit()
print('YES')

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

if m > n:
    print("NO")
    exit()

d_c = collections.Counter(d_list)
t_c = collections.Counter(t_list)

for i in t_c:
    if t_c[i] <= d_c[i]:
        continue
    else:
        print("NO")
        exit()

print("YES")

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

if m > n:
    print("NO")
    exit()

d_c = collections.Counter(d_list)
t_c = collections.Counter(t_list)

for i in t_c:
    if t_c[i] <= d_c[i]:
        continue
    else:
        print("NO")
        exit()

print("YES")

Solution (Python):
from collections import Counter

n = int(input())
l1 = list(map(int,input().split()))
l1_cnt = Counter(l1) 

m = int(input())
l2 = list(map(int,input().split()))
l2_cnt = Counter(l2) 
l2_set=set(l2)

for i in l2_set:
    if l2_cnt[i]<=l1_cnt[i]:
        continue
    else:
        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()))

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

for t in T:
    if t not in p:
        print('NO')
        exit()
    if p[t] == 0:
        print('NO')
        exit()
    p[t] -= 1
    
print('YES')

Solution (Python):
import collections
N = int(input())
D = collections.Counter(list(map(int, input().split())))
M = int(input())
T = collections.deque(sorted(list(map(int, input().split()))))
ans = 'YES'
for i in range(M):
  prb = T.pop()
  
  if prb in D:
    if D[prb]:
      D[prb] -= 1
      if not D[prb]:
        del D[prb]
    else:
      ans = 'NO'
      break
  else:
    ans = 'NO'
    break
print(ans)

Solution (Python):
from collections import Counter

n=int(input())
nl=sorted(list(map(int,input().split())))
m=int(input())
ml=sorted(list(map(int,input().split())))

cnl=Counter(nl)
cml=Counter(ml)

ans="YES"

for i in cml.keys():
  if i  not in cnl.keys():
    ans="NO"
  else:
    if cml[i] > cnl[i]:
      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()))
T_=list(set(T))
c = collections.Counter(D)
c2 = collections.Counter(T)
flg=True
for t in T_:
    
    if c[t] < c2[t]:
        flg=False
if flg:
    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()))
sd = set(D)
st = set(T)
cntd = Counter(D)
cntt = Counter(T)
ok = True
for t in T:
    if t not in sd:
        ok = False
    elif cntt[t] > cntd[t]:
        ok = False
if ok:
    print('YES')
else:
    print('NO')

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]

num = {}
for v in a:
  if v in num:
    num[v] = num[v] + 1
  else:
    num[v] = 1
m = int(input())
t = [int(x) for x in input().split()]

ok = True
for v in t:
  if v not in num:
    ok = False
  elif num[v] <= 0:
    ok = False
  else:
    num[v] = num[v] - 1

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

Solution (Python):
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    D = [int(x) for x in input().split()]
    M = int(input())
    T = [int(x) for x in input().split()]

    c = collections.Counter(D)

    for t in T:
        if c[t] <= 0:
            print("NO")
            return
        else:
            c[t] -= 1

    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, t = Counter(d), Counter(t)
for i in set(t):
    if d[i] < t[i]:
        print("NO")
        exit()
print("YES")

Solution (Python):
from collections import Counter

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

ts = list(set(tl))
tc = Counter(tl)
dc = Counter(dl)

for t in ts:
    if tc[t] <= dc[t]:
        continue
    else:
        print('NO')
        break
else:
    print('YES')

Solution (Python):
import collections
N=int(input())
D=list(map(int,input().split()))
E=collections.Counter(D)
M=int(input())
T=list(map(int,input().split()))
F=collections.Counter(T)
r='YES'
for u in F.keys():
     if E[u] < F[u]:
         r='NO'
print(r)

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

for num, count in TC.items():
     if DC[num] < count:
         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()))

memo = {}

for d in D:
    if d in memo:
        memo[d] += 1
    else:
        memo[d] = 1
        
for t in T:
    if t in memo and 0 < memo[t]:
        memo[t] -= 1
    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()))

C = Counter(D)

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

Solution (Python):
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  


from collections import defaultdict

N = I()
D = LI()
d1 = defaultdict(int)  
for d in D:
    d1[d] += 1

M = I()
T = LI()
d2 = defaultdict(int)  
for t in T:
    d2[t] += 1

for key in d2.keys():
    if d2[key] > d1[key]:
        print('NO')
        break
else:
    print('YES')

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
Ds = list(mapint())
M = int(input())
Ts = list(mapint())

from collections import Counter
c = Counter(Ds)
for t in Ts:
    if c[t]==0:
        print('NO')
        break
    else:
        c[t] -= 1
else:
    print('YES')

Solution (Python):
import sys
from collections import Counter

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

counter = Counter(D)
for t_i in T:
    if t_i in counter and 0 < counter[t_i]:
        counter[t_i] -= 1
    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()))
dic={}
for i in range(n):
    if d[i] in dic:
        dic[d[i]]+=1
    else:
        dic[d[i]]=1
for i in range(m):
    if not t[i] in dic:
        print("NO")
        exit()
    if dic[t[i]]==0:
        print("NO")
        exit()
    dic[t[i]]-=1
print("YES")

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

cntD = collections.Counter(D)
cntT = collections.Counter(T)

result = 'YES'
for t in cntT.keys():
    if cntT[t] > cntD[t]:
        result = 'NO'
        break
print(result)

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
from collections import Counter
d=Counter(a)
m=int(input())
b=list(map(int,input().split()))
dd=Counter(b)
for i in dd:
  if i not in d:
    print("NO")
    exit()
  if d[i]<dd[i]:
    print("NO")
    exit()
print("YES")

Solution (Python):
n=int(input())
d=sorted(list(map(int,input().split())))
d.append(-1)
m=int(input())
t=sorted(list(map(int,input().split())))
x=0
f=0
for i in range(m):
    while d[x]!=t[i]:
        x+=1
        if x==n:
            print("NO")
            exit()
    x+=1
print("YES")

Solution (Python):
from collections import defaultdict


def solve():
    N = int(input())
    D = list(map(int, input().split()))
    M = int(input())
    T = list(map(int, input().split()))
    cnt = defaultdict(int)
    for d in D:
        cnt[d] += 1
    for t in T:
        if cnt[t] <= 0:
            print('NO')
            return
        cnt[t] -= 1
    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()))

from collections import Counter

c =dict(Counter(d)) 

ans='YES'
for i in range(m):
    p = t[i]

    if p in c:
        if c[p]>=1:
            c[p]-=1
        else:
            ans='NO'
            break
    else:
        ans='NO'
        break

print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  
def LS2(): return list(sys.stdin.readline().rstrip())  


from collections import defaultdict

N = I()
D = LI()
d1 = defaultdict(int)
for d in D:
    d1[d] += 1

M = I()
T = LI()
d2 = defaultdict(int)
for t in T:
    d2[t] += 1

for key in d2.keys():
    if d2[key] > d1[key]:
        print('NO')
        break
else:
    print('YES')

Solution (Python):
from collections import Counter


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

for t in T:
    if D[t] - 1 < 0:
        print("NO")
        break
    D[t] -= 1
else:
    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()
c = Counter(a)
m = inp()
b = inpl()
d = Counter(b)
for key in list(d):
    if c[key] < d[key]:
        print('NO')
        break
else:
    print('YES')

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import Counter

n=int(input())
d=lnii()
m=int(input())
t=lnii()

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

print('YES')

Solution (Python):
from collections import defaultdict
dic = defaultdict(int) 
N = int(input())
D = list(map(int,input().split()))
for i in range(N):
  dic[D[i]] += 1


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

for i in range(M):
  if dic[T[i]] == 0:
    print("NO")
    exit()
  else:
    dic[T[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

c1 = Counter(D)
c2 = Counter(T)
if c1|c2 == c1:
    print('YES')
else:
    print('NO')

Solution (Python):
from collections import Counter

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


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

Solution (Python):
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right 
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)

N,D = ilint()
M,T = ilint()
S = dict()
for d in D:
    S.setdefault(d,0)
    S[d] += 1
for t in T:
    if t not in S or S[t]==0:
        print('NO')
        exit()
    S[t] -= 1
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 a, b in t.items():
    if d[a] < b:
        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()))
if n<m:
  print('NO')
  exit()
d.sort()
t.sort()
i=0
j=0
while i<n and j<m:
  if d[i]==t[j]:
    i+=1
    j+=1
  else:
    i+=1
if j==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)

ans = 'YES'
for dif, num in tc.items():
    if dc[dif] < num:
        
        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()))

from collections import Counter
dc = Counter(d)
tc = Counter(t)

ans = 'YES'
for dif, num in tc.items():
    if dc[dif] < num:
        
        ans = 'NO'
        break

print(ans)

Solution (Python):
import sys, math
from functools import lru_cache
import numpy as np
from collections import defaultdict
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def makePrimeChecker(n):
    isPrime = [True] * (n + 1)
    isPrime[0] = False
    isPrime[1] = False
    for i in range(2, int(n ** 0.5) + 1):
        if isPrime[i]:
            for j in range(i * i, n + 1, i):
                isPrime[j] = False
    return isPrime


def main():
    N = ii()
    D = list(mi())
    M = ii()
    T = list(mi())

    d = defaultdict(int)
    for i in range(N):
        d[D[i]] += 1

    t = defaultdict(int)
    for i in range(M):
        d[T[i]] -= 1

    for v in d.values():
        if v < 0:
            print('NO')
            return
    
    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()))

cntD = collections.Counter(D)
cntT = collections.Counter(T)

result = 'YES'
for t in cntT.keys():
    if not(t in cntD):
        result = 'NO'
        break
    if cntT[t] > cntD[t]:
        result = 'NO'
        break
print(result)

Solution (Python):
from collections import defaultdict
N = int(input())
D = list(map(int, input().split()))
D_dict = defaultdict(int)
for d in D:
    D_dict[d] += 1
M = int(input())
T = list(map(int, input().split()))
T_dict = defaultdict(int)
for t in T:
    T_dict[t] += 1

for target, t_cnt in T_dict.items():
    d_cnt = D_dict[target]
    if t_cnt > d_cnt:
        print('NO')
        exit()
print('YES')

Solution (Python):
'''
Created on 2020/08/29

@author: harurun
'''
def main():
  import heapq
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N=int(pin())
  D=list(map(int,pin().split()))
  M=int(pin())
  T=list(map(int,pin().split()))
  
  if M>N:
    print("NO")
    return 
  D+=[10**9+1]
  T+=[10**9+1]
  heapq.heapify(D)
  heapq.heapify(T)
  j=0
  for i in range(M):
    p=heapq.heappop(T)
    while j<N:
      q=heapq.heappop(D)
      j+=1
      if p==q:
        break
    else:
      print("NO")
      return 
  print("YES")
  return 
main()

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

D.sort()
T.sort()
i = 0
j = 0
while i < N and j < M:
    if D[i] == T[j]:
        i += 1
        j += 1
    else:
        i += 1

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')

from collections import deque, defaultdict





def solve():
    N = II()
    D = LI()
    M = II()
    T = MI()

    dct_d = defaultdict(lambda: 0)
    for d in D:
        dct_d[d] += 1

    for t in T:
        if dct_d[t] > 0:
            dct_d[t] -= 1
        else:
            print('NO')
            return
    print('YES')

if __name__ == '__main__':
    solve()

Solution (Python):
from collections import Counter

n = int(input())
D = Counter([int(i) for i in input().split()])
m = int(input())
T = Counter([int(i) for i in input().split()])

for k, v in T.items():
    if k not in D.keys():
        print("NO")

        quit()
    else:
        if D[k] < T[k]:
            print("NO")
            quit()
        else:
            continue

print("YES")

Solution (Python):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    n = I()
    d = LI()
    m = I()
    t = LI()
    ddic = collections.Counter(d)
    tdic = collections.Counter(t)

    for i in tdic.keys():
        sub = max(0,tdic[i]-ddic.get(i,0))
        if sub > 0:
            print("NO")
            break
    else:
        print("YES")
main()

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INT()
    D = LIST()
    M = INT()
    T = LIST()

    dc = Counter(D)
    tc = Counter(T)

    for k, v in tc.items():
        if v > dc[k]:
            print("NO")
            sys.exit()

    print("YES")


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

D_c = Counter(D)
T_c = Counter(T)

cnt = 0
for k, v in zip(T_c.keys(), T_c.values()):
    if  D_c[k] < v:
        print('NO')
        break
    else:
        cnt += 1

if cnt == len(T_c):
    print('YES')

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_left, bisect_right

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
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)

S = set(T)
for s in S:
    if d[s] >= t[s]:
        continue
    else:
        print("NO")
        exit()
print("YES")

Solution (Python):
from collections import Counter
import sys

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


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



D_keylist = (list(D_counter.items()))

T_keylist = (list(T_counter.keys()))
T_Valuelist = (list(T_counter.values()))


ans = 0
T_index = 0

for i in D_keylist:
    D_key = i[0] 
    D_value = i[1] 

    T_key = T_keylist[T_index] 
    T_value = T_Valuelist[T_index] 


    if D_key == T_key and (D_value >= T_value): 
        T_index = T_index + 1 
        ans = ans + 1 

        if T_index == M:
            break
    else:
        pass


if len(T_keylist) == ans: 
    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()))

if len(D) < len(T):
    print("NO")
    exit()
D.sort()
T.sort()
dl = Counter(D)
tl = Counter(T)
for t in tl.keys():
    if not t in dl:
        print("NO")
        exit()
    if tl[t] > dl[t]:
        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()))

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

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

ans = True

for t in Tdic:
    if not t in Ddic:
        ans = False
    elif Tdic[t] > Ddic[t]:
        ans = False

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

for i in range(M):
  temp=T[i]
  D[temp]-=1
  if D[temp]==-1:
    print('NO')
    break
else:
  print('YES')

Solution (Python):
import sys

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

num_dict = {}

for i in range(n):
    if str(dn[i]) in num_dict.keys():
        num_dict[str(dn[i])] += 1
    else:
        num_dict[str(dn[i])] = 1

for i in range(m):
    if str(tn[i]) in num_dict.keys():
        num_dict[str(tn[i])] += -1
    else:
        print("NO")
        sys.exit()

result_list = list(num_dict.values())
for i in range(len(result_list)):
    if result_list[i] < 0:
        print("NO")
        sys.exit()
print("YES")

Solution (Python):
import sys
import math
from collections import Counter


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
D = inintl()
m = inint()
T = inintl()

D = Counter(D)

for t in T:
    D[t] -= 1

for i in D:
    if D[i] < 0:
        print("NO")
        exit()

print("YES")

Solution (Python):
import collections
n = int(input())
d = list(map(str, input().split()))
m = int(input())
t = list(map(str, input().split()))
c_d = collections.Counter(d)
c_t = collections.Counter(t)
ans = ''
for e in c_t:
  if c_t[e] <= c_d[e]:
    next
  else:
    ans = 'NO'
if ans == '':
  ans = 'YES'
print(ans)

Solution (Python):
import collections

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

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

for Tkey,Tval in Tc.items():
    Dval = Dc[Tkey]
    if Dval < Tval:
        print('NO')
        exit()
print('YES')

Solution (Python):
from collections import Counter

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

ca = Counter(a)
cb = Counter(b)

for i,j in cb.items():
    if i not in ca or j > ca[i]:
        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())))
 
ans = 'YES'
for key, value in T.items():
    if value > D[key]:
        ans = 'NO'
        break
    else:
        pass
print(ans)