Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = []
for i in range(N):
  a.append(int(input()))

for i in range(N):
  b = a[:]
  b.pop(i)
  print(max(b))


Fixed submission:
N = int(input())
a = []
for i in range(N):
  a.append(int(input()))

sort = sorted(a)
m1 = sort[-1]
m2 = sort[-2]
if m1 == m2:
  for i in range(N):
    print(m1)
else:
  j = a.index(m1)
  for i in range(N):
    if i == j:
      print(m2)
    else:
      print(m1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = []
for i in range(N):
  a.append(int(input()))

for i in range(N):
  b = a[:]
  b.pop(i)
  print(max(b)

Fixed submission:
N = int(input())
a = []
for i in range(N):
  a.append(int(input()))

sort = sorted(a)
m1 = sort[-1]
m2 = sort[-2]
if m1 == m2:
  for i in range(N):
    print(m1)
else:
  j = a.index(m1)
  for i in range(N):
    if i == j:
      print(m2)
    else:
      print(m1)
Buggy python submission (verdict: Time Limit Exceeded):
L, R = list(map(int, input().split()))

x = range(L, R + 1)

minimum = 2018
for i in range(len(x) - 1):
  for j in range(i + 1, len(x)):
    minimum = min(minimum, x[i] * x[j] % 2019)
    if minimum == 0:
      break

print(minimum)

Fixed submission:
L, R = list(map(int, input().split(' ')))
#print(L, R)

min = 2019
for i in range(L, R):
    for j in range(i + 1, R + 1):
        mod_ij = (i * j) % 2019
        if min > mod_ij:
            min = mod_ij
            if min == 0:
                break
    if min == 0:
        break

print(min)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = list(map(int, input().split()))

x = range(L, R + 1)

minimum = 2018
for i in range(len(x) - 1):
  for j in range(i + 1, len(x)):
    minimum = min(minimum, x[i] * x[j] % 2019)

print(minimum)

Fixed submission:
L, R = list(map(int, input().split(' ')))
#print(L, R)

min = 2019
for i in range(L, R):
    for j in range(i + 1, R + 1):
        mod_ij = (i * j) % 2019
        if min > mod_ij:
            min = mod_ij
            if min == 0:
                break
    if min == 0:
        break

print(min)
Buggy python submission (verdict: Runtime Error):
H=int(input())
W=int(input())
h=int(input())
w=int(input())

a = (H-h) * (W-w)
print(a)

Fixed submission:
H, W = map(int, input().split())
h, w = map(int, input().split())
a = (H-h) * (W-w)
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=sum(B[0:A[1]])
for i in range(A[0]-A[1]+1):
  C=max(C,sum(B[i:i+A[1]]))
print((C+A[1])/2)



Fixed submission:
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=sum(B[0:A[1]])
D=C
for i in range(A[1]-1,A[0]-1):
  D=D+B[i+1]-B[i-A[1]+1]
  C=max(C,D)
print((C+A[1])/2)

Buggy python submission (verdict: Time Limit Exceeded):
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=[]
for i in range(len(B)-A[1]+1):
  D=0
  for j in range(A[1]):
    D=D+B[i+j]
  C.append(D)
print((max(C)+A[1])/2)



Fixed submission:
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=sum(B[0:A[1]])
D=C
for i in range(A[1]-1,A[0]-1):
  D=D+B[i+1]-B[i-A[1]+1]
  C=max(C,D)
print((C+A[1])/2)
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int,input().split())
ans=[K for i in range(N)]
for i in range(Q):
  A=int(input())
  ans[A-1]=ans[A-1]+1
  ans=list(map(lambda x:x-1,ans))
for i in range(N):
  if ans[i]>0:
    print('Yes')
  else:
    print('No')

Fixed submission:
N,K,Q=map(int,input().split())
ans=[K for i in range(N)]
ans=list(map(lambda x:x-Q,ans))
for i in range(Q):
  A=int(input())
  ans[A-1]=ans[A-1]+1
for i in range(N):
  if ans[i]>0:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N=int(input())
h=[0 for i in n+1]
h=list(map(int,input().split()))



Fixed submission:
N=int(input())
h=[0 for i in range(N+1)]
h=list(map(int,input().split()))
dp=[0 for i in range(N+1)]
for i in range(1,N):
  if(i==1):
    dp[i]=dp[i]+abs(h[i]-h[i-1])
  else:
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
N=int(input())
h=[0 for i in n+1]
h=map(int,input().split())



Fixed submission:
N=int(input())
h=[0 for i in range(N+1)]
h=list(map(int,input().split()))
dp=[0 for i in range(N+1)]
for i in range(1,N):
  if(i==1):
    dp[i]=dp[i]+abs(h[i]-h[i-1])
  else:
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[]
B=[]
C=[]
for i in range(N):
  a,b,c=map(int,input().split())
  A.append(a)
  B.append(b)
  C.append(c)
dp=[[0 for i in range(N)]for j in range(N)]
dp[0][0]=A[0]
dp[0][1]=B[0]
dp[0][2]=C[0]
for i in range(1,N):
  dp[i]=[max(dp[i-1][1]+A[i],dp[i-1][2]+A[i]),max(dp[i-1][0]+B[i],dp[i-1][2]+B[i]),max(dp[i-1][0]+C[i],dp[i-1][1]+C[i])]
print(max(dp[N-1][0],dp[N-1][1],dp[N-1][2]))

Fixed submission:
N=int(input())
a,b,c=map(int,input().split())
dp=[[0 for i in range(3)]for j in range(N)]
dp[0]=[a,b,c]
for i in range(1,N):
  A,B,C=map(int,input().split())
  dp[i]=[max(dp[i-1][1]+A,dp[i-1][2]+A),max(dp[i-1][0]+B,dp[i-1][2]+B),max(dp[i-1][0]+C,dp[i-1][1]+C)]
print(max(dp[N-1][0],dp[N-1][1],dp[N-1][2]))

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[]
B=[]
C=[]
for i in range(N):
  a,b,c=map(int,input().split())
  A.append(a)
  B.append(b)
  C.append(c)
dp=[[0 for i in range(N)]for j in range(N)]
dp[0][0]=A[0]
dp[0][1]=B[0]
dp[0][2]=C[0]
for i in range(1,N):
  dp[i]=[max(dp[i-1][1]+A[i],dp[i-1][2]+A[i]),max(dp[i-1][0]+B[i],dp[i-1][2]+B[i]),max(dp[i-1][0]+C[i],dp[i-1][1]+C[i])]
print(max(dp[N-1][0],dp[N-1][1],dp[N-1][2]))
  
                  

Fixed submission:
N=int(input())
a,b,c=map(int,input().split())
dp=[[0 for i in range(3)]for j in range(N)]
dp[0]=[a,b,c]
for i in range(1,N):
  A,B,C=map(int,input().split())
  dp[i]=[max(dp[i-1][1]+A,dp[i-1][2]+A),max(dp[i-1][0]+B,dp[i-1][2]+B),max(dp[i-1][0]+C,dp[i-1][1]+C)]
print(max(dp[N-1][0],dp[N-1][1],dp[N-1][2]))
Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int,input().split())
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1,N+1):
  w,v=map(int,input().split())
  for j in range(1,W+1):
    if w<=j:
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
    else:
      dp[i][j]=dp[i-1][j]
