Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, K, S = list(map(int, input().split()))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

for i in range(S + 1, 10**6):
    if gcd(S, i) == 1:
        p = gcd(S, i)
        break

ans = []
ans.extend([S for _ in range(K)])
ans.extend([p for _ in range(N-K)])
print(ans)

Fixed submission:
N, K, S = list(map(int, input().split()))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

for i in range(2, 10**6):
    if gcd(S, i) == 1:
        break

ans = []
ans.extend([S for _ in range(K)])
ans.extend([i for _ in range(N-K)])

ans_str = ""
for j in range(len(ans)):
    ans_str += str(ans[j])
    ans_str += " "
ans_str = ans_str[:len(ans_str) - 1]
print(ans_str)
Buggy python submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
print(lcm(a,b))

Fixed submission:
import fractions

a, b = map(int, input().split())

def lcm(x, y):
    return (x * y)//fractions.gcd(x, y)

print(lcm(a,b))
Buggy python submission (verdict: Runtime Error):
# 最大値を見つけ、それを２で割るをチケットがなくなるまで繰り返す
# 普通にやると、最大値の選定でO(n)、それをチケット数分だけ繰り返すのでO(n*m)。
# 間に合わないので、優先度付きキューを用いる
import math

n, m = map(int, input().split())
a = [0] * n
a = list(map(int, input().split()))

a = list(map(lambda x: x*(-1), a))
heapq.heapify(a)
for _ in range(m):
    tmp = heapq.heappop(a) * (-1)
    tmp = math.floor(tmp / 2) * (-1)
    heapq.heappush(a, tmp)

print(sum(list(map(lambda x: x*(-1), a))))

Fixed submission:
# 最大値を見つけ、それを２で割るをチケットがなくなるまで繰り返す
# 普通にやると、最大値の選定でO(n)、それをチケット数分だけ繰り返すのでO(n*m)。
# 間に合わないので、優先度付きキューを用いる
import math
import heapq

n, m = map(int, input().split())
a = [0] * n
a = list(map(int, input().split()))

a = list(map(lambda x: x*(-1), a))
heapq.heapify(a)
for _ in range(m):
    tmp = heapq.heappop(a) * (-1)
    tmp = math.floor(tmp / 2) * (-1)
    heapq.heappush(a, tmp)

print(sum(list(map(lambda x: x*(-1), a))))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import copy

H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]
d = [(1, 0), (0, 1), (-1, 0), (0, -1)]
que = deque([(i, j) for i in range(H) for j in range(W) if a[i][j] == '#'])
count = 0

flag_all = False

while True:
	count += 1

	que_next = deque()
	while que:
		i, j = que.popleft()
		for k in range(4):
			dx, dy = d[k][0], d[k][1]
			x = i + dx
			y = j + dy
			if x >= 0 and x < H and y >= 0 and y < W and a[x][y] != '#':
				a[x][y] = '#'
				que_next.append((x, y))

	que = copy.copy(que_next)

	if que:
		que = copy.copy(que_next)
	else:
		break
print(count-1)


Fixed submission:
from collections import deque
import copy

H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]
d = [(1, 0), (0, 1), (-1, 0), (0, -1)]
que = deque([(i, j) for i in range(H) for j in range(W) if a[i][j] == '#'])
count = 0

flag_all = False

while True:
	count += 1

	que_next = deque()
	while que:
		i, j = que.popleft()
		for k in range(4):
			dx, dy = d[k][0], d[k][1]
			x = i + dx
			y = j + dy
			if x >= 0 and x < H and y >= 0 and y < W and a[x][y] != '#':
				a[x][y] = '#'
				que_next.append((x, y))

	que = copy.copy(que_next)

	if que:
		que = copy.copy(que_next)
	else:
		break
print(count-1)

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

H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]
d = [(1, 0), (0, 1), (-1, 0), (0, -1)]
que = deque([(i, j) for i in range(H) for j in range(W) if a[i][j] == '#'])
count = 0

flag_all = False

while True:
	count += 1

	que_next = deque()
	while que:
		i, j = que.popleft()
		for k in range(4):
			dx, dy = d[k][0], d[k][1]
			x = i + dx
			y = j + dy
			if x >= 0 and x < H and y >= 0 and y < W and a[x][y] != '#':
				a[x][y] = '#'
				que_next.append((x, y))

	que = copy.copy(que_next)

	if not que:
		break
