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

Fixed submission:
h,w = map(int,input().split())
l = [["."]*(w+2)]
for i in range(h):
    l.append(["."] + [i for i in input()] + ["."])
l.append(["."]*(w+2))
 
def count(i,j):
    if l[i][j] == "#":
        return "#"
    c = 0
    for n in range(i-1,i+2):
        for m in range(j-1,j+2):
            if l[n][m] == "#":
                c += 1
    return str(c)
 
ans = ["".join([count(i,j) for j in range(1,1+w)]) for i in range(1,1+h)]
 
print("\n".join(ans))

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
l = [["."]*(w+2)]
for i in range(h):
    l.append(["."] + [i for i in input()] + ["."])
l.append(["."]*(w+2))
 
def count(i,j):
    if l[i][j] == "#":
        return "#"
    c = 0
    for n in range(i-1,i+2):
        for m in range(j-1,j+2):
            if l[n][m] == "#":
                c += 1
    return str(c)
 
ans = ["".join([count(i,j) for j in range(1,1+w)]) for i in range(1,1+h)]
 
print("\n".join(ans))
h,w = map(int,input().split())
l = [["."]*(w+2)]
for i in range(h):
    l.append(["."] + [i for i in input()] + ["."])
l.append(["."]*(w+2))

def count(i,j):
    if l[i][j] == "#":
        return "#"
    c = 0
    for n in range(i-1,i+2):
        for m in range(j-1,j+2):
            if l[n][m] == "#":
                c += 1
    return str(c)

ans = ["".join([count(i,j) for j in range(1,1+w)]) for i in range(1,1+h)]

print("\n".join(ans))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
l=[["."*(w+2)]]
for i in range(h):
  l.append(["."]+[i for i in input()]+["."])
l.append(["."]*(w+2))

def count(i,j):
  if l[i][j]=="#":
    return "#"
  c=0
  for n in range(i-1,i+2):
    for m in range(j-1,j+2):
      if l[n][m]=="#":
        c+=1
  return str(c)

ans=["".join([count(i,j) for j in range(1,1+w)]) for i in range(1,1+h)]

print("\n".join(ans))
Problem p03611 (python)

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))
a1=[x-1 for x in a]
a2=[x+1 for x in a]
b=a+a1+a2
c=collections.Counter(b)

print(max(c.values()))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
if n==1:
  print(1)
  exit()
a.sort()
b=[]
for i in range(a[0],a[n-1]-1):
  ans=0
  ans+=a.count(i)+a.count(i+1)+a.count(i+2)
  b.append(ans)

b.sort()
print(b[-1])
Problem p03672 (python)

