Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math


def main():
    a,b,n = map(int,input().split())
    m = math.floor(a * 0 /b) - a * math.floor(0/b)
    for i in range(1,min(b-1,n)+1):
        if m < math.floor(a * i / b) - a * math.floor(i/b):

            m = math.floor(a * i / b) - a * math.floor(i/b)
    print(m)
if __name__ == "__main__":
    main()


Fixed submission:
import math


def main():
    a,b,n = map(int,input().split())
    # m = math.floor(a * 0 /b) - a * math.floor(0/b)
    # for i in range(1,min(b-1,n)+1):
    #     if m < math.floor(a * i / b) - a * math.floor(i/b):
    #         m = math.floor(a * i / b) - a * math.floor(i/b)
    i = min(b-1,n)
    m = a*i//b - a*(i//b)
    
    print(m)
if __name__ == "__main__":
    main()

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


def main():
    a,b,n = map(int,input().split())
    m = math.floor(a * 0 /b) - a * math.floor(0/b)
    for i in range(1,n+1):
        if m < math.floor(a * i / b) - a * math.floor(i/b):

            m = math.floor(a * i / b) - a * math.floor(i/b)
    print(m)
if __name__ == "__main__":
    main()


Fixed submission:
import math


def main():
    a,b,n = map(int,input().split())
    # m = math.floor(a * 0 /b) - a * math.floor(0/b)
    # for i in range(1,min(b-1,n)+1):
    #     if m < math.floor(a * i / b) - a * math.floor(i/b):
    #         m = math.floor(a * i / b) - a * math.floor(i/b)
    i = min(b-1,n)
    m = a*i//b - a*(i//b)
    
    print(m)
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def ProblemA(X):
    if X>=30:
        print('Yes')
    else;
        print('No')
X=int(input())
ProblemA(X)

Fixed submission:
def ProblemA(X):
    if X>=30:
        print('Yes')
    else:
        print('No')
X=int(input())
ProblemA(X)
Buggy python submission (verdict: Runtime Error):
import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=0
y=copy.copy(a)
a=a-1
while l<=a:
    x=(l+a)//2
    m=0
    for i in range(N):
        if A[i]%x==0:
            m+=A[i]//x-1
        else:
            m+=A[i]//x
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)

Fixed submission:
import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=1
y=copy.copy(a)
a=a-1
while l<=a:
    x=(l+a)//2
    m=0
    for i in range(N):
        if A[i]%x==0:
            m+=A[i]//x-1
        else:
            m+=A[i]//x
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)

Buggy python submission (verdict: Runtime Error):
import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=0
y=copy.copy(a)
a=a-1
while l<=a:
    x=(l+a)//2
    m=sum([A[i]//x for i in range(N)]) # x以下にするための回数
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)

Fixed submission:
import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=1
y=copy.copy(a)
a=a-1
while l<=a:
    x=(l+a)//2
    m=0
    for i in range(N):
        if A[i]%x==0:
            m+=A[i]//x-1
        else:
            m+=A[i]//x
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)

