Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np

N=int(input())
A=[int (x) for x in input().split()]
p=[0]*N
for i in range(N-1):
    p[A[i]-1]+=1
for i in range(N):
    print(int(p[i]))

Fixed submission:
N=int(input())
A=[int (x) for x in input().split()]
p=[0]*N
for i in range(N-1):
    p[A[i]-1]+=1
for i in range(N):
    print(int(p[i]))

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

N=int(input())
A=[int (x) for x in input().split()]
p=[0]*N
for i in range(N-1):
    p[A[i]-1]+=1
for i in range(N):
    print(int(p[i]))

Fixed submission:
N=int(input())
A=[int (x) for x in input().split()]
p=[0]*N
for i in range(N-1):
    p[A[i]-1]+=1
for i in range(N):
    print(int(p[i]))

Buggy python submission (verdict: Runtime Error):
import numpy as np
#A = np.array([int(i) for i in input().split()])
#A = [int (x) for x in input().split()]
#N=int(input())

N=int(input())
A=[int (x) for x in input().split()]
p=[0]*N
for i in range(N-1):
    p[A[i]-1]+=1
for i in range(N):
    print(int(p[i]))

Fixed submission:
N=int(input())
A=[int (x) for x in input().split()]
p=[0]*N
for i in range(N-1):
    p[A[i]-1]+=1
for i in range(N):
    print(int(p[i]))

Buggy python submission (verdict: Runtime Error):
import numpy as np
#A = np.array([int(i) for i in input().split()])
#N=int(input())

N=int(input())
A = np.array([int(i) for i in input().split()])
p=np.zeros(N)
for i in range(N-1):
    p[A[i]-1]+=1
for i in range(N):
    print(int(p[i]))

Fixed submission:
N=int(input())
A=[int (x) for x in input().split()]
p=[0]*N
for i in range(N-1):
    p[A[i]-1]+=1
for i in range(N):
    print(int(p[i]))

Buggy python submission (verdict: Runtime Error):
import numpy as np
#A = np.array([int(i) for i in input().split()])
#N=int(input())

N=int(input())
A = np.array([int(i) for i in input().split()])
p=np.zeros(N)
for i in range(N-1):
    p[A[i]-1]+=1
for i in range(N):
    print(int(p[i]))

Fixed submission:
N=int(input())
A=[int (x) for x in input().split()]
p=[0]*N
for i in range(N-1):
    p[A[i]-1]+=1
for i in range(N):
    print(int(p[i]))
Buggy python submission (verdict: Time Limit Exceeded):
def solve():

    N,M=map(int,input().split())
    A_list=[]#正解問題番号を入れる
    W_list=[0]*N
    WA=0
    PS=[list(map(str,input().split())) for i in range(M) ]
    ans=0
    pena=0
    for x in range(M):
        #if PS[x][0] not in A_list:
            if PS[x][0] in A_list:
                continue
            if PS[x][1]=='AC':
                A_list.append(PS[x][0])
                ans+=1
                WA+=W_list[int(PS[x][0])-1]
            else:
                #pena+=1
                W_list[int(PS[x][0])-1]+=1
    
    #print(ans,pena)
    print(ans,WA)
solve()


Fixed submission:
n, m = map(int, input().split())
AC = [0] * (n+1) #その問題で既に AC が出たか
b = [0] * (n+1) #その問題で WA が出た回数

WA = 0

for i in [0]*(m):

    s = input().split()

    if AC[int(s[0])] == 0:
        if s[1] == "AC":
            AC[int(s[0])] = 1
            WA += b[int(s[0])]
        else:
            b[int(s[0])] += 1

print(sum(AC), WA)

Buggy python submission (verdict: Time Limit Exceeded):
def solve():

    N,M=map(int,input().split()) #N個の問題,M回の提出
    A_list=[]#正解問題番号を入れる
    W_list=[0]*N
    WA=0
    PS=[list(map(str,input().split())) for i in range(M) ]
    ans=0
    pena=0
    for x in range(M):
        if PS[x][0] not in A_list:
            if PS[x][1]=='AC':
                A_list.append(PS[x][0])
                ans+=1
                WA+=W_list[int(PS[x][0])-1]
            else:
                #pena+=1
                W_list[int(PS[x][0])-1]+=1
    
    #print(ans,pena)
    print(ans,WA)
solve()


