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

Fixed submission:
from collections import deque
n,x,y = map(int,input().split())
next = [[] for i in range(n)]
next[0].append(1)
next[n-1].append(n-2)
next[x-1].append(y-1)
next[y-1].append(x-1)
for i in range(1,n-1):
  next[i].append(i-1)
  next[i].append(i+1)

ans = [0] *(n-1)

for j in range(n):
  mark = ['inf']*(n)
  que = deque([j])
  mark[j] = 0
 
  while que:
    q = que.popleft()
    for k in next[q]:
      if mark[k] == 'inf':
        mark[k] = mark[q] + 1
        que.append(k)
  
  for l in range(0,n):
    if mark[l] != 0:
      ans[mark[l]-1] += 1

for x in ans:
  print(x//2)

Buggy submission (verdict: Runtime Error):
from collections import deque
n,x,y = map(int,input().split())
next = [[] for i in range(n)]
next[0].append(1)
next[n-1].append(n-2)
next[x-1].append(y-1)
next[y-1].append(x-1)
for i in range(1,n-1):
  next[i].append(i-1)
  next[i].append(i+1)

ans = [0] *(n-1)

for j in range(n):
  mark = ['inf']*(n)
  que = deque([j])
  mark[j] = 0
 
  while que:
    q = que.popleft()
    for k in next[q]:
      if mark[k] == 'inf':
        mark[k] = mark[q] + 1
        que.append(k)
  
  for l in range(0,n):
    if mark[l] != 0:
      ans[mark[l]-1] += 1

import numpy as np    
arr = np.array(ans) //2
for x in arr:
  print(x)
Problem p02753 (python)

Fixed submission:
s = input()
n = len(s)
sa = 'A'*n
sb = 'B'*n

if s != sa and s != sb:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
rev = 1
for i in range(q):
  t = input()
  
  if t == '1':
    rev *= -1
  else:
    x,y,sr = t.split()
    if rev == 1 and y == '2':
      s = s + sr
    else:
      s = sr + s

if rev == -1:
  s = s[::-1]
  
print(s)
Problem p02754 (python)

Fixed submission:
n,a,b = map(int,input().split())

if a+b == 0:
  print(0)
  
else:  

  d = n//(a+b)
  q = n % (a+b)

  
  if q <= a:
    print(a*d+q)
  else:
    print(a*d+a)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
s = 'b'*a + 'r'*b
if a+b == 0:
  print(0)
  
else:  

  d = n//(a+b)
  q = n % (a+b)

  
  if q <= a:
    print(a*d+q)
  else:
    print(a*d+a)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
s = 'b'*a + 'r'*b
d = n//(a+b)
q = n % (a+b)

if q <= a:
  print(a*d+q)
else:
  print(a*d+a)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
s = 'b'*a + 'r'*b
d = n//(a+b)
q = n % (a+b)

if q <= a:
  print(b*d)
else:
  print(b*d+q-a)
Problem p02820 (python)

Fixed submission:
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T= input()
def score(x):
  if x == 'r':
    return P
  elif x == 's':
    return R
  elif x == 'p':
    return S
  else:
    return 0
s = 0
List = [x for x in T]
for t in range(len(T)-K):
  if List[t] == List[t+K]:
    List[t+K] = 'z' 
for y in List:  
  s += score(y)
print(s)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T= input()
def score(x):
  if x == 'r':
    return P
  elif x == 's':
    return R
  elif x == 'p':
    return S
  else:
    return 0
s = 0
for t in range(len(T)-1):
  if T[t] == T[t+1]:
    T[t+1] = 'z'
  s += score(T[t])
print(s)
Problem p02552 (python)

Fixed submission:
x = int(input())
print(x^1)

Buggy submission (verdict: Runtime Error):
x = input()
print(x^1)

Buggy submission (verdict: Runtime Error):
print(x^1)
Problem p02547 (python)

Fixed submission:
n = int(input())
count = 0
times_count = 0
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        count = 0
    if count == 3:
        times_count += 1

if times_count == 0:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
n = int(input())
eq_count = 0
times_count = 0
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        count = 0
    if count == 3:
        print('Yes')
        exit(0)
print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
eq_count = 0
times_count = 0
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        count = 0
    if count == 3:
        print('Yes')
        exit()
print('No')
Problem p02595 (python)

Fixed submission:
def main():
    n, d = map(int, input().split())
    counter = 0
    for _ in range(n):
        x, y = map(int, input().split())
        if x**2 + y**2 <= d**2:
            counter += 1
    return print(counter)
 
main()

Buggy submission (verdict: Runtime Error):
def main():
    d, n = map(int, input().split())
    counter = 0
    for _ in range(n):
        x, y = map(int, input().split())
        if x**2 + y**2 <= d**2:
            counter += 1
    return print(counter)
 
main()

Buggy submission (verdict: Runtime Error):
def main():
    d, n = map(int, input().split())
    counter = 0
    for _ in range(n):
        x, y = map(int, input().split())
        if x**2 + y**2 <= d:
            counter += 1
    return print(str(counter))

main()
Problem p02622 (python)

Fixed submission:
s=input()
t=input()
ans=0
for i in range(len(s)):
    if s[i]!=t[i]:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s=iuput()
t=input()
ans=0
for i in range(len(s)):
    if s[i]==t[i]:
        ans += 1
print(ans)
Problem p02682 (python)

Fixed submission:
a, b, c, k = map(int, input().split())
if k <= a:
    print(k)
if a < k <= a + b:
    print(a)
if a + b < k:
    d = 2*a + b - k
    print(d)

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
if k <= a:
    print(k)
if a < k <= a + b:
    print(a)
ifa + b < k:
    d = 2*a + b - k
    print(d)
Problem p02688 (python)

Fixed submission:
n,k = map(int, input().split())
d = []
A= []
c = []
 
for i in range(k):
    d.append(int(input()))
    A.append(list(map(int, input().split())))
 
for j in range(k):
    for m in range(d[j]):
        c.append(A[j][m])
 
print(n-len(set(c)))

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
d = []
A= []
c = []
 
for i in range(k):
    d.append(int(input()))
    a = input()
    A.append([int(a[j]) for j in range(a)])
 
for j in range(k):
    for m in range(d[j]):
        c.append(A[j][m])
 
print(n-len(set(c)))

Buggy submission (verdict: Runtime Error):
d = []
A= []
c = []
 
for i in range(k):
    d.append(int(input()))
    a = input()
    A.append([int(a[j]) for j in range(a)])
 
for j in range(k):
    for m in range(d[j]):
        c.append(A[j][m])
 
print(n-len(set(c)))

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
d = []
A= []
c = []

for i in range(k):
    d.append(int(input()))
    a = input()
    A.append([int(a[j]) for j in range(a)])

for j in range(k):
    for k in range(d[j]):
        c.append(A[j][k])

print(n-len(set(c)))

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
d = []
c = []
e = []
for i in range(k):
    d.append(int(input()))
    a = input()
    c.append([a[j:j+1] for j in range(len(a))])
    e[i] = list(map(int, c[i]))

for j in range(k):
    for k in range(d[j]):
        a = set(e[j][k])

print(n-len(a))

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

for j in range(k):
    for k in range(d[j]):
        a = set(A[j][k])

print(n-len(a))
Problem p02689 (python)

Fixed submission:
n, m = map(int, input().split())
h = list(map(int, input().split()))
sore = [[0] for i in range(n)]
for i in range(m):
    road = list(map(int, input().split()))
    sore[road[0]-1].append(h[road[1]-1])
    sore[road[1]-1].append(h[road[0]-1])
ans = 0
for i in range(n):
    if h[i] > max(sore[i]):
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
H = list(map(int, input().split()))
s = [[0] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    s[a-1].append(H[b-1])
    s[b-1].append(H[a-1])
c = 0
for j in range(n):
    if H[j] > max(s[j]):
        c+= 1
 print(c)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
H = list(map(int, input().split()))
s = [[0]]*m
 
for _  in range(m):
    a, b = map(int, input().split())
    s[a-1].append(H[b-1])
    s[b-1].append(H[a-1])
 
c = 0
for j in range(n):
    if H[j] > max(s[j]):
        c+= 1
 
print(c)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
H = list(map(int, input().split()))
s = [[0]]*m

for i in range(m):
    a, b = map(int, input().split())
    s[a-1].append(H[b-1])
    s[b-1].append(H[a-1])

c = 0
for j in range(n):
    if H[j] > max(s[j]):
        c+= 1

print(c)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
H = list(map(int, input().split()))
S = []
c = 0
b = []
 
for i in range(m):
    S.append(list(map(int, input().split())))
 
for j in range(n):
    for k in range(m):
        if j in S[k]:
            if S[k][0] == j:
                if H[S[k][0]] < H[S[k][1]]:
                    c += 1
            else:
                if H[S[k][0]] > H[S[k][1]]:
                    c + = 1
    if c == 0:
        b.append(j)
    c = 0
 
print(len(b))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
H = list(map(int, input().split()))
S = []
c = 0
b = []
 
for i in range(m):
    S.append(list(map(int, input().split())))
 
for j in range(n):
    for k in range(m):
        if j in S[k]:
            if S[k][0] == j:
                if S[k][0] < S[k][1]:
                    c += 1
            else:
                if S[k][0] > S[k][1]:
                    c + = 1
    if c ==0:
        b.append(j)
 
print(len(b))

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
H = list(map(int, input().split()))
S = []
c = 0
b = []

for i in range(m):
    S.append(list(map(int, input()split())))

for j in range(n):
    for k in range(m):
        if j in S[k]:
            if S[k][0] == j:
                if S[k][0] < S[k][1]:
                    c += 1
            else:
                if S[k][0] > S[k][1]:
                    c + = 1
    if c ==0:
        b.append(j)

print(len(b))
Problem p02572 (python)

Fixed submission:
ans = 0
N = int(input())
array = list(map(int, input().split()))
x = sum(array)
y = 0
for i in range(N):
  y += array[i]**2

ans = x**2 -y
print((ans//2)%(10**9+7))

Buggy submission (verdict: Runtime Error):
ans = 0
N = int(input())
array = list(map(int, input().split()))
x = sum(array)
for i in range(N):
    ans += array[i] * (x -arrau[i])
print(int(ans/2)%(10**9+7))
Problem p02951 (python)

Fixed submission:
a, b, c = map(int, input().split())
print(max(0, c - (a - b)))

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().aplit())
print(c - (a - b))
Problem p02879 (python)

Fixed submission:
list = input().split(' ')
A = int(list[0])
B = int(list[1])
if A <= 9 and B <= 9:
    print(A*B)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
A, B = [int(input()) for i in range(2)]
result = int(int(A)*int(B))
if 9 < int(A) and 9 < int(B):
    print(-1)
else:
    print(result)

Buggy submission (verdict: Runtime Error):
A, B =[int(input()) for i in range(2)]
result = int(int(A)*int(B))
if 9 < int(A):
    print(-1)
elif 9 < int(B):
    print(-1)
else:
    print(result)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
result = int(A)*int(B)
if 9 < int(A):
    print(-1)
elif 9 < int(B):
    print(-1)

else:
    print(result)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
result = int(A)*int(B)
if 9 < int(A):
    print(-1)
elif 9 < int(B):
    print(-1)

else:
    print(result)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
result = int(A)*int(B)
if 9 < int(A):
    print(-1)
elif 9 < int(B):
    print(-1)

else:
    print(result)
Problem p02693 (python)

Fixed submission:
from math import *
k=int(input())
a,b =map(int,input().split())
m=0
while a<=b :
    if a%k==0:
        m=1
        break
    a=a+1
if m==1:
    print("OK")
else :
    print("NG")

Buggy submission (verdict: Runtime Error):
from math import *
k=int(input())
a=int(input())
b=int(input())
m=0
while a<=b :
    if a%k==0:
        m=1
        break
    a=a+1
if m==1:
    print("OK")
else :
    print("NG")

Buggy submission (verdict: Runtime Error):
from math import *
k=int(input())
a=int(input())
b=int(input())
m=0
while a<=b :
    if a%k==0:
        m=1
        break
    a+=1
if m==1:
    print("OK")
else :
    print("NG")

Buggy submission (verdict: Runtime Error):
from math import *
k=int(input())
a=int(input())
b=int(input())
m=0
while a<=b :
    if a%k==0:
        m=1
        break
    a+=1
if m==1:
    print("OK")
else :
    print("NG")

Buggy submission (verdict: Runtime Error):
from math import *
k=int(input())
a=int(input())
b=int(input())
m=0
while a<=b :
    if a%k==0:
        m=1
        break
    a+=1
if m==1:
    print("OK")
else :
    print("NG")
Problem p02552 (python)

Fixed submission:
# coding: utf8
# 日本語を入力できるようにするために上記一文が必要

x = int(input())

if x == 0:
        print(1)
elif x == 1:
        print(0)

Buggy submission (verdict: Runtime Error):
# coding: utf8
# 日本語を入力できるようにするために上記一文が必要

import math

N = int(input())

if N == 1:
        print(0)
elif N == 2:
        print(1)
else:
        ans = math.factorial(N)*(10**(N -2))


print(ans%(10**9+7))
Problem p02546 (python)

Fixed submission:
a=raw_input()
if a[-1]=='s':
    print (a+"es")
else: 
    print (a+"s")

Buggy submission (verdict: Runtime Error):
n,x,m=map(int,raw_input().split()) 
v=[x] 
t={x:1} 
ok=1
while True: 
    y=(x*x)%m 
    if y==0: 
        print sum(v);ok=0;break
    if y in t: 
        break 
    else: 
        t[y]=1 
        v.append(y) 
        x=y 
g=n%(len(v)) 
ans=0
for i in range(len(v)): 
    if i>g: 
        ans+=((n/len(v))*(v[i]) )
        
    else: 
        ans+=((n/len(v)+1)*v[i]) 
       
if ok:
    print ans

Buggy submission (verdict: Runtime Error):
a=raw_input() 
if a[-1] =="s": 
  print a+"es"
elss:
  print a+"s"
Problem p02550 (python)

Fixed submission:
n,x,m=map(int,raw_input().split())
i=0
v=[x]
t={x:0}
p=0 
start=0
while True: 
    i+=1
    y=(x*x)%m 
    if y in t: 
        p+=(i-t[y]) 
        start+=t[y]
        break 
    t[y]=i
    v.append(y) 
    x=y 
ans=0 

if n<(len(v)): 
    for i in range(n): 
        ans+=v[i] 
    print ans 
else: 
    for i in range(start): 
        ans+=v[i] 
    n-=(start) 
    g=n%p+start
    l=n/p 
    for i in range(start,len(v)): 
        ans+=(l*v[i]) 
        if i<g: 
            ans+=v[i] 
    print ans

Buggy submission (verdict: Runtime Error):
n,x,m=map(int,raw_input().split())
i=0
v=[x]
t={x:0}
p=0 
start=0
while True: 
    i+=1
    y=(x*x)%m 
    if y in t: 
        p+=(i-t[y]) 
        start+=t[y]
        break 
    p[y]=i
    v.append(y) 
    x=y 
ans=0
if n<(start): 
    for i in range(n): 
        ans+=v[i] 
    print ans 
else: 
    for i in range(start): 
        ans+=v[i] 
    n-=(start+1) 
    g=n%p 
    l=n/p 
    for i in range(start,n): 
        ans+=(l*v[i]) 
        if i<g: 
            ans+=v[i] 
print ans
Problem p02552 (python)

Fixed submission:
x = int(input())

if x == 0:
    print(1)
else:
    print(0)

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

if a*c > b*d:
    print(a*c)
elif b > 0 and d > 0:
    print(b*d)
elif a < 0 and c < 0:
    print(a*c)
else:
    x = min(abs(a),abs(b))
    y = min(abs(c),abs(d))
    print(-x*y)
Problem p02546 (python)

Fixed submission:
a=input()
e=a[len(a)-1:len(a)]
if e == "s":
    print(a+"es")
else:
    print(a+"s")

Buggy submission (verdict: Runtime Error):
a=input()
e=a[len(a)-1:len(a)-1]
if e == "s":
    print(a+"es")
else:
    print(a+"s"
Problem p03307 (python)

Fixed submission:
a=int(input())
if (a%2)==0: print(a)
else: print(a*2)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
a.sort()
print(a[n-1]-a[0])
Problem p02570 (python)

Fixed submission:
def main():
    l_input = list(map(int, input().split()))
    time = l_input[0] / l_input[2]
    if(time <= l_input[1]):
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
import itertools
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    comb = list(itertools.combinations(num_list, 2))
    total = sum([c1*c2 for c1, c2 in comb])
    print(total % (1000000000 + 7))
if __name__ == '__main__':
    main()
Problem p02546 (python)

Fixed submission:
s = input()

if s[-1] == 's':
  print(s + 'es')
else:
  print(s + 's')

Buggy submission (verdict: Runtime Error):
n = int(input())
c=0
for i in range(1,n):
  a = 0
  while a<n-i:
    a+=i
    c+=1
 
print(c)
Problem p02571 (python)

Fixed submission:
s = input()
t = input()
l = len(t)
ans = 0
a = 0
list1 = [0]
for i in range(len(s) - l + 1):
  ss = list(s[i:i+l])
  for j in range(l):
    if ss[j] ==t[j]:
      ans += 1
      list1.append(ans)
    else:
      pass
  ans = 0
m =  max(list1)
print(l-m)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
l = len(t)
ans = 0
a = 0
list1 = []
for i in range(len(s) - l + 1):
  ss = list(s[i:i+l])
  for j in range(l):
    if ss[j] ==t[j]:
      ans += 1
      list1.append(ans)
    else:
      pass
  ans = 0
m =  max(list1)
print(l-m)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
l = len(t)
ans = 0
a = 0
list1 = []
for i in range(len(s) - l + 1):
  ss = list(s[i:i+l])
  for j in range(l):
    if ss[j] ==t[j]:
      ans += 1
      list1.append(ans)
    else:
        ans = 0
  ans = 0
m =  max(list1)
print(l-m)
Problem p02546 (python)

Fixed submission:
text = input()
tend = len(text)
text2 = ""
if text[len(text)-1:len(text)] == "s":
    text2 = text +'es'
else:
    text2 = text +'s'
print(text2)

Buggy submission (verdict: Runtime Error):
N = int(input())
A=[list(map(int, input().split())) for i in range(N)]
num = 0
zoro = 0
while num < N:
  if A[num][0] ==A[num][1]:
    num +=1
    zoro +=1 
  else:
    num +=1
    if zoro >2:
      zoro = zoro
    else:
      zoro = 0
if zoro >2 :
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
A=[list(map(int, input().split())) for i in range(N)]
num = 0
zoro = 0
while num < N:
  if A[num][0] ==A[num][1]:
    num +=1
    zoro +=1 
  else:
    num +=1
    if zoro >2:
      zoro = zoro
    else:
      zoro = 0
if zoro >2 :
  print("Yes")
else:
  print("No")
Problem p02676 (python)

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

if len(z) > a: 
  print(z[0:a] + "...")
else:
  print(z)

Buggy submission (verdict: Runtime Error):
a, b, h, m = map(int,input().split())

hk = h * 30
mk = m * 6

kaku = mk - hk

print(((b ** 2)+(a ** 2)) - (2 * a * b * kaku))
Problem p02711 (python)

Fixed submission:
a = input()

if "7" in a:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = []
if a <= 1000000:
for i in range(a):
    if i % 15 == 0:
      pass
    elif i % 3 == 0:
      pass
    elif i % 5 == 0:
      pass
    else:
      b.append(i)
print(sum(b))
Problem p02712 (python)

Fixed submission:
a = int(input())
b = []

for i in range(a+1):
    if i % 3 == 0 and i % 5 == 0:
      pass
    elif i % 3 == 0:
      pass
    elif i % 5 == 0:
      pass
    else:
      b.append(i)
print(sum(b))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = []
if a <= 1000000:
for i in range(a):
    if i % 15 == 0:
      pass
    elif i % 3 == 0:
      pass
    elif i % 5 == 0:
      pass
    else:
      b.append(i)
else:
  pass
print(sum(b))
Problem p02777 (python)

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

if A == S:
  print(N-1,M)
elif B == S:
  print(N,M-1)

Buggy submission (verdict: Runtime Error):
as. bs = map(str,input().split())
ci, di = map(int,input().split())
es = str(input())

if es == as:
  ca = ci - 1
  print(ca)
elif es == bs:
  da = di -1
  print(da)
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())
l = [1,2,3]
l.remove(a)
l.remove(b)
print(''.join(map(str,l)))

Buggy submission (verdict: Runtime Error):
a = input()
b = input()

l = [1,2,3]

l.remove(a)
l.remove(b)

print(l)
Problem p02847 (python)

Fixed submission:
A = input()

S = ['SUN','MON','TUE','WED','THU','FRI','SAT']

for i in range(7):
  if A == S[i]:
    print(7-i)
    break
  i+=1

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

S = [SUN,MON,TUE,WED,THU,FRI,SAT]

for i in range(7):
  if A == S[i]:
    print(7-i)
    break
  i+=1
Problem p02897 (python)

Fixed submission:
N = int(input())

L = [i for i in range(N+1)]

odd = []

for j in range(N+1):
  if L[j] % 2 == 0:
    pass
  else:
    odd.append(L[j])
  j+=1

print(len(odd)/(len(L)-1))

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

c=0

for i in range(A):
  if N[i] >= B:
    c+=1
  else:
    pass
  i+=1
print(c)

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

c=0

for i in range(A):
  if N[i] >= B:
    c+=1
  else:
    pass
  i+=1
print(c)
Problem p02546 (python)

Fixed submission:
n = input()
if n[-1] == 's':
  print(n+'es')
else:
  print(n+'s')

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

ans = []
for i in range(n):
  a = num_list[i]
  a1= a[0]
  a2 = a[1]
  if a1 == a2:
    ans.append(1)
    if i > 1 and ans[i-2] == 1 and ans[i-1] == 1 and ans[i] == 1:
      print('Yes')
      break
  else:
    ans.append(0)
if len(ans) == n:
  print('No')
Problem p02570 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A <= B*C:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
D,T,S = map(float,raw_input().split())
def intime(D,T,S):
  if D<=T*S:
    print('Yes')
  else:
    print('No')
Problem p02572 (python)

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

mod = 10 ** 9 + 7
ans = 0

A_sum = [A[0] for i in range(N)]
for i in range(1, N):
    A_sum[i] = A_sum[i-1] + A[i]

for i in range(1, N):
    ans += A[i] * A_sum[i-1]
    ans %= mod

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

ans = 1
res = 0

for i in range(N):
    ans *= A[i]
    ans %= 10 ** 9 + 7

for i in range(N):
    res += ans * pow(A[i], -1, 10 ** 9 + 7)
    res %= 10 ** 9 + 7

print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

ans = 1
res = 0

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

for i in range(N):
    ans *= A[i]
    ans %= 10 ** 9 + 7

for i in range(N):
    res += ans * modinv(A[i], 10 ** 9 + 7)
    res %= 10 ** 9 + 7

print(res)