Buggy python submission (verdict: Runtime Error):
import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=0
y=copy.copy(a)
while l<=a:
    x=(l+a)//2
    m=sum([A[i]//x for i in range(N)]) # x以下にするための回数
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)

Fixed submission:
import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=1
y=copy.copy(a)
a=a-1
while l<=a:
    x=(l+a)//2
    m=0
    for i in range(N):
        if A[i]%x==0:
            m+=A[i]//x-1
        else:
            m+=A[i]//x
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
X=input()
def popcount(n):
    s=str(bin(n))
    return len([i for i in s if i=='1'])
def f(n,P):
    c=0
    while n!=0:
        n=n%P
        P=popcount(n)
        c=c+1
    return c
x=int(X,2)
P=popcount(x)
for i in range(N):
    F=list(X)
    if F[i]=='1':
        F[i]='0'
        Q=P-1
        y=x-2**(N-i-1)
    else:
        F[i]='1'
        Q=P+1
        y=x+2**(N-i-1)
    print(f(y,Q))

Fixed submission:
N=int(input())
X=input()
def popcount(n):
    s=str(bin(n))
    return len([i for i in s if i=='1'])
def f(n):
    c=1
    while n!=0:
        n=n%popcount(n)
        c=c+1
    return c
x=int(X,2)
P=popcount(x)
F=list(X)
L=[1,2]# L[i]=2**i%(P+1)
M=[1,2]# M[i]=2**i%(P-1)
if P!=1:
    for i in range(1,N):
        L.append((L[i]*2)%(P+1))
        M.append((M[i]*2)%(P-1))
    s=x%(P+1)
    t=x%(P-1)
    for i in range(N):
        if F[i] == '1':
            q = (t - M[N-i-1])%(P-1)
            print(f(q))
        else:
            Q = P + 1
            q = (s + L[N-i-1])%(P+1)
            print(f(q))
else:
    for i in range(1,N):
        L.append(0)
    s=x%2
    for i in range(N):
        if F[i] == '1':
            print(0)
        else:
            q = (s + L[N - i - 1])%2
            print(f(q))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
X=input()
def popcount(n):
    s=str(bin(n))
    return len([i for i in s if i=='1'])
def f(n):
    c=0
    while n!=0:
        n=n%popcount(n)
        c=c+1
    return c
for i in range(N):
    F=list(X)
    if F[i]=='1':
        F[i]='0'
    else:
        F[i]='1'
    s=''
    for d in F:
        s=s+d
    print(f(int(s,2)))

Fixed submission:
N=int(input())
X=input()
def popcount(n):
    s=str(bin(n))
    return len([i for i in s if i=='1'])
def f(n):
    c=1
    while n!=0:
        n=n%popcount(n)
        c=c+1
    return c
x=int(X,2)
P=popcount(x)
F=list(X)
L=[1,2]# L[i]=2**i%(P+1)
M=[1,2]# M[i]=2**i%(P-1)
if P!=1:
    for i in range(1,N):
        L.append((L[i]*2)%(P+1))
        M.append((M[i]*2)%(P-1))
    s=x%(P+1)
    t=x%(P-1)
    for i in range(N):
        if F[i] == '1':
            q = (t - M[N-i-1])%(P-1)
            print(f(q))
        else:
            Q = P + 1
            q = (s + L[N-i-1])%(P+1)
            print(f(q))
else:
    for i in range(1,N):
        L.append(0)
    s=x%2
    for i in range(N):
        if F[i] == '1':
            print(0)
        else:
            q = (s + L[N - i - 1])%2
            print(f(q))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
L=[(i,A[i]) for i in range(N)]
B=sorted(L,key=lambda x: x[1],reverse=True)
S=0
i=0
for j in range(1,N):
    if j%2==1:
        S+=B[0][1]
        del B[0]
    else:
        S+=B[0][1]
print(S)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=sorted(A,reverse=True)
S=0
i=0
for j in range(1,N):
    if j%2==1:
        S+=B[i]
        i+=1
    else:
        S+=B[i]
print(S)
Buggy python submission (verdict: Runtime Error):
a=input()
print(a+a^2+a^3)

Fixed submission:
a=int(input())
print(a+a**2+a**3)
Buggy python submission (verdict: Runtime Error):
import copy
L = list(map(int, input().split())) # N, M, K=map(int,input().split())
N=L[0]
M=L[1]
K=L[2]
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = 0
b = 0
p=N
q=M
for i in range(N):
    a=a+A[i]
    if a>K:
        a=a-A[i]
        p=i
        break
if a<K:
    X=K-a
    for j in range(M):
        b=b+B[j]
        if b>X:
            b=b-B[j]
            q=j
            break
c=a+b
count=p+q
F=[p+q]
u=0
for i in range(p):
    u=0
    c=c-A[p-i-1]
    count=count-1
    for j in range(M-q):
        c=c+B[q+j]
        if K<c:
            c=c-B[q]
            F.append(copy.copy(count))
            u=1
            break
        else:
            count=count+1
            q=q+1
    if u==0:
        F.append(copy.copy(count))
        break
print(max(F))

Fixed submission:
N, M, K=map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
LA = [0]
LB = [0]
for i in range(N):
    C=LA[i]+A[i]
    if C>K:
        N=i
        break
    else:
        LA.append(C)
for j in range(M):
    C=LB[j]+B[j]
    if C>K:
        M=j
        break
    else:
        LB.append(C)
r=N
for i in range(N+1):
    u=0
    for j in range(r-N+i,M+1):
        if LA[N-i]+LB[j]>K:
            r=max(r,N-i+j-1) # 最大のrを求めたいので結果をrefineする場合だけで回す
            u=1
            break
    if u==0:
        r=max(r,N-i+M)
        break
print(r)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
L = list(map(int, input().split())) # N, M, K=map(int,input().split())
N=L[0]
M=L[1]
K=L[2]
A = list(map(int, input().split()))
B = list(map(int, input().split()))
P=[(0,0)]
R=[0]
c=0
while c!=N+M or Q!=[]:
    Q=[]
    S=[]
    c=c+1
    n=len(P)
    for i in range(n):
        a=P[i][0]
        b=P[i][1]
        if a<N and ((a+1,b) not in Q):
            C=R[i]+A[a]
            if C<=K:
                Q.append((a+1,b))
                S.append(C)
        if b<M  and ((a,b+1) not in Q):
            C=R[i]+B[b]
            if C<=K:
                Q.append((a,b+1))
                S.append(C)
    if Q!=[]:
        P=copy.copy(Q)
        R=copy.copy(S)
    else:
        c=c-1
        break
print(c)

Fixed submission:
N, M, K=map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
LA = [0]
LB = [0]
for i in range(N):
    C=LA[i]+A[i]
    if C>K:
        N=i
        break
    else:
        LA.append(C)
for j in range(M):
    C=LB[j]+B[j]
    if C>K:
        M=j
        break
    else:
        LB.append(C)
r=N
for i in range(N+1):
    u=0
    for j in range(r-N+i,M+1):
        if LA[N-i]+LB[j]>K:
            r=max(r,N-i+j-1) # 最大のrを求めたいので結果をrefineする場合だけで回す
            u=1
            break
    if u==0:
        r=max(r,N-i+M)
        break
print(r)
Buggy python submission (verdict: Runtime Error):
=int(input())
Al=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
s=''
M=[26**i for i in range(12)]
S=[]
k=0
for i in range(11):
    k=k+M[i]
    if N<k:
        m=k-M[i]
        N=N-m
        L=[0]
        n=0
        for j in range(1, i+1):
            L.append(N%M[j])
            s=Al[(L[j]-L[j-1])//M[j-1]]+s
        break
print(s)

Fixed submission:
N=int(input())
Al=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
s=''
M=[26**i for i in range(12)]
k=0
for i in range(12):
    k=k+M[i]
    if N<k:
        m=k-M[i]
        N=N-m
        L=[0]
        n=0
        for j in range(1, i+1):
            L.append(N%M[j])
            s=Al[(L[j]-L[j-1])//M[j-1]]+s
        break
print(s)

Buggy python submission (verdict: Runtime Error):
N=int(input())
Al=['z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y']
s=''
L=[]
M=[26**i for i in range(12)]
for i in range(1,12):
    if M[i-1]<=N:
        L.append(N%M[i])
    else:
        l=i
        break
for i in range(l-1):
    if i==0:
        s=s+Al[L[i]]
    else:
        s=Al[(L[i]-L[i-1])//M[i]]+s
print(s)

Fixed submission:
N=int(input())
Al=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
s=''
M=[26**i for i in range(12)]
k=0
for i in range(12):
    k=k+M[i]
    if N<k:
        m=k-M[i]
        N=N-m
        L=[0]
        n=0
        for j in range(1, i+1):
            L.append(N%M[j])
            s=Al[(L[j]-L[j-1])//M[j-1]]+s
        break
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
A.sort()
C=[]
while len(A)>0:
    c=len(A)
    a=A[0]
    if len(A)>1 and A[1]==a:
        pass
    else:
        C.append(a)
    A=[A[j] for j in range(c) if A[j]%a!=0]
print(len(C))

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A.sort()
TF={a:True for a in A}
for i in range(N):
    if TF[A[i]]==True:
        if i > 0 and A[i - 1] == A[i]:
            TF[A[i]] = False
        m=A[N-1]//A[i]
        for j in range(2,m+1):
            s=A[i]*j
            if s in TF:
                TF[s]=False
print(len([1 for a in A if TF[a]==True]))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
A.sort()
C=[]
i=0
while len(A)>0:
    c=len(A)
    a=A[0]
    del A[0]
    if a not in A:
        C.append(a)
    A=[A[j] for j in range(c-1) if A[j]%a!=0]
print(len(C))

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A.sort()
TF={a:True for a in A}
for i in range(N):
    if TF[A[i]]==True:
        if i > 0 and A[i - 1] == A[i]:
            TF[A[i]] = False
        m=A[N-1]//A[i]
        for j in range(2,m+1):
            s=A[i]*j
            if s in TF:
                TF[s]=False
print(len([1 for a in A if TF[a]==True]))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
S=set(A)
F=[]
for a in S:
    if A.count(a)==1:
        F.append(a)
T=0
for a in F:
    c=0
    for l in S:
        if a%l==0 and a!=l:
            c=1
            break
    if c==0:
        T+=1
print(T)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A.sort()
TF={a:True for a in A}
for i in range(N):
    if TF[A[i]]==True:
        if i > 0 and A[i - 1] == A[i]:
            TF[A[i]] = False
        m=A[N-1]//A[i]
        for j in range(2,m+1):
            s=A[i]*j
            if s in TF:
                TF[s]=False
print(len([1 for a in A if TF[a]==True]))
Buggy python submission (verdict: Time Limit Exceeded):
N, S=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[0]+A
dp=[[0 for j in range(S+1)] for i in range(N+1)]
dp[0][0]=1
for i in range(1,N+1):
    for j in range(S+1):
        dp[i][j]=(dp[i][j]+2*dp[i-1][j]) %998244353 # x[i]を入れないが、大きい方に入れるか入れないかが二通り
    for j in range(S-A[i]+1):
        dp[i][j+A[i]]=(dp[i][j+A[i]]+dp[i-1][j]) %998244353 # x[i]を入れる
print(dp[N][S])

Fixed submission:
N, S=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[0]+A
dp=[[0 for j in range(S+1)] for i in range(N+1)]
dp[0][0]=1
for i in range(1,N+1):
    for j in range(S+1):
        dp[i][j]=(dp[i][j]+2*dp[i-1][j]) %998244353 # x[i]を入れないが、大きい方に入れるか入れないかが二通り
    for j in range(S-A[i]+1):
        dp[i][j+A[i]]=(dp[i][j+A[i]]+dp[i-1][j]) %998244353 # x[i]を入れる
print(dp[N][S])

Buggy python submission (verdict: Time Limit Exceeded):
N, S=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[0]+A
dp=[[0 for j in range(S+1)] for i in range(N+1)]
dp[0][0]=1
for i in range(1,N+1):
    for j in range(S+1):
        dp[i][j]=(dp[i][j]+2*dp[i-1][j]) %998244353 # x[i]を入れないが、大きい方に入れるか入れないかが二通り
        if j+A[i]<=S:
            dp[i][j+A[i]]=(dp[i][j+A[i]]+dp[i-1][j]) %998244353 # x[i]を入れる
print(dp[N][S])

Fixed submission:
N, S=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[0]+A
dp=[[0 for j in range(S+1)] for i in range(N+1)]
dp[0][0]=1
for i in range(1,N+1):
    for j in range(S+1):
        dp[i][j]=(dp[i][j]+2*dp[i-1][j]) %998244353 # x[i]を入れないが、大きい方に入れるか入れないかが二通り
    for j in range(S-A[i]+1):
        dp[i][j+A[i]]=(dp[i][j+A[i]]+dp[i-1][j]) %998244353 # x[i]を入れる
print(dp[N][S])
Buggy python submission (verdict: Runtime Error):
N, M = input().split()
height = input().split()
able = []
for n in range(int(N)):
  able.append([])
for m in range(int(M)):
  con = input().split()
  con[0] = int(con[0]) - 1
  con[1] = int(con[1]) - 1
  able[con[0]].append(height(con[1]))
  able[con[1]].append(height(con[0]))
good = []
for n in range(int(N)):
  if len(able[n]) == 0:
    good.append(n)
  else:
    if int(height[n]) > max(able[n])
      good.append(n)
print(len(good))


Fixed submission:
N, M = input().split()
height = input().split()
able = []
for n in range(int(N)):
  able.append([])
for m in range(int(M)):
  con = input().split()
  con[0] = int(con[0]) - 1
  con[1] = int(con[1]) - 1
  able[con[0]].append(int(height[con[1]]))
  able[con[1]].append(int(height[con[0]]))
good = []
for n in range(int(N)):
  if len(able[n]) == 0:
    good.append(n)
  else:
    if int(height[n]) > max(able[n]):
      good.append(n)
print(len(good))
Buggy python submission (verdict: Time Limit Exceeded):
target = int(input())
 
year = 0
money = 100
while money < target:
  year += 1
  money *= 1.01
  if "." in str(money):
    money = str(money)
    money = money.split(".")
    money = int(money[0])
print(year)

Fixed submission:
import math

target = int(input())
 
year = 0
money = 100
while money < target:
  year += 1
  money *= 1.01
  money = math.floor(money)
print(year)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
X,K,D=map(int,input().split())

for ii in range(K):
    if abs(X)<=D:
        if (K-ii)%2==1:
            if X>=0:
                X-=D
            else:
                X+=D
        break
    elif X>=0:
        X-=D
    else:
        X+=D
print(abs(X))
        


Fixed submission:
# -*- coding: utf-8 -*-
X,K,D=map(int,input().split())

X=abs(X)
ii=int(X/D)
if K<=ii:
    X-=K*D
else:
    X-=ii*D
    if (K-ii)%2==1:
        X-=D

print(abs(X))
Buggy python submission (verdict: Runtime Error):
print(eval(input().replase(" ","*")))

Fixed submission:
print(eval(input().replace(" ","*")))
Buggy python submission (verdict: Runtime Error):
from decimal import *
import numpy as np
n=input()
ans=list(map(Decimal,input().split()))
ans = np.prod(ans)

if ans>10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
n=input()
A=list(map(int,input().split()))
ans=1
if A.count(0)==0:
  for i in A:
    ans*=i
    if ans>10**18:
      ans=-1
      break
else:
  ans=0
print(ans)

Buggy python submission (verdict: Runtime Error):
from decimal import *
import numpy as np
n=input()
ans=list(map(Decimal,input().split()))
ans = np.prod(ans)

if ans>10**18:
  print(-1)
else:
  print(int(ans))

Fixed submission:
n=input()
A=list(map(int,input().split()))
ans=1
if A.count(0)==0:
  for i in A:
    ans*=i
    if ans>10**18:
      ans=-1
      break
else:
  ans=0
print(ans)

Buggy python submission (verdict: Runtime Error):
from decimal import *
n=input()
ans=eval("Decimal("+input().replace(" ",")*Decimal(")+")")

if ans>10**18:
  print(-1)
else:
  print(int(ans))

Fixed submission:
n=input()
A=list(map(int,input().split()))
ans=1
if A.count(0)==0:
  for i in A:
    ans*=i
    if ans>10**18:
      ans=-1
      break
else:
  ans=0
print(ans)

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

n=input()
a=list(map(int,input().split()))
a=np.array(a,dtype="float64")
ans=np.prod(a)

if ans>10**18:
  print(-1)
else:
  print(int(ans))

Fixed submission:
n=input()
A=list(map(int,input().split()))
ans=1
if A.count(0)==0:
  for i in A:
    ans*=i
    if ans>10**18:
      ans=-1
      break
else:
  ans=0
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator

n=input()
a=list(map(int,input().split()))
ans= functools.reduce(operator.mul, a)

if ans>10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
n=input()
A=list(map(int,input().split()))
ans=1
if A.count(0)==0:
  for i in A:
    ans*=i
    if ans>10**18:
      ans=-1
      break
else:
  ans=0
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=input()
a=list(map(int,input().split()))
ans=1
for i in a:
  ans*=i
if ans>10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
n=input()
A=list(map(int,input().split()))
ans=1
if A.count(0)==0:
  for i in A:
    ans*=i
    if ans>10**18:
      ans=-1
      break
else:
  ans=0
print(ans)

Buggy python submission (verdict: Runtime Error):
n=input()
ans=eval(input().replace(" ","*"))
if ans>10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
n=input()
A=list(map(int,input().split()))
ans=1
if A.count(0)==0:
  for i in A:
    ans*=i
    if ans>10**18:
      ans=-1
      break
else:
  ans=0
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int,input().split())
ans=a*b
print(math.floor(ans))

Fixed submission:
from decimal import *
a,b = input().split()
ans = Decimal(a) * Decimal(b)
print(ans.quantize(Decimal("1"),rounding=ROUND_DOWN))
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[]
B=[]
for _ in range(M):
  a,b=map(int,input().split())
  A.append(a)
  B.append(b)
ans=0
for i in range(1,N+1):
  f=True
  for j in range(M):
    if A[j]==i:
      if H[i-1]<=H[B[j]-1]:
        f=False
    if B[j]==i:
      if H[i-1]<=H[A[j]-1]:
        f=False
  if f:
    ans+=1
print(ans)

Fixed submission:
N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[]
B=[]
for _ in range(M):
  a,b=map(int,input().split())
  A.append(a)
  B.append(b)
ans=0
f=[True]*N
for j in range(M):
  if H[A[j]-1]<=H[B[j]-1]:
    f[A[j]-1]=False
  if H[B[j]-1]<=H[A[j]-1]:
    f[B[j]-1]=False
for i in f:
  if i:ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
R=int(input())

print(3.14*math.tau)

Fixed submission:
import math
R=int(input())

print(R*math.tau)
Buggy python submission (verdict: Time Limit Exceeded):
import math


K=int(input())

ans=0

for a in range(K):
    for b in range(K):
        for c in range(K):
            ans += math.gcd(math.gcd(a+1,b+1),c+1)

print(ans)

Fixed submission:
import math


K=int(input())

ans=0

for a in range(K):
    for b in range(K):
        tmp=math.gcd(a+1,b+1)
        for c in range(K):
            ans += math.gcd(tmp,c+1)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K=int(input())

ans=K**2+(K-1)*K+(K-1)*(K-1)

for a in range(1,K):
    for b in range(1,K):
        for c in range(1,K):
            ans += gcd(a+1,b+1,c+1)

print(ans)

Fixed submission:
import math


K=int(input())

ans=0

for a in range(K):
    for b in range(K):
        tmp=math.gcd(a+1,b+1)
        for c in range(K):
            ans += math.gcd(tmp,c+1)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K=int(input())

ans=0

for a in range(K):
    for b in range(K):
        for c in range(K):
            ans += gcd(a+1,b+1,c+1)

print(ans)

Fixed submission:
import math


K=int(input())

ans=0

for a in range(K):
    for b in range(K):
        tmp=math.gcd(a+1,b+1)
        for c in range(K):
            ans += math.gcd(tmp,c+1)

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

ans = S.count("R")*S.count("G")*S.count("B")

tmp=0

for i in range(N):
  for j in range(i,N):
    if j-i+j < N:
      if S[i]==S[j] and S[j]==S[j-i+j] and S[i]==S[j-i+j]
        tmp += 1

ans = ans - tmp
print(ans)

Fixed submission:
N=int(input())
S=input()

ans = S.count("R")*S.count("G")*S.count("B")

tmp=0

for i in range(N):
  for j in range(i,N):
    if j-i+j < N:
      if S[i]!=S[j] and S[j]!=S[j-i+j] and S[i]!=S[j-i+j]:
        tmp += 1

ans = ans - tmp
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

ans = S.count("R")*S.count("G")*S.count("B")

tmp=0

for i in range(N):
  for j in range(i,N):
    if j-i+j < N:
      if len(set([S[i],S[j],S[j-i+j]]))==3:
        tmp += 1

ans = ans - tmp
print(ans)

Fixed submission:
N=int(input())
S=input()

ans = S.count("R")*S.count("G")*S.count("B")

tmp=0

for i in range(N):
  for j in range(i,N):
    if j-i+j < N:
      if S[i]!=S[j] and S[j]!=S[j-i+j] and S[i]!=S[j-i+j]:
        tmp += 1

ans = ans - tmp
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(input())

ans=0

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if j-i != k-j and S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                ans += 1

print(ans)

Fixed submission:
N=int(input())
S=input()

ans = S.count("R")*S.count("G")*S.count("B")

tmp=0

for i in range(N):
  for j in range(i,N):
    if j-i+j < N:
      if S[i]!=S[j] and S[j]!=S[j-i+j] and S[i]!=S[j-i+j]:
        tmp += 1

ans = ans - tmp
print(ans)