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:
# 計算量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(len(t_cnt)):
    if t_cnt[i] != 0:
        if d_cnt[i] < t_cnt[i]:
            print('NO')
            exit()

print('YES')

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 dn,tn in zip(d_cnt,t_cnt):
    if tn != 0:
        if dn < tn:
            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()))

cnt=[0]*1000000010

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

ans="YES"
for i in range(m):
    cnt[T[i]]-=1
    if cnt[T[i]]<0:
        ans="NO"
        break

print(ans)

Submission status: Runtime Error

Solution code:
mport collections
 
n = int(input())
ln = list(map(int, input().split()))
m = int(input())
lm = list(map(int, input().split()))
 
c1 = collections.Counter(lm)
c2 = collections.Counter(ln)
 
for i in c1.keys():
    if c2[i] < c1[i]:
        print("NO")
        exit()
 
print("YES")

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 = [0 for _ in range(200005)]
t = [0 for _ in range(200005)]

ans = "YES"

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

for i in range(M):
    t[T[i]] += 1

for i in range(len(d)):
    if t[i] > d[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()))

d = [0 for _ in range(200005)]

ans = "YES"

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

for i in range(M):
    # print(d[T[i]-1])
    d[T[i]] -= 1
    if d[T[i]] < 0:
        ans = "NO"
        break

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

d = [0 for _ in range(2000005)]

ans = "YES"

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

# print(d)
for i in range(M):
    # print(d[T[i]-1])
    d[T[i]] -= 1
    if d[T[i]] < 0:
        ans = "NO"
        break
# print(d)
print(ans)

Submission status: Runtime Error

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 = [0 for _ in range(2000005)]

ans = "YES"

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

# print(d)
for i in range(M):
    # print(d[T[i]-1])
    d[T[i]-1] -= 1
    if d[T[i]-1] < 0:
        ans = "NO"
        break
# print(d)
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
dl = list(map(int,input().split()))
m = int(input())
tl = list(map(int,input().split()))
d_dic = dict()
t_dic = dict()
for d in dl:
  if d in d_dic:
    d_dic[d] += 1
  else:
    d_dic[d] = 1
for t in tl:
  if t in t_dic:
    t_dic[t] += 1
  else:
    t_dic[t] = 1
for v in t_dic.keys():
  if t_dic[v] > d_dic[v]:
    print('NO')
    exit()
print('YES')

Submission status: Runtime Error

Solution code:
import heapq

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

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

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

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

Submission status: Runtime Error

Solution code:
import heapq

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

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

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

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

Submission status: Runtime Error

Solution code:
import heapq

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

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

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

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

Submission status: Runtime Error

Solution code:
import heapq

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

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

for i in range(m):
    a=heapq.heappop(t)
    b=heapq.heappop(d)
    #print(a,b,cnt)
    while b<a:
        b=heapq.heappop(d)
    if b==a:
        cnt+=1
        
    
if cnt==m:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
import sys

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

q = [0] * (10 ** 9 + 1)
for d in D:
    q[d] += 1

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

print("YES")

Submission status: Runtime Error

Solution code:
import sys

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

q = [0] * (max(D) + 1)
for d in D:
    q[d] += 1

for t in T:
    if q[t] > 0:
        q[t] -= 1
    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()))

# n 問題案数
# m 必要問題数
# d 難易度
# t 難易度

freq_of_val_in_d = dict()
freq_of_val_in_t = dict()

for v in d:
    if v in freq_of_val_in_d:
        freq_of_val_in_d[v] += 1
        continue
    freq_of_val_in_d[v] = 1

for v in t:
    if v in freq_of_val_in_t:
        freq_of_val_in_t[v] += 1
        continue
    freq_of_val_in_t[v] = 1

f = True
for v in t:
    if freq_of_val_in_t[v] > freq_of_val_in_d[v]:
        f = False

if f:
    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 = {}
for i in range(n):
    if d[i] not in D:
        D[d[i]] = 1
    else:
        D[d[i]] += 1
T = {}
for j in range(m):
    if t[j] not in T:
        T[t[j]] = 1
    else:
        T[t[j]] += 1
for k in T:
    if T[k] <= D[k]:
        continue
    else:
        print('NO')
        break
else:
    print('YES')

Submission status: Runtime Error

Solution code:
from collections import defaultdict

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

memo = defaultdict(int)

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

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

memo.sort()

print("YES" if memo[0] >= 0 else "NO")

Submission status: Runtime Error

Solution code:
from collections import defaultdict

N = int(input())
D = list(map(int, input().split()))
kind = defaultdict(int)
for d in D:
  kind[d] += 1

M = int(input())
T = list(map(int, input().split()))
for t in T:
  d[t] -= 1
  if d[t] < 0:
    print('NO')
    quit()

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()))
if N<M:
  print('NO')
  exit()
