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: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

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

print("YES")

Submission status: Wrong Answer

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

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

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

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

print("YES")

Submission status: Wrong Answer

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

for i in range(m):
    if t_list[i] in d_list:
        t_list[i] = 0
    else:
        print("NO")
        exit()

print("YES")

Submission status: Wrong Answer

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

for i in range(m):
    if t_list[i] in d_list:
        t_list[i] = 0
    else:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
from os import remove


n = int(input())
d_list = list(map(int, input().split()))
m = int(input())
t_list = list(map(int, input().split()))

for i in range(m):
    if t_list[i] in d_list:
        t_list[i] = 0
    else:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

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

ans="Yes"

for i in cml.keys():
  if i  not in cnl.keys():
    ans="No"
  else:
    if cml[i] > cnl[i]:
      ans="No"
      break
      
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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
        if len(T_keylist)-1 < T_index:
            print("NO")
            sys.exit()
        ans = ans + 1
    else:
        pass


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

Submission status: Wrong Answer

Solution code:
import sys

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

num_dict = {}

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

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

result_list = list(num_dict.values())

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

Submission status: Wrong Answer

Solution code:
import sys
import math
from collections import Counter


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

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

D = Counter(D)

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

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

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
NNN = map(int,input().split())
NN = list(NNN)
M = int(input())
MMM = map(int,input().split())
MM = list(MMM)
list1 =[]
for i in MM:
  for j in range(len(NN)):
    if i == NN[j] and j not in list1:
      list1.append(j)
if len(list1) == len(MM):
  print('YES')
else:
  print('NO')

Submission status: Wrong Answer

Solution code:
from collections import *
n=int(input())
d=list(map(int,input().split()))
d.sort()
d=deque(d)
m=int(input())
t=list(map(int,input().split()))
t.sort()
t=deque(t)
dd=d.popleft()
tt=t.popleft()
while d and t:
    if tt==dd:
        if len(t)==0:
            print("YES")
            exit()
        if len(d)==0:
            print("NO")
            exit()
        tt=t.popleft()
        dd=d.popleft()
    elif tt!=dd:
        if len(d)==0:
            print("NO")
            exit()
        dd=d.popleft()

Submission status: Wrong Answer

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

cd = collections.Counter(d)
ct = collections.Counter(t)

flg = True
for k in ct.items():
  if k[1] >= cd[k[0]]:
    flg = False

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

Submission status: Wrong Answer

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 index < len(d):
    if t[i] == d[index]:
      del d[index]
  else:
    flg = False
    break
 
print('YES' if flg else 'NO')

Submission status: Wrong Answer

Solution code:
import bisect

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

t_max = max(t)
flg = True

for i in range(m):
  if t_max > d[-1]:
    flg = False
    break
  else:
    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: Wrong Answer

Solution code:
# 15
from collections import Counter
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
d = LI()
m = I()
t = LI()
d.sort()
t.sort()
c_t = Counter(t)
c_d = Counter(d)
# print(c_t.items())
# print(c_d.items())
ans = 'YES'
i = 0
c_d = dict([(k, v) for k, v in c_d.items() if k in c_t.keys()])
# print(c_d.items())
for (k_t, v_t), (k_d, v_d) in zip(c_t.items(), c_d.items()):
    if k_t != k_d or v_t > v_d:
        ans = 'NO'
        break
print(ans)

Submission status: Wrong Answer

Solution code:
#B - Problem Set

# -*- coding: utf-8 -*-
from collections import Counter

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

D_count = Counter(D)
T_count = Counter(T)

for t_key, t_val in T_count.items():
    if(t_key in D_count):
        if(t_val > D_count[t_key]):
            print("NO") 
            break
    else:
        print("NO")
        break

print("YES")

Submission status: Wrong Answer

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

for t in T:
    if t not in D:
        print("N0")
        exit()
    else:
        D.remove(t)
print("YES")

