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

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

l  = input()
l =[int(i) for i in l.split()]
v ={}
for i in l :
    if  i in v:
        v[i]+=1
    else:v[i] = 1
m = int(input())
l = input()
l = [int(i) for i in l.split()]
t = 1
for i in l :
    if not(i in v) :
        t= 0
        break
    else:
        v[i]-=1
        if v[i]<0:
            t=0
            break
if t==1:
    print("YES")
if t==0:
    print("NO")

Solution (Python):

def main():
    N = int(input())
    D = [int(n) for n in input().split()]
    M = int(input())
    T = [int(n) for n in input().split()]
    d_dict = {}
    t_dict = {}
    for i in D:
        d_dict[i] = d_dict.get(i, 0) + 1
    for i in T:
        t_dict[i] = t_dict.get(i, 0) + 1

    ok = True
    for k in t_dict.keys():
        if d_dict.get(k, 0) < t_dict[k]:
            ok = False
            break

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


if __name__ == '__main__':
    main()

Solution (Python):

def main():
    N = int(input())
    D = [int(n) for n in input().split()]
    M = int(input())
    T = [int(n) for n in input().split()]
    
    
    
    
    d_dict = {}
    t_dict = {}
    for i in D:
        d_dict[i] = d_dict.get(i, 0) + 1
    for i in T:
        t_dict[i] = t_dict.get(i, 0) + 1
    
    

    ok = True
    for k in t_dict.keys():
        if d_dict.get(k, 0) < t_dict[k]:
            ok = False
            break

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


if __name__ == '__main__':
    main()

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

M = int(input())
T = input().split()
flg = True
for i in range(M):
    if T[i] in D:
        D[T[i]] -= 1
        if D[T[i]] < 0:
            print('NO')
            flg = False
            break
    else:
        print('NO')
        flg = False
        break
if flg:
    print('YES')

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

d.sort()
t.sort()
a = 0

for x in t:
    for i in range(a, n):
        if d[i] > x:
            print('NO')
            exit()
        if x == d[i]:
            a = i+1
            break

print('YES')

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

summary_d = {}
summary_t = {}

for i in range(0, len(d)):
    summary_d[d[i]] = summary_d.get(d[i],0) + 1

for i in range(0, len(t)):
    summary_t[t[i]] = summary_t.get(t[i],0) + 1

result = {}

for k,v in summary_t.items():
    result[k] = summary_d.get(k,0) - v

if min(result.values()) >= 0:
    print("YES")
else:
    print("NO")

Solution (Python):

def spaceinput():
    return list(map(int,input().split(" ")))


M=spaceinput()
P=sorted(spaceinput())
N=spaceinput()
T=sorted(spaceinput())

false=False
k=0
for st in T:
    
    for kk in range(k,len(P)):
        if st==P[kk]:
            k=kk+1
            break

        

        if P[kk]>st:
            false=True
            break






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

Solution (Python):
def solve():
    while 1:
        try:
            N = int(input())
            D = list(map(int, input().split(" ")))
            M = int(input())
            T = list(map(int, input().split(" ")))
            D_dict = {}
            T_dict = {}
            for d in D:
                if d not in D_dict:
                    D_dict[d] = 1
                else:
                    D_dict[d] += 1

            for t in T:
                if t not in T_dict:
                    T_dict[t] = 1
                else:
                    T_dict[t] += 1

            for key, val in T_dict.items():
                if key not in D_dict:
                    print("NO")
                    raise EndLoop
                else:
                    if val > D_dict[key]:
                        print("NO")
                        raise EndLoop

            print("YES")
            break
        except:
            break


solve()

Solution (Python):
from collections import Counter
N = input()
D = Counter([i for i in input().split()])
M = input()
T = Counter([i for i in input().split()])
for key, value in T.items():
    try:
        if D[key] < value:
            print("NO")
            break
    except:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
from collections import defaultdict

input()
d_list = input().split(" ")
input()
t_list = input().split(" ")

d_dict = defaultdict(lambda: 0)
for d in d_list:
    d_dict[d] += 1

t_dict = defaultdict(lambda: 0)
for t in t_list:
    t_dict[t] += 1

yes = True
for k, v in t_dict.items():
    if v > d_dict[k]:
        print("NO")
        yes = False
        break
if yes:
    print("YES")

Solution (Python):
dict ={}
raw_input()
for i in raw_input().split():
 if i in dict:
  dict[i]=dict[i]+1
 else:
  dict[i]=1