print(dp[N][W])

Fixed submission:
N,W=map(int,input().split())
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1,N+1):
  w,v=map(int,input().split())
  for j in range(1,W+1):
    if w<=j:
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
    else:
      dp[i][j]=dp[i-1][j]
print(dp[N][W])
Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int,input().split())
dp=[[0 for i in range(W+1)] for j in range(N+1)]
for i in range(1,N+1):
  w,v=map(int,input().split())
  for j in range(1,W+1):
    if w<=j:
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
    else:
      dp[i][j]=dp[i-1][j]
print(dp[N][W])

Fixed submission:
N,W=map(int,input().split())
w=[0 for i in range(N+1)]
v=[0 for i in range(N+1)]
for i in range(1,N+1):
  w[i],v[i]=map(int,input().split())
N_max=max(v[i] for i in range(N+1))
INF=float('inf')
dp=[[INF for i in range(N*N_max+1)]for j in range(N+1)]
dp[0][0]=0
for i in range(1,N+1):
  for j in range(N*N_max+1):
    if v[i]<=j:
      dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i]]+w[i])
    else:
      dp[i][j]=dp[i-1][j]
ans=0
for i in range(1,N*N_max+1):
  if dp[N][i]<=W:
    ans=i
print(ans)
Buggy python submission (verdict: Runtime Error):
a=list(map(int,input().split()))
a.sort()
if a[0]=5 and a[1]=5 and a[2]=7:
  print(Yes)