print(count-1)


Fixed submission:
from collections import deque
import copy

H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]
d = [(1, 0), (0, 1), (-1, 0), (0, -1)]
que = deque([(i, j) for i in range(H) for j in range(W) if a[i][j] == '#'])
count = 0

flag_all = False

while True:
	count += 1

	que_next = deque()
	while que:
		i, j = que.popleft()
		for k in range(4):
			dx, dy = d[k][0], d[k][1]
			x = i + dx
			y = j + dy
			if x >= 0 and x < H and y >= 0 and y < W and a[x][y] != '#':
				a[x][y] = '#'
				que_next.append((x, y))

	que = copy.copy(que_next)

	if que:
		que = copy.copy(que_next)
	else:
		break
print(count-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
h = list(map(int, input().split(" ")))

dp = [1000000 for i in range(N+10)]
dp[1] = 0

for i in range(1, N-1):
    dp[i + 1] = min(dp[i + 1], abs(h[i + 1] - h[i]) + dp[i])
    dp[i + 2] = min(dp[i + 2], abs(h[i + 2] - h[i]) + dp[i])

print(dp[N])

Fixed submission:
# dp[i]: i+1にくるまでにかかったコストの最小値
N = int(input())
h = list(map(int, input().split()))
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N-1):
    dp[i+1] = min(dp[i+1], dp[i]+abs(h[i]-h[i+1]))
    if i < N-2:
        dp[i+2] = min(dp[i+2], dp[i]+abs(h[i]-h[i+2]))
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
import numpy as np
# dp[i][j]: i+1日目に活動jをしたときのi+1日目までの幸福度の最大値
N = int(input())
abc = []
for i in range(N):
    abc.append(list(map(int, input().split())))
dp = np.zeros(shape=(N, 3), dtype=int)
dp[0, :] = abc[0]
for i in range(N-1):
    dp[i+1, 0] = max(dp[i+1, 0], dp[i, 1] + abc[i+1][0], dp[i, 2] + abc[i+1][0])
    dp[i+1, 1] = max(dp[i+1, 1], dp[i, 0] + abc[i+1][1], dp[i, 2] + abc[i+1][1])
    dp[i+1, 2] = max(dp[i+1, 2], dp[i, 0] + abc[i+1][2], dp[i, 1] + abc[i+1][2])
print(max(dp[N-1, :]))

Fixed submission:
import numpy as np
N = int(input())
abc = []
for i in range(N):
    abc.append(list(map(int, input().split())))
    
dp = np.zeros(shape=(N, 3), dtype=int)
dp[0, :] = abc[0]
for i in range(N-1):
    dp[i+1, 0] = max(dp[i+1, 0], dp[i, 1] + abc[i+1][0], dp[i, 2] + abc[i+1][0])
    dp[i+1, 1] = max(dp[i+1, 1], dp[i, 0] + abc[i+1][1], dp[i, 2] + abc[i+1][1])
    dp[i+1, 2] = max(dp[i+1, 2], dp[i, 0] + abc[i+1][2], dp[i, 1] + abc[i+1][2])
print(max(dp[N-1, :]))
Buggy python submission (verdict: Runtime Error):
import numpy as np
# dp[i][j]: i+1個目までの品物で重量の総和がj以下である時の価値の最大値

N, W = map(int, input().split())
w, v = [], []
for _ in range(N):
    tmp = list(map(int, input().split()))
    w.append(tmp[0])
    v.append(tmp[1])
    
dp = np.zeros(shape=(N+1, W+1), dtype=int)
for i in range(N):
    for j in range(W+1):
        if w[i] <= j:
            dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
        else:
            #dp[i+1][j] = max(dp[i][j], dp[i+1][j])
            dp[i+1][j] = dp[i][j]
print(dp[N][W])

Fixed submission:
# pypyはnumpyが使えないみたい
#import numpy as np
# dp[i][j]: i+1個目までの品物で重量の総和がj以下である時の価値の最大値

N, W = map(int, input().split())
w, v = [], []
for _ in range(N):
    tmp = list(map(int, input().split()))
    w.append(tmp[0])
    v.append(tmp[1])
    
