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: Runtime Error

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

d_dict={}
for dd in d:
    if dd not in d_dict:
        d_dict[dd]=d.count(dd)
t_dict={}
for tt in t:
    if tt not in t_dict:
        t_dict[tt]=t.count(tt)

for t_num in t_dict:
    if d_dict[t_num]>= t_dict[t_num]:
        continue
    else:
        print("NO")
        exit()
print("YES")

Submission status: Runtime Error

Solution code:
a=int(input())
b=list(map(int,input().split()))
c=int(input())
d=list(map(int,input().split()))
e=set(d)

for item in e:
  if d.count(item)>c.count(item):
    print("NO")
    exit()
    
print("YES")

Submission status: Runtime Error

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

from collections import Counter
n=counter(n)
d=counter(d)

for item in e:
  if r[item]<d[item]:
    print("NO")
    exit()
print("YES")

Submission status: Runtime Error

Solution code:
N = input()
nums = list(map(int, input().split()))
nums.sort()
M = input()
tasks = list(map(int, input().split()))
tasks.sort()

ans = "YES"

for task in tasks:
    if nums.index(task) != -1:
        nums.remove(task)
    else:
        ans = "NO"
        break

print(ans)

Submission status: Runtime Error

Solution code:
N = input()
nums = list(map(int, input().split()))
nums.sort()
M = input()
tasks = list(map(int, input().split()))
tasks.sort()

ans = "YES"

for task in tasks:
    if nums.find(task) != -1:
        nums.remove(task)
    else:
        ans = "NO"
        break

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
ds = sorted(list(map(int,input().split())))
m = int(input())
ts = sorted(list(map(int,input().split())))

j = 0
for i in range(n):
  if ds[i+j] == ts[i]:
    continue
  elif ds[i+j] < ts[i]:
    for k in range(n - i+j):
      if ds[i+j+k] == ts[i]:
        j += k
        break
      elif ds[i+j+k] < ts[i]:
        continue
      else:
        print('NO')
        exit(0)
  else:
    print('NO')
    exit(0)
    
print('YES')

Submission status: Runtime Error

Solution code:
n = int(input())
ds = list(map(int,input().split()))
m = int(input())
ts = list(map(int,input().split()))

for t in ts:
  if i in ds:
    ds.remove(t)
  else:
    print('NO')
    exit(0)
print('YES')

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <math.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
using namespace std;
int main() {
	int N, M,a;
	map<int, int>m{};
	bool flag = true;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> a;
		m[a]++;
	}
	cin >> M;
	for (int i = 0; i < M; i++)
	{
		cin >> a;
		if (m[a] == 0)flag = false;
		else m[a]--;
	}
	cout << (flag ? "YES" : "NO");
}

Submission status: Runtime Error

Solution code:
import bisect

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

for t in T:
    bl=bisect.bisect_left(D,t)
    if D[bl]==t:
        del D[bl]
    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()))
for i in T:
	if i in D:
		remove(i)
	else:
		print("No")
		exit()
print("Yes")

Submission status: Runtime Error

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

c = Counter(D) - Counter(T)
answer = 'YES' if min(c.values()) >= 0 else 'NO'
print(answer)

Submission status: Runtime Error

Solution code:
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
dd=[0]*(max(d)+1)
tt=[0]*(max(t)+1)
for i in range(n):
    dd[d[i]]+=1
for i in range(m):
    tt[t[i]]+=1
for i in range(m):
    if tt[t[i]]>dd[t[i]]:
        print("NO")
        exit()
print("YES")

Submission status: Runtime Error

Solution code:
n = int(input())
d_array = [int(x) for x in input().split()]
d_dict = {}
for i in range(200000+1):
    d_dict[i] = 0
for d in d_array:
    d_dict[d] += 1
m = int(input())
t_array = sorted([int(x) for x in input().split()])

for t in t_array:
    if d_dict[t] > 0:
        d_dict[t] -= 1
    else:
        print("NO")
        break
else:
    print("YES")

Submission status: Runtime Error

Solution code:
N = int(input())
D = [int(i)-1 for i in input().split()]
Dlist = [0]*(max(D)+1)
for d in D:
    Dlist[d] += 1


M = int(input())
T = [int(i)-1 for i in input().split()]
Tlist = [0]*(max(T)+1)
for t in T:
    Tlist[t] += 1
 
flag = True
 
for i in T:
    if Tlist[i] > Dlist[i]:
        flag = False
        break
 
if flag:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*max(D)
for d in D:
    Dlist[d-1] += 1