Submission status: Wrong Answer

Solution code:
n=int(input())
d=set(map(int,input().split()))
m=int(input())
t=set(map(int,input().split()))
print('YES' if t<=d else 'NO')

Submission status: Wrong Answer

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

count_d = Counter(d)
count_t = Counter(t)

for i in count_t.items():
  if i[0] not in count_d:
    print("NO")
    exit()
  if i[0] in count_d: count_d[i[0]] -= i[1]
else:
  for x in count_d.values():
    if x < 0:
      print("NO")
      exit()
  print("Yes")

Submission status: Wrong Answer

Solution code:
import collections

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

    cD = dict(collections.Counter(D))
    cT = dict(collections.Counter(T))

    for k, v in cT.items():
        if k not in cD:
            print("Yes")
            exit()
        else:
            if v > cD[k]:
                print("Yes")
                exit()

    print("No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import collections

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

    cD = dict(collections.Counter(D))
    cT = dict(collections.Counter(T))

    for k, v in cT.items():
        if k not in cD:
            print("No")
            exit()
        else:
            if v > cD[k]:
                print("No")
                exit()

    print("Yes")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import collections

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

    cD = collections.Counter(D)
    cT = collections.Counter(T)

    for k, v in cT.items():
        if k not in cD:
            print("No")
            exit()
        else:
            if v > cD[k]:
                print("No")
                exit()

    print("Yes")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

t.sort()
j = 0
i = 0
flag = 1
if n<m:
  print('NO')
else:
  while True:
    if i == m:
      break
    if j == n:
      flag = 0
      break
    if t[i]>d[j]:
      j+=1
    elif t[i]<d[j]:
      flag = 0
      break
    else:
      i += 1
      j += 1

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

Submission status: Wrong Answer

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

t.sort()
j = 0
i = 0
flag = 1
if n<m:
  print('NO')
else:
  while True:
    if i == m:
      break
    if t[i]>d[j]:
      j+=1
    elif t[i]<d[j]:
      flag = 0
      break
    else:
      i += 1
      j += 1

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

Submission status: Wrong Answer

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

# In[7]:


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


# In[8]:


for i,t in enumerate(T):
    if t in D:
        D.pop(D.index(t))
    else:
        print("No")
        break
else:
    print("Yes")


# In[ ]:

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N = k()
D = l()
M = k()
T = l()

d = Counter(D)
t = Counter(T)
for i in t.values():
    if i in d:
        if t[i] <= d[i]:
            pass
        else:
            print("NO")
            sys.exit()
    else:
        print("NO")
        sys.exit()

print("YES")

Submission status: Wrong Answer

Solution code:
import math
import collections
import fractions
import itertools

def solve():
    n = int(input())
    d = list(map(int, input().split()))
    m = int(input())
    t = list(map(int, input().split()))
    t = collections.Counter(t)
    for i in t:
        if t[i] > d.count(i):
            print("NO")
    else:
        print("YES")
    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
import math
import collections
import fractions
import itertools

def solve():
    n = int(input())
    d = list(map(int, input().split()))
    m = int(input())
    t = list(map(int, input().split()))
    t = collections.Counter(t)
    for i in t:
        if t[i] > d.count(i):
            print("YES")
    else:
        print("NO")
    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
n=int(input())
d=sorted(list(map(int,input().split())))
m=int(input())
t=sorted(list(map(int,input().split())))
j=0
if d[0]>t[0]:
  import sys
  sys.exit()
for i in range(m):
  while d[j]<t[i]:
    j+=1
  if d[j]>t[i]:
    print("NO")
    break
  j+=1
else:
  print("YES")

Submission status: Wrong Answer

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

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

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

for i, c in Tc.items():
    if (Dc[i] < c):
        print('No')
        exit()
    else:
        continue

print('Yes')

Submission status: Wrong Answer

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

d = collections.Counter(d)
t = collections.Counter(t)
ans = "YES"
for i in d.keys():
    if d[i] < t[i]:
        ans = "NO"
        print(ans)
        exit()
print(ans)

Submission status: Wrong Answer

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

d2 = collections.Counter(d)
t2 = collections.Counter(t)
ans = "YES"
for i in d2.keys():
    if t2[i] < d2[i]:
        ans = "NO"
        print(ans)
        exit()
print(ans)

Submission status: Wrong Answer

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

d = collections.Counter(d)
t = collections.Counter(t)
ans = "YES"
for i in d.keys():
    if t[i] < d[i]:
        ans = "NO"
        print(ans)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
import math
import sys
import collections 
N=int(input())
D = list(map(int, input().split()))
M=int(input())
T = list(map(int, input().split()))
new_D=sorted(D)
new_T=sorted(T)
a=collections.Counter(new_D)
b=collections.Counter(new_T)
#print(a[10])
#print(new_D[0])
for i in range(1,200001):
    if a[i]<b[i]:
        print("NO")
        sys.exit()
    
    
print("YES")

Submission status: Wrong Answer

Solution code:
import math
import sys
import collections 
N=int(input())
D = list(map(int, input().split()))
M=int(input())
T = list(map(int, input().split()))
new_D=sorted(D)
new_T=sorted(T)
a=collections.Counter(new_D)
b=collections.Counter(new_T)
#print(new_D[0])
for i in range(1,200000):
    if a[i]<b[i]:
        print("NO")
        sys.exit()
    
    
print("YES")

Submission status: Wrong Answer

Solution code:
import math
import sys
N=int(input())
D = list(map(int, input().split()))
M=int(input())
T = list(map(int, input().split()))
new_D=sorted(D)
new_T=sorted(T)
#print(new_D[0])
for i in range(1,200000):
    if new_D.count(i)<new_T.count(i):
        print("NO")
        sys.exit()
    
    
print("YES")

Submission status: Wrong Answer

Solution code:
n=int(input())
d=list(map(int,input().split()))
m=int(input())
t=list(map(int,input().split()))
d.sort()
t.sort()
for i in range(len(d)-len(t)+1):
    if t==d[i:i+len(t)+1]:
        print("YES")
        exit()

print("NO")

Submission status: Wrong Answer

Solution code:
from collections import Counter
N=int(input())
d=list(map(int,input().split()))
D=Counter(d)
M=int(input())
t=list(map(int,input().split()))
T=Counter(t)
for key in T.keys():
    if D[key]<T[key]:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
from collections import Counter
N=int(input())
d=list(map(int,input().split()))
D=Counter(d)
M=int(input())
t=list(map(int,input().split()))
T=Counter(t)
for key,value in T.items():
    if D[key]<value or key not in D.keys():
        print("No")
        exit()
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
from collections import Counter
N=int(input())
d=list(map(int,input().split()))
D=Counter(d)
M=int(input())
t=list(map(int,input().split()))
T=Counter(t)
for key,value in T.items():
    if D[key]<value:
        print("No")
        exit()
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
from collections import Counter
N=int(input())
D=list(map(int,input().split()))
D=Counter(D)
M=int(input())
T=list(map(int,input().split()))
T=Counter(T)
for key,value in T.items():
    if D[key]<value:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
D=list(map(int, input().split()))
M=int(input())
T=list(map(int, input().split()))
import bisect
D=sorted(D)
for i in range(M):
    t=T[i]
    idx=bisect.bisect_right(D, t)
    #print(D)
    if D[idx-1]==t:
        D.pop(idx-1)
    else:
        #print("NO")
        exit()
print("YES")

Submission status: Wrong Answer

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)
for i in range(M):
    if T[i] in d:
        d[T[i]]-=1
    else:
        print('NO')
        exit()