dp = [[0 for _ in range(W+1)] for _ in range(N+1)]
for i in range(N):
    for j in range(W+1):
        if w[i] <= j:
            dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
        else:
            #dp[i+1][j] = max(dp[i][j], dp[i+1][j])
            dp[i+1][j] = dp[i][j]
print(dp[N][W])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
# dp[i][j]: i+1個目までの品物で重量の総和がj以下である時の価値の最大値

N, W = map(int, input().split())
w, v = [], []
for _ in range(N):
    tmp = list(map(int, input().split()))
    w.append(tmp[0])
    v.append(tmp[1])
    
dp = np.zeros(shape=(N+1, W+1), dtype=int)
for i in range(N):
    for j in range(W+1):
        if w[i] <= j:
            dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
        else:
            #dp[i+1][j] = max(dp[i][j], dp[i+1][j])
            dp[i+1][j] = dp[i][j]
print(dp[N][W])

Fixed submission:
# pypyはnumpyが使えないみたい
#import numpy as np
# dp[i][j]: i+1個目までの品物で重量の総和がj以下である時の価値の最大値

N, W = map(int, input().split())
w, v = [], []
for _ in range(N):
    tmp = list(map(int, input().split()))
    w.append(tmp[0])
    v.append(tmp[1])
    
dp = [[0 for _ in range(W+1)] for _ in range(N+1)]
for i in range(N):
    for j in range(W+1):
        if w[i] <= j:
            dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
        else:
            #dp[i+1][j] = max(dp[i][j], dp[i+1][j])
            dp[i+1][j] = dp[i][j]
print(dp[N][W])
Buggy python submission (verdict: Runtime Error):
# dp[i][j]: i+1個の品物から価値がj以上になるように選んだときの重量の最小値

dp[0][0] = 0
for i in range(N):
    for j in range(V+1):
        if j - v[i] >= 0:
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i])
        else:
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])

# dp[N][j]がW以下であるときのｊの最大値
ans = []
for j in range(V+1):
    if dp[N][j] <= W:
        ans.append(j)
print(max(ans))

Fixed submission:
# dp[i][j]: i+1個の品物から価値がj以上になるように選んだときの重量の最小値
N, W = map(int, input().split())
w, v = [], []
for _ in range(N):
    tmp = list(map(int, input().split()))
    w.append(tmp[0])
    v.append(tmp[1])
V = sum(v)
dp = [[float("inf") for _ in range(V+1)] for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
    for j in range(V+1):
        if j - v[i] >= 0:
            dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i])
        else:
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])

# dp[N][j]がW以下であるときのｊの最大値
ans = []
for j in range(V+1):
    if dp[N][j] <= W:
        ans.append(j)
