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 1600s.

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



Sample input:
5
3 1 4 1 5
3
5 4 3


Sample output:
YES

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

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

Submission status: Accepted

Solution code:
#!usr/bim/python
#! -*- coding: utf-8 -*-

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]
    #print d,t
    if d > t:
        status = 1
        break
    elif d == t:
        i += 1
        j += 1
    else:
        i += 1

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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"

Submission status: Accepted

Solution code:
# B - Problem Set

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

Submission status: Accepted

Solution code:
# encoding:utf-8
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()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

Submission status: Accepted

Solution code:
#import bisect

#def index(a, x):
#    'Locate the leftmost value exactly equal to x'
#    i = bisect.bisect_left(a, x)
#    if i != len(a) and a[i] == x:
#        return [1,i]
#    return [0,0]


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]

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

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

D.sort()
#T.sort()
TC = Counter(D)
D =T
#print(TC)
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")

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# B
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)

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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"

Submission status: Accepted

Solution code:
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'

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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"

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
# coding: utf-8
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')

Submission status: Accepted

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

ans = "YES"
cntd = {}
for di in d:
    if di in cntd:
        cntd[di] += 1
    else:
        cntd[di] = 1
cntt = {}
for ti in t:
    if ti in cntt:
        cntt[ti] += 1
    else:
        cntt[ti] = 1

for k, v in cntt.items():
    if k not in cntd or cntd[k] < v:
        ans = "NO"
        break
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
D = sorted(map(int, input().split()))
M = int(input())
T = sorted(map(int, input().split()))
i = 0
for t in T:
    while D[i] < t:
        i += 1
    if D[i] == t:
        i += 1
    else:
        print('NO')
        exit()
print('YES')

Submission status: Accepted

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())))
m = int(input())
b = sorted(list(map(int, input().split())))
i = 0
for x in b:
    while i < n and a[i] < x:
        i += 1
    if i < n and a[i] == x:
        i += 1
    else:
        print('NO')
        exit(0)
print('YES')

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
D = Counter(map(int,input().split()))
m = int(input())
T = Counter(map(int,input().split()))

print('YES' if all(D[i] >= T[i] for i in T) else 'NO')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import re
import string

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

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

ok = True
for t in T:
    if c[t] > 0:
        c[t] -= 1
    else:
        ok = False
        break
if ok:
    print("YES")
else:
    print("NO")

Submission status: Accepted

Solution code:
n = int(input())
d = dict()
a = [int(i) for i in input().split()]
for i in a:
    if i not in d.keys():
        d[i] = 0
    d[i] += 1
m = int(input())
for i in [int(j) for j in input().split()]:
    if i not in d.keys():
        print("NO")
        break
    d[i] -= 1
    if d[i] < 0:
        print("NO")
        break
else:
    print("YES")

Submission status: Accepted

Solution code:
# coding: utf-8

from collections import Counter, defaultdict


def array2d(dim1, dim2, init=None):
    return [[init for _ in range(dim2)] for _ in range(dim1)]


def main():
    N = int(input())
    D = map(int, input().split(" "))
    ds = defaultdict(int)
    for d in D:
        ds[d] += 1
    M = int(input())
    T = map(int, input().split(" "))
    for t in T:
        ds[t] -= 1
    for i in ds.values():
        if i < 0:
            return "NO"
    return "YES"


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

Submission status: Accepted

Solution code:
from collections import Counter


def solve(d, t):
    for ti, tc in t.items():
        if ti not in d:
            return False
        if d[ti] < tc:
            return False
    return True


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

print('YES' if solve(d, t) else 'NO')

Submission status: Accepted

Solution code:
ri = lambda: map(int, raw_input().split())
input()
d = dict()
for x in ri():
    if x not in d:
        d[x] = 0
    d[x] += 1
input()
for x in ri():
    if x not in d or d[x] == 0:
        print 'NO'
        quit()
    d[x] -= 1
print 'YES'

Submission status: Accepted

Solution code:
n = int(input())
D = map(int, input().split())
m = int(input())
T = map(int, input().split())
def count(A):
    B = {}
    for a in A:
        B[a] = B.get(a, 0) + 1
    return B

E = count(D)
U = count(T)