M = int(input())
T = [int(i) for i in input().split()]
if max(T) > max(D):
    print('NO')
    exit()

Tlist = [0]*max(T)
for t in T:
    Tlist[t-1] += 1
 
flag = True
 
for i in T:
    i -= 1
    if Tlist[i] > Dlist[i]:
        flag = False
        break
 
if flag:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*1000000
for d in D:
    Dlist[d-1] += 1


M = int(input())
T = [int(i) for i in input().split()]
    
Tlist = [0]*1000000
for t in T:
    Tlist[t-1] += 1
 
flag = True
 
for i in range(len(Tlist)):
    if Tlist[i] > Dlist[i]:
        flag = False
        break
 
 
if flag:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*max(D)
for d in D:
    Dlist[d-1] += 1


M = int(input())
T = [int(i) for i in input().split()]
if max(T) > max(D):
    print('NO')
    exit()
    
Tlist = [0]*max(T)
for t in T:
    Tlist[t-1] += 1
 
flag = True
 
for i in range(len(Tlist)):
    if Tlist[i] > Dlist[i]:
        flag = False
        break
 
 
if flag:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*max(D)
for d in D:
    Dlist[d-1] += 1

M = int(input())
T = [int(i) for i in input().split()]
Tlist = [0]*max(T)
for t in T:
    Tlist[t-1] += 1

flag = True

for i in range(max(T)):
    if Tlist[i] > Dlist[i]:
        flag = False
        break


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

Submission status: Runtime Error

Solution code:
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*max(D)
for d in D:
    Dlist[d-1] += 1

M = int(input())
T = [int(i) for i in input().split()]
Tlist = [0]*max(T)
for t in T:
    Tlist[t-1] += 1

flag = True

for i in range(len(Tlist)):
    if Tlist[i] > Dlist[i]:
        flag = False
        break


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

Submission status: Runtime Error

Solution code:
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*(max(D))
for d in D:
    Dlist[d-1] += 1

M = int(input())
T = [int(i) for i in input().split()]
Tlist = [0]*(max(T))
for t in T:
    Tlist[t-1] += 1

flag = True

for i in range(len(Tlist)):
    if Tlist[i] > Dlist[i]:
        flag = False
        break


if flag:
    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()))
d.sort()
t.sort()
di=0
f=0
for ti in range(m):
    if di<n:
        while d[di]!=t[ti]:
            di+=1
            if d[di]>t[ti]:
                f=1
                break
    if f==1:
        break
if f==1:
    print('NO')
else:
    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()
di=0
f=0
for ti in range(m):
    if di<n:
    	while d[di]!=t[ti]:
        	di+=1
        	if d[di]>t[ti]:
            	f=1
            	break
    if f==1:
        break
if f==1:
    print('NO')
else:
    print('YES')

Submission status: Runtime Error

Solution code:
n = int(input())
d  =list(map(int,input().split()))
d.sort()
m = int(input())
t = list(map(int,input().split()))
t.sort()
for x in t:
    while d[i] < x:
        i += 1
    if d[i] == x:
        i += 1
    else:
        print("NO")
        exit()
print("YES")

Submission status: Runtime Error

Solution code:
input()
d = Counter(map(int,input().split()))
input()
t = Counter(map(int,input().split()))
d.subtract(t)
if -d:
    print("NO")
else:
    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.sort()
t.sort()

def array_count(arr):
    arr_target = [[]]
    cnt = 1
    for i in range(1,len(arr)):
        if arr[i] == arr[i-1]:
            cnt += 1
        else:
            arr_target.append([arr[i-1],cnt])
            cnt = 1
    arr_target.append([arr[len(arr)-1],cnt])
    del arr_target[0]
    return arr_target

d = array_count(d)
t = array_count(t)

cand = [0] * 200000

for i in range(len(d)):
    cand[d[i][0]] += d[i][1]

for i in range(len(t)):
    cand[t[i][0]] -= t[i][1]

flag = True
for i in range(len(cand)):
    if cand[i] < 0:
        flag = False

if flag:
    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.sort()
t.sort()

def array_count(arr):
    arr_target = [[]]
    cnt = 1
    for i in range(1,len(arr)):
        if arr[i] == arr[i-1]:
            cnt += 1
        else:
            arr_target.append([arr[i-1],cnt])
            cnt = 1
    arr_target.append([arr[len(arr)-1],cnt])
    del arr_target[0]
    return arr_target

d = array_count(d)
t = array_count(t)

cand = [0] * 200000