Fixed submission:
n, m = map(int, input().split())
AC = [0] * (n+1) #その問題で既に AC が出たか
b = [0] * (n+1) #その問題で WA が出た回数

WA = 0

for i in [0]*(m):

    s = input().split()

    if AC[int(s[0])] == 0:
        if s[1] == "AC":
            AC[int(s[0])] = 1
            WA += b[int(s[0])]
        else:
            b[int(s[0])] += 1

print(sum(AC), WA)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split()) #N個の問題,M回の提出
A_list=[]#正解問題番号を入れる
W_list=[0]*N
WA=0
PS=[list(map(str,input().split())) for i in range(M) ]
ans=0
pena=0
for x in range(M):
    if PS[x][0] not in A_list:
        if PS[x][1]=='AC':
            A_list.append(PS[x][0])
            ans+=1
            WA+=W_list[int(PS[x][0])-1]
        else:
            pena+=1
            W_list[int(PS[x][0])-1]+=1

#print(ans,pena)
print(ans,WA)


Fixed submission:
n, m = map(int, input().split())
AC = [0] * (n+1) #その問題で既に AC が出たか
b = [0] * (n+1) #その問題で WA が出た回数

WA = 0

for i in [0]*(m):

    s = input().split()

    if AC[int(s[0])] == 0:
        if s[1] == "AC":
            AC[int(s[0])] = 1
            WA += b[int(s[0])]
        else:
            b[int(s[0])] += 1

print(sum(AC), WA)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
ans=0
for i in range(1,N):
    ans+=i
print(ans)

Fixed submission:
N=int(input())
ans=N*(N-1)//2
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+1):
    for j in range(N+1):
        tmp=N-R*i-G*j
        if tmp<0:
            break
        if tmp>=0 and tmp%B==0:
            ans+=1
print(ans)

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

solve()

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

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

solve()

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

solve()

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

solve()

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

solve()

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

solve()

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

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

solve()
Buggy python submission (verdict: Runtime Error):
A,B,C,D=map(int,list(input())

if A+B+C+D==7:
    print('{}+{}+{}+{}=7'.format(A,B,C,D))
elif A-B+C+D==7:
    print('{}-{}+{}+{}=7'.format(A,B,C,D))
elif A+B-C+D==7:
    print('{}+{}-{}+{}=7'.format(A,B,C,D))
elif A+B+C-D==7:
    print('{}+{}+{}-{}=7'.format(A,B,C,D))
elif A-B-C+D==7:
    print('{}-{}-{}+{}=7'.format(A,B,C,D))
elif A+B-C-D==7:
    print('{}+{}-{}-{}=7'.format(A,B,C,D))
elif A-B+C-D==7:
    print('{}-{}+{}-{}=7'.format(A,B,C,D))
elif A-B-C-D==7:
    print('{}-{}-{}-{}=7'.format(A,B,C,D))


Fixed submission:
A,B,C,D=map(int,list(input()))

if A+B+C+D==7:
    print('{}+{}+{}+{}=7'.format(A,B,C,D))
elif A-B+C+D==7:
    print('{}-{}+{}+{}=7'.format(A,B,C,D))
elif A+B-C+D==7:
    print('{}+{}-{}+{}=7'.format(A,B,C,D))
elif A+B+C-D==7:
    print('{}+{}+{}-{}=7'.format(A,B,C,D))
elif A-B-C+D==7:
    print('{}-{}-{}+{}=7'.format(A,B,C,D))
elif A+B-C-D==7:
    print('{}+{}-{}-{}=7'.format(A,B,C,D))
elif A-B+C-D==7:
    print('{}-{}+{}-{}=7'.format(A,B,C,D))
elif A-B-C-D==7:
    print('{}-{}-{}-{}=7'.format(A,B,C,D))
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

int main(){
    int N; cin >> N;
    int i=1;
    while(N>=i*i){
        i++;
    }
    cout << (i-1)*(i-1);
}

Fixed submission:
N=int(input())

i=1
while(N>=i*i):
    i+=1

print((i-1)*(i-1))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
B=[]

for i in range(N):
    a=int(input())
    if a in B:
        B.remove(a)
    else:
        B.append(a)
print(len(B))

Fixed submission:
N=int(input())
B=set()

for i in range(N):
    a=int(input())
    if a in B:
        B.remove(a)
    else:
        B.add(a)
print(len(B))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[int(input()) for i in range(N)]

B=[]
for i in A:
    if i in B:
        B.remove(i)
    else:
        B.append(i)
print(len(B))

Fixed submission:
N=int(input())
B=set()

for i in range(N):
    a=int(input())
    if a in B:
        B.remove(a)
    else:
        B.add(a)
print(len(B))
Buggy python submission (verdict: Runtime Error):
import numpy as np

N=int(input())
#A=np.array([map(int,input().split())])
A = np.array([int(i) for i in input().split()])
max_A=np.max(A)
min_A=np.min(A)
print(max_A-min_A)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
max_A=max(A)
min_A=min(A)
print(max_A-min_A)
Buggy python submission (verdict: Time Limit Exceeded):
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
count = 0
ans = "No"

N,K = I()
A = l()

before = 1
for i in range(K):
    before *= A[i]

for i in range(N-K):
    after = before / A[i] * A[K+i]
    if after > before:
        print("Yes")
    else:
        print("No")
    before = after





Fixed submission:
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
count = 0
ans = "No"

N,K = I()
A = l()


for i in range(N-K):
    if  A[K+i]/A[i] > 1:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
count = 0
ans = "No"

N,K = I()
A = l()

before = 1
for i in range(K):
    before *= A[i]

for i in range(N-K):
    after = before / A[i] * A[K+i]
    if after > before:
        print("Yes")
    else:
        print("No")
    before = after





Fixed submission:
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
count = 0
ans = "No"

N,K = I()
A = l()


for i in range(N-K):
    if  A[K+i]/A[i] > 1:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from operator import add, mul, sub,truediv, floordiv
from functools import reduce

import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int,input().split()))
ans = reduce(mul, A)

