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

Fixed submission:
S = input()


count=0

for i in range(len(S) // 2):
    if S[i] != S[-1-i]:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
S = input()

count=0

for i in range(len(S) // 2):
    if S[i] != RS[-1-i]:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
S = input()

count=0

for i in range(len(S) // 2):
    if S[i] != RS[-i-1]:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
S = input()
RS = reversed(S)

count=0

for i in range(len(S) // 2):
    if S[i] != RS[i]:
        count += 1

print(count)
Problem p02860 (python)

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

ans = 'Yes'

if n % 2 != 0:
    ans = 'No'
    
for i in range(n // 2):
    if s[i] != s[i + (n // 2)]:
        ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()

ans = 'Yes'

for i in ((n // 2) - 1):
    if s[i] != s[i + (n // 2)]:
        ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()

ans = 'Yes'

for i in (n // 2):
    if s[i] != s[i + (n // 2)]:
        ans = 'No'

print(ans)
Problem p02777 (python)

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

if( S==U ):
    A-=1
if( T==U ):
    B-=1

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

Buggy submission (verdict: Runtime Error):
S = str( input() )
T = str( input() )
A = int( input() )
B = int( input() )
U = str( input() )

if( S==U ):
    A-=1
if( T==U ):
    B-=1

print( str(A)+" "+str(B) )
Problem p02693 (python)

Fixed submission:
k= int(input())
x,y = map(int,input().split())
if 1<=x<=y<=1000 and 1<=k<=1000:
    pass



    if x%k>>0 :
        if x<= (x//k+1)*k <=y :
            print('OK')
        else:
            print('NG')
    else:
        print('OK')

else:
    print('NG')

Buggy submission (verdict: Runtime Error):
k,x,y = map(int,input().split())
if 1<=x<=y<=1000 and 1<=k<=1000:
    pass



if x%k>>0 :
    if x<= (x/k+1)*k <=y :
        print('OK')
    else:
        print('NG')
else:
    print('OK')

Buggy submission (verdict: Runtime Error):
k,x,y = map(int,input().split())

if x%k>>0 :
    if x<= (x/k+1)*k <=y :
        print('OK')
    else:
        print('NO')
else:
    print('OK')

Buggy submission (verdict: Runtime Error):
k,x,y = map(int,input().split())

if x%k>>0 :
    if x<= (x/k+1)*k <=y :
        print('OK')
    else:
        print('NG')

if x%k ==0:

    print('OK')

Buggy submission (verdict: Runtime Error):
k,x,y = map(int,input().split())

if x%k>>0 :
    if x<= (x/k+1)*k <=y :
        print('OK')
    else:
        print('NO')

elif x%k ==0:

    print('OK')

Buggy submission (verdict: Runtime Error):
k,x,y = map(int,input().split())

if x%k>>0 :
    if x<= (x/k+1)*k <＝y :
        print('OK')
    else:
        print('NO')

if x%k ==0:

    print('OK')

Buggy submission (verdict: Runtime Error):
k,x,y = map(int,input().split())

if (x//k+1)*k <<y :
    print('OK')
else:
    print('NG')

Buggy submission (verdict: Runtime Error):
k,x,y = map(int,input().split())

if (x//k+1)*k <<y :
    print('YES')
else:
    print('NO')
Problem p02699 (python)

Fixed submission:
s, w = map(int,input().split())
if w>=s:
  print("unsafe")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
x, y = map(int,input().split())
if x<y:
  print("unsafe")
else:
  print("safe')
Problem p02699 (python)

Fixed submission:
S,W=map(int,input().split()) 
if S<=W:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
S=input()
count=0
#S3=''

#for i in range(len(S)):
#    S3+=str(int(S[i])%3)
for i in range(0,len(S)-4):
    check3=int(S[i])+int(S[i+1])+int(S[i+2])+int(S[i+3])
    for j in range(i+5,len(S)+1):
        check3+=int(S[j-1])
        check3%=3
        if check3==0:
            if int(S[i:j])%673==0:
                count+=1
                
print(str(count))

Buggy submission (verdict: Runtime Error):
S=input()
count=0

for i in range(0,len(S)-4):
    check3=int(S[i])+int(S[i+1])+int(S[i+2])+int(S[i+3])
    for j in range(i+5,len(S)+1):
        check3+=int(S[j-1])
        check3%=3
        if check3==0:
            if int(S[i:j])%673==0:
                count+=1
                
print(str(count))

Buggy submission (verdict: Runtime Error):
S=input()
count=0
#S3=''

#for i in range(len(S)):
#    S3+=str(int(S[i])%3)
for i in range(0,len(S)-4):
    check3=int(S[i])+int(S[i+1])+int(S[i+2])+int(S[i+3])
    for j in range(i+5,len(S)+1):
        check3+=int(S[j-1])
        check3%=3
        if check3==0:
            if int(S[i:j])%673==0:
                count+=1
                
print(str(count))

Buggy submission (verdict: Runtime Error):
S=[str(input()) for i in range(2*10^1-1)]
S.pop(0)
print(len(set(S)))
Problem p02701 (python)

Fixed submission:
N=int(input())
S = [str(input()) for i in range(N)]
print(len(set(S)))

Buggy submission (verdict: Runtime Error):
N=input()
S = [str(input()) for i in range(N)]
print(len(set(S)))

Buggy submission (verdict: Runtime Error):
S = [str(input()) for i in range(2*10^5)]
#(2*10^5):    
S.pop(0)
if '' in S:
    print(len(set(S))-1)
else:
    print(len(set(S)))

Buggy submission (verdict: Runtime Error):
S=[str(input()) for i in range(2*10^5-1)]
S.pop(0)
print(len(set(S)))

Buggy submission (verdict: Runtime Error):
S=[str(input()) for i in range(2*10^1-1)]
S.pop(0)
print(len(set(S))
Problem p02711 (python)

Fixed submission:
N=input()
if "7" in N:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N=input()
S=input()
R=[]
G=[]
B=[]
for i in range(len(S)):
    if S[i]=='R':
        R.append(i)
    if S[i]=='G':
        G.append(i)
    if S[i]=='B':
        B.append(i)

count=0
for i in range(len(R)):
    for j in range(len(G)):

        if max(R[i],G[j])+abs(R[i]-G[j]) in B:
            count+=1

        if min(R[i],G[j])-abs(R[i]-G[j]) in B:
            count+=1

        if (R[i]+G[j])/2 in B:
            count+=1


print(str((len(R)*len(G)*len(B))-count))

Buggy submission (verdict: Runtime Error):
N=input()
S=input()
Sn=[]
R=0
G=0
B=0
for i in range(len(S)):
    if S[i]=='R':
        R+=1
        Sn.append(1)
    elif S[i]=='G':
        G+=1
        Sn.append(2)
    else:
        B+=1
        Sn.append(3)

count=0
for start in range(len(S)):
        for diff in range(1,int((len(S)-start+1)/2)):
            if (Sn[start]-Sn[start+diff])*(Sn[start+diff]-Sn[start+(2*diff)])*(Sn[start]-Sn[start+(2*diff)])!=0: 
                count+=1
                
print(str((R*G*B)-count))

Buggy submission (verdict: Runtime Error):
N=input()
S=input()
Sn=[]
R=0
G=0
B=0
for i in range(len(S)):
    if S[i]=='R':
        R+=1
        Sn.append(1)
    elif S[i]=='G':
        G+=1
        Sn.append(2)
    else:
        B+=1
        Sn.append(3)

count=0
for start in range(len(S)):
        for diff in range(1,int((len(S)-start+1)/2)):
      
            if (Sn[start]-Sn[start+diff])*(Sn[start+diff]-Sn[start+(2*diff)])*(Sn[start]-Sn[start+(2*diff)])!=0: 
                count+=1
                
print(str((R*G*B)-count))
Problem p02688 (python)

Fixed submission:
n, k= map(int, input().split())
num = list(range(1, n+1))
c = set()
num = set(num)
for i in range(k):
  a = input()
  b = set(list(map(int, input().split())))
  c = c.union(b)
num = list(num -c)
print(len(num))

Buggy submission (verdict: Runtime Error):
n, k= map(int, input().split())
num = range(1,n)
c = set()
num = set(num)
for i in range(k):
  a = input()
  b = set(list(map(int, input().split())))
  c = b | c
print(c)
num = list(num -c)
L=[str(a) for a in L_int]
L=" ".join(L)
print(L)
Problem p02688 (python)

Fixed submission:
n, k = list(map(int, input().split()))
d = []
for _ in range(k):
    x = int(input())
    y = list(map(int, input().split()))
    for i in y:
        d.append(i)

d = set(d)
d = list(d)
print(n - len(d))

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
d = []
for _ in range(k):
  x = int(input())
  y = int(map(int, input().split()))
  for i in y:
    d.append(i)

d = set(d)
d = list(d)
print(n - len(d))
Problem p02712 (python)

Fixed submission:
n = int(input())

fb = 0
for i in range(n+1):
    if(i%5 != 0 and i%3 != 0):
        fb = fb + i

print(fb)

Buggy submission (verdict: Runtime Error):
n = int(input())

fb = long(0)
for i in range(n):
    if(i%5 != 0 and i%3 != 0):
        fb = fb + i

print(fb)
Problem p02881 (python)

Fixed submission:
N = int(input())
n = int((N ** 0.5)//1 + 1)

ans = 1000000
ans_list = []

for i in range(1, n):
    if N % i == 0:
        ans = N / i
        ans_list.append(i + ans)

print(int(min(ans_list)-2))

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

def prime_factorize(n):
    a = []
    time = 0
    while n % 2 == 0:
        a.append(2)
        n //= 2
    ff = 3
    while ff * ff <= n:
        if n % ff == 0:
            a.append(ff)
            n //= ff
        else:
            ff += 2
    if n != 1:
        a.append(n)
        a.append(1)
    return a


f = []
serch_mini = []


for i in range(len(prime_factorize(N))):
    f = prime_factorize(N)
    b = f[0:i+1]
    c = f[i+1:]
    bb = 1
    cc = 1
    for j in range(len(b)):
        bb *= b[j]
    for k in range(len(c)):
        cc *= c[k]
    serch_mini.append(bb+cc)

serch_mini.remove(bb+cc)

print(min(serch_mini)-2)

Buggy submission (verdict: Runtime Error):
import sympy

N = int(input())

a = sympy.factorint(N)
key = []
f = []
serch_mini = []

for i in a:
    key.append(i)

for i in key:
    b = a[i]
    for j in range(b):
        f.append(i)

for i in range(len(f)):
    b = f[0:i+1]
    c = f[i+1:]
    bb = 1
    cc = 1
    for j in range(len(b)):
        bb *= b[j]
    for k in range(len(c)):
        cc *= c[k]
    serch_mini.append(bb+cc)

print(min(serch_mini)-2)
Problem p02793 (python)

Fixed submission:
import sys

def compute_gcd(x, y):
   while(y):
       x, y = y, x % y
   return x
 
def compute_lcm(x, y):
   lcm = (x*y)//compute_gcd(x,y)
   return lcm

def lcm(a):
	x = a[0]
	for i in range(1, len(a)):
		x = compute_lcm(x, a[i])
	return x

n = int(input())

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

MOD = 10 ** 9 + 7

ans = lcm(a)
cur = 0

for i in a:
	cur += ans // i

print(cur % MOD)

Buggy submission (verdict: Runtime Error):
import sys
 
def compute_gcd(x, y):
   while(y):
       x, y = y, x % y
   return x
 
def compute_lcm(x, y):
   lcm = (x*y)//compute_gcd(x,y)
   return lcm
   
n = int(input())

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

MOD = 10 ** 9 + 7

ans = 1
d = 1
cur = 0

for i in a:
	ans = compute_lcm(ans, i)

for i in a:
	cur += ans / i

print(cur % MOD)
Problem p02753 (python)

Fixed submission:
inp=input()
if inp=='AAA'or inp=='BBB':
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
inp=list(map(int,input().split()))
S=inp[0]
B=inp[1]
R=inp[2]
x=S//(B+R)#brグループが何回
y=S%(B+R)

print(B*x+min(y,B))

Buggy submission (verdict: Runtime Error):
inp=list(map(int,input().split()))
S=inp[0]
B=inp[1]
R=inp[2]
x=S//(B+R)#brグループが何回
y=S%(B+R)
print(B*x+y)

Buggy submission (verdict: Runtime Error):
inp=list(map(int,input().split()))
S=inp[0]
B=inp[1]
R=inp[2]
x=S//(B+R)#brグループが何回
y=S//(B+R)
print(B*x+y)

Buggy submission (verdict: Runtime Error):
inp=list(map(int,input().split()))
S=inp[0]
B=inp[1]
R=inp[2]
if B==0:
  print(0)
else:
  ans=B+(S-B-R)
  print(ans)
Problem p02754 (python)

Fixed submission:
inp=list(map(int,input().split()))
s=inp[0]
b=inp[1]
r=inp[2]
print(s//(b+r)*b+min(s%(b+r),b))

Buggy submission (verdict: Runtime Error):
inp=list(map(int,input().split()))
S=inp[0]
B=inp[1]
R=inp[2]
x=S//(B+R)#brグループが何回
y=S//(B+R)
print(b*x+y)

Buggy submission (verdict: Runtime Error):
inp=list(map(int,input().split()))
S=inp[0]
B=inp[1]
R=inp[2]
ans=B+(S-B-A)
print(ans)
Problem p02699 (python)

Fixed submission:
S,W=map(int,input().split())
if W>=S:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
S,W=int(input().split())
if W>=S:
    print("unsafe")
else:
    print("safe")
Problem p02723 (python)

Fixed submission:
S=input()
if S[2] is S[3] and S[4] is S[5]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S=input()
if S[3] is S[4] and S[5] is S[6]:
    print("Yes")
else:
    print("No")
Problem p02729 (python)

Fixed submission:
N, M = map(int, input().split())
NM = N + M
print(NM * (NM - 1) // 2 - N * M)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
c = [A.count(i + 1) for i in range(N)]
ans = [c[i] * (c[i] - 1) // 2 for i in range(N)]
s = sum(ans)

for val in A:
  m = c[val - 1] - 1
  print(s - m)
Problem p02831 (python)

Fixed submission:
import fractions
a, b = map(int, input().split())
print(a * b // fractions.gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math

a,b=(int(x) for x in input().split())

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

print(lcm(a, b))
Problem p02836 (python)

Fixed submission:
s=input()
count=0

for i in range(len(s) // 2):
	if s[i]!=s[-(i+1)]:
		count+=1
print(count)

Buggy submission (verdict: Runtime Error):
s=input()
count=0
i=0
while i<=range(len(s) // 2):
	if s[i]!=s[-(i+1)]:
		count+=1
    i+=1
print(count)

Buggy submission (verdict: Runtime Error):
s=input()
i=0
count=0

while i<range(len(s)//2):
	if s[i]!=s[-(i+1)]:
		count+=1
	i+=1

print(count)
Problem p02879 (python)

Fixed submission:
a,b=(int(x) for x in input().split())

if a<10 and b<10:
	print(a*b)
else:
	print("-1")

Buggy submission (verdict: Runtime Error):
a,b=(int(x) for x in input().split())

if a<10 and b<10:
	print(a*b)
else::
	print("-1")
Problem p03077 (python)

Fixed submission:
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

p = [a, b, c, d, e]
if n%min(p) != 0:
    print(n//min(p)+5)
else:
    print(n//min(p)+4)

Buggy submission (verdict: Runtime Error):
p = [a, b, c, d, e]
n//min(p)+5
Problem p03137 (python)

Fixed submission:
n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
d = []
if n>=m or m==1:
    print(0)
elif n<m:
    for i in range(m-1):
        d.append(x[i+1] - x[i])
    print(sum(sorted(d)[:m-n]))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
d = []
for i in range(m-1):
    d.append(x[i+1] - x[i])
    
ans = 0
if n>=m:
    ans = 1
else:
    for i in range(n):
        if i == 0:
            ans += x[:d.index(sorted(d)[::-1][i])+1][-1] - x[:d.index(sorted(d)[::-1][i])+1][0]
        elif i == n-1:
            ans += x[d.index(sorted(d)[::-1][i-1])+1:][-1] - x[d.index(sorted(d)[::-1][i-1])+1:][0]
        else:
            ans += x[d.index(sorted(d)[::-1][i-1])+1:d.index(sorted(d)[::-1][i])+1][-1] - x[d.index(sorted(d)[::-1][i-1])+1:d.index(sorted(d)[::-1][i])+1][0]

print(ans)
Problem p03329 (python)

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

ans = []
for i in range(n+1):
    cnt6 = i
    cnt9 = n - i
    ans6 = 0
    ans9 = 0
    
    while cnt6 > 0:
        sho = 6**math.floor(math.log(cnt6, 6))
        ans6 += cnt6//sho
        cnt6= cnt6%sho
        
    while cnt9 > 0:
        if cnt9 != 59049:
            sho2 = 9**math.floor(math.log(cnt9, 9))
        else:
            sho2=59049
        ans9 += cnt9//sho2
        cnt9 = cnt9%sho2
        
    ans.append(ans6+ans9)
    sho, sho2 = 0, 0
        
print(min(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())

import math
def bank2(n):
    ans = 1
    list_six = [6**i for i in range(math.floor(math.log(n, 6)+1))]
    list_nine = [9**i for i in range(math.floor(math.log(n, 9)+1))]
    
    if n in list_six or n in list_nine:
        pass
    elif n == 12 or n == 13 or n == 14:
        ans += bank(n-6)
    elif n > 1:
        ans += min(bank(n - list_six[-1]), bank(n - list_nine[-1]))
        
    return ans

print(bank2(n))

Buggy submission (verdict: Runtime Error):
n = int(input())
import math
def bank(n):
    ans = 1
    list_six = [6**i for i in range(math.floor(math.log(n, 6)+1))]
    list_nine = [9**i for i in range(math.floor(math.log(n, 9)+1))]
    
    if n == 6 or n== 9:
        pass
    elif n == 12 or n == 13 or n == 14:
        ans += bank(n-6)
    elif n > 1:
        ans += bank(n - max(list_six[-1], list_nine[-1]))
        
    return ans
  
print(bank(n))
Problem p02847 (python)

Fixed submission:
N = input()

day_d = {\
    "SUN":7,
    "MON":6,
    "TUE":5,
    "WED":4,
    "THU":3,
    "FRI":2,
    "SAT":1
    }

print(day_d[N])

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

day_d = {\
    "SUN":7,
    "MAN":6,
    "TUE":5,
    "WED":4,
    "THU":3,
    "FRI":2,
    "SAT":1
    }

print(day_d[N])
Problem p02990 (python)

Fixed submission:
import math
import itertools

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def main():
    N,K = map(int,input().split(" "))
    for i in range(1,K+1):
        if(i<=N-K+1):
            print(combinations_count(K-1,i-1)*combinations_count(N-K+1,i)%(10**9+7))
        else:
            print(0)

if __name__=='__main__':
    main()

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

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def main():
    N,K = map(int,input().split(" "))
    for i in range(1,K+1):
        print(combinations_count(K-1,i-1)*combinations_count(N-K+1,i)%(10**9+7))

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

Fixed submission:
def main():
    P,Q,R = map(int,input().split(" "))
    print(min([P+Q,Q+R,P+R]))

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def stairs(n):
    if(n<=0):
        return 1
    comb = 0
    for i in range(int(n/2)+1):
        comb += combinations_count(n-i,i)
    return comb

def main():
    N,M = map(int,input().split(" "))
    broken_l = []
    for _ in range(M):
        broken_l.append(int(input()))

    broken_l.append(-1)
    broken_l.append(N+1)
    broken_l.sort()
    ans = 1
    for i in range(len(broken_l)-1):
        step = broken_l[i+1] - broken_l[i]
        if(step == 1 and broken_l[i+1]!=1):
            print(0)
            exit(0)
        else:
            ans *= stairs(step-2)
            ans = ans%(10**9+7)

    print(ans)
if __name__ == '__main__':
    main()
Problem p03834 (python)

Fixed submission:
a,b,c=input().split(",")
print(a,b,c)

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
print(a,b,c)

Buggy submission (verdict: Runtime Error):
a,b,c=map(input().split(","))
print(a,b,c)
Problem p02711 (python)

Fixed submission:
a,b,c = map(int,input())

if a*b*c == 0 :
  print("No")
elif a*b*c%7 == 0 :
  print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input())

if a*b*c == 0 :
  print("No")
elif:a*b*c%7 == 0 :
  print("Yes")
else: print("No")
Problem p02693 (python)

Fixed submission:
K = int(input())
score = input().split()
s1 = int(score[0])
s2 = int(score[1])
if ( s1 % K ) == 0:
		print('OK')
elif ( s2 % K ) == 0:
		print('OK')
elif ( s1 // K ) < ( s2 // K ):
		print('OK')
else:
		print('NG')

Buggy submission (verdict: Runtime Error):
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):
K = int(input())
score = input().split()
if int(score[0] < K):
	if int(int(score[0])/K) < int(int(score[1])/K):
		print('OK')
	else:
		if int(score[0]) % K == int(score[1]) % K:
			print('OK')
		else:
			print('NG')

Buggy submission (verdict: Runtime Error):
K = int(input())
score = input().split()
if int(int(score[0])/K) < int(int(score[1])/K):
	print('OK')
else:
	if int(score[0]) % K == int(score[1]) % K:
		print('OK')
	else:
		print('NG'
Problem p02689 (python)

Fixed submission:
n, m = map(int, input().rstrip().split())
h = list(map(int, input().rstrip().split()))
l = []
high = [0] * n
count = 0

for i in range(m):
    a, b = map(int, input().rstrip().split())
    l.append([a, b])

for i in l:
    if h[i[0]-1] < h[i[1]-1]:
        high[i[0]-1] += 1
    elif h[i[0]-1] == h[i[1]-1]:
        high[i[0]-1] += 1
        high[i[1]-1] += 1
    else:
        high[i[1]-1] += 1

for hi in high:
    if hi == 0:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().rstrip().split())
h = map(int, input().rstrip().split())
l = []
high = [0] * n
count = 0

for i in range(m):
    a, b = map(int, input().rstrip().split())
    l.append([a, b])

for i in l:
    if h[i[0]-1] < h[i[1]-1]:
        high[i[0]-1] += 1
    elif h[i[0]-1] == h[i[1]-1]:
        high[i[0]-1] += 1
        high[i[1]-1] += 1
    else:
        high[i[1]-1] += 1

for hi in high:
    if hi == 0:
        count += 1
print(count)
Problem p02711 (python)

Fixed submission:
N=str(input())
L=N.count('7')
if L>=1:
    print('Yes')
else :
    print('No')

Buggy submission (verdict: Runtime Error):
#D
N=int(input())
S=str(input())
count=0
for i in range(N):
    for j in range(i+1,N):
        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]:
                count+=1
print(count)
Problem p02862 (python)

Fixed submission:
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


x,y=map(int,input().split())
s=int((2*y-x)/3)
t=int((2*x-y)/3)
if (2*y-x)%3!=0 or (2*x-y)%3!=0:
    print(0)
elif s<0 or t<0:
    print(0)
else:
    a = cmb(s+t, t)
    print(a%(10**9+7))

Buggy submission (verdict: Runtime Error):
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


x,y=map(int,input().split())
s=(2*y-x)/3
t=(2*x-y)/3
if (2*y-x)%3!=0 or (2*x-y)%3!=0:
    print(0)
else:
    a = cmb(s+t, t)
    print(a%(10**9+7))

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

x,y=map(int,input().split())
s=(2*y-x)/3
t=(2*x-y)/3
if (2*y-x)%3!=0 or (2*x-y)%3!=0:
    print(0)
else:
    a = comb(s+t, t, exact=True)
    print(a%(10**9+7))