print('YES')

Submission status: Wrong Answer

Solution code:
import collections

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

if M > N :
    print("No")

# print(D)
for i in range(M):
    # print(D[T[i]])
    if D[T[i]] == 0:
        print("NO")
        exit()
    D[T[i]] -= 1
    # print(D[T[i]])
    
print("YES")

Submission status: Wrong Answer

Solution code:
import collections

def main():
    N = int(input())
    D = list(map(int, input().split()))
    M = int(input())
    T = list(map(int, input().split()))
    Dcounter = collections.Counter(D)
    Tcounter = collections.Counter(T)
    for t in T:
        if Dcounter[t] - Tcounter[t] < 0:
            print('No')
            return
    print('Yes')

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
D=list(map(int,input().split()))
M=int(input())
T=list(map(int,input().split()))
d,t={},{}
for key in D:
    if key in d:
        d[key]+=1
    else:
        d[key]=1
for key in T:
    if key in t:
        t[key]+=1
    else:
        t[key]=1
flag=True
for key in list(set(T)):
    if key in d and t[key]>d[key]:
        flag=False
print("YES" if flag else "NO")

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    ddic = {}
    tlis = []
    dlis = list(map(int, input().split()))
    m = int(input())
    tlis = list(map(int, input().split()))
    for d in dlis:
        if d in ddic:
            ddic[d] += 1
        else:
            ddic[d] = 0
    for t in tlis:
        if t in ddic:
            #print(t,tlis, dlis)
            ddic[t] -= 1
        else:
            #print(t,tlis, dlis)
            print("NO")
            exit()
    print("YES")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n = int(input())
    dlis = []
    tlis = []
    dlis = list(map(int, input().split()))
    m = int(input())
    tlis = list(map(int, input().split()))
    dlis.sort()
    for t in tlis:
        if t in dlis:
            #print(t,tlis, dlis)
            dlis.remove(t)
        else:
            #print(t,tlis, dlis)
            print("No")
            exit()
    print("Yes")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