Fixed submission:
s=str(input())
flag=0
for i in range(1,len(s)):
  s=s[:len(s)-2]
  for j in range(len(s)//2):
    if s[j]!=s[len(s)//2+j]:
      flag=1
      break
  if flag==0:
    print(len(s))
    exit()
  else:
    flag=0
    continue

Buggy submission (verdict: Runtime Error):
s=str(input())
flag=0
for i in range(len(s)):
  s=s[:len(s)-2*i]
  for j in range(len(s)//2):
    if s[j]!=s[len(s)-j]:
      flag=1
      break
  if flag==0:
    print(len(s))
    exit()
  else:
    flag=0
    continue
Problem p03680 (python)

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]
ans=1
res=1
for i in range(n):
  if a[res-1]==2:
    print(ans)
    exit()
  else:
    ans+=1
    res=a[res-1]

print(-1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
t=[]
t.append(1)
for i in range(n):
  a.append(input())

x=a[0]
while True:
  if x==2:
    print(len(t))
    break
  elif x in t:
    print(-1)
    break
  else:
    t.append(x)
    y=x
    x=a[y-1]

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
t=[]
t.append(1)
for i in range(n):
  a.append(input())

x=a[0]
while True:
  if x==2:
    print(len(t))
    exit()
  elif x in t:
    print(-1)
    exit()
  else:
    x=a[x-1]
Problem p03694 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
print(a[n-1]-a[0])

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

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a1=0
b=0
c=0
d=0
e=0
f=0
g=0
h=0
ans=0
for i in range(n):
  if 1<=a[i]<=399:
    a1=1
  elif 400<=a[i]<=799:
    b=1
  elif 800<=a[i]<=1199:
    c=1
  elif 1200<=a[i]<=1599:
    d=1
  elif 1600<=a[i]<=1999:
    e=1
  elif 2000<=a[i]<=2399:
    f=1
  elif 2400<=a[i]<=2799:
    g=1
  elif 2800<=a[i]<=3199:
    h=1
  else:
    ans+=1

x=a1+b+c+d+e+f+g+h
if a1==b==c==d==e==f==g==h==0:
  print(1,ans)
else:
  print(x,x+ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a1=0
b=0
c=0
d=0
e=0
f=0
g=0
h=0
ans=0
for i in range(n):
  if 1<=a[i]<=399:
    a1=1
  elif 400<=a[i]<=799:
    b=1
  elif 800<=a[i]<=1199:
    c=1
  elif 1200<=a[i]<=1599:
    d=1
  elif 1600<=a[i]<=1999:
    e=1
  elif 2000<=a[i]<=2399:
    f=1
  elif 2400<=a[i]<=2799:
    g=1
  elif 2800<=a[i]<=3199:
    h=1
  else:
    ans+=1

x=a1+b+c+d+e+f+g+h
if a1=b=c=d=e=f=g=h=0:
  print(1,ans)
else:
  print(x,x+ans)
Problem p03720 (python)

Fixed submission:
n,m=map(int,input().split())
a_s=[]
b_s=[]
for i in range(m):
  a,b=map(int,input().split())
  a_s.append(a)
  b_s.append(b)

for i in range(1,n+1):
  print(a_s.count(i)+b_s.count(i))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a_s=[]
b_s=[]
for i in range(m):
  a,b=map(int,input().split())
  a_s.append(a)
  b_s.append(b)

for i in range(1,N+1):
  print(a_s.count(i)+b_s.count(i))
Problem p03721 (python)

Fixed submission:
n,k=map(int,input().split())
s=[0]*10**5
for i in range(n):
    a,b=map(int,input().split())
    s[a-1]+=b
i=0
while k>0:
    k-=s[i]
    i+=1
print(i)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s[0]*10**5
for i in range(n):
  a,b=map(int,input().split())
  s[a-1]+=b
i=0
while k>0:
  k-=s[i]
  i+=1
print(i)
Problem p03730 (python)

Fixed submission:
a,b,c=map(int,input().split())
ans="NO"
for i in range(1,b+1):
  if a*i%b==c:
    ans="YES"
    break

print(ans)

Buggy submission (verdict: Runtime Error):
,b,c=map(int,input().split())
s={}
while True:
  if a%b==c:
    print("YES")
    break
  elif (a%b) in s:
    print("NO")
    break
  else:
    s.add((a%b))
    a+=a
Problem p03844 (python)

Fixed submission:
a,op,b=map(str,input().split())
a=int(a)
b=int(b)
if op=="+":
  print(a+b)
else:
  print(a-b)

Buggy submission (verdict: Runtime Error):
a,b,c=map(input().split())
if b=="+":
  print(a+b)
else:
  print(a-b)
Problem p03845 (python)

Fixed submission:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for i in range(m):
  p,x=map(int,input().split())
  y=t[p-1]
  t[p-1]=x
  print(sum(t))
  t[p-1]=y

Buggy submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
for i in range(m):
  p,x=map(int,input().split())
  y=t[p-1]
  t[p-1]=x:
  print(sum(t))
  t[p-1]=y
Problem p03846 (python)

Fixed submission:
N=int(input())
*A,=sorted(map(int,input().split()))
 
a=True
if N%2==0:
 for i in range(1,N,2):
  if A[i-1]!=i or A[i]!=i:
    a=False
    break
else:
 if A[0]!=0:a=False
 else:
    for i in range(2,N,2):
     if A[i-1]!=i or A[i]!=i:
        a=False
        break
print(2**(N//2)%(10**9+7) if a else 0)

Buggy submission (verdict: Runtime Error):
n=int(input())
*A=sorted(map(int,input().split()))

a=True
if n%2==0:
  for i in range(1,n,2):
    if A[i-1]!=i or A[i]!=i:
      a=False
      break
else:
  if A[0]!=0:a=False
  else:
    for i in range(2,n,2):
      if A[i-1]!=i or A[i]!=i:
        a=False
        break
print(2**(n//2)%(10**9+7) if a else 0)
Problem p03853 (python)

Fixed submission:
h,w=map(int,input().split())
for i in range(h):
  c=input()
  print(c)
  print(c)

Buggy submission (verdict: Runtime Error):
h,w=int(input())
for i in range(h):
  s=input()
  print(s)
  print(s)
Problem p03998 (python)

Fixed submission:
s = {'a': input(), 'b': input(), 'c': input()}
 
now = 'a'
while s[now] != '':
    next = s[now][0]
    s[now] = s[now][1:]
    now = next
print(now.upper())

Buggy submission (verdict: Runtime Error):
s={'a': input(), 'b': input(), 'c' input()}
now='a'
while s[now]!="":
  next =s[now][0]
  s[now]=s[now][1:]
  now= next
print(now.upper())

Buggy submission (verdict: Runtime Error):
a=str(input())
b=str(input())
c=str(input())
x=a[1]
a=a[1:]
while True:
  if x=='a':
    x=a[1]
    a=a[1:]
    if len(a)==0:
      print("A")
      break
  elif x=='b':
    x=b[1]
    b=b[1:]
    if len(b)==0:
      print("B")
      break
  else:
    x=c[1]
    c=c[1:]
    if len(c)==0:
      print("C")
      break
Problem p04043 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a==b==5 and c==7:
  print('YES')
elif a==c==5 and b==7:
  print('YES')
elif b==c==5 and a==7:
  print("YES")
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a==b==5 and c==7:
  print('YES')
elif a==c==5 and b==7:
  print('YES')
elif b==c==5 amd c==7:
  print("YES")
else:
  print('NO')
Problem p03543 (python)

Fixed submission:
a = int(input())
b1 = a // 10
b2 = a % 1000
if (b1 * b2) % 111 == 0:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
a = input()
b1 = a // 10
b2 = a % 1000
if (b1 * b2) % 111 == 0:
	print(Yes)
else:
	print(No)
Problem p02613 (python)

Fixed submission:
n=int(input())
dic={"AC":0,"WA":0,"TLE":0,"RE":0}
for _ in range(n):
  s=input()
  dic[s]+=1
for k,v in dic.items():
  print("{0} x {1}".format(k,v))

Buggy submission (verdict: Runtime Error):
n=int(input())
dic={"AC":0,"WA":0,"TLE":0,"RE":0}
for _ in range(n):
  s=input()
  dic[s]+=1
for k,v in dic.items():
  print("{0} x {1}".format(k,v)
Problem p03101 (python)

Fixed submission:
H,W=map(int,input().split())
h,w=map(int,input().split())
X=H-h
Y=W-w
Z=X*Y
print(Z)

Buggy submission (verdict: Runtime Error):
H=int(input())
W=int(input())
h=int(input())
w=int(input())
print((H-h)*(W-w))
Problem p03136 (python)

Fixed submission:
N=int(input())
table=list(map(int,input().split()))
if max(table)*2<sum(table[:]):
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
l_list = list(int(input()) for _ in range(N))
max_l=max(l_list)
if sum(l_list)-max_l>max_l:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
l_list=[int(input())for _ in range(N)]
max_l=max(l_list)
if sum(l_list)-max_l>max_l:
  print("Yes")
else:
  print("No")
Problem p03238 (python)

Fixed submission:
if int(input())==1:
  print("Hello World")
else:
  A = int(input())
  B=int(input())
  print(A+B)

Buggy submission (verdict: Runtime Error):
if int(input())==1:
  print("Hello World")
else:
  A,B=map(int,input().split())
  print(A+B)
Problem p03351 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
if abs(a-c)<= d:
  print("Yes")
elif abs(a-b)<=d and abs(b-c)<=d:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if abs(a-c)<= d:
  print("Yes")
elif abs(a-b)<=d and abs(b-c)<=d:
  print("Yes")
else:
  print("No"
Problem p03399 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(int(min(a,b)+min(c,d)))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print(min(a,b)+min(c,d))
Problem p02732 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
c = [0 for i in range(n+1)]
b = sorted(a)
cnt = 1
for i in range(n-1):
  if b[i]==b[i+1]:
    cnt += 1
  else:
    c[b[i]] = cnt
    cnt = 1
  if i==n-2:
    c[b[n-1]] = cnt
ans = 0
for i in range(n+1):
  ans += int(c[i]*(c[i]-1)/2)
for i in range(n):
  print(ans-(c[a[i]]-1))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
c = [0 for i in range(n)]
b = sorted(a)
cnt = 1
for i in range(n-1):
  if b[i]==b[i+1]:
    cnt += 1
  else:
    c[b[i]] = cnt
    cnt = 1
  if i==n-2:
    c[b[n-1]] = cnt
ans = 0
for i in range(n):
  ans += int(c[i]*(c[i]-1)/2)
for i in range(n):
  print(ans-(c[a[i]]-1))
Problem p02947 (python)

Fixed submission:
n = int(input())
s = []
for i in range(n):
    s.append(''.join(sorted(input())))
s.sort()
ans = 0
t = 0
for i in range(1,n):
    if s[i-1]==s[i]:
        t += 1
        if i==n-1:
            ans += t*(t+1)/2
    else:
        if t>0:
            ans += t*(t+1)/2
            t = 0

print(int(ans))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
s = [['n' for i in range(10)] for j in range(n)]
for i in range(n):
    s[i]=list(input())
    s[i].sort()
j=0
tans=1
f = 1
ans=0
donei=[]
for i in range(n):
    if not i in donei:
        j=n-1
        while j>i:
            if s[i]==s[j]:
                tans = tans + 1
                donei.append(j)
            j=j-1
        for k in range(tans):
            f = f * (k+1)
        ans = ans + int(f/2)
        tans=1

print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
s = [['n' for i in range(10)] for j in range(n)]
for i in range(n):
    s[i]=list(input())
    s[i].sort()
j=0
tans=1
ans=0
donei=[]
for i in range(n):
    if not i in donei:
        j=n-1
        while j>i:
            if s[i]==s[j]:
                tans = tans + 1
                donei.append(j)
            j=j-1
        ans = ans + int(math.factorial(tans)/2)
        tans=1

print(ans)
Problem p02953 (python)

Fixed submission:
n = input()
h = [int(i) for i in input().split()]

max = 0
i = 0
y = 1
for i in range(int(n)):
    if h[i] > max:
        max = h[i]
    elif h[i] < max-1:
        y = 0
    
if y==1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = input()
h = [int(i) for i in input().split()]

max = 0
i = 0
y = 1
for i in range(n):
    if h[i] > max:
        max = h[i]
    elif h[i] < max-1:
        y = 0
    
if y==1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = input()
h = [int(i) for i in input().sprit()]

max = 0
i = 0
y = 1
for i in range(n):
    if h[i] > max:
        max = h[i]
    elif h[i] < max-1:
        y = 0
    
if y==1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = input()
h = [int(i) for i in input().sprit()]

max = 0
i = 0
y = 1
for i in range(n):
    if h[i] > max:
        max = h[i]
    elif h[i] < max-1:
        y = 0
        break
    
if y==1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = input()
h = [int(i) for i in input().sprit()]

max = 0
i = 0
y = 1
for i in range(n):
    if h[i] > max:
        max = h[i]
    else if h[i] < max-1:
        y = 0
        break
    
if y:
    print("yes")
else:
    print("no")

Buggy submission (verdict: Runtime Error):
n = input()
h = [int(i) for i in input().sprit()]

max = 0
y = 1
for i in range(n):
    if h[i] > max:
        max = h[i]
    else if h[i] < max-1:
        y = 0
        break
    
if y:
    print("yes")
else:
    print("no")

Buggy submission (verdict: Runtime Error):
n = input()
h = [int(i) for i in input().sprit()]

max = 0

while 1:
    for i in range(n):
        if h[i] > max:
            max = h[i]
        else if h[i] < max+1:
            print("no")
            break
    print("yes")
    break
Problem p03469 (python)

Fixed submission:
s = input()
print("2018/01/"+s[8:])

Buggy submission (verdict: Runtime Error):
import sys

N, Y = map(int, input().split())
for x in range(N+1):
	for y in range(N+1-x):
		for z in range(N+1-x-y):
   			if Y == 10000*x+5000*y+1000*z :
    			print(x,y,z)
    			sys.exit()
print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
s= List(input())
s[3]="8"
print(s)

Buggy submission (verdict: Runtime Error):
s= input()
s[3]="8"
print(s)
Problem p03470 (python)

Fixed submission:
n = int(input())
d = []
for i in range(n):
    d.append(int(input()))
print(len(set(d)))

Buggy submission (verdict: Runtime Error):
n = int(input())
d = []
for i in range(n):
    d.extend(int(input()))
print(len(set(d)))
Problem p03473 (python)

Fixed submission:
a = int(input())
a = 48 - a
print(a)

Buggy submission (verdict: Runtime Error):
a = input()
a = 48 - a
print(a)
Problem p04029 (python)

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

Buggy submission (verdict: Runtime Error):
N=input()
print(N*(N+1)/2)
Problem p04030 (python)

Fixed submission:
s = str(input())
a = []
 
for i in range(len(s)):
    if s[i] == '0':
        a.append('0')
    elif s[i] == '1':
        a.append('1')
    else:
        if len(a) != 0:
            a.pop()
 
print(''.join(a))

Buggy submission (verdict: Runtime Error):
s = str(input())
a = []
 
for i in len(s):
    if s[i] == '0':
        a.append('0')
    elif s[i] == '1':
        a.append('1')
    else:
        if len(a) != 0:
            a.pop()
 
print(''.join(a))
Problem p04043 (python)

Fixed submission:
a,b,c=map(int,input().split())
if((a*b*c)%7==0)and((a*b*c)/7==25):
	print("YES")
else:
  	print("NO")

Buggy submission (verdict: Runtime Error):
abc=map(int,input().split())
if abc.count(5)==5 and abc.count(7)==1:
	print("YES")
else:
  	print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if((a*b*c)%7=0)and((a*b*c)/7=25):
	print("YES")
else:
  	print("NO")
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
if a*b %2==0:
	print("Even")
else:
	print("Odd")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a*b %2=0:
	print("Even")
else:
	print("Odd")
Problem p03324 (python)

Fixed submission:
from sys import stdin
d,n=[int(x) for x in stdin.readline().rstrip().split()]
x=1
for i in range(d):
    x*=100
ans=0
if (n==100):
    n+=1

for i in range(n):
    ans+=x
print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin
d,n=[int(x) for x in stdin.readline().rstrip().split()]
x=1
for i in range(d):
    x*=100
ans=0
for i in range(n):
    ans+=x
    if(ans%(x*100))==0)ans+=x
print(ans)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
if s == t[:-1]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
z=0
a,b,c,k = map(int,input().split())
z=k-a
if z>=0:
    z=z-b
print(a+b*0+z*-1)
Problem p02999 (python)

Fixed submission:
x,y = map(int,input().split())
if x<y:
	print(0)
else:
	print(10)

Buggy submission (verdict: Runtime Error):
count=0
a=0
n,x = map(int,input().split())
li = list(map(int,input().split()))
for i in range(n):
    if (a<=x):
        a=a+li[i]
        count+=1
print(count)
Problem p03035 (python)

Fixed submission:
a,b=map(int,input().split())
if a<=5:
   print(0)
elif a<=12:
   print(b//2)
else:
   print(b)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a>=13:
	print(b)
elif a<=5:
	print(0)
elif a>=6 and a<=12 
	print(b/2)

Buggy submission (verdict: Runtime Error):

a,b = map(int,input().split())
if a>=13:
	print(b)
elif a<=5:
	print(0)
else:
	print(b/2) a,b = map(int,input().split())
if a>=13:
	print(b)
elif a<=5:
	print(b*0)
else:
	print(b/2)

Buggy submission (verdict: Runtime Error):

a,b = map(int,input().split())
if a>=13:
	print(b)
elif a<=5:
	print(0)
else:
	print(b/2) a,b = map(int,input().split())
if a>=13:
	print(b)
elif a<=5:
	print('a')
else:
	print(b/2)
Problem p03493 (python)

Fixed submission:
a=list(input())
b=0
if a[0]=='1':
	b=b+1
if a[1]=='1':
	b=b+1
if a[2]=='1':
	b=b+1
print(b)

Buggy submission (verdict: Runtime Error):
print(a=list(input())
b=0
for i in range(3):
	if a[i]=='1':
		b=b+1
print(b)
Problem p04047 (python)

Fixed submission:
n = int(input())
print(sum(sorted(list(map(int, input().split())))[::2]))

Buggy submission (verdict: Runtime Error):
n = int(input())
print(sum(sorted(map(int, input()))[::2]))
Problem p03281 (python)

Fixed submission:
ans = 0
def solve(n):
    global ans
    for i in range(1,n+1,2):
        div_list=[]
        for j in range(1,int((i+1)**0.5)+1):
            if i % j == 0:
                if (i//j)!=j:
                    div_list.append(i//j)
                    div_list.append(j)
                else:
                    div_list.append(j)
        if len(div_list) == 8:
            ans+=1

def main():
    n=int(input())
    solve(n)
    print(ans)

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):

def solve():
    ans = 0
    n=int(input())
    for i in range(1,n+1):
        div_list = []
        for j in range(1,int(i**0.5)+1):
            if i%j!=0:
                continue
            if i//j==j:
                div_list.append(j)
            else:
                div_list.append(i//j)
                div_list.append(j)
        if len(div_list)==8:
            ans=+=1
    print(ans)

if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):

def solve():
    ans = 0
    n=int(input())
    for i in range(1,n+1):
        div_list = []
        for j in range(1,int(i**0.5)+1):
            if i%j!=0:
                continue
            if i//j==j:
                div_list.append(j)
            else:
                div_list.append(i//j)
                div_list.append(j)
        if len(div_list)=8:
            ans=+=1
    print(ans)

if __name__ == '__main__':
    solve()
Problem p02579 (python)

Fixed submission:
import sys, math, itertools, collections, bisect, heapq
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
dydx4 = ((-1,0),(0,-1),(0,1),(1,0))
def check(i,j):
  return 0 <= i < h and 0 <= j < w 
def on_block(i,j):
  return S[i][j] == "#"
h,w = map(int,input().split())
ci,cj = map(int,input().split())
ci-=1;cj-=1
gi,gj = map(int,input().split())
gi-=1;gj-=1
S = [list(input()) for i in range(h)]
grid = [[inf] * w for i in range(h)]
grid[ci][cj] = 0
que = collections.deque()
que.append((0,ci,cj))
while que:
  now,si,sj = que.popleft()
  if now > grid[si][sj]:continue
  for di,dj in dydx4:
    ni = si + di
    nj = sj + dj
    if not check(ni,nj):continue
    if on_block(ni,nj): continue
    else:
      if now < grid[ni][nj] :
        grid[ni][nj] = now
        que.appendleft((now,ni,nj))
        # heapq.heappush(que,(now,ni,nj))
  for i in range(si-2,si+3):
    for j in range(sj-2,sj+3):
      if not check(i,j):continue
      if on_block(i,j):continue
      else:
        if now + 1 < grid[i][j] :
          grid[i][j] = now + 1
          que.append((now+1,i,j))
          # heapq.heappush(que,(now+1,i,j))
print(grid[gi][gj] if grid[gi][gj] != inf else -1)
# print(*grid,sep = "\n")

Buggy submission (verdict: Runtime Error):
import sys, math, itertools, collections, bisect, heapq
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
dydx4 = ((-1,0),(0,-1),(0,1),(1,0))
def check(i,j):
  return 0 <= i < h and 0 <= j < w 
def on_block(i,j):
  return S[i][j] == "#"
h,w = map(int,input().split())
ci,cj = map(int,input().split())
ci-=1;cj-=1
gi,gj = map(int,input().split())
gi-=1;gj-=1
S = [list(input()) for i in range(w)]
grid = [[inf] * w for i in range(h)]
grid[ci][cj] = 0
que = []
que.append((0,ci,cj))
while que:
  now,si,sj = heapq.heappop(que)
  if now > grid[si][sj]:continue
  for di,dj in dydx4:
    ni = si + di
    nj = sj + dj
    if not check(ni,nj):continue
    if on_block(ni,nj): continue
    else:
      if now < grid[ni][nj] :
        grid[ni][nj] = now
        heapq.heappush(que,(now,ni,nj))
  for i in range(si-2,si+3):
    for j in range(sj-2,sj+3):
      if not check(i,j):continue
      if on_block(i,j):continue
      else:
        if now + 1 < grid[i][j] :
          grid[i][j] = now + 1
          heapq.heappush(que,(now+1,i,j))
print(grid[gi][gj] if grid[gi][gj] != inf else -1)
# print(*grid,sep = "\n")