for i in range(len(d)):
    cand[d[i][0]] += d[i][1]

for i in range(len(t)):
    cand[t[i][0]] -= t[i][1]

flag = True
for i in range(len(cand)):
    if cand[i] < 0:
        flag = False

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

Submission status: Runtime Error

Solution code:
n = int(input())
d = list(map(int,input().split()))
d.sort()
m = int(input())
t = list(map(int,input().split()))
t.sort()
for x in d:
    if x == t[0]:
        t.pop(0)
if len(t)==0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
n-int(input())
arr1=list(map(int,input().split()))
arr1=sorted(arr1)
m=int(input())
arr2=list(map(int,input().split()))
arr2=sorted(arr2)
pos=0
for i in range(n):
  if arr1[i]==arr2[pos]:
    pos+=1
  if pos==m:
    print('YES')
    break
else:
  print('NO')

Submission status: Runtime Error

Solution code:
n=int(input())
d=dict()
for a in map(int,input().split()):
  if a not in d:
    d[a]=1
  else:
    d[a]+=1
m=int(input())
t=dict()
for a in map(int,input().split()):
  if a not in t:
    t[a]=1
  else:
    t[a]+=1
ans="YES"
for i in t.keys():
  if not t[i]==d[i]:
    ans="NO"
print(ans)

Submission status: Runtime Error

Solution code:
n,d,m,t,ans=int(input()),list(map(int,input().split())),int(input()),list(map(int,input().split())),"YES"
dn,tn,dc,tc=[],[],[],[]
for i in d:
  if i in dn:dc[dn.index(i)]+=1
  else:dn.append(i);dc.append(1)
for i in t:
  if i in tn:tc[tn.index(i)]+=1
  else:tn.append(i);tc.append(1)
for i in range(len(tn)):
  if tc[i]>dc[dn.index(tn[i])]:ans="NO"
print(ans)

Submission status: Runtime Error

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

md = [0] * 1000000001
mt = [0] * 1000000001

for i in d:
    md[i] += 1
for i in t:
    mt[i] += 1
flag = True   
for i in range(1,1000000001):
    if mt[i] > md[i]:
        flag = False
        break

print("YES" if flag else "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 n >= m:
    for i in d:
        t.remove(i)
        if len(t) == 0:
            break
if len(t) == 0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
def binarySearch(list_a, key):
    left = 0
    right = len(list_a)
    while left < right:
        mid = (left + right) // 2
        if list_a[mid] == key:
            return mid
            break
        elif key < list_a[mid]:
            right = mid
        else:
            left = mid+1
    else:
        return "NOT_FOUND"

def merge(list_a, left, mid, right):
    import math
    n1 = mid - left
    n2 = right - mid
    list_l = []
    list_r = []
    for i in range(0,n1):
        list_l.append(list_a[left + i])
    for i in range(0,n2):
        list_r.append(list_a[mid + i])
    list_l.append(math.inf)
    list_r.append(math.inf)
    i = 0
    j = 0
    for k in range(left,right):
        if list_l[i] <= list_r[j]:
            list_a[k] = list_l[i]
            i += 1
        else:
            list_a[k] = list_r[j]
            j += 1

def mergeSort(list_a, left, right):
    if left + 1 < right:
        mid = (left + right) //2
        mergeSort(list_a, left, mid)
        mergeSort(list_a, mid, right)
        merge(list_a, left, mid, right)


n = int(input())
list_d = list((map(int, input().split())))
m = int(input())
list_t = list((map(int, input().split())))

mergeSort(list_d, 0, n)
mergeSort(list_t, 0, m)
for number in list_t:
    ind = binarySearch(list_d, number)
    if ind != "NOT_FOUND":
        del list_d[ind]
    else:
        print("NO")
        break
else:
    print("YES")

Submission status: Runtime Error

Solution code:
import math
def binarySearch(list_a, key):
    left = 0
    right = len(list_a)
    while left < right:
        mid = (left + right) // 2
        if list_a[mid] == key:
            return mid
            break
        elif key < list_a[mid]:
            right = mid
        else:
            left = mid+1
    else:
        return "NOT_FOUND"

def merge(list_a, left, mid, right):
    import math
    n1 = mid - left
    n2 = right - mid
    list_l = []
    list_r = []
    for i in range(0,n1):
        list_l.append(list_a[left + i])
    for i in range(0,n2):
        list_r.append(list_a[mid + i])
    list_l.append(math.inf)
    list_r.append(math.inf)
    i = 0
    j = 0
    for k in range(left,right):
        if list_l[i] <= list_r[j]:
            list_a[k] = list_l[i]
            i += 1
        else:
            list_a[k] = list_r[j]
            j += 1

def mergeSort(list_a, left, right):
    if left + 1 < right:
        mid = (left + right) //2
        mergeSort(list_a, left, mid)
        mergeSort(list_a, mid, right)
        merge(list_a, left, mid, right)


n = int(input())
list_d = list((map(int, input().split())))
m = int(input())
list_t = list((map(int, input().split())))

mergeSort(list_d, 0, n)

for number in list_t:
    ind = binarySearch(list_d, number)
    if ind != "NOT_FOUND":
        del list_d[ind]
    else:
        print("NO")
        break
else:
    print("YES")

Submission status: Runtime Error

Solution code:
def binarySearch(list_a, key):
    left = 0
    right = len(list_a)
    while left < right:
        mid = (left + right) // 2
        if list_a[mid] == key:
            return mid
            break
        elif key < list_a[mid]:
            right = mid
        else:
            left = mid+1
    else:
        return "NOT_FOUND"

def merge(list_a, left, mid, right):
    import math
    n1 = mid - left
    n2 = right - mid
    list_l = []
    list_r = []
    for i in range(0,n1):
        list_l.append(list_a[left + i])
    for i in range(0,n2):
        list_r.append(list_a[mid + i])
    list_l.append(math.inf)
    list_r.append(math.inf)
    i = 0
    j = 0
    for k in range(left,right):
        if list_l[i] <= list_r[j]:
            list_a[k] = list_l[i]
            i += 1
        else:
            list_a[k] = list_r[j]
            j += 1

def mergeSort(list_a, left, right):
    if left + 1 < right:
        mid = (left + right) //2
        mergeSort(list_a, left, mid)
        mergeSort(list_a, mid, right)
        merge(list_a, left, mid, right)


n = int(input())
list_d = list((map(int, input().split())))
m = int(input())
list_t = list((map(int, input().split())))

mergeSort(list_d, 0, n)
for number in list_t:
    ind = binarySearch(list_d, number)
    if ind != "NOT_FOUND":
        del list_d[ind]
    else:
        print("NO")
        break
else:
    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()))