print(max(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
    
a.sort()
flag=False
ans = 0
i = 0
while i <= len(a) - 1:
    if a[i] != a[i+1]:
        ans += 1
        i += 1
        flag=True
    else:
        i += 2
        flag=False

if flag:
    ans += 1
print(ans)

Fixed submission:
d={}
for _ in[0]*int(input()):
    i=input()
    d[i]=d.get(i,0)^1
print(sum(d.values()))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

A = []
for i in range(N):
    tmp = input()
    A.append([0 if s=="." else 1 for s in tmp])
B = []
for i in range(M):
    tmp = input()
    B.append([0 if s=="." else 1 for s in tmp])
    
A = np.array(A)
B = np.array(B)

def is_match(a, b):
    return (a==b).all()
flag = False
for i in range(N):
    for j in range(N):
        x_left = i
        x_right = i + M
        y_up = j
        y_under = j + M
        if x_right >= N or y_under >= N:
            continue
        if is_match(B, A[x_left:x_right, y_up:y_under]):
            flag = True
if flag:
    print("Yes")
else:
    print("No")

Fixed submission:
import numpy as np
N, M = map(int, input().split())

A = []
for i in range(N):
    tmp = input()
    A.append([0 if s=="." else 1 for s in tmp])
B = []
for i in range(M):
    tmp = input()
    B.append([0 if s=="." else 1 for s in tmp])
    
A = np.array(A)
B = np.array(B)

def is_match(a, b):
    return (a==b).all()
flag = False
for i in range(N):
    for j in range(N):
        x_left = i
        x_right = i + M
        y_up = j
        y_under = j + M
        if x_right > N or y_under > N:
            continue
        if is_match(B, A[x_left:x_right, y_up:y_under]):
            flag = True
if flag:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
print(A)
# 全探索で間に合う？
def is_match(a, b):
    return (a==b).all()
flag = False
for i in range(N):
    for j in range(N):
        x_left = i
        x_right = i + M
        y_up = j
        y_under = j + M
        if x_right >= N or y_under >= N:
            continue
        if is_match(B, A[x_left:x_right, y_up:y_under]):
            flag = True
if flag:
    print("Yes")
else:
    print("No")

Fixed submission:
import numpy as np
N, M = map(int, input().split())

A = []
for i in range(N):
    tmp = input()
    A.append([0 if s=="." else 1 for s in tmp])
B = []
for i in range(M):
    tmp = input()
    B.append([0 if s=="." else 1 for s in tmp])
    
A = np.array(A)
B = np.array(B)

def is_match(a, b):
    return (a==b).all()
flag = False
for i in range(N):
    for j in range(N):
        x_left = i
        x_right = i + M
        y_up = j
        y_under = j + M
        if x_right > N or y_under > N:
            continue
        if is_match(B, A[x_left:x_right, y_up:y_under]):
            flag = True
if flag:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
A,B=map(int, input().split())
print(ceil((B-1)/(A-1)))

Fixed submission:
import math
A,B=map(int, input().split())
print(math.ceil((B-1)/(A-1)))

Buggy python submission (verdict: Runtime Error):
inputs = input()
a, b = int(inputs.split(' '))
a * n - (n - 1) >= b
print(int((b + 1) / (a -1))


Fixed submission:
from math import ceil

inputs = input()
a = int(inputs.split(" ")[0])
b = int(inputs.split(" ")[1])
print(ceil((b - 1) / (a - 1)))
Buggy python submission (verdict: Runtime Error):
from math import ceil
a, b = map(float, input().split(' '))
return ceil(a + b / 2)

Fixed submission:
from math import ceil

a, b = map(float, input().split())
print(ceil((a + b) / 2))
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import Fraction
import math

n,m = [int(x) for x in input().split()]
tle = m
ac = n-m

p_ok = Fraction(1, 2)**tle
p_ng = 1 - p_ok

time = 0
p_sum = 0

i = 1
while True:
    p = (p_ng**(i-1))*p_ok
    time += i*(100*ac+1900*tle)*p
    p_sum += p
    if 1-p_sum < 0.000000000001:
        break
    i += 1

print(math.ceil(time))


Fixed submission:
from fractions import Fraction
import math

n,m = [int(x) for x in input().split()]
tle = m
ac = n-m

p_ok = Fraction(1, 2)**tle
p_ng = 1 - p_ok

time = 0
p_sum = 0

i = 1
while True:
    p = (p_ng**(i-1))*p_ok
    time += i*(100*ac+1900*tle)*p
    p_sum += p
    if 1-p_sum < 0.00000001:
        break
    i += 1

print(math.ceil(time))
Buggy python submission (verdict: Runtime Error):
N = int(input())

X = list(map(int, input().split()))
ans = 10**18
for i in range(1, 101):
    temp=0
    for num in X:
        temp += (i-num)**2
    ans = min(ans, tmp)
print(ans)

Fixed submission:
n=int(input())
arr=list(map(int,input().split()))
ans=10**18 #最小値を求めるので初期化しておく
for i in range(1,101): #1<=P<=100の範囲について消費する体力の総和を計算
 tmp=0
 for num in arr:
   tmp+=(i-num)**2
 ans=min(ans,tmp) #消費する体力の総和の最小値が答えとなる
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())

X = list(map(int, input().split()))
ans = 10**18
for i in range(1, 101):
    temp=0
    for num in X:
        temp + =(i-num)**2
    ans = min(ans, tmp)
print(ans)

Fixed submission:
n=int(input())
arr=list(map(int,input().split()))
ans=10**18 #最小値を求めるので初期化しておく
for i in range(1,101): #1<=P<=100の範囲について消費する体力の総和を計算
 tmp=0
 for num in arr:
   tmp+=(i-num)**2
 ans=min(ans,tmp) #消費する体力の総和の最小値が答えとなる
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())

X = list(map(int, input().split()))
ans = 10**18
for i in range(1. 101):
    temp=0
    for num in X:
        temp + =(i-num)**2
    ans = min(ans, tmp)
print(ans)

Fixed submission:
n=int(input())
arr=list(map(int,input().split()))
ans=10**18 #最小値を求めるので初期化しておく
for i in range(1,101): #1<=P<=100の範囲について消費する体力の総和を計算
 tmp=0
 for num in arr:
   tmp+=(i-num)**2
 ans=min(ans,tmp) #消費する体力の総和の最小値が答えとなる
print(ans)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())