A={}
B={}
for i in D:
  if i not in A:
    A[i]=0
  A[i]+=1
  
for i in T:
  if i not in B:
    B[i]=0
  B[i]+=1
  
for i in B.keys():
  if not A[i]:
    print('NO')
    exit()
  if A[i]<B[i]:
    print('NO')
    exit()
print('YES')

Submission status: Runtime Error

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

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

from collections import Counter
 
d_count = Counter(D)
t_count = Counter(T)
for k,v in t_count.items():
    if k not in d_count:
        print('NO')
        exit()
    if d_count[k]< v:
        print('NO')
        exit()
print('YES')

Submission status: Runtime Error

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

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

from collections import Counter
 
d_count = Counter(D)
t_count = Counter(T)
for k,v in t_count.items():
    if k not in d_count:
        print('NO')
        exit()
    if d_count[k]< v:
        print('NO')
        exit()
print('YES')

Submission status: Runtime Error

Solution code:
from collections import defaultdict

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

dic = defaultdict(int)
for d in D:
    dic[d] += 1

for t in T:
    if dic[t]:
        dic[t] -= 1
    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()))

max_diff = max(max(d),max(t))

diff = [0]*(max_diff+1)

for i in d:
    diff[i] += 1

flag = True

print(1111111)

for i in t:
    if diff[i] > 0:
        diff[i] -= 1
    else:
        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()))

max_diff = max(max(d),max(t))

diff = [0]*(max_diff+10)

for i in d:
    diff[i] += 1

flag = True

for i in t:
    if diff[i] > 0:
        diff[i] -= 1
    else:
        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()))

max_diff = max(max(d),max(t))

diff = [0]*(max_diff+1)

for i in d:
    diff[i] += 1

flag = True

for i in t:
    if diff[i] > 0:
        diff[i] -= 1
    else:
        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()))

max_diff = max(d)

diff = [0]*(max_diff+1)

for i in d:
    diff[i] += 1

flag = True

for i in t:
    if diff[i] > 0:
        diff[i] -= 1
    else:
        flag = False
        break

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

Submission status: Runtime Error

Solution code:
N = int(input())
D_list = list(map(int, input().split()))
M = int(input())
T_list = list(map(int, input().split()))

dic_T = {}
for i in T_list:
    dic_T[i] = T_list.count(i)

dic_D = {}
for i in D_list:
    dic_D[i] = D_list.count(i)

ans = 'YES'
for k in dic_T:
    if dic_T[k] > dic_D[k]:
        ans = 'NO'
        print(ans)
        break

if ans == 'YES':
    print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
D_list = list(map(int,input().split()))
M = int(input())
T_list = list(map(int,input().split()))

dic_T = {}
for i in T_list:
    dic_T[i] = T_list.count(i)

dic_D = {}
for i in D_list:
    dic_D[i] = D_list.count(i)

ans = 'YES'
for k in dic_T:
    if dic_T[k] > dic_D[k]:
        ans = 'NO'
        print(ans)
        break

if ans == 'YES':
    print(ans)

Submission status: Runtime Error

Solution code:
# B - Problem Set
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))

dic = dict()

for di in d:
	if di in dic.keys():
		dic[di] += 1
	else:
		dic[di] = 1

for ti in t:
	if not ti in dic.keys():
		print('NO')
		sys.exit()
	elif dic[ti] < 1:
		print('NO')
		sys.exit()
	else:
		dic[ti] -= 1

print('YES')

Submission status: Runtime Error

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

max_diff = max(D)
difficulty = [0] * (max_diff + 1)
for d in D:
    difficulty[d] += 1

for t in T:
    if t > max_diff:
        print('NO')
        sys.exit()
    difficulty[t] -= 1
    if difficulty[t] < 0:
        print('NO')
        sys.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()))
if n < m:
    print('NO')
    exit(0)
dcnt = {}
for x in d:dcnt[x] = 0
ok = True
for x in d:dcnt[x]+=1
for i in range(m):
    if t[i] not in dcnt:ok = False
    if dcnt[t[i]] == 0:ok = False
    dcnt[t[i]] -= 1
if ok: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 n < m:
    print('NO')
    exit(0)
dcnt = {}
for x in d:dcnt[x] = 0
ok = True
for x in d:dcnt[x]+=1
for i in range(m):
    if dcnt[t[i]] == 0:ok = False
    dcnt[t[i]] -= 1
if ok:print('YES')
else:print('NO')

Submission status: Runtime Error

Solution code:
import collections

n=int(input())
d=list(map(int,input().split()))
li=collections.Counter(d)
m=int(input())
t=list(map(int,input().split()))
co=[0]*200001