t_ = set(t)
for i in range(len(t_)):
  if t.count(t_[i]) > d.count(t_[i]):
    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()))
t_ = set(t)
for i in range(len(t_):
  if t.count(t_[i]) > d.count(t_[i]):
    print("NO")
    exit()
print("YES")

Submission status: Runtime Error

Solution code:
input()
s=input.split()
a=[]
for i in s:
 a.append(int(i))
a.sort()
input()
s=input.split()
b=[]
for i in s:
 b.append(int(i))
b.sort()
while len(a)>0:
    if a[0]==b[0]:
        del(a[0])
        del(b[0])
        if len(b)==0:
            break
    elif a[0]<b[0]:
        del(a[0])
    else:
        a=[]
if len(b)==0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
D = [int(i) for i in input().split()]
M = int(input())
T = [int(i) for i in input().split()]

count_D = collections.Counter(D)
count_T = collections.Counter(T)

ans = 'YES'
for k,v in count_T.items():
  if D[k] < v:
    ans = 'NO'
    break
print(ans)

Submission status: Runtime Error

Solution code:
N = input()
D = map(int, raw_input().split())
M = input()
T = map(int, raw_input().split())
var = []
result = True
for i in range(N):
  var[D[i]] += 1
for j in range(M):
  if(var[T[j]] == 0):
    result = False
    break
  else:
    var[T[j]] -= 1
if(result):
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:

q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y):
    MAX=max(x)
else:
    MAX=max(y)
z=[0]*MAX

print('YES')

Submission status: Runtime Error

Solution code:

q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y):
    MAX=max(x)
else:
    MAX=max(y)
z=[0]*1000000000

print('YES')

Submission status: Runtime Error

Solution code:

q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y):
    MAX=max(x)
else:
    MAX=max(y)

z=[0]*MAX

print('YES')

Submission status: Runtime Error

Solution code:

q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y):
    MAX=max(x)
else:
    MAX=max(y)

z=[0]*int(MAX)

print('YES')

Submission status: Runtime Error

Solution code:
q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y):
    MAX=max(x)
else:
    MAX=max(y)

z=[0]*(int(MAX)+1)

print('YES')

Submission status: Runtime Error

Solution code:
q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y):
    MAX=max(x)
else:
    MAX=max(y)

z=[0]*(MAX+1)