else:
  print(No)

Fixed submission:
a=list(map(int,input().split()))
a.sort()
if a[0]==5 and a[1]==5 and a[2]==7:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
if __name__== '__main__':
  s = input('>>')
  for i in range(2):
     if s[i] == 'A':
        print('Yes')
     elif s[i] == 'B':
      	print('Yes')
      else:
        print('No')
      

Fixed submission:
if __name__== '__main__':
  s = input()
  if s[0] == 'A' and s[1] == 'A' and s[2] == 'A':
        	print('No')
  elif s[0] == 'B' and s[1] == 'B' and s[2] == 'B':
      		print('No')
  else:
        	print('Yes')
Buggy python submission (verdict: Runtime Error):
l = len(input())
out = "x"*l
peint(out)

Fixed submission:
l = len(input())
out = "x"*l
print(out)
Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter

N, M = map(int,input().split())
A = list(map(int,input().split()))
BC = []
for i in range(M):
    tmp = list(map(int,input().split()))
    BC.append(tmp)
A.sort(reverse=True)
BC.sort(key=itemgetter(1),reverse=True)

l = 0
r = N-1
flg = False
for k in range(M):
    # l tansaku
    for p in range(N):
        if BC[k][1] > A[p]:
            l = p
            break
        elif p == N-1:
            flg = True
    #break
    if flg or r < l: break
    tmpC = BC[k][1]
    #chikan
    for o in range(BC[k][0]):
        if r < l or r == -1:
            flg = True
            break
        A[r] = tmpC
        r -= 1

print(sum(A))

Fixed submission:
from operator import itemgetter

N, M = map(int,input().split())
A = list(map(int,input().split()))
BC = []
for i in range(M):
    tmp = list(map(int,input().split()))
    BC.append(tmp)
A.sort(reverse=True)
BC.sort(key=itemgetter(1),reverse=True)

l = 0
r = N-1
flg = False
for k in range(M):
    # l tansaku
    for p in range(l,N):
        if BC[k][1] > A[p]:
            l = p
            break
        elif p == N-1:
            flg = True
    #break
    if flg or r < l: break
    tmpC = BC[k][1]
    #chikan
    for o in range(BC[k][0]):
        if r < l or r == -1:
            flg = True
            break
        A[r] = tmpC
        r -= 1