for i in t:
    if (li[i]-co[i])>0:
        co[i]+=1
    else:
        print("NO")
        exit()

print("YES")

Submission status: Runtime Error

Solution code:
N = int(input())
D = sorted(list(map(int, input().split())))
M = int(input())
T = sorted(list(map(int, input().split())))
C = [0] * 3*10**5
for d in D:
    if d in C:
        C[d] += 1
    else:
        C[d] = 1
E = [0] * 3*10**5
for t in T:
    if t in E:
        E[t] += 1
    else:
        E[t] = 1
for key, val in enumerate(E):
    if val != 0:
        C[key] //= val

print('YES' if min(C[t] for t in T if t) > 0 else 'NO')

Submission status: Runtime Error

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

from collections import Counter
for i in t:
  if d[i] < t[i]:
    print('NO')
    exit()
print('YES')

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

int main(){
    int n, m;
    cin >> n;
    map<int,int> A;
    rep(i, n){
        int d;
        cin >> d;
        A[d]++;
    }
    cin >> m;
    rep(i, m){
        int t;
        cin >> t;
        A[t]--;
        if(A[t] < 0){
            co("NO");
            return 0;
        }
    }
    co ("YES");
}

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

int main(){
    sonic();
    int n, m;
    R n;
    map<int,int> A;
    rep(i, n){
        int d;
        R d;
        A[d]++;
    }
    R m;
    rep(i, m){
        int t;
        R t;
        A[t]--;
        if(A[t] < 0){
            co("NO");
            return 0;
        }
    }
    co ("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()))
flag=0
for i in range(M):
  flag=0
  for j in range(N):
    if D[j]==T[i] and flag==0:
      D.remove(D[j])
      flag=1
    if flag!=0:
      break
  if flag==0:
    flag=2
    print("No")
if flag==1:
  print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(map(int,input().split()))
m=int(input())
pl=list(map(int,input().split()))
for i in range(m):
  if not pl[i] in set(l):
    print('NO')
    break
  else:
    l.remove(pl[i])
  if i==m-1:
    print('YES')v

Submission status: Runtime Error

Solution code:
n=int(input())
l=list(map(int,input().split()))
m=int(input())
pl=list(map(int,input().split()))
for i in range(m):
  if not pl[i] in set(l):
    print('NO')
    break
  elif:
    l.remove(pl[i])
  if i==m-1:
    print('YES')

Submission status: Runtime Error

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

ans="YES"

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

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

Submission status: Runtime Error

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

ans="YES"

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

for ti in tp:
    if d[ti]==0:
        ans="No"
        break
    else:
        d[ti]-=1
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()))
D.sort()
T.sort()
if n=<m:
    if D==T:
        print('YES')
        exit()
    else:
        print('NO')
        exit()

r = 'YES'
for i in range(m):
    if T[i] in D:
        idx = D.index(T[i])
        D = D[idx+1:]
    else:
        r = 'NO'
        break
print(r)

Submission status: Runtime Error

Solution code:
n = int(input())
dlis = list(map(int, input().split()))
m = int(input())
tlis = list(map(int, input().split()))
def list_difference(list1, list2):
    result = list1.copy()
    for value in list2:
        if value in result:
            result.remove(value)

    return result
lis = list_difference(tlis, dlis)
if lis:
    print("NO")
else:
    print("YES")

Submission status: Runtime Error

Solution code:
import collections
n=int(input())
d=list(map(int,input().split()))
m=int(input())
t=list(map(int,input().split()))
dd,tt=collections.Counter(d),collections.Counter(t)
for k,v in tt.items():
  h=dd.get(k)>=v
  if h==False or h==None:
    print("NO")
    exit()
print("YES")

Submission status: Runtime Error

Solution code:
import collections
n=int(input())
d=list(map(int,input().split()))
m=int(input())
t=list(map(int,input().split()))
dd,tt=collections.Counter(d),collections.Counter(t)
for k,v in tt.items():
  h=dd.get(k)>=v
  if h==False:
    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()))

count = {}

for i in range(n):
    if d[i] in count.keys():
        count[d[i]] += 1
    else:
        count[d[i]] = 1  

for i in range(m):
    if count[t[i]] == 0:
        print("NO")
        break
    else:
        count[t[i]] -=1
    if i == m-1:
        print("YES")

Submission status: Runtime Error

Solution code:
from collections import Counter
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))
Tcount = Counter(T)
flag = 'YES'
Dcount = Counter(D)
for n,c in Tcount.items():
    if n not in D:
        flag = 'NO'
        break
    if c > D[n]:
        flag = 'NO'
        break
print(flag)

Submission status: Runtime Error