if M == len(set(D).intersection(set(T))):
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
n = int(input())
d = input().split()
m = int(input())
t = input().split()
dic = {}

for a in range(n):
  if d[a] not in dic:
    dic[d[a]] = 1
  else:
    dic[d[a]] += 1

con = 0

for b in range(m):
  if t[b] not in dic or dic[t[b]] == 0:
    print("No")
    break
  elif t[b] in dic:
    dic[t[b]] -= 1
    con += 1

if con == m:
  print("YES")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N = int(input())
D = list(map(int, input().split()))
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: Wrong Answer

Solution code:
from collections import defaultdict

N = int(input())
D = list(map(int, input().split()))
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: Wrong Answer

Solution code:
N = int(input())
D = list(map(int, input().split(" ")))
M = int(input())
T = list(map(int, input().split(" ")))
count = 0
if N >= M:
    for i in range(0,M):
        if T[i] in D:
            count += 1
        if count == M:
            break

if count == M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# CODE FESTIVAL 2017 予選 B: B – Problem Set
N = int(input())
D = [int(s) for s in input().split()]
M = int(input())
T = [int(s) for s in input().split()]

canDo = 'Yes'

for t in T:
    if t not in D:
        canDo = 'No'
        break
    else:
        D[D.index(t)] = 0

print(canDo)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dd = Counter(d)
tt = Counter(t)
print(dd, tt)
ok = True
for i, j in tt.items():
    if i in dd:
        # print('Y')
        if dd[i] < j:
            ok = False
    else:
        ok = False
    # print(i, j, ok)

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

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

dc = Counter(dl)
tc = Counter(tl)

for k in tc:
    if dc[k]<tc[k]:
        print("No")
        exit()
print("YES")

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

c1 = Counter(D)
c2 = Counter(T)

for t in c2.keys():
    if c2[t] > c1[t]:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
from collections import Counter 

N=int(input())
C = Counter(list(map(int,input().split())))
M = Counter(list(map(int,input().split())))
for key in M.keys():
  if C[key]<M[key]:
    print("NO")
    break