if ans > 10**18:
    ans = -1

print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit()
ans = 1

for i in range(N):
    ans *= A[i]
    if ans > 10 ** 18:
        print(-1)
        exit()

print(ans)

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

N = int(input())
A = list(map(int,input().split()))
ans = 1

for i in range(N):
    ans*= A[i]

if ans > 10**18:
    ans = -1



print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit()
ans = 1

for i in range(N):
    ans *= A[i]
    if ans > 10 ** 18:
        print(-1)
        exit()

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans = 1

for i in range(N):
    ans*= A[i]

if ans > 10**18:
    ans = -1



print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit()
ans = 1

for i in range(N):
    ans *= A[i]
    if ans > 10 ** 18:
        print(-1)
        exit()

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans = 1

for i in range(N):
    ans*= A[i]

if ans > 10**18:
    ans = -1



print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit()
ans = 1

for i in range(N):
    ans *= A[i]
    if ans > 10 ** 18:
        print(-1)
        exit()

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
input = stdin.readline
#N = int(input())
#J,K = map(int,input().split())
#A = list(map(int,input().split()))
#A = [list(map(int,input().split())) for _ in range(N)]
#for i in range():

N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(M)]
length = len(AB)
ans = [0]*(N-1)
seek = [1]
seeknext = [0]
while length > 0:
    i = 0
    delete = 0
    while i < length:
        if AB[i][0] in seek:
            if ans[AB[i][1]-2] == 0:
                ans[AB[i][1]-2] = AB[i][0]
            seeknext += [AB[i][1]]
            AB = AB[:i]+AB[i+1:]
            length-=1
        elif AB[i][1] in seek:
            if ans[AB[i][0]-2] == 0:
                ans[AB[i][0]-2] = AB[i][1]
            seeknext += [AB[i][0]]
            AB = AB[:i]+AB[i+1:]
            length-=1
        else:
            i += 1
    seek = seeknext
    seeknext = [0]
print("Yes")
for i in ans:
    print(i)
            
            



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

ans =[[0,0] for _ in range(M)]

AB = [list(map(int,input().split())) for i in range(M)]

to_list = [[] for _ in range(N)]
prev = [0]*N
for a,b in AB:
  to_list[a-1].append(b-1)
  to_list[b-1].append(a-1)

que = [0]
marked = {0}
for i in que:
  for j in to_list[i]:
    if j in marked: 
      continue
    que.append(j)
    marked.add(j)
    prev[j] = i+1
print("Yes")
print(*prev[1:],sep = "\n")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
count = 0

for i in range(N):
  if i+1+A[i]< N:
    for j in range(i+1+A[i],N):
      if j-i == A[i] +A[j]:
        count += 1
