Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
ln = list(map(int, input().split()))
m = int(input())
lm = list(map(int, input().split()))

c = collections.Counter(lm)

for i in c.keys():
    if ln.count(i) < c[i]:
        print("NO")
        exit()

print("YES")

Fixed submission:
import sys
from collections import Counter
 
N = int(input())
s1 = list(map(int,input().split()))
M = int(input())
s2 = list(map(int,input().split()))
 
c1 = Counter(s1)
c2 = Counter(s2)
 
for k,v in c2.items():
    if k in c1:
        if v > c1[k]:
            print('NO')
            sys.exit()
    else:
        print('NO')
        sys.exit()
print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
ln = list(map(int, input().split()))
m = int(input())
lm = list(map(int, input().split()))

c = collections.Counter(lm)

for i in c.keys():
    if ln.count(i) < c[i]:
        print("NO")
        exit()

print("YES")

Fixed submission:
import sys
from collections import Counter
 
N = int(input())
s1 = list(map(int,input().split()))
M = int(input())
s2 = list(map(int,input().split()))
 
c1 = Counter(s1)
c2 = Counter(s2)
 
for k,v in c2.items():
    if k in c1:
        if v > c1[k]:
            print('NO')
            sys.exit()
    else:
        print('NO')
        sys.exit()
print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
ln = list(map(int, input().split()))
m = int(input())
lm = list(map(int, input().split()))

c = collections.Counter(lm)

for i in range(len(c)):
    if ln.count(list(c.keys())[i]) < c[list(c.keys())[i]]:
        print("NO")
        exit()

print("YES")

Fixed submission:
import sys
from collections import Counter
 
N = int(input())
s1 = list(map(int,input().split()))
M = int(input())
s2 = list(map(int,input().split()))
 
c1 = Counter(s1)
c2 = Counter(s2)
 
for k,v in c2.items():
    if k in c1:
        if v > c1[k]:
            print('NO')
            sys.exit()
    else:
        print('NO')
        sys.exit()
print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ln = sorted(list(map(int, input().split())))
m = int(input())
lm = sorted(list(map(int, input().split())))

for i in range(m):
    j = 0
    for j in range(n):
        if lm[i] == ln[j]:
            del ln[j]
            n -= 1
            break
        elif lm[i] < ln[j] or lm[i] > ln[n-1]:
            print("NO")
            exit()

print("YES")

Fixed submission:
import sys
from collections import Counter
 
N = int(input())
s1 = list(map(int,input().split()))
M = int(input())
s2 = list(map(int,input().split()))
 
c1 = Counter(s1)
c2 = Counter(s2)
 
for k,v in c2.items():
    if k in c1:
        if v > c1[k]:
            print('NO')
            sys.exit()
    else:
        print('NO')
        sys.exit()
print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ln = list(map(int, input().split()))
m = int(input())
lm = list(map(int, input().split()))

for i in range(m):
    if lm[i] in ln:
        ln.remove(lm[i])
    else:
        print("NO")
        exit()

print("YES")

Fixed submission:
import sys
from collections import Counter
 
N = int(input())
s1 = list(map(int,input().split()))
M = int(input())
s2 = list(map(int,input().split()))
 
c1 = Counter(s1)
c2 = Counter(s2)
 
for k,v in c2.items():
    if k in c1:
        if v > c1[k]:
            print('NO')
            sys.exit()
    else:
        print('NO')
        sys.exit()
print('YES')