raw_input()
for i in raw_input().split():
 if i in dict:
  dict[i]=dict[i]-1
  if dict[i]<0:
   print "NO"
   exit()
 else:
  print "NO"
  exit()
print "YES"

Solution (Python):
N = int(input())
D = [int(i) for i in input().strip().split(' ')]
M = int(input())
D2 = [int(i) for i in input().strip().split(' ')]
D.sort()
D2.sort()

if M > N:
  print("NO")
else:
  d2idx = 0
  for i in range(len(D)):
    if D[i] == D2[d2idx]:
      d2idx += 1
    if d2idx >= len(D2):
      break
  print("YES" if d2idx == len(D2) else "NO")

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

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

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

    for key, val in t.items():
        if key in d.keys():
            d[key] -= val
            if d[key] < 0:
                ans = 'NO'
                break
        else:
            ans = 'NO'
            break
    else:
        ans = 'YES'

    print(ans)

main()

Solution (Python):
n=input()
a=sorted(map(int,raw_input().split()))
m=input()
b=sorted(map(int,raw_input().split()))
if n<m:print "NO"
else:
    i=0
    j=0
    while i<m:
        if b[i]==a[j]:
            i+=1
            j+=1
        elif b[i]<a[j]:
            break
        else:
            j+=1
            if j>=n: break
    print "YES" if i==m else "NO"

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

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


i = len(D)-1
j = len(T)-1

flag = True
while(0<=i and 0<=j):
    if D[i] > T[j]:
        i -= 1
    elif D[i] == T[j]:
        i -= 1
        j -= 1
    else:
        flag = False
        break
        
if flag == False or (i<=-1 and j>-1):
    print("NO")
else:
    print("YES")

Solution (Python):
import sys
N = int(input().strip())
D = list(map(int, input().strip().split(" ")))
print(N, len(D), file=sys.stderr)

import collections
Dd = collections.defaultdict(int)
for d in D:
    Dd[d] += 1

M = int(input().strip())
T = list(map(int, input().strip().split(" ")))
print(M, len(T), file=sys.stderr)
Td = collections.defaultdict(int)
for t in T:
    Td[t] += 1

for k,v in Td.items():
    if Dd[k] < v:
        print("NO")
        exit(0)
print("YES")
exit(0)

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

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

D_dic = {k: 0 for k in D}
T_dic = {k: 0 for k in T}

for i in range(N):
    d = D[i]
    if D_dic[d]:
        a = D_dic[d] + 1
        D_dic[d] = a
    else:
        D_dic[d] = 1
    
for j in range(M):
    t = T[j]
    if T_dic[t]:
        b = T_dic[t] + 1
        T_dic[t] = b
    else:
        T_dic[t] = 1

cou = 0
if N >= M:
    for k in range(M):
        tk = T[k]
        try:
            if D_dic[tk]:
                c = D_dic[tk] - 1
                D_dic[tk] = c
                cou += 1
            else:
                x = 'NO'
                break
        except KeyError:
            x = 'NO'
            break
            
    if cou == M:
        x = 'YES'
else:
    x = 'NO'

print(x)

Solution (Python):
from collections import Counter

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

res = 'YES'
counter_d = Counter(D)
counter_t = Counter(T)

set_t = list(set(T))
for i in set_t:
    if counter_d[i] < counter_t[i]:
        res = 'NO'
        break

print(res)

Solution (Python):
import sys
n = int(input())
d = {}
for i in input().split():
    if i in d:
        d[i] += 1
    else:
        d[i] = 1

m = int(input())
for i in input().split():
    if i in d and d[i] > 0:
        d[i] -= 1
    else:
        print("NO")
        sys.exit()
print("YES")

Solution (Python):
n = int(input())
D = sorted([int(_) for _ in input().split()])
m = int(input())
T = sorted([int(_) for _ in input().split()])

i = 0
for t in T:
	while(D[i] < t):
		i += 1
	if D[i] == t:
		i += 1
	else:
		print("NO")
		exit(0)
print("YES")

Solution (Python):
from collections import Counter

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

res = "YES"

for i in T:
  if i not in D or T[i] > D[i]:
    res = "NO"
    break

print(res)

Solution (Python):
n = int(input())
d = {}
inp = map(int, input().split())

for i in inp:
    if i not in d:
        d[i] = 1
    else:
        d[i] += 1

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