print(count)
    
        

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
a = [ A[i] - (i+1) for i in range(N)]
c = Counter(a)
count = 0
for i in range(N-1):
  count += c[-1*(A[i] + (i+1))]
  c[A[i]-(i+1)] -= 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
a = Counter(A)
b = list(a.keys())
B = [-1]*(N+1)

for i in range(N):
  count = 0
  k = A[i]
  if B[k] != -1:
    print(int(B[k]))
  else:
    for j in b:
      if j == k:
        count += (a[j]-1)*(a[j]-2)/2
      else:
        count += a[j]*(a[j]-1)/2
    B[k] = count
    print(int(count))

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
a = Counter(A)
b = list(a.keys())
B = [0]*(N+1)
for i in b:
  B[i] = int(a[i]*(a[i]-1)/2)
total = sum(B)

for i in range(N):
  k = A[i]
  change = (a[k]-1)*(a[k]-2)/2
  print(int(total-B[k]+change))
Buggy python submission (verdict: Runtime Error):
N = int(input())

if N % 2 == 0:
  print(N/2)
else:
  print(N//2　+1)

Fixed submission:
N = int(input())

if N % 2 == 0:
  print(int(N/2))
else:
  print(int(N//2 +1))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
s = sorted(S)
import collections
c = collections.Counter(s)
C = c.most_common()

a = C[0][1]
b = []
for i in range(N):
  if a == C[i][1]:
    b.append(C[i][0])
  else:
    break
B = sorted(b)

for i in B:
  print(i)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
s = sorted(S)
import collections
c = collections.Counter(s)
C = c.most_common()
 
a = C[0][1]
b = []
for i in range(len(C)):
  if a == C[i][1]:
    b.append(C[i][0])
  else:
    break
B = sorted(b)
 
for i in B:
  print(i)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
P = list(map(int, input().split()))
 
A = 0
for i in range(N-K+1):
  B = 0
  for j in range(K):
    B += (1 + P[i+j])/2
    if B > A:
      A = B
 
print(A)

Fixed submission:
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()

if U == S:
  A -=1
else:
  B -= 1

print(str(A) +" " + str(B))
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))
E = [(1+i)/2 for i in p]
S = [0] + [sum(E[0:i+1]) for i in range(N)]
ans = 0
i = 0
while N-K-i >= 0:
  A = S[K+i] -S[i]
  ans = max(ans,A)
  i += 1
print(ans)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
E = [(1+i)/2 for i in p]
S = [0]*(N+1)
sum = 0
for i in range(N):
  sum += E[i]
  S[i+1] = sum
ans = 0
i = 0
while N-K-i >= 0:
  A = S[K+i] -S[i]
  ans = max(ans,A)
  i += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))
E = [(1+i)/2 for i in p]
ans = 0
i = 0
while N-K-i >= 0:
  A = sum(E[N-K-i:N-i])
  ans = max(ans,A)
  i += 1
print(ans)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
E = [(1+i)/2 for i in p]
S = [0]*(N+1)
sum = 0
for i in range(N):
  sum += E[i]
  S[i+1] = sum
ans = 0
i = 0
while N-K-i >= 0:
  A = S[K+i] -S[i]
  ans = max(ans,A)
  i += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
P = list(map(int, input().split()))
 
A = 0
for i in range(N-K+1):
  B = 0
  for j in range(K):
    B += (1 + P[i+j])/2
    if B > A:
      A = B
 
print(A)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
E = [(1+i)/2 for i in p]
S = [0]*(N+1)
sum = 0
for i in range(N):
  sum += E[i]
  S[i+1] = sum
ans = 0
i = 0
while N-K-i >= 0:
  A = S[K+i] -S[i]
  ans = max(ans,A)
  i += 1
print(ans)

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

A = 0
for i in range(N-K+1):
  B = 0
  for j in range(K):
    E = 0
    for k in range(P[i+j]):
      E += k + 1
    E /= P[i+j]
    B += E
    if B > A:
      A = B

print(A)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
E = [(1+i)/2 for i in p]
S = [0]*(N+1)
sum = 0
for i in range(N):
  sum += E[i]
  S[i+1] = sum
ans = 0
i = 0
while N-K-i >= 0:
  A = S[K+i] -S[i]
  ans = max(ans,A)
  i += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

A = 0