ok = 1
for u in U:
    if not U[u] <= E.get(u, 0):
        ok = 0
print("YES"*ok or "NO")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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 t_i in t:
    while j < n and d[j] < t_i:
        j += 1
    if j == n or d[j] != t_i:
        result = False
        break
    j += 1
else:
    result = True
print(['NO', 'YES'][result])

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline())
di = {}
fi = {}
a = map(int,stdin.readline().split())
ans = 'YES'
for i in a:
 di[i] = di.get(i,0) + 1
m = int(stdin.readline())
b = map(int,stdin.readline().split())
for i in b:
 fi[i] = fi.get(i,0) + 1
for i in fi:
 if fi[i] > di.get(i,0):
  ans = 'NO'
print ans

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from collections import defaultdict

def solve():
    N = int(raw_input())
    D = map(int, raw_input().split())
    cnt = defaultdict(int)
    for di in D:
        cnt[di] += 1
    M = int(raw_input())
    T = map(int, raw_input().split())
    for ti in T:
        if cnt[ti] == 0:
            return False
        cnt[ti] -= 1
    return True

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def main():
    n = I()
    d = LI()
    m = I()
    t = LI()
    c = collections.defaultdict(int)
    for k in d:
        c[k] += 1
    for k in t:
        if c[k] < 1:
            return 'NO'
        c[k] -= 1

    return 'YES'


print(main())

Submission status: Runtime Error

Solution code:
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 p[i] == 0 or i not in p:
        print("NO")
        exit()
    p[i] -= 1
print("YES")

Submission status: Runtime Error

Solution code:
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 p[i] == 0:
        print("NO")
        exit()
    p[i] -= 1
print("YES")

Submission status: Runtime Error

Solution code:
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
lst = [0]*200001
for j in d:
    lst[j] += 1
for i in t:
    if lst[i] == 0:
        print("NO")
        exit()
    lst[i] -= 1
print("YES")

Submission status: Runtime Error

Solution code:
# coding: utf-8
n=int(input())
D=list(map(int,input().split()))
m=int(input())
T=list(map(int,input().split()))
d={}
t={}
for d_ in D:
    if str(d_) in d:
        d[str(d_)]+=1
    else:
        d[str(d_)] = 1
for t_ in T:
    if str(t_) in t:
        t[str(t_)]+=1
    else:
        t[str(t_)] = 1

D_=list(set(D))
T_=list(set(T))
flg=True
#print(T_,D_)
if len(T) > len(D) or len(T_) > len(D_):
    flg=False
if flg:
    for t_ in T_:
        #print(t_)
        #print(t[str(t_)], d[str(t_)])
        if t[str(t_)] <= d[str(t_)]:
            pass
        else:
            flg=False
if flg:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
# coding: utf-8
n=int(input())
D=list(map(int,input().split()))
m=int(input())
T=list(map(int,input().split()))
d={}
t={}
for d_ in D:
    if str(d_) in d:
        d[str(d_)]+=1
    else:
        d[str(d_)] = 1
for t_ in T:
    if str(t_) in t:
        t[str(t_)]+=1
    else:
        t[str(t_)] = 1

D_=list(set(D))
T_=list(set(T))
flg=True
if len(T_) > len(D_):
    flg=False
if flg:
    for t_ in T_:
        #print(t_)
        #print(t[str(t_)], d[str(t_)])
        if t[str(t_)] <= d[str(t_)]:
            pass
        else:
            flg=False
if flg:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
n = int(input())
D = list(map(int,input().split()))
m = int(input())
T = list(map(int,input().split()))
if m > n:
    print('NO')
    exit()
numd = [0]*(10**9+5)
numt = [0]*(10**9+5)
for d in D:
    numd[d] += 1
for t in T:
    numt[t] += 1
for t in T:
    if numt[t] > numd[t]:
        print('NO')
        exit()
print('YES')

Submission status: Runtime Error

Solution code:
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:
  ptint("NO")

Submission status: Runtime Error

Solution code:
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:
  ptint("No")

Submission status: Runtime Error

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

num = {}
for v in a:
  if v in a:
    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:
  ptint("No")

Submission status: Runtime Error