fl = 0
for i in inp:
    if i in d:
        if d[i] == 0:
            fl = 1
            break
        d[i] -= 1
    else:
        fl = 1
        break

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


if n < m :
    print("NO")
else :
    dic = collections.defaultdict(int)
    for dd in d :
        dic[dd] += 1
    
    for tt in t :
        dic[tt] -= 1
        if dic[tt] < 0 :
            print("NO")
            break
    else :
        print("YES")

Solution (Python):
from collections import deque
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
a = deque(sorted(d))
b = deque(sorted(t))
flag = 0
if n >= m:
    for i in range(n):
        if a[0] == b[0]:
            b.popleft()
        a.popleft()
        if len(b) == 0:
            print("YES")
            flag = 1
            break
if flag == 0:
    print("NO")

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


def countNumber(LIST):
    cnt = {}
    for l in LIST:
        try:
            cnt[l] += 1
        except KeyError:
            cnt[l] = 1
    return cnt


countD = countNumber(D)
countT = countNumber(T)

flag = True
for i in countT.keys():
    try:
        if countD[i] < countT[i]:
            flag = False
    except KeyError:
        flag = False
        break

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

Solution (Python):
from sys import stdin, stdout
from collections import defaultdict
def readLine_int_list():return list(map(int, stdin.readline().split()))
def main():
    d = defaultdict(lambda: 0)
    t = defaultdict(lambda: 0)
    
    n=int(input())
    _d=readLine_int_list()
    for i in _d:
        d[i] += 1
        
    m = int(input())
    _t = readLine_int_list()
    
    for i in _t:
        t[i] += 1
    
    ans = "YES"
    for i in t:
        if i in d:
            if t[i] - d[i] > 0:
                ans = "NO"
                break
        else:
            ans = "NO"
            break
    print(ans)
if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
dic={}
ds=[int(s)for s in input().split(" ")]
for d in ds:
    if d in dic:dic[d]+=1
    else:dic[d]=1
m=int(input())
ts=sorted([int(s)for s in input().split(" ")])
f=True
for t in ts:
    if t not in dic or dic[t]==0:
        print("NO")
        f=False
        break
    else:dic[t]-=1
if f:print("YES")

Solution (Python):


import sys

line = sys.stdin.readline().strip()
n = int(line)
parts = sys.stdin.readline().strip().split()
nvals = map(int,parts)
nhash = {}

for item in nvals:
    if nhash.has_key(item):
        nhash[item] += 1
    else:
        nhash[item] = 1

line = sys.stdin.readline().strip()
m = int(line)
parts = sys.stdin.readline().strip().split()
mvals = map(int,parts)
mhash = {}

for item in mvals:
    if mhash.has_key(item):
        mhash[item] += 1
    else:
        mhash[item] = 1

for item in mhash.keys():
    if nhash.has_key(item) and mhash[item] <= nhash[item]:
        pass
    else:
        print "NO"
        sys.exit()

print "YES"

Solution (Python):
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
import itertools
n=i1()
d=sorted(i2())
m=i1()
t=sorted(i2())
def a():
 j=0
 for i in range(m):
    while t[i]!=d[j]:
        if t[i]<d[j]:
            print("NO")
            return 0
        j+=1
    j+=1

 print("YES")
a()

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

dic = dict()

for di in d:
    if di in dic:
        dic[di] += 1
    else:
        dic[di] = 1

ans = "YES"
for ti in t:
    if ti not in dic or dic[ti] == 0:
        ans = "NO"
        break
    else:
        dic[ti] -= 1

print(ans)

Solution (Python):
import sys

n = int(input())
d = input().split()
m = int(input())
t = input().split()

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

for j in t:
    if j not in dic:
        print('NO')
        sys.exit()

    dic[j] -= 1
    if dic[j] < 0:
        print('NO')
        sys.exit()

print('YES')

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

dic = {}
dic2 = {}

for a in t:
  if a not in dic:
    dic[a]=1
  else:
    dic[a] += 1

for a in d:
  if a not in dic2:
    dic2[a]=1
  else:
    dic2[a] += 1

for a in dic:
  if a not in dic2:
    print "NO"
    exit(0)
  if dic[a] > dic2[a]:
    print "NO"
    exit(0)

print "YES"

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

dd = {}
tt = {}

for ddd in d:
    dd.setdefault(ddd,0)
    dd[ddd] += 1

for ttt in t:
    tt.setdefault(ttt,0)
    tt[ttt] += 1