print(a*b/2)


Fixed submission:
a=input()
x=[ int(y) for y in a.split() ]
print(x[0]*x[1]//2)
Buggy python submission (verdict: Runtime Error):
i = [input() for i in range(2)]
a = [i for i in i[0]]
b = [i for i in i[1]]
c = 0
for i in range(3):
  if a[i] == b[i]:
    c += 1
  else:
    c += 0
print(c)

Fixed submission:
a,b = map(int, input().split())
i = a
c = 1
while int(i) < b:
  i += a - 1
  c += 1
if b == 1:
  print(0)
else:
  print(c)
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        s = L[i] + L[j]
        ans += bs.bisect_left(L,s) - j - 1
        # bisect.bisect_left(list, x)
        # はリストにxを挿入できる点を返す
        # すなわち、
        # (val < x for val in list[0:i]) + (val >= x for val in list[i:len(list)])
print(ans)

Fixed submission:
import bisect as bs
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        s = L[i] + L[j]
        ans += bs.bisect_left(L,s) - j - 1
        # bisect.bisect_left(list, x)
        # はリストにxを挿入できる点を返す
        # すなわち、
        # (val < x for val in list[0:i]) + (val >= x for val in list[i:len(list)])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))
L.sort()
k2 = 2
ans = 0
for i in range(N-2):
    for j in range(1,N-1-i):
        s = L[i] + L[N-j-1]
        if L[N-j] >= s:
            ans += j
        else:
            for k in range(N-j+1,N):
                if L[k] >= s:
                    ans += N-k
                    break
print((N*(N-1)*(N-2))//6 - ans)

Fixed submission:
import bisect as bs
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        s = L[i] + L[j]
        ans += bs.bisect_left(L,s) - j - 1
        # bisect.bisect_left(list, x)
        # はリストにxを挿入できる点を返す
        # すなわち、
        # (val < x for val in list[0:i]) + (val >= x for val in list[i:len(list)])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        s = L[i]+L[j]
        for k in range(j+1,N):
            if L[k] >= s:
                break
            ans += 1
print(ans)

Fixed submission:
import bisect as bs
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        s = L[i] + L[j]
        ans += bs.bisect_left(L,s) - j - 1
        # bisect.bisect_left(list, x)
        # はリストにxを挿入できる点を返す
        # すなわち、
        # (val < x for val in list[0:i]) + (val >= x for val in list[i:len(list)])
print(ans)
Buggy python submission (verdict: Runtime Error):
H, W = list(map(int, input().split()))
S = []
for _ in range(H):
    S.append(list(input()))
    
for w in range(W):
    if S[0][w] == ".":
        S[0][w] = str(S[0][max(0,w-1):min(W, w+2)].count("#")
                    +S[1][max(0,w-1):min(W, w+2)].count("#"))

for h in range(1, H-1):
    for w in range(W):
        if S[h][w] == ".":
            S[h][w] = str(S[h-1][max(0,w-1):min(W, w+2)].count("#")
                        +S[h][max(0,w-1):min(W, w+2)].count("#")
                        +S[h+1][max(0,w-1):min(W, w+2)].count("#"))
            
for w in range(W):
        if S[H-1][w] == ".":
            S[H-1][w] = str(S[H-2][max(0,w-1):min(W, w+2)].count("#")
                        +S[H-1][max(0,w-1):min(W, w+2)].count("#"))
            
for h in range(H):
    print("".join(S[h]))

Fixed submission:
H, W = list(map(int, input().split()))
S = []
for _ in range(H):
    S.append(list(input()))

if H > 1:
    for w in range(W):
        if S[0][w] == ".":
            S[0][w] = str(S[0][max(0,w-1):min(W, w+2)].count("#")
                        +S[1][max(0,w-1):min(W, w+2)].count("#"))

    for h in range(1, H-1):
        for w in range(W):
            if S[h][w] == ".":
                S[h][w] = str(S[h-1][max(0,w-1):min(W, w+2)].count("#")
                            +S[h][max(0,w-1):min(W, w+2)].count("#")
                            +S[h+1][max(0,w-1):min(W, w+2)].count("#"))

    for w in range(W):
            if S[H-1][w] == ".":
                S[H-1][w] = str(S[H-2][max(0,w-1):min(W, w+2)].count("#")
                            +S[H-1][max(0,w-1):min(W, w+2)].count("#"))

else:
    for w in range(W):
        if S[0][w] == ".":
            S[0][w] = str(S[0][max(0,w-1):min(W, w+2)].count("#"))
for h in range(H):
    print("".join(S[h]))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

count_T = Counter(T)

for num, cnt in count_T.most_common():
    if D.count(num) < cnt:
        print("NO")
        break
        
else:
    print("YES")

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

D = sorted(D)
T = sorted(T)


i = len(D)-1
j = len(T)-1

flag = True
while(0<=i and 0<=j):
    if D[i] > T[j]:
        i -= 1
    elif D[i] == T[j]:
        i -= 1
        j -= 1
    else:
        flag = False
        break
        
if flag == False or (i<=-1 and j>-1):
    print("NO")
else:
    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 t in T:
    if t in D:
        D.remove(t)
    else:
        print("NO")
        break
        
else:
    print("YES")

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

D = sorted(D)
T = sorted(T)


i = len(D)-1
j = len(T)-1

flag = True
while(0<=i and 0<=j):
    if D[i] > T[j]:
        i -= 1
    elif D[i] == T[j]:
        i -= 1
        j -= 1
    else:
        flag = False
        break
        
if flag == False or (i<=-1 and j>-1):
    print("NO")
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())

if N%2 == 0:
    print(N, N, N//2)
    
else:
    flag = False
    H = math.ceil(N/4)
    for h in range(H, 10000):
        if flag == True:
            break
        
        N_ = math.ceil((N*h)/(h*4-N)) 
        for n in range(N_, 10000):
            if flag == True:
                break
            
            if (N*h*n)%(n*(h*4-N)-N*h) == 0:
                print(h, n, (N*h*n)//(n*(h*4-N)-N*h))
                flag = True
            

Fixed submission:
import math

N = int(input())

if N%2 == 0:
    print(N, N, N//2)
    
else:
    flag = False
    
    for h in range(1, 3501):
        if flag == True:
            break
        
        for n in range(1, 3501):
            if flag == True:
                break
            
            if ((n*(h*4-N)-N*h) > 0) and (N*h*n)%(n*(h*4-N)-N*h) == 0:
                print(h, n, (N*h*n)//(n*(h*4-N)-N*h))
                flag = True

Buggy python submission (verdict: Runtime Error):
import math

N = int(input())

if N%2 == 0:
    print(N, N, N//2)
    
else:
    flag = False
    H = math.ceil(N/4)
    for h in range(H, 3501):
        if flag == True:
            break
        
        N_ = math.ceil((N*h)/(h*4-N)) 
        for n in range(N_, 3501):
            if flag == True:
                break
            
            
            if (N*h*n)%(n*(h*4-N)-N*h) == 0:
                print(h, n, (N*h*n)//(n*(h*4-N)-N*h))
                flag = True
            

Fixed submission:
import math

N = int(input())

if N%2 == 0:
    print(N, N, N//2)
    
else:
    flag = False
    
    for h in range(1, 3501):
        if flag == True:
            break
        
        for n in range(1, 3501):
            if flag == True:
                break
            
            if ((n*(h*4-N)-N*h) > 0) and (N*h*n)%(n*(h*4-N)-N*h) == 0:
                print(h, n, (N*h*n)//(n*(h*4-N)-N*h))
                flag = True
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A = []

for _ in range(N):
    a = int(input())
    if a in A:
        A.remove(a)
    else:
        A.append(a)

print(len(A))

Fixed submission:
N = int(input())

A = set()

for _ in range(N):
    a = int(input())
    if a in A:
        A.remove(a)
    else:
        A.add(a)

print(len(A))