Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02682 (python)

Fixed submission:
import sys 
from collections import deque
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())
def LS(): return list(sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def Main():
    a,b,c,k = IL()
    ta = min(k,a)
    tb = min(k-ta,b)
    if tb<0:    tb = 0
    tc = k-ta-tb
    print(ta-tc)
    return

if __name__=='__main__':
    Main()

Buggy submission (verdict: Runtime Error):
import sys 
from collections import deque
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())
def LS(): return list(sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def Main():
    a,b,c,k = IL()
    l = [1]*a+[0]*b+[-1]*c
    print(sum(l[:k]))
    return

if __name__=='__main__':
    Main()

Buggy submission (verdict: Runtime Error):
import sys 
from collections import deque
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())
def LS(): return list(sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def Main():
    a,b,c,k = IL()
    l = [1]*a+[0]*b+[-1]*c
    print(sum(l[:k]))
    return

if __name__=='__main__':
    Main()
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
a,b=map(Decimal,input().split())
print(int(a*b))

Buggy submission (verdict: Runtime Error):
import Decimal from decimal
a,b=map(Decimal,input().split())
print(int(a*b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(int(a*b))
Problem p02729 (python)

Fixed submission:
n,m=map(int,input().split())
print(int((n*(n-1)/2 + m*(m-1)/2)))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input())
print(int((n*(n-1)/2 + m*(m-1)*2)))
Problem p02679 (python)

Fixed submission:
import math
mod=1000000007
n=int(input())
iwashi_group={}
count=0

#傾きを第1象限(True)と第4象限(False)の座標で管理する
for i in range(n):
    a,b=map(int,input().split())
    
    if a*b>0:
        GCD=math.gcd(abs(a),abs(b))
        iwashi=(abs(a)//GCD,abs(b)//GCD)
        flag=True
    
    elif a*b<0:
        GCD=math.gcd(abs(a),abs(b))
        iwashi=(abs(b)//GCD,abs(a)//GCD)
        flag=False

    elif a==0 and b==0:
        count+=1
        continue

    elif a==0:
        iwashi=(0,1)
        flag=True
    
    elif b==0:
        iwashi=(0,1)
        flag=False
  
    if iwashi in iwashi_group:
        if flag:
            iwashi_group[iwashi][0]+=1
        else:
            iwashi_group[iwashi][1]+=1
    else:
        if flag:
            iwashi_group[iwashi]=[1,0]
        else:
            iwashi_group[iwashi]=[0,1]

ans=1
for a,b in iwashi_group.values():
    ans=ans*(2**a+2**b-1)%mod

print((ans+count-1)%mod)

Buggy submission (verdict: Runtime Error):
import math
mod=1000000007
n=int(input())
iwashi_group={}

#傾きを第1象限(True)と第4象限(False)の座標で管理する
for i in range(n):
    a,b=map(int,input().split())
    
    if a*b>0:
        GCD=math.gcd(abs(a),abs(b))
        iwashi=(abs(a)//GCD,abs(b)//GCD)
        flag=True
    
    elif a*b<0:
        GCD=math.gcd(abs(a),abs(b))
        iwashi=(abs(b)//GCD,abs(a)//GCD)
        flag=False

    elif a==0 and b==0:
        Flag=True
        continue

    elif a==0:
        iwashi=(0,1)
        flag=True
    
    elif b==0:
        iwashi=(0,1)
        flag=False
  
    if iwashi in iwashi_group:
        if flag:
            iwashi_group[iwashi][0]+=1
        else:
            iwashi_group[iwashi][1]+=1
    else:
        if flag:
            iwashi_group[iwashi]=[1,0]
        else:
            iwashi_group[iwashi]=[0,1]

ans=1
for a,b in iwashi_group.values():
    ans=ans*(2**a+2**b-1)%mod
if Flag:
    print(ans)
else:
    print(ans-1)
Problem p02685 (python)

Fixed submission:
n,m,k=map(int,input().split())
mod=998244353
cntb=1
ans=0
for i in range(k+1):
    ans=ans+(((m*pow(m-1,n-1-i,mod))%mod)*cntb)%mod
    ans=ans%mod
    cntb=(cntb*(n-1-i)*pow(i+1,mod-2,mod))%mod
print(ans%mod)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
mod=998244353
cntb=1
for i in range(k+1):
    # cntb*=(n-i)//i
    ans+=((m*pow(m-1,n-1-i,mod)％mod)*cntb)%mod
    ans%=mod
    cntb*=((n-i−1)*pow(i+1,mod-2,mod))%mod
print(ans%mod)
Problem p02693 (python)

Fixed submission:
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        exit()
print("NG")

Buggy submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
a1=int(a*n/b)-a*int(n/b)
print(a1)
Problem p02759 (python)

Fixed submission:
N = int(input())
print((N+1)//2)

Buggy submission (verdict: Runtime Error):
# ABC 157 C
list_s=[]
list_c=[]
Flag=0
N,M= map(int,input().split())

for i in range(M):
    s,c= map(int,input().split())
    list_s.append(s)
    list_c.append(c)
    if s in list_s:
        x=list_s.index(s)
        n=list_c[x]

        if n!=c:
            Flag=1

if 1 in list_s:
    in1=list_s.index(1)
    n1=list_c[in1]
    if n1==0:
        Flag=1
else :
    n1=1

if 2 in list_s:
    in2=list_s.index(2)
    n2=list_c[in2]
else :
    n2=0

if 3 in list_s:
    in3=list_s.index(3)
    n3=list_c[in3]
else :
    n3=0

if N==1 and n1==0:
    Flag=0
    
if Flag==0:
    if N==1:
        if M==0:
            print(0)
        else:
            print(n1)
    if N==2:
        print(10*n1+n2)
    if N==3:
        print(100*n1+10*n2+n3)
else :
    print(-1)
Problem p02860 (python)

Fixed submission:
N=int(input())
S=input()
if N%2==0:
  if S[:int(N/2)]==S[int(N/2):]:
    print("Yes")
    exit()
print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
if N%2==0:
  if S[:N/2]==S[N/2:]:
    print("Yes")
    exit()
print("No")
Problem p02879 (python)

Fixed submission:
a,b=map(int,input().split())
if a>9 or b>9:
  print(-1)
else:
  print(a*b)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a>9 or b>9:
  pritn(-1)
else:
  print(a*b)
Problem p02933 (python)

Fixed submission:
a=int(input())
s=input()

if a>=3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline 
n,q=map(int,input().split())
Graph=[[] for _ in range(n+1)]
ans=[0 for _ in range(n+1)]
seen=[False for _ in range(n+1)]

for _ in range(n-1):
    a,b=map(int,input().split())
    Graph[a].append(b)
    Graph[b].append(a)

for _ in range(q):
    p,x=map(int,input().split())
    ans[p]+=x

def dfs(v):
    seen[v]=True
    for nv in Graph[v]:
        if seen[nv]:
            continue
        else:
            ans[nv]+=ans[v]
            dfs(nv)

dfs(1)
print(*ans[1:])
Problem p03013 (python)

Fixed submission:
N,M=map(int,input().split())
mod=1000000007
f=[False]*(N+1)
for _ in range(M):
    i=int(input())
    f[i]=True
dp=[0 for _ in range(N+1)]

if N==1:
    if f[1]:
        print(0)
    else:
        print(1)
else:
    if f[1] and f[2]:
        print(0)
        exit()
    elif f[1]:
        dp[1]=0;dp[2]=1
    elif f[2]:
        dp[1]=1;dp[2]=0
    else:
        dp[1]=1;dp[2]=2

    for i in range(3,N+1):
        if f[i]:
            dp[i]=0
        else:
            dp[i]=dp[i-1]+dp[i-2]
    print(dp[N]%mod)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
mod=1000000007
f=[False]*(N+1)
for _ in range(M):
    i=int(input())
    f[i]=True
dp=[0 for _ in range(N+1)]

if f[1] and f[2]:
    print(0)
    exit()
elif f[1]:
    dp[1]=0;dp[2]=1
elif f[2]:
    dp[1]=1;dp[2]=0
else:
    dp[1]=1;dp[2]=2

for i in range(3,N+1):
    if f[i]:
        dp[i]=0
    else:
        dp[i]=dp[i-1]+dp[i-2]
print(dp[N]%mod)
Problem p03775 (python)

Fixed submission:
import math
N=int(input())
a=0
for i in range(1,1+math.ceil(math.sqrt(N))):
    if N%i==0 and i>a:
        a=i
b=int(N/a)
print(max([len(str(a)),len(str(b))]))

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
a=0
for i in range(1,1+math.ceil(math.sqrt(N))):
    if N%i==0 and i>a:
        a=i
b=int(N/a)
print(max([len(str(a)),len(str(b))]))9876543210
Problem p02598 (python)

Fixed submission:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,k=map(int,input().split())
a=lmp()

def ok(s):
    c=0
    for i in a:
        c+=-(-i//s)-1
    return c<=k


l=0
r=max(a)
while r>l+1:
    md=(r+l)//2
    if ok(md):
        r=md
    else:
        l=md
print(r)

Buggy submission (verdict: Runtime Error):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,k=mp()
a=sorted(lmp())
ans=10**10
l=1
r=a[-1]
while True:
    if x==l and y==r:
        print(r)
        exit()
    m=(l+r)//2
    c=0
    for i in a:
        c+=-(-i//m)-1
    if c>k:
        l=m
    else:
        r=m
Problem p02659 (python)

Fixed submission:
a,b=map(float,input().split())
a=int(a)
b=int(b*1000)
print((a*b)//1000)

Buggy submission (verdict: Runtime Error):
from decimal import Decimal
a,b=map(str,input().split())
f1 = Decimal(a)
f2 = Decimal(b)
print(int(a*b))
Problem p02729 (python)

Fixed submission:
import math
n,m=map(int,input().split())
if n>1:
  N=math.factorial(n) // (math.factorial(n - 2) * 2)
else:
  N=0
if m>1:
  M=math.factorial(m) // (math.factorial(m - 2) * 2)
else:
  M=0
print(N+M)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
l=[int(x) for x in input().split()]
for k in range(n):
  L=l.pop(k)
  ans=0
  for i in range(n+1):
    c=l.count(i)
    if c>1:
      ans=ans+math.factorial(c) // (math.factorial(c- 2) * 2)
  print(ans)
  l.insert(k,L)
Problem p02766 (python)

Fixed submission:
n,k=map(int,input().split())
for i in range(100000000000):
  if k**i>n:print(i);exit()

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=k
if k>n:
  print(i)
  exit()
for i in range(1000000):
  s*=k
  if s>n:
    print(i+2)
    exit()
Problem p02771 (python)

Fixed submission:
s=list(set(input().split()))
if len(s)==2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
list=[int(input()) for i in range(3)]
print("Yes" if len(set(list))=2 else "No")

Buggy submission (verdict: Runtime Error):
list=[int(input()) for i in range(3)]
print(len(set(list)))
Problem p02777 (python)

Fixed submission:
s,t=input().split()
a,b=map(int,input().split())
u=input()
if s==u:
  print(a-1,b)
else:
  print(a,b-1)

Buggy submission (verdict: Runtime Error):
s,t=map(input().split())
a,b=map(int,input().split())
u=input()
if s==u:
  print(a-1,b)
else:
  print(a,b-1)
Problem p02860 (python)

Fixed submission:
n=int(input())
s=input()
if n%2==1:
  print("No")
  exit()
for i in range(n//2):
  if s[i]!=s[n//2+i]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
if n%2==1:
  print("No")
  exit()
for i in range((n//2)-1):
  if a[i]!=a[-i-1]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
if n%2!=0:
  print("No")
  exit()
for i in range(n//2+1):
  if a[i]!=a[-i-1]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
l=len(s)
s2=s.pop(l//2)
print("Yes" if s==s2 else "No")
Problem p03013 (python)

Fixed submission:
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

mod=1000000007
n,m=mp()
dp=[0]*(n+2)
dp[0]=1
for i in range(m):
    a=int(input())
    dp[a]=-1
for i in range(n):
    if dp[i]==-1:
        continue
    if dp[i+1]>=0:
        dp[i+1]+=dp[i]
        dp[i+1]=dp[i+1]%mod
    if dp[i+2]>=0:
        dp[i+2]+=dp[i]
        dp[i+2]=dp[i+2]%mod
print(dp[-2]%mod)

Buggy submission (verdict: Runtime Error):
from functools import lru_cache
n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
a=sorted(a)
@lru_cache(maxsize=None) 
def fib(n): 
    if n <= 1:
        return 1
    else:
        return fib(n - 2) + fib(n - 1)
ans=fib(a[0])*fib(n-a[-1])
for i in range(1,m):
  if a[i]-a[i-1]==1:
    print(0)
    exit()
  elif m==1:
    print(ans)
    exit()
  ans=ans*fib(a[i]-a[i-1]-1)
print(ans%1000000007)
Problem p03017 (python)

Fixed submission:
import sys
from collections import Counter
from collections import deque
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,a,b,c,d=mp()
s=input()
if s[a-1]=="#" or s[b-1]=="#" or s[c-1]=="#" or s[d-1]=="#":
    print("No")
    exit()
for i in range(min(a,b)-1,max(c,d)):
    if s[i]=="#" and s[i+1]=="#":
        print("No")
        exit()
if d<c:
    ch=False
    for i in range(b-2,d-1):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            ch=True
    if ch:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter
from collections import deque
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,a,b,c,d=mp()
s=input()
if s[a-1]=="#" or s[b-1]=="#" or s[c-1]=="#" or s[d-1]=="#":
    print("No")
    exit()
for i in range(min(a,b)-1,max(c,d)):
    if s[i]=="#" and s[i+1]=="#":
        print("No")
        exit()
if d<c:
    ch=False
    for i in range(b-1,d):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            ch=True
    if ch:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
else:
    print("Yes")
Problem p03038 (python)

Fixed submission:
import numpy as np
n,m=map(int,input().split())
a=sorted(list(map(int,input().split())))
l=[list(map(int,input().split())) for i in range(m)]
l.sort(key=lambda x: x[1], reverse=True)
l=np.array(l)


nl=[]
k=0
i=0
while k<=n and i<m:
  nl.extend([l[i][1]]*l[i][0])
  k+=l[i][0]
  i+=1


for i in range(min(n,np.sum(l, axis=0)[0])):
  if nl[i]<=a[i]:
    print(sum(nl[0:i])+sum(a[i:n]))
    exit()
if n<np.sum(l, axis=0)[0]:
  print(sum(nl[0:n]))
else:
  print(sum(nl)+sum(a[np.sum(l, axis=0)[0]:n]))

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m=map(int,input().split())
a=sorted(list(map(int,input().split())))
l=[list(map(int,input().split())) for i in range(m)]
l.sort(key=lambda x: x[1], reverse=True)
l=np.array(l)


nl=[]
k=0
i=0
while k<=n and i<m:
  nl.extend([l[i][1]]*l[i][0])
  k+=l[i][0]
  i+=1


for i in range(min(n,np.sum(l, axis=0)[0])):
  if nl[i]<=a[i]:
    print(sum(nl[0:i])+sum(a[i:n]))
    exit()
if n<np.sum(l, axis=0)[0]:
  print(sum(nl[0:n]))
else:
  print(sum(nl)+sum(a[np.sum(l, axis=0)[0]:n]))
Problem p03042 (python)

Fixed submission:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

s=int(input())
a=s//100
b=s%100
if 0<a<13:
    if 0<b<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0<b<13:
        print("YYMM")
    else:
        print("NA")

Buggy submission (verdict: Runtime Error):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

s=int(input())
a=s//100
b=s%100
if (a==0 or a>12) and (b==0 or b>12):
    print("Na")
elif (a==0 or a>12):
    print("YYMM")
elif (b==0 or b>12):
    p12rint("MMYY")
else:
    print("AMBIGUOUS")
Problem p03208 (python)

Fixed submission:
n,k=map(int,input().split())
h=[int(input()) for _ in range(n)]
h=sorted(h)
l=[]
for i in range(n-k+1):
  l.append(h[i+k-1]-h[i])
print(min(l))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=[input() for _ in range(n)]
h=sorted(h)
l=[]
for i in range(n-k+1):
  l.append(h[i+k-1]-h[i])
print(min(l))
Problem p03705 (python)

Fixed submission:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,a,b=mp()
print(max(((b-a)*(n-2)+1),0))

Buggy submission (verdict: Runtime Error):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,a,b=mp()
print(max((b-a)*(n-2)+1),0)
Problem p02951 (python)

Fixed submission:
a,b,c = map(int,input().split());
if((a-b)<c):
  print(c-(a-b))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b,c = int(inpupt().split())
if((a-b)<c):
  print(c-(a-b))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b,c = int(input());
if((a-b)<c):
  print(c-(a-b))
else:
  print(0)
Problem p02571 (python)

Fixed submission:
def main():
	s = str(input())
	t = str(input())
	
	
	if len(s) == len(t):
		ans = 0
		for i in range(len(t)):
			if list(s)[i] == list(t)[i]:
				ans += 1
		print(len(t)-ans)

	else:
		l = []
		for i in range(len(s)-len(t)):
			l.append(s[i:i+len(t)])
		
		ans = []
		for c in l:
			counter = 0
			for i in range(len(c)):
				if list(c)[i] == list(t)[i]:
					counter += 1
			ans.append(counter)

		if not ans:
			print(len(t))
		else:
			print(len(t)-max(ans))





	

if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
def main():

	s = str(input())
	t = str(input())
	
	if len(s) < len(t):
		print(0)
	
	else:
		l = []
		for i in range(len(s)-len(t)):
			l.append(s[i:i+len(t)])
		
		ans = []
		for c in l:
			counter = 0
			for i in range(len(c)):
				if list(c)[i] == t[i]:
					counter += 1
			ans.append(counter)

		print(len(t)-max(ans))





	

if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
def main():
	s = str(input())
	t = str(input())
	
	if len(s) > len(t):
		print(0)
	
	else:
		l = []
		for i in range(len(s)-len(t)):
			l.append(s[i:i+len(t)])
		
		ans = []
		for c in l:
			counter = 0
			for i in range(len(c)):
				if list(c)[i] == t[i]:
					counter += 1
			ans.append(counter)
			
		print(len(t)-max(ans))





	

if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
def main():

	s = str(input())
	t = str(input())
	l = []
	for i in range(len(s)-len(t)):
		l.append(s[i:i+len(t)])
	ans = []
	for c in l:
		counter = 0
		for i in range(len(c)):
			if list(c)[i] == t[i]:
				counter += 1
		ans.append(counter)
	print(len(t)-max(ans))





	

if __name__ == '__main__':
	main()
Problem p02689 (python)

Fixed submission:
def main():
	n,m = map(int,input().split())
	h = list(map(int,input().split()))
	l = [list(map(int, input().split())) for i in range(m)]

	ans = int(n)
	del_list = set()
	for i in range(m):
		if h[l[i][0]-1] > h[l[i][1]-1] and l[i][1] not in del_list:
			ans -= 1
			del_list.add(l[i][1])
		elif h[l[i][0]-1] < h[l[i][1]-1] and l[i][0] not in del_list:
			ans -= 1
			del_list.add(l[i][0])
		elif h[l[i][0]-1] == h[l[i][1]-1]:
			if l[i][0] not in del_list and l[i][1] not in del_list:
				ans -= 2
				del_list.add(l[i][0])
				del_list.add(l[i][1])
			elif l[i][0] not in del_list:
				ans -= 1
				del_list.add(l[i][0])
			elif l[i][1] not in del_list:
				ans -= 1
				del_list.add(l[i][1])
			else:
				ans += 0
		else:
			ans += 0

	print(ans)





if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
def main():
	n,m = map(int,input().split())
	h = list(map(int,input().split()))
	l = [list(map(int, input().split())) for i in range(m)]

	ans = int(n)
	del_list = set()
	for i in range(m):
		print("i is {}".format(i), "and then del_list is {}".format(del_list))
		if h[l[i][0]-1] > h[l[i][1]-1] and l[i][1] not in del_list:
			ans -= 1
			del_list.add(l[i][1])
		elif h[l[i][0]-1] < h[l[i][1]-1] and l[i][0] not in del_list:
			ans -= 1
			del_list.add(l[i][0])
		elif h[l[i][0]-1] == h[l[i][1]-1]:
			if l[i][0] not in del_list and l[i][1] not in del_list:
				ans -= 2
				del_list.add(l[i][0])
				del_list.add(l[i][1])
			elif l[i][0] not in del_list:
				ans -= 1
				del_list.add(l[i][0])
			elif l[i][1] not in del_list:
				ans -= 1
				del_list.add(l[i][1])
			else:
				ans += 0
		else:
			ans += 0

	print(ans)





if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
def main():
	# k = int(input())
	# s = str(input())
	n,m = map(int,input().split())
	#1行R列
	h = list(map(int,input().split()))
	#R行1列
	# l = [int(input()) for i in range(n)]
	#R行C列
	l = [list(map(int, input().split())) for i in range(m)]

	ans = int(n)
	del_list = set()
	for i in range(m):
		if l[i][0] != l[i][1] and h[min(l[i][0]-1,l[i][1]-1)] not in del_list:
			ans -= 1
			del_list.add(min(h[l[i][0]-1],h[l[i][1]-1]))
			# print("i del {}".format(min(h[l[i][0]-1],h[l[i][1]-1])))
		else:
			if h[l[i][0]-1] in del_list and h[l[i][1]-1] in del_list:
				ans += 0
			elif h[l[i][0]-1] in del_list:
				ans -= 1
				del_list.add(min(h[l[i][0]-1]))
			else:
				ans -= 1
				del_list.add(min(h[l[i][1]-1]))
	print(ans)





if __name__ == '__main__':
	main()