for search in tt.keys():
    if search in dd:
        if tt[search] > dd[search]:
            
            print 'NO'
            sys.exit()

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

from collections import Counter
cntD = Counter(D)
cntT = Counter(T)

for key, value in cntT.items():
    if cntD[key] < value:
        print('NO')
        break
else:
    print('YES')

Solution (Python):
from collections import defaultdict

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

    counter1 = defaultdict(int)
    counter2 = defaultdict(int)

    for d in D:
        counter1[d] += 1
    for t in T:
        counter2[t] += 1

    for t, cnt in counter2.items():
        if counter1[t] < cnt:
            print("NO")
            return

    print("YES")

foo()

Solution (Python):
def main():    
    N = int(input())
    D = [int(i) for i in input().split()]
    M = int(input())
    D.sort()
    T = [int(i) for i in input().split()]
    T.sort()

    point = 0
    for t in T:
        for p in range(point, N):
            if D[p] < t:
                continue
            elif D[p] == t:
                point = p+1
                
                break

            elif D[p] > t:
                print('NO')
                return 
    print('YES')
    return

if __name__ == '__main__':
    main()

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

T = defaultdict(int)
M = int(input())
for s in map(int,input().split()):
    T[s] += 1

for key,value in T.items():
   if not(key in D):
       print("NO")
       exit()
   else:
       if value > D[key]:
           print("NO")
           exit()

else:
    print("YES")

Solution (Python):
N = int(input())
Di = input().split()
D = {}
for d in Di:
    if d in D:
        D[d] += 1
    else:
        D[d] = 1
M = int(input())
T = input().split()
judge = 0

for t in T:
    if (t in D) and (D[t] != 0):
        D[t] -= 1
    else:
        judge = 1
        break

if judge == 0:
    print("YES")
else:
    print("NO")

Solution (Python):



N = int(input())
D = input().split(" ")
M = int(input())
T = input().split(" ")


if len(D) < len(T):
	print("NO")
	exit(0)

D.sort()
T.sort()

i = 0
j = 0

while True:
	if i > M-1:
		print("YES")
		break

	elif D[j] == T[i] :
		i += 1
		j += 1

	else:
		j += 1

		if j > N - 1:
			print("NO")
			break

		elif D[j] > T[i]:
			print("NO")
			break

Solution (Python):



n = raw_input()
n = int(n)

dl = raw_input()
dl = dl.split()
dl = map(int,dl)
dl.sort()

m = raw_input()
m = int(m)

tl = raw_input()
tl = tl.split()
tl = map(int,tl)
tl.sort()

status = 0
i = 0
j = 0
while j < m:
    d = dl[i]
    t = tl[j]
    
    if d > t:
        status = 1
        break
    elif d == t:
        i += 1
        j += 1
    else:
        i += 1

if status == 0:
    print "YES"
else:
    print "NO"

Solution (Python):
from collections import Counter

if __name__ == '__main__':
    N = int(input())
    D = list(map(int, input().split()))
    M = int(input())
    T = list(map(int, input().split()))

    counter_d = Counter(D)
    counter_t = Counter(T)

    ans = "YES"
    for point, num in counter_t.items():
        if counter_d.get(point) is None or counter_d.get(point) < num:
            ans = "NO"
            break

    print(ans)

Solution (Python):

from collections import Counter

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

T_cnt = list(Counter(T).items())
D_cnt = Counter(D)

for t in T_cnt:
    if D_cnt[t[0]] < t[1]:
        print("NO")
        break

else:
    print("YES")

Solution (Python):
N = int(input())
d = {}
for D in map(int, input().split()):
    d[D] = d.get(D, 0) + 1
M = int(input())
for T in map(int, input().split()):
    if T in d:
        d[T] -= 1
        if d[T] < 0:
            print('NO')
            exit(0)
    else:
        print('NO')
        exit(0)
print('YES')

Solution (Python):

import sys
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
a = {}
for tmp in range(len(d)):
    if d[tmp] in a:
        a[d[tmp]] += 1
    else:
        a[d[tmp]] = 1
for tmp in range(len(t)):
    if t[tmp] in a:
        if a[t[tmp]] == 0:
            print("NO")
            sys.exit()
        else:
            a[t[tmp]] -= 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()))

D.sort(reverse=True)
T.sort(reverse=True)

count = 0

j = 0

for i in range(M):
    while True:
        if j >= N:
            break
        if T[i] == D[j]:
            count += 1
            j += 1
            break
        else:
            j += 1

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