for i in range(N):
  if P[i] <= min(P[0:i+1]):
  	A += 1
  if P[i] == 1:
    break
  elif P[i] == 2:
    A+=1
    break
print(A)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
 
A = 0
C = P[0]
for i in range(N):
  if P[i] <= C:
    C = P[i]
    A += 1
print(A)

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

A = 0

for i in range(N):
  if P[i] <= min(P[0:i+1]):
  	A += 1
  if P[i] == 1:
    break
print(A)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
 
A = 0
C = P[0]
for i in range(N):
  if P[i] <= C:
    C = P[i]
    A += 1
print(A)

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

A = 0

for i in range(N):
  if P[i] <= min(P[0:i+1]):
  	A += 1
print(A)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
 
A = 0
C = P[0]
for i in range(N):
  if P[i] <= C:
    C = P[i]
    A += 1
print(A)

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

A = 0

for i in range(N):
  B = 0
  for j in range(i+1):
    if P[i] <= P[j]:
      B += 1
  if B == i + 1:
    A += 1
print(A)
  

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
 
A = 0
C = P[0]
for i in range(N):
  if P[i] <= C:
    C = P[i]
    A += 1
print(A)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
P,S = [map(int,input().split()) for i in range(M)]

a = [0]*N

ac = 0
wa = 0

for i in range(M):
  if a[P[i]-1] == 0:
    if S[i] == "AC":
      ac += 1
      a[P[i]-1] = 1
    else:
      wa += 1
print(ac + " " + wa)
  

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

wa = [0]*N
ac = [0]*N

wac = 0
acc = 0

for i in range(M):
  p,s = input().split()
  p = int(p)
  if s == "AC":
    if ac[p-1] != 1:
      ac[p-1] = 1
      acc += 1
      wac += wa[p-1]
  else:
    if ac[p-1] == 0:
      wa[p-1] += 1
print(str(acc) +" "+ str(wac))
Buggy python submission (verdict: Runtime Error):
print(input().split().replace(" ","")


Fixed submission:
T , S = input().split()
print(S +T)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,K = map(int,input().split())

for i in range(K):
  if A > 0:
    A -= 1
  else:
    if B > 0:
    	B -= 1

print(str(A) + " " + str(B))

Fixed submission:
A,B,K = map(int,input().split())
 
if K >= A:
  B = B -(K-A)
  A = 0
  if B < 0:
    B = 0
else:
  A = A - K

print(str(A) + " " + str(B))

Buggy python submission (verdict: Runtime Error):
A,B,K = map(int,input().split())

for i in range(K):
  if A > 0:
    A -= 1
  else:
    if B > 0
    B -= 1

print(str(A) + " " + STR(B))

Fixed submission:
A,B,K = map(int,input().split())
 
if K >= A:
  B = B -(K-A)
  A = 0
  if B < 0:
    B = 0
else:
  A = A - K

print(str(A) + " " + str(B))
Buggy python submission (verdict: Runtime Error):
X = int(input())
while True:
  for i in range(1,N):
    if X % (i+1) == 0:
      break
    else:
      if i == N - 1:
        print(X)
        exit()
  X += 1
 


 
      
    


Fixed submission:
X = int(input())
if X == 2:
    print(2)
    exit()
while True:
    N = int(X**0.5)
    for i in range(1,N):
        if X % (i+1) == 0:
            break
        else:
          if i == N - 1:
            print(X)
            exit()
    X += 1

Buggy python submission (verdict: Runtime Error):
X = int(input())
while True:
  for i in range(1,N):
    if X % (i+1) == 0:
      break
    else:
      if i == N - 1:
        print(X)
        exit()
  X += 1
 


 
      
    

Fixed submission:
X = int(input())
if X == 2:
    print(2)
    exit()
while True:
    N = int(X**0.5)
    for i in range(1,N):
        if X % (i+1) == 0:
            break
        else:
          if i == N - 1:
            print(X)
            exit()
    X += 1
Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)
n = N // 2
A = 0

if N % 2 == 0:
  T = S[:n]
  U = S[n::-1].reverse()
print(T)
print(U)

Fixed submission:
S = input()
N = len(S)
n = N // 2
A = 0

if N % 2 == 0:
  T = S[:n]
  U = S[:n-1:-1]
else:
  T = S[:n]
  U = S[:n:-1]
for i in range(n):
  if T[i] != U[i]:
    A += 1
print(A)