Buggy python submission (verdict: Time Limit Exceeded):
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:
        d.remove(i)
    else:
        print("NO")
        exit()
print("YES")

Fixed submission:
import collections

n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dc = collections.Counter(d)
tc = collections.Counter(t)
for i in tc:
    if tc[i] > dc[i]:
        print("NO")
        exit()
print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
t_ = list(set(t))
for i in range(len(t_)):
  if t.count(t_[i]) > d.count(t_[i]):
    print("NO")
    exit()
print("YES")


Fixed submission:
import collections

n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dc = collections.Counter(d)
tc = collections.Counter(t)
for i in tc:
    if tc[i] > dc[i]:
        print("NO")
        exit()
print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
t_ = list(set(t))
for i in range(len(t_)):
  if t.count(t_[i]) > d.count(t_[i]):
    print("NO")
    exit()
print("YES")


Fixed submission:
import collections

n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dc = collections.Counter(d)
tc = collections.Counter(t)
for i in tc:
    if tc[i] > dc[i]:
        print("NO")
        exit()
print("YES")

Buggy python submission (verdict: Runtime Error):
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")


Fixed submission:
import collections

n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dc = collections.Counter(d)
tc = collections.Counter(t)
for i in tc:
    if tc[i] > dc[i]:
        print("NO")
        exit()
print("YES")

Buggy python submission (verdict: Runtime Error):
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")


Fixed submission:
import collections

n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dc = collections.Counter(d)
tc = collections.Counter(t)
for i in tc:
    if tc[i] > dc[i]:
        print("NO")
        exit()
print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
for i in range(m):
  if t.count(t[i]) > d.count(t[i]):
    print("NO")
    exit()
print("YES")


Fixed submission:
import collections

n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dc = collections.Counter(d)
tc = collections.Counter(t)
for i in tc:
    if tc[i] > dc[i]:
        print("NO")
        exit()
print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
for i in range(m):
  if t[i] in set(d):
    d.remove(t[i])
  else:
    print("NO")
    exit()
print("YES")


Fixed submission:
import collections

n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dc = collections.Counter(d)
tc = collections.Counter(t)
for i in tc:
    if tc[i] > dc[i]:
        print("NO")
        exit()
print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
for i in range(m):
  if t[i] in d:
    d.remove(t[i])
  else:
    print("NO")
    exit()
print("YES")


Fixed submission:
import collections

n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dc = collections.Counter(d)
tc = collections.Counter(t)
for i in tc:
    if tc[i] > dc[i]:
        print("NO")
        exit()
print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
for i in range(m):
  if t[i] in d:
    d.remove(t[i])
  else:
    print("NO")
    exit()
print("YES")

Fixed submission:
import collections

n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
dc = collections.Counter(d)
tc = collections.Counter(t)
for i in tc:
    if tc[i] > dc[i]:
        print("NO")
        exit()
print("YES")