Solution (Python):
from collections import defaultdict

N = int(input())
D = list(map(int, input().strip().split()))
d_dict = defaultdict(lambda:0)
for d in D:
    d_dict[d] += 1
del D
M = int(input())
T = list(map(int, input().strip().split()))

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

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.sort()
T.sort()

indexD=0
indexT=0
while indexD<len(D) and indexT<len(T):
	if D[indexD]==T[indexT]:
		indexD+=1
		indexT+=1
	else:
		indexD+=1
if indexT==len(T):
	print("YES")
else:
	print("NO")

Solution (Python):
m=input()
a=map(int,raw_input().split())
n=input()
b=map(int,raw_input().split())
d={}
flag=True
for i in a:
    d[i]=d.get(i,0)+1
for i in b:
    d[i]=d.get(i,0)-1
    if d[i]<0:
        flag=False
        break
print "YES" if flag else "NO"

Solution (Python):


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

import collections
dd = collections.Counter(d)
tt = collections.Counter(t)
f = True
for i in tt.keys():
    if dd[i] < tt[i]:
        f = False
        break
if f:
    print("YES")
else:
    print("NO")

Solution (Python):

from collections import Counter

def judge(ds, ts):
	for word, cnt in ts.most_common():
		if cnt > ds[word]:
			return "NO"
	return "YES"


def main():
	n = int(input())
	ds = Counter(list(map(int, input().split())))
	m = int(input())
	ts = Counter(list(map(int, input().split())))

	print(judge(ds, ts))



if __name__ == '__main__':
	main()

Solution (Python):



from collections import Counter

def main():
    _ = input()
    D = Counter(input().split())
    _ = input()
    T = Counter(input().split())
    D.subtract(T)
    if min(D.values()) < 0:
        print("NO")
    else:
        print("YES")
    return None

if __name__ == "__main__":
    main()

Solution (Python):










N=int(raw_input())
D=sorted(map(int, raw_input().split()))
M=int(raw_input())
T=sorted(map(int, raw_input().split()))

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

ans=["NO","YES"]
a=1

for t in T:
    try:
        if DD[t]>0:
            DD[t]-=1
        else:
            a=0
            break
    except:
        a=0
        break
print ans[a]

Solution (Python):
candidates_len = int(input())
candidates = [int(i) for i in input().split()]

required = {}
M = int(input())
problems = [int(i) for i in input().split()]

for i in problems:
    try:
        required[i] += 1
    except:
        required[i] = 1

for i in candidates:
    try:
        if required[i] - 1 <= 0:
            del required[i]
        else:
            required[i] -= 1
    except:
        pass
if len(list(required)) == 0:
    print("YES")
else:
    print("NO")

Solution (Python):
import sys
N=int(input())
D=list(map(int,input().split()))
M=int(input())
T=list(map(int,input().split()))
D.sort()
T.sort()
for i in range(M-1,-1,-1):
  while D:
    q=D.pop()
    if T[i]==q:
      
      break
    elif T[i]>q:
      print("NO")
      sys.exit()
  else:
    print("NO")
    sys.exit()
print("YES")

Solution (Python):
inputs = input()
N = int(inputs)

inputs = input().split()

prob = {}
for i in inputs:
    if not int(i) in prob.keys():
        prob[int(i)] = 1
    else:
        prob[int(i)] += 1

inputs = input()
M = int(inputs)

inputs = input().split()
flag = True

for i in inputs:
    if not int(i) in prob.keys():
        flag = False
    else:
        prob[int(i)] -= 1
        if prob[int(i)] < 0:
            flag = False

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

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

D.sort()

TC = Counter(D)
D =T

index_a =0
flag=True
for d in D:
    if TC[d]>0:
        TC[d]-=1
    else:
        print("NO")
        exit(0)


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

D.sort()
T.sort()

i = 0
ans = "YES"
for e in T:
    flag = True
    while flag:
        if i >= N:
            ans = "NO"
            break
        else:
            if D[i] == e:
                flag = False
            i += 1

    if ans == "NO":
        break
print(ans)

Solution (Python):

N = int(input())
D_dict = dict()
D_list = list(map(int, input().split()))
M = int(input())
T_list = list(map(int, input().split()))

for i in range(N):
    di = D_list[i]
    if di not in D_dict.keys():
        D_dict[di] = 1
    else:
        D_dict[di] += 1
        