print('YES')

Submission status: Runtime Error

Solution code:
q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y):
    MAX=max(x)
else:
    MAX=max(y)

z=[0]*(MAX+1)

for k in x :
    z[k] += 1
    
for i in y :
    z[i] -= 1
    if z[i] == -1 :
        print('NO')
        exit()
        
print('YES')

Submission status: Runtime Error

Solution code:

q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y): MAX=max(x)
else : MAX=max(y)

z=[0]*(MAX+1)

for k in x :
    z[k] += 1
    
for i in y :
    z[i] -= 1
    if z[i] == -1 :
        print('NO')
        exit()
        
print('YES')

Submission status: Runtime Error

Solution code:

q=input()
x=[int(i) for i in input().split()]
cnt=input()
j=0
y=[int(i) for i in input().split()]

if max(x) >= max(y): MAX=max(x)
else : MAX=max(y)

z=[0]*(MAX+1)

for k in x :
    z[k] += 1
    
for i in y :
    z[i] -= 1
    if z[i] == -1 :
        print('NO')
        exit()
        
print('YES')

Submission status: Runtime Error

Solution code:

q=input()
x=[int(i) for i in input().split()]
cnt=input()
j=0
y=[int(i) for i in input().split()]

if max(x) >= max(y): MAX=max(x)
else : MAX=max(y)

z=[0]*MAX

for k in x :
    z[k-1] += 1
    
for i in y :
    z[i-1] -= 1
    if z[i-1] == -1 :
        print('NO')
        exit()
        
print('YES')

Submission status: Runtime Error

Solution code:
import sys

q=input()
x=[int(i) for i in input().split()]
cnt=input()
j=0
y=[int(i) for i in input().split()]

if max(x) >= max(y): MAX=max(x)
else : MAX=max(y)

z=[0]*MAX

Submission status: Runtime Error

Solution code:
import sys

q=input()
x=[int(i) for i in input().split()]
cnt=input()
j=0
y=[int(i) for i in input().split()]

if max(x) >= max(y): MAX=max(x)
else : MAX=max(y)

z=[0]*MAX

for k in x :
    z[k-1] += 1
    
for i in y :
    z[i-1] -= 1
    if z[i-1] == -1 :
        print('NO')
        sys.exit()
        
print('YES')

Submission status: Runtime Error

Solution code:
import sys

q=input()
x=[int(i) for i in input().split()]
cnt=input()
j=0
y=[int(i) for i in input().split()]

if max(x) >= max(y): MAX=max(x)
else : MAX=max(y)

z=[0]*MAX

for k in x :
    z[k-1] += 1
    
j=0
for i in y :
    z[i-1] -= 1
    if z[i-1] == -1 :
        print('NO')
        j=1
        break
if j==0:
    print('YES')

Submission status: Runtime Error

Solution code:
import sys

q=input()
x=[int(i) for i in input().split()]
cnt=input()
j=0
y=[int(i) for i in input().split()]

if max(x) >= max(y): MAX=max(x)
else : MAX=max(y)

z=[0]*MAX

for k in x :
    z[k-1] += 1
    
for i in y :
    z[i-1] -= 1
    if z[i-1] == -1 :
        print('NO')
        sys.exit()
print('YES')

Submission status: Runtime Error

Solution code:
import sys

q=input()
x=[int(i) for i in input().split()]
cnt=input()
j=0
y=[int(i) for i in input().split()]

if max(x) >= max(y): MAX=max(x)
else : MAX=max(y)

z=[0]*MAX

for k in x :
    z[k] += 1
    
for i in y :
    z[i] -= 1
    if z[i] == -1 :
        print('NO')
        sys.exit()
print('YES')

Submission status: Runtime Error

Solution code:
import sys

q=input()
x=[int(i) for i in input().split()]
cnt=input()
j=0
y=[int(i) for i in input().split()]

z=[0]*max(x)

for k in x :
    z[k] += 1
    
for i in y :
    z[i] -= 1
    if z[i] == -1 :
        print('NO')
        sys.exit()
print('YES')

Submission status: Runtime Error

Solution code:
q=input()
x=[int(i) for i in input().split()]
cnt=input()
j=0
y=[int(i) for i in input().split()]
x=x.sort()
y=y.sort()

for k in range(len(y)) :
    for i in range(len(x)) :
        if x[i] == y[k] :
            del x[i]
            break
        if i+1 == len(x) :
            print('NO')
            j=1
if j == 0 :
    print('OK')

Submission status: Runtime Error

