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

d.sort()

t.sort()

index = 0

for i in t:
    flag = True
    while index < len(d):
        if i == d[index]:
            d.pop(index)
            flag = False
            break
        else:
            index += 1
    if flag:
        print('NO')
        exit()

print('YES')
           

Fixed submission:
from collections import Counter
 
N = int(input())
D = list(input().split())
 
M = int(input())
T = list(input().split())
 
D_count = Counter(D)
T_count = Counter(T)

for k, v in T_count.items():
    if D_count[k] < v:
        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()))

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

Fixed submission:
from collections import Counter
 
N = int(input())
D = list(input().split())
 
M = int(input())
T = list(input().split())
 
D_count = Counter(D)
T_count = Counter(T)

for k, v in T_count.items():
    if D_count[k] < v:
        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()))

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

Fixed submission:
from collections import Counter
 
N = int(input())
D = list(input().split())
 
M = int(input())
T = list(input().split())
 
D_count = Counter(D)
T_count = Counter(T)

for k, v in T_count.items():
    if D_count[k] < v:
        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()))

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

Fixed submission:
from collections import Counter
 
N = int(input())
D = list(input().split())
 
M = int(input())
T = list(input().split())
 
D_count = Counter(D)
T_count = Counter(T)

for k, v in T_count.items():
    if D_count[k] < v:
        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()))

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

Fixed submission:
from collections import Counter
 
N = int(input())
D = list(input().split())
 
M = int(input())
T = list(input().split())
 
D_count = Counter(D)
T_count = Counter(T)

for k, v in T_count.items():
    if D_count[k] < v:
        print('NO')
        exit()
 
print('YES')