else:
  print("YES")

Submission status: Wrong Answer

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

ans = 'YES'
for t in T:
  if t in set_d:
    pass
  else:
    ans = 'NO'
    
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
d = [int(i) for i in input().split()] # 配列で数字

m = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
t = [int(i) for i in input().split()]

def bs(nums, target):
    l = 0
    r = len(nums) - 1
    while l <= r:
        mid = (l + r) // 2
        if nums[mid] == target:
            return mid
        elif nums[mid] > target:
            r = mid - 1
        else:
            l = mid + 1
    return -1

if n < m:
    print('NO')
else:
    d.sort()
    done = set()
    for p in t:
        r = bs(d, p)
        if r == -1 and r not in done:
            print('NO')
            break
        else:
            done.add(r)
    else:
        print('YES')

Submission status: Wrong Answer

Solution code:
N = int(input())
D = sorted(list(map(int,input().split())))
M = int(input())
T = sorted(list(map(int,input().split())))
for i,x in enumerate(T[::-1]):
    while len(D):
        temp = D.pop()
        if temp==x:
            break
    if i!=M-1 and len(D)==0:
        print('NO')
        break
else:
    print('YES')

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
D = collections.Counter(list(map(int,input().split())))
M = int(input())
T = collections.Counter(list(map(int,input().split())))
for x in T:
    if D[x]<T[x]:
        print('NO')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
D = sorted(list(map(int,input().split())))
M = int(input())
T = sorted(list(map(int,input().split())))
for x in T[::-1]:
    while len(D):
        temp = D.pop()
        if temp==x:
            break
    if len(D)==0:
        print('NO')
        break 
else:
    print('YES')

Submission status: Wrong Answer

Solution code:
from collections import Counter as c
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
flag = True
d_c = c(d)
t_c = c(t)
if n<m: flag = False
else: 
    for i,j in t_c.items():
        if d_c[i] < j:
            flag = False
            break
print('Yes' if flag else 'No')

Submission status: Wrong Answer

Solution code:
n = int(input())
*D, = map(int, input().split())
m = int(input())
*T, = map(int, input().split())
D = set(D)
T = set(T)
if all([t in D for t in T]):
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
d = [int(i) for i in input().split()]
m = int(input())
t = [int(i) for i in input().split()]
d_ans = dict(Counter(d))
t_ans = dict(Counter(t))
flag = True
for i in t_ans:
    if t_ans[i] not in d_ans:
        flag = False
        
    else:
        if t_ans[i] > d_ans[i]:
            flag = False
print('YES' if flag==True else 'NO')

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

def Topo_sort(x,y):
    co = cl.Counter(n for m in x.values() for n in m)
    S = cl.deque([i for i in range(y) if co[i] == 0])
    while S:
        n = S.popleft()
        yield n
        for i in x[n]:
            co[i] -= 1
            if co[i] <= 0:
                S.append(i)
    
    """
    if sum(co.values()) != 0:
        print(1)
        exit()
    else:
        print(0)
        exit()
    """
    #閉路検出(1が存在,0が存在しない)
# g = cl.dafaultdict(set)に有向グラフを作成し(g[~] != ~ ,yはノード数) リストが帰ってくる
n = onem()

d = l()


po = cl.defaultdict(int)

for i in range(n):
    po[str(d[i])] += 1

M = onem()

t = l()

for i in range(M):
    if po[str(t[i])]:
        po[str(t[i])] -= 1
    else:
        print("No")
        break
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n = II()
    d = LI()
    m = II()
    t = LI()
    d.sort()
    t.sort()
    i = 0
    for j in range(m):
        if i >= n:
            print("NO")
            return
        if d[i] == t[j]:
            i += 1
        elif d[i] > t[j]:
            print("NO")
            return
    print("YES")
    return


#main
if __name__ == '__main__':
    solve()