print(sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
ans = 0
for i in range(N//R+1):
    for j in range(N//G+1):
        x = i * R
        y = j*G
        z = N - x-y
        if z>= 0 and z%B == 0:
            ans += 1
print(int(ans))

Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
for i in range(N//R+1):
    x = i * R
    for j in range((N-x)//G+1):
        
        y = j*G
        z = N - x-y
        if z>= 0 and z%B == 0:
            ans += 1
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
ans = 0
for i in range(N//R+1):
    for j in range(N//G+1):
        if i*R + j*G <= N and (N-i*R-j*G)%B == 0:
            ans += 1
print(int(ans))


Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
for i in range(N//R+1):
    x = i * R
    for j in range((N-x)//G+1):
        
        y = j*G
        z = N - x-y
        if z>= 0 and z%B == 0:
            ans += 1
print(int(ans))
Buggy python submission (verdict: Runtime Error):
K, S = int(input().split())
ans = 0
for o in range(2, K):
    for p in range(2, K-o):
        for q in range(2, K-o-p):
            if o + p + q == S:
                ans += 1
print(ans)


Fixed submission:
K, S = map(int, input().split())
ans = 0
for o in range(0, K+1):
    for p in range(0, K+1):
            if 0 <= S-o-p <= K:
                ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
K, S = int(input().split())
ans = 0
for o in range(2, K):
    for p in range(2, K):
        for q in range(2, K):
            if o + p + q == S:
                ans += 1
print(ans)

Fixed submission:
K, S = map(int, input().split())
ans = 0
for o in range(0, K+1):
    for p in range(0, K+1):
            if 0 <= S-o-p <= K:
                ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
 ans = N // (A + B) * A
 rem = N % (A + B)
 ans += min(rem, A)
 print(ans)


Fixed submission:
N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)
Buggy python submission (verdict: Runtime Error):
l = list(map(int,input().split()))

if l[1] == 0:
    ans = 0
else:
    q, mod = divmod(l[0], (l[1]+l[2]))
    qq, modd = divmod(mod, l[1])
    if qq == 0 :
        ans = l[1] * q + modd
    else:
        ans = l[1] * (q + qq)

print(ans)

Fixed submission:
S = input()
a,b,c = list(S)

if a == b == c:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
i = list(map(int, input().split()))
N = i[0]
R = i[1]

if N >= 10:
    insc = R
else:
    insc = R + 100(10-N)

print(insc)

Fixed submission:
i = list(map(int, input().split()))
N = i[0]
R = i[1]

if N >= 10:
    insc = R
else:
    insc = R + 100*(10-N)

print(insc)
Buggy python submission (verdict: Runtime Error):
def judgeServe(strs: str) -> str:
  if s.count('A') > 0 and s.count('A') < 3:
    return 'Yes'
  else:
    return 'No'

strs = input()
print(judgeServe(strs))
  
    

Fixed submission:
strs = input()
count_A = strs.count('A')
if count_A > 0 and count_A < 3:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
#10進数でちょうどn桁
defs = [tuple(map(int,input().split())) for _ in range(m)]

is_empty = False
jouken = {}

for i in range(n):
    #i桁目で条件に重複がないか見る
    dd = list(set([d[1] for d in defs if d[0]-1 == i]))
    if len(dd) > 1:
        is_empty = True
        break
    elif len(dd) == 1:
        jouken[i] = dd[0] #i桁目の数が決まる

num = [0]*n

if n == 1:
    print(jouken[0])
else:
    if 0 in jouken:
        if jouken[0] == 0:
            is_empty = True
        else:
            num[0] = jouken[0]
    else:
        num[0] == 1
    for i in range(1,len(num)):
        if i in jouken:
            num[i] = jouken[i]
        else:
            num[i] = 0

num = [str(i) for i in num]

if is_empty:
    print(-1)
else:
    print(''.join(num))

Fixed submission:
n,m = map(int,input().split())
#10進数でちょうどn桁
defs = [tuple(map(int,input().split())) for _ in range(m)]

is_empty = False
jouken = {}

for i in range(n):
    #i桁目で条件に重複がないか見る
    dd = list(set([d[1] for d in defs if d[0]-1 == i]))
    if len(dd) > 1:
        is_empty = True
        break
    elif len(dd) == 1:
        jouken[i] = dd[0] #i桁目の数が決まる

num = [0]*n

if n == 1:
    if 0 in jouken:
        num[0] = jouken[0]
    else:
        num[0] = 0
else:
    if 0 in jouken:
        if jouken[0] == 0:
            is_empty = True
        else:
            num[0] = jouken[0]
    else:
        num[0] = 1
    for i in range(1,n):
        if i in jouken:
            num[i] = jouken[i]
        else:
            num[i] = 0

num = [str(i) for i in num]

if is_empty:
    print(-1)
else:
    print(''.join(num))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a_list = sorted(list(map(int,input().split())))

def c(n,k):
    return n * (n-1) / k

pair_len = c(n,2)

minus_num = len([i for i in a_list if i < 0])
plus_num = len([i for i in a_list if i > 0])
zero_num = n - minus_num - plus_num

minus_len = minus_num * plus_num
plus_len = c(minus_num,2) + c(plus_num,2)
zero_len = int(pair_len - minus_len - plus_len)

if k <= minus_len:
    #-1つ,+1つ
    minus_list = a_list[:minus_num]
    plus_list = a_list[minus_num+zero_num:]
    all_num = sorted([i*j for i in minus_list for j in plus_list])
    print(all_num[k-1])
elif k <= minus_len + zero_len:
    print(0)
else:
    #-2つ or +2つ
    minus_list = a_list[:minus_num]
    plus_list = a_list[minus_num+zero_num:]
    all_num = sorted([minus_list[i]*minus_list[j] for i in range(len(minus_list)-1) for j in range(i+1,len(minus_list))] + [plus_list[i]*plus_list[j] for i in range(len(plus_list)-1) for j in range(i+1,len(plus_list))])
    print(all_num[k-minus_len-zero_len-1])

Fixed submission:
import numpy as np

n,k = map(int,input().split())
a_list = np.array(list(map(int,input().split())))
a_list = np.sort(a_list)

zero = a_list[a_list == 0]
pos = a_list[a_list > 0]
neg = a_list[a_list < 0]

def count(x): #積がx以下になるペアの個数を返す(一旦重複は考えない)
    ans = 0
    if x >= 0:
        ans += n * len(zero)
    # a_list * pos < xだから，a_list < x/posになる個数をcountしている(pos側を固定)
    ans += np.searchsorted(a_list,x // pos, side='right').sum()
    # a_list < x // negとなる者を全ての組み合わせから抜く
    ans += (n - np.searchsorted(a_list, (-x - 1) // (-neg), side='right')).sum()
    # 同じもの2つは選べない
    ans -= np.count_nonzero(a_list * a_list <= x)
    return ans // 2

left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if count(x) >= k:
        right = x
    else:
        left = x

print(right)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
ps = list(map(int,input().split()))

#隣接する最大の部分をとって(N+1)/2すればいい

max_part = 0
for i in range(N-K+1):
    max_part = max(sum(ps[i:i+K]),max_part)

print((max_part+K)/2)

Fixed submission:
N,K = map(int,input().split())
ps = tuple(map(int,input().split()))

max_sum = sum(ps[:K])
num = sum(ps[:K])

for i in range(N-K):
    num = num - ps[i] + ps[i+K]
    max_sum = max(max_sum,num)
    

print((max_sum+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
ps = list(map(int,input().split()))

#隣接する最大の部分をとって(N+1)/2すればいい

max_part = 0
for i in range(N-K+1):
    x = sum(ps[i:i+K])
    if max_part < x:
        max_part = x

print((max_part+K)/2)

Fixed submission:
N,K = map(int,input().split())
ps = tuple(map(int,input().split()))

max_sum = sum(ps[:K])
num = sum(ps[:K])

for i in range(N-K):
    num = num - ps[i] + ps[i+K]
    max_sum = max(max_sum,num)
    

print((max_sum+K)/2)
Buggy python submission (verdict: Time Limit Exceeded):
HP,n = map(int,input().split())
s = [tuple(map(int,input().split())) for i in range(n)]

dp = [float('inf')]*(HP+1) #0~HP
dp[0] = 0
for damage, cost in s:
    for hp in range(HP):
        next_idx = min(hp+damage, HP)
        dp[next_idx] = min(dp[next_idx], dp[hp]+cost)
print(dp[-1])

Fixed submission:
HP,n = map(int,input().split())
s = [tuple(map(int,input().split())) for i in range(n)]

#dp[damage] := モンスターにdamageを与える最小コスト
dp = [float('inf')]*(HP+1) #0~HP
dp[0] = 0
for damage, cost in s:
    for hp in range(HP):
        next_idx = min(hp+damage, HP)
        dp[next_idx] = min(dp[next_idx], dp[hp]+cost)
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    HP,n = map(int,input().split())
    s = [tuple(map(int,input().split())) for i in range(n)]
    max_s = max(s)

    #dp[damage] := モンスターにdamageを与える最小コスト
    dp = [float('inf')]*(HP+1) #0~HP
    dp[0] = 0
    for hp in range(HP):
        for damage, cost in s:
            next_idx = min(hp+damage, HP)
            dp[next_idx] = min(dp[next_idx], dp[hp]+cost)
    print(dp[-1])

if __name__ == '__main__':
    main()

Fixed submission:
HP,n = map(int,input().split())
s = [tuple(map(int,input().split())) for i in range(n)]

#dp[damage] := モンスターにdamageを与える最小コスト
dp = [float('inf')]*(HP+1) #0~HP
dp[0] = 0
for damage, cost in s:
    for hp in range(HP):
        next_idx = min(hp+damage, HP)
        dp[next_idx] = min(dp[next_idx], dp[hp]+cost)
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def main():
    HP,n = map(int,input().split())
    s = [tuple(map(int,input().split())) for i in range(n)]

    #dp[damage] := モンスターにdamageを与える最小コスト
    dp = [float('inf')]*(HP+1) #0~HP
    dp[0] = 0
    for hp in range(HP):
        for damage, cost in s:
            next_idx = min(hp+damage, HP)
            dp[next_idx] = min(dp[next_idx], dp[hp]+cost)
    print(dp[-1])

if __name__ == '__main__':
    main()

Fixed submission:
HP,n = map(int,input().split())
s = [tuple(map(int,input().split())) for i in range(n)]

#dp[damage] := モンスターにdamageを与える最小コスト
dp = [float('inf')]*(HP+1) #0~HP
dp[0] = 0
for damage, cost in s:
    for hp in range(HP):
        next_idx = min(hp+damage, HP)
        dp[next_idx] = min(dp[next_idx], dp[hp]+cost)
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Ps = list(map(int,input().split()))

x = 0
for i in range(N):
    if min(Ps[:i+1]) == Ps[i]:
        x += 1
print(x)

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

x = 0
min_now = max(Ps)

for i in range(N):
    if min_now >= Ps[i]:
        x += 1
        min_now = Ps[i]
print(x)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
p_s = [tuple(input().split()) for _ in range(M)]

wa_score = [0]*N
ac_flg = [0]*N

for p,s in p_s:
    p = int(p)
    if s == 'AC':
        ac_flg[p-1] = 1
    else:
        if ac_flg[p-1] == 0:
            wa_score[p-1] += 1

ac_count = sum(ac_flg)
wa_count = 0
for i in ac_flg:
    if i == 1:
        wa_count += wa_score[i]

print(ac_count,wa_count)

Fixed submission:
N,M = map(int,input().split())
p_s = [tuple(input().split()) for _ in range(M)]

wa_total = [0]*N
wa_count = [0]*N 
ac_flg = [False]*N

for p,s in p_s:
    p = int(p)-1
    if not ac_flg[p]:
        if s == 'AC':
            ac_flg[p] = True
            wa_count[p] = wa_total[p]
        else:
            wa_total[p] += 1

print(ac_flg.count(True),sum(wa_count))
Buggy python submission (verdict: Runtime Error):
import numpy as np

N,M = map(int,input().split())
Xs = sorted([int(i) for i in input().split()])

if N >= M:
    print(0)
else:
    margin = [Xs[i+1]-Xs[i] for i in range(len(Xs)-1)]
    margin = [(i,x) for i,x in enumerate(margin)]
    point = [x[0] for x in sorted(margin,key=lambda x:x[1],reverse=True)[:N-1]]
    move = 0
    move += Xs[point[0]] - Xs[0]
    for i in range(1,len(point)):
        move += Xs[point[i]] - Xs[point[i-1]+1]
    move += Xs[-1] - Xs[point[-1]+1]
    print(move)

Fixed submission:
import numpy as np

N,M = map(int,input().split())
Xs = sorted([int(i) for i in input().split()])

if N >= M:
    print(0)
elif N == 1:
    print(Xs[-1]-Xs[0])
else:
    margin = [Xs[i+1]-Xs[i] for i in range(len(Xs)-1)]
    margin = [(i,x) for i,x in enumerate(margin)]
    point = [x[0] for x in sorted(margin,key=lambda x:x[1],reverse=True)[:N-1]]
    move = 0
    move += Xs[point[0]] - Xs[0]
    for i in range(1,len(point)):
        move += Xs[point[i]] - Xs[point[i-1]+1]
    move += Xs[-1] - Xs[point[-1]+1]
    print(move)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N,M = map(int,input().split())
Xs = sorted([int(i) for i in input().split()])

if N >= M:
    print(0)
else:

    margin = [Xs[i+1]-Xs[i] for i in range(len(Xs)-1)]
    point = []
    for i in range(N-1):
        p = np.argmax(margin)
        point.append(p)
        margin[p] = 0
    move = 0
    move += abs(Xs[point[0]] - Xs[0])
    for i in range(1,len(point)):
        move += abs(Xs[point[i]] - Xs[point[i-1]+1])
    move += abs(Xs[-1] - Xs[point[-1]+1])
    print(move)


Fixed submission:
import numpy as np

N,M = map(int,input().split())
Xs = sorted([int(i) for i in input().split()])

if N >= M:
    print(0)
elif N == 1:
    print(Xs[-1]-Xs[0])
else:
    margin = [Xs[i+1]-Xs[i] for i in range(len(Xs)-1)]
    margin = [(i,x) for i,x in enumerate(margin)]
    point = [x[0] for x in sorted(margin,key=lambda x:x[1],reverse=True)[:N-1]]
    move = 0
    move += Xs[point[0]] - Xs[0]
    for i in range(1,len(point)):
        move += Xs[point[i]] - Xs[point[i-1]+1]
    move += Xs[-1] - Xs[point[-1]+1]
    print(move)
Buggy python submission (verdict: Runtime Error):
S = input()

if 'A' in S && 'B' in S
  print('Yes')
else
  print('No')
  

Fixed submission:
S = input()
 
if 'A' in S and 'B' in S:
  print('Yes')
else:
  print('No')