res = 'YES'
for i in range(M):
    ti = T_list[i]
    if ti not in D_dict.keys():
        res = 'NO'
    elif D_dict[ti] <= 0:
        res = 'NO'
    else:
        D_dict[ti] -= 1

print(res)

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

m = int(input())
t_list = input().split()
t_list = [int(x) for x in t_list]

from collections import Counter

count_d = Counter(d_list)
count_t = Counter(t_list)

check = 0
for key, value in count_t.items():
    if count_d[key] < value:
        check = 1
        break

if check == 0:
    print("YES")
else:
    print("NO")

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

for k in t:
    if t[k] > d[k]:
        print('NO')
        exit()
print('YES')

Solution (Python):
from collections import Counter

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

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

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

Solution (Python):


import collections


def solve(ds, ts):
    ctr_d = collections.Counter(ds)
    ctr_t = collections.Counter(ts)
    delta_ctr = collections.Counter({k: ctr_d[k] - v for
                                     k, v in ctr_t.items()})
    return all(v >= 0 for v in delta_ctr.values())


def main():
    _ = input()
    ds = [int(d) for d in input().split()]
    _ = input()
    ts = [int(t) for t in input().split()]
    print("YES" if solve(ds, ts) else "NO")


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)
flag = True
for t in T:
    if D[t]>0:
        D[t] -= 1
    else:
        flag = False
        break
if flag:
    print('YES')
else:
    print('NO')

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

D_dict = {}
for d in D:
    if d not in D_dict:
        D_dict[d] = 0
    D_dict[d]+=1
flag = True
for t in T:
    if t not in D_dict:
        flag = False
        break
    D_dict[t]-=1
    if D_dict[t] < 0:
        flag = False
        break
if flag:
    print("YES")
else:
    print("NO")

Solution (Python):
N = int(raw_input())
ds = map(int, raw_input().split())
M = int(raw_input())
ts = map(int, raw_input().split())

qs = {}
for d in ds:
  qs[d] = qs.get(d, 0) + 1

ms = {}
for t in ts:
  ms[t] = ms.get(t, 0) + 1

for d, c in ms.iteritems():
  if qs.get(d, 0) < c:
    print "NO"
    exit()

print "YES"

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

from collections import defaultdict
dic = defaultdict(int)
for di in d:
    dic[di] += 1
for ti in t:
    if dic[ti] <= 0:
        print "NO"
        exit()
    else:
        dic[ti] -= 1

print 'YES'

Solution (Python):
import collections
n = int(input())
d = list(map(int, input().split()))
D = collections.defaultdict(int)
for i in d:
    D[i] += 1
m = int(input())
t = list(map(int, input().split()))
T = collections.defaultdict(int)
for i in t:
    T[i] += 1
for k,v in T.items():
    if k not in D or D[k] < v:
        print('NO')
        exit()
print('YES')

Solution (Python):
from sys import stdin
from collections import defaultdict
n = int(stdin.readline())
a = stdin.readline().split()
d = defaultdict(int)
for x in a:
    d[x] += 1
m = int(stdin.readline())
a = stdin.readline().split()
for x in a:
    d[x] -= 1
    if d[x] < 0:
        print "NO"
        quit()
print "YES"

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

D = [int(x) for x in input().split(" ")]
dic = {}

for d in D:
    if d in dic:
        dic[d] += 1
    else:
        dic[d] = 1

M = int(input())
T = [int(x) for x in input().split(" ")]

NO = False

for t in T:
    if t not in dic:
        NO = True
    else:
        dic[t] -= 1
        if dic[t] < 0:
            NO = True
    if NO:
        break

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

Solution (Python):

from collections import Counter

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

for k in T:
    if D[k] < T[k]:
        print("NO")
        break
else:
    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())
d = sorted(list(map(int,input().split())))
m = int(input())
t = sorted(list(map(int,input().split())))
didx = 0
tidx = 0
while tidx < m and didx < n:
    if d[didx] == t[tidx]:
        didx += 1; tidx += 1
    elif d[didx] < t[tidx]:
        didx += 1
    else:
        print("NO")
        break
else:
    if tidx == m:
        print("YES")
    else:
        print("NO")

Solution (Python):

dic={}
input()
for i in map(int,input().split()):
    if i in dic:
        dic[i]+=1
    else:
        dic[i]=1
input()
for i in map(int,input().split()):
    if i in dic:
        dic[i]-=1
        if dic[i]<0:
            print('NO')
            exit()
    else:
        print('NO')
        exit()
print('YES')