Solution code:
n = int(input())
D = list(map(int,input().split()))
m = int(input())
T = list(map(int,input().split()))
if m > n:
    print('NO')
    exit()
numd = [0]*200005
numt = [0]*200005
for d in D:
    numd[d] += 1
for t in T:
    numt[t] += 1
for t in T:
    if numt[t] > numd[t]:
        print('NO')
        exit()
print('YES')

Submission status: Runtime Error

Solution code:
= list(map(int,input().split()))
m = int(input())
T = list(map(int,input().split()))
if m > n:
    print('NO')
    exit()
numd = [0]*200005
numt = [0]*200005
for d in D:
    numd[d] += 1
for t in T:
    numt[t] += 1
for t in T:
    if numt[t] > numd[t]:
        print('NO')
        exit()
print('YES')

Submission status: Runtime Error

Solution code:
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)


#一つずつずらしていく、Tのkeyとvalueを取り出す
D_keylist = (list(D_counter.items()))

#一つずつずらしていく、Tのkeyとvalueを取り出す
T_keylist = (list(T_counter.keys()))
T_Valuelist = (list(T_counter.values()))

if N < M:
    print("NO")
    sys.exit()




 
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
    else:
        pass


if len(T_keylist) == ans:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
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)


#一つずつずらしていく、Tのkeyとvalueを取り出す
D_keylist = (list(D_counter.items()))

#一つずつずらしていく、Tのkeyとvalueを取り出す
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
    else:
        pass


if len(T_keylist) == ans:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
import sys

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

d_num = [0 for i in range(200001)]
t_num = [0 for i in range(200001)]

for i in range(len(dn)):
    d_num[dn[i]] += 1

for i in range(len(tn)):
    t_num[tn[i]] += 1
    
for i in range(len(t_num)):
    if d_num[i] < t_num[i]:
        print("NO")
        sys.exit()
print("YES")

Submission status: Runtime Error

Solution code:
import sys

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

d_num = [0 for i in range(200001)]
t_num = [0 for i in range(200001)]

for i in range(len(dn)):
    d_num[dn[i]] += 1

for i in range(len(tn)):
    t_num[tn[i]] += 1
    
for i in range(len(t_num)):
    if d_num[i] < t_num[i]:
        print("NO")
        sys.exit()
print("yes")

Submission status: Runtime Error

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

d_dic = dict()
t_dic = dict()

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

ans = 0

for i in t_dic.keys():
    if t_dic[i] > d_dic[i]:
        ans = 1
        break

if ans == 1:
    print("NO")
else:
    print("YES")

Submission status: Runtime Error

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

flg = True
for i in range(m):
  index = bisect.bisect_left(d,t[i])
  if t[i] == d[index]:
    del d[index]
  else:
    flg = False
    break
 
print('YES' if flg else 'NO')

Submission status: Runtime Error

Solution code:
import bisect
 
n = int(input())
d = sorted(list(map(int,input().split())))
m = int(input())
t = list(map(int,input().split()))
d.append(d[-1]+1)

flg = True
for i in range(m):
  index = bisect.bisect_left(d,t[i])
  if t[i] == d[index]:
    del d[index]
  else:
    flg = False
    break
 
print('YES' if flg else 'NO')

Submission status: Runtime Error

Solution code:
import bisect

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

flg = True
for i in range(m):
  index = bisect.bisect_left(d,t[i])
  if t[i] == d[index]:
    del d[index]
  else:
    flg = False
    break

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

Submission status: Runtime Error

Solution code:
N=int(input())
D=list(map(int,input().split()))
D.sorted()
M=int(input())
T=list(map(int,input().split()))
T.sorted()
for num in T:
    if num in D:
        D.remove(num)
    else:
        print('NO')
        exit()
print('YES')

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
# 計算量O(N2M)

N = int(input())

d = list(map(int,input().split()))
d_cnt = [0]*max(d)

for v in d:
    d_cnt[v-1] += 1

M = int(input())

t = list(map(int,input().split()))
t_cnt = [0]*max(t)

for v in t:
    t_cnt[v-1] += 1

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

for i in range(min(len(d_cnt),len(t_cnt))):
    if t_cnt[i] != 0:
        if d_cnt[i] < t_cnt[i]:
            print('NO')
            exit()

print('YES')