Solution code:
from collections import Counter
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))
Tcount = Counter(T)
flag = 'YES'
Dcount = Counter(D)
for n,c in Tcount.items():
    if c > D[n]:
        flag = 'NO'
        break
print(flag)

Submission status: Runtime Error

Solution code:
import collections
import bisect

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


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

c = collections.Counter(a)
d = collections.Counter(b)

e = []
for i in c.keys():
    e.append(i)

f = []
for i in c.values():
    f.append(i)

for i, j in d.items():
    if i not in e:
        print('NO')
        exit()
    else:
        index = bisect.bisect_left(e, i)
        if f[index] < j:
            print('NO')
            exit()

print('YES')

Submission status: Runtime Error

Solution code:
import collections
import bisect

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


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

c = collections.Counter(a)
d = collections.Counter(b)

e = []
for i in c.keys():
    e.append(i)

f = []
for i in c.values():
    f.append(i)

for i, j in d.items():
    if i not in e:
        print('NO')
        exit()
    else:
        index = bisect.bisect_left(e, i)
        if f[index] < j:
            print('NO')
            exit()

print('YES')

Submission status: Runtime Error

Solution code:
import collections
import bisect

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

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

c = collections.Counter(b)

for i, j in c.items():
    for k in range(j):
        d = bisect.bisect_left(a, i)
        if a[d] == i:
            a.pop(d)
            continue
        else:
            print('NO')
            exit()

print('YES')

Submission status: Runtime Error

Solution code:
import collections
import bisect

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

if n < m:
    print('No')
    exit()

c = collections.Counter(b)

for i, j in c.items():
    for k in range(j):
        d = bisect.bisect_left(a, i)
        if a[d] == i:
            a.pop(d)
            continue
        else:
            print('No')
            exit()

print('Yes')

Submission status: Runtime Error

Solution code:
input()
D = {}
for a in [int(a) for a in input().split()]:
    if a not in D: D[i] = 0
    D[a] += 1

input()
for a in [int(a) for a in input().split()]:
    if a not in D: D[i] = 0
    D[a] -= 1

for a in D:
    if D[a] < 0:
        print("NO")
        break
else:
    print("YES")

Submission status: Runtime Error

Solution code:
input()
D = {}
for a in [int(a) for a in input().split()]:
    if a not in D: D[i] = 0
    D[i] += 1

input()
for a in [int(a) for a in input().split()]:
    if a not in D: D[i] = 0
    D[i] -= 1

for a in D:
    if D[a] < 0:
        print("NO")
        break
else:
    print("YES")

Submission status: Runtime Error

Solution code:
N = int(input())
D = sorted(list(map(int,input().split())))
M = int(input())
T = sorted(list(map(int,input().split())))
cur = 0
flag = 0
for i in range(N):
    if cur<M and D[i]==T[cur]:
        cur += 1
    elif D[i]<T[cur]:
        continue
    else:
        flag = 1
        break
if flag==0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
from collections import Counter, defaultdict

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

memo = defaultdict(int)
for d in D:
    memo[d] += 1

for i in range(m):
    ti = T[i]
    if ti not in memo:
        print("NO")
        exit()
    if memo[ti] == 0:
        print("NO")
        exit()
    memo[ti] -= 1

print("YES")

Submission status: Runtime Error

Solution code:
n = int(input())

x = dict()
for i in input().split():
    x[i] = x.get(i, 0) + 1

m = int(input())

for i in input().split():
    if x[i] == 0 or i not in x:
        print("NO")
        exit()
    else:
        x[i] -= 1
print("YES")

Submission status: Runtime Error

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

flag = 1
for elem in t:
    try:
        x = d.index(elem)
    except ValueError:
        flag = 0
        break
    d.remove(ele_m)

if flag == 0:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

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

j=0
for i in range(len(t)):
  if j==len(s):
    print("NO")
    break
  t[i]==s[j]:
    j+=1
else:
  print("YES")

Submission status: Runtime Error

Solution code:
from collections import Counter

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

d = Counter(D)
t = Counter(T)
for key, value in t.items():
    if d.get(key, 0) < value:
        print('NO')
        exit()
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()

l = [0] * (d[-1] + 1)
for i in d:
    l[i] += 1

for i in t:
    l[i] -= 1

l.sort()
if l[0] >= 0:
    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()))
for i in range(N):
  if D[i] in T:
    T.remove(D[i])
    D.pop(i)
  if len(T)==0:
    break
if len(T)==0:
  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()))
for i in range(N):
  if D[i] in T:
    T.remove(D[i])
    D.pop(i)
    if len(T)==0:
      break
if len(T)==0:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
m=int(input())
b=list(map(int,input().split()))
a.sort()
b.sort()
j=0
for i in range(n):
	if a[i]==b[j]:
		j+=1
if j==m:
	print("YES")
else:
	print("NO")