Solution code:
q=input()
x=[int(i) for i in input().split()]
cnt=input()
j=0
y=[int(i) for i in input().split()]
x=x.sort()
y=y.sort()

for k in range(len(y)) :
    for i in range(len(x)) :
        if x[i] == y[k] :
            del x[i]
            break
        if i+1 == len(x) :
            print('NO')
            j=1
if j==0 :
    print('OK')

Submission status: Runtime Error

Solution code:
import bisect
s=input()
s=input().split()
t=input()
t=input().split()
s.sort()
t.sort()
f=False
for c in t:
 i=bisect.bisect_left(s,c)
 if s[i]!=c:
  print("NO")
  f=True
  break
 else:
  s.pop[i]
if not f:
 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()))
for i in range(n):
	for k in range(len(d)):
		if len(t) == 0:
			answer = 1
			break
		elif t[0] == d[k]:
			del d[k]
			del t[0]
			break
if answer == 1:
	print('YES')
else:
	print('NO')

Submission status: Runtime Error

Solution code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import math
import bisect
import itertools
import numpy as np
from collections import OrderedDict
from bisect import bisect_left, bisect_right, insort_left, insort_right


class EndLoop(Exception):
    pass

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

Submission status: Runtime Error

Solution code:
import numpy as np
n = input()
d = [int(i) for i in input().split()]
n = input()
t = [int(i) for i in input().split()]

def p2(d,t):
    arr = np.zeros(10**9)
    for i in d:
        arr[i] += 1
    for i in t:
        arr[i] -= 1
        if arr[i] < 0: return("NO")
    return("YES")
print(p2(d,t))

Submission status: Runtime Error

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

for k, v in t_dict.items():
    if v > d_dict[k]:
        print("NO")
        exit(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()))

dictD = [0]*1000000001
for d in D:
    dictD[d-1] += 1
for t in T:
    dictD[t-1] -= 1

dictD.sort()
if dictD[0] < 0:
    print("NO")
else:
    print("YES")

Submission status: Runtime Error

Solution code:
N = input()
D = [i for i in input()]
M = input()
T = [i if i in D else "<muri>" for i in input()]

if "<muri>" in T:
    print("NO")
    quit()
for t in T:
    if d in D:
        D.remove(t)
    else:
        print("NO")
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()))

dictD = [0]*1000000000
for d in D:
    dictD[d-1] += 1
for t in T:
    dictD[t-1] -= 1

dictD.sort()
if dictD[0] < 0:
    print("NO")
else:
    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_dic = {k: 0 for k in D}
T_dic = {k: 0 for k in T}

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

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

print(x)

Submission status: Runtime Error

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

dictD = [0]*200001
for d in D:
    dictD[d-1] += 1
for t in T:
    dictD[t-1] -= 1

dictD.sort()
if dictD[0] < 0:
    print("NO")
else:
    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()))

dictD = [0]*200000
for d in D:
    dictD[d-1] += 1
for t in T:
    dictD[t-1] -= 1

dictD.sort()
if dictD[0] < 0:
    print("NO")
else: print("YES")

Submission status: Runtime Error

Solution code:
N = input()
D = [i for i in input()]
M = input()
T = [i for i in input()]

for d in D:
    if t in T:
        T.remove(t)
    if len(T)==0:
        print("YES")
        quit()
print("NO")

Submission status: Runtime Error

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

d_cnt = [0 for _ in range(200000)]
t_cnt = [0 for _ in range(200000)]

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

for t in T:
	t_cnt[t] += 1

for i in range(len(t_cnt)):
	if t_cnt[i] > d_cnt[i]:
		print("NO")
		exit(0)
print("YES")

Submission status: Runtime Error

Solution code:
n = input()
d = [int(i) for i in input().split(" ")]

m = input()
t = [int(i) for i in input().split(" ")]


d_set = set(d)
d_set = list(d_set)
t_set = set(t)
t_set = list(t_set)

flag =0

if len(t_set != d_set):
    flag = 1
else:
    for s in t_set:
        if d.count(s) < t.count(s):
            flag = 1
            break


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

Submission status: Runtime Error

Solution code:
n = input()
d = [int(i) for i in input().split(" ")]

m = input()
t = [int(i) for i in input().split(" ")]


d_set = set(d)
d_set = list(d_set)
t_set = set(t)
t_set = list(t_set)

flag =0

if len(t_set != d_set):
    flag = 1
else:
    for s in t_set:
    if(d.count(s) < t.count(s)):
        flag = 1
        break


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