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

Fixed submission:
n=int(input())
def dfs(s):
    if int(s) > n:
        return 0
    if all(s.count(c)>0 for c in "753"):
        ret = 1
    else:
        ret = 0
    for c in "753":
        ret += dfs(s+c)
    return ret
print(dfs("0"))

Buggy submission (verdict: Runtime Error):
 n=int(input())
def des(s):
    if int(s) > n:
        return 0
    ret = 1 if all(s.count(c)>0 for c in "753") else 0
    for c in "753":
        ret += dfs(s+c)
    return ret
print(dfs("0"))
Problem p03284 (python)

Fixed submission:
n,k = map(int,input().split())
print(0 if n%k==0 else 1)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(n if n%2==0 else n*2)
Problem p03325 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
cnt=0
for a in A:
    while a%2 == 0:
        cnt += 1
        a = a//2
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
cnt=0
if any(A%2==0):
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
cnt=0
if any(A%2==0):
    cnt+=1
print(cnt)
Problem p03377 (python)

Fixed submission:
a,b,x=map(int,input().split())
print("YES" if a<=x and x<=a+b else "NO" )

Buggy submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
print("YES"  a<=x and x<=a+b else "NO" )
Problem p03433 (python)

Fixed submission:
n = int(input())
a=int(input())
print("Yes" if n%500<=a else "No")

Buggy submission (verdict: Runtime Error):
x,a,b = [int(input()) for i in range(3)]
print((x-a)%b)
Problem p03545 (python)

Fixed submission:
n = [x for x in input()]
l=len(n)-1
for i in range(2**l):
    op=["-"]*l
    for j in range(l):
        if ((i>>j)&1):
            op[l-1-j]="+"
    formula=""
    for p,q in zip(n,op + [""]):
        formula+=(p+q)
    if eval(formula)==7:
        print(formula + "=7" )
        break

Buggy submission (verdict: Runtime Error):
n = [int(x) for ix in input()]
l=len(n)-1
for i in range(2**l):
    op=["-"]*l
    for j in range(l):
        if ((i>>j)&1):
            op[l-1-j]="+"
    formula=""
    for p,q in zip(n,op + [""]):
        formula+=(p+q)
    if eval(formula)==7:
        print(formula + "=7" )
        break
Problem p03574 (python)

Fixed submission:
def minesweeper(grid, x, y):
    if grid[x][y] == '.':
        cnt = 0
        for i in range(x-1, x+2): 
            if i < 0 or H-1 < i:
                pass
            else :
                for j in range(y-1, y+2):
                    if j < 0 or W - 1 < j:
                        pass
                    else :
                        if grid[i][j] == '#':
                            cnt += 1
        grid[x][y] = str(cnt)
    return grid


H, W = [int(i) for i in input().split()]

grid = []
for h in range(H):
    grid.append([l for l in input()])
    
for x in range(H):
    for y in range(W):
        grid = minesweeper(grid, x, y)
        
for row in grid:
    print(''.join(row))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[input for i in range(h)]
for i in range(h):
    l=""
    for j in range(w):
        if s[i][j]=="#":
            l+="#"
        else:
            l+=str(sum([t[max(0,j-1):min(w,j+2)].count("#") for t in s[max(0,i-1):min(h,i+2)]]))
    print(l)
Problem p03737 (python)

Fixed submission:
s1,s2, s3=input().split()
print(s1[0].upper()+s2[0].upper()+s3[0].upper())

Buggy submission (verdict: Runtime Error):
s1 s2 s3=input().split()
print(s1[0].upper()+s2[0].upper()+s3[0].upper())
Problem p02684 (python)

Fixed submission:
# -*- coding: utf-8 -*-

N, K=map(int, input().split())
A = list(map(int,input().split()))
now=0
rireki=[0]*N
isou=1
hazimete=0
for i in range(4*N):
    if rireki[now]==0:
        rireki[now]=1
        startnum=i
        start=now
    else:
        if hazimete==1:
            startnum=i
            start=now
        hazimte=1
        if rireki[now]==1:
            rireki[now]=2
        else:
            if rireki[now]==2:
                rireki[now]=3
                isou=i-startnum-1
                break
    #print("{}".format(now))
    now=A[now]-1

#print("{}".format(isou))
amari=(K-startnum-1)%isou

for i in range(amari):
    now=A[now]-1
#print("{}".format(amari))
if K>startnum:
    print("{}".format(now+1))
else:
    now=0
    for i in range(K):
        now=A[now]-1
    print("{}".format(now+1))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N, K=map(int, input().split())
A = list(map(int,input().split()))
now=0
rireki=[0]*N
for i in range(K):
    if rireki[now]==0:
        rireki[now]=1
    else:
        loop=i+1
        break

#    print("{}".format(now))
    now=A[now]-1


amari=K%loop
for i in range(amari):
    now=A[now]-1

print("{}".format(A[now]))
Problem p02691 (python)

Fixed submission:
# -*- coding: utf-8 -*-

N = int(input())
A = list(map(int, input().split()))
count=0
L = [0]*N
R = [0]*N
N2=2*N
hash_L=[0]*N2
hash_R=[0]*N2

sheet_L=[0]*N2
sheet_R=[0]*N2
for i in range(N):
    L[i]=A[i]+i+1
    if L[i]<N2:
        if sheet_L[L[i]]==0:
            hash_L[L[i]]=L[i]
            sheet_L[L[i]]=1
        else:
            sheet_L[L[i]]=sheet_L[L[i]]+1

    R[i]=-A[i]+i+1
    if R[i]>0:
        if sheet_R[R[i]]==0:
            hash_R[R[i]]=R[i]
            sheet_R[R[i]]=1
        else:
            sheet_R[R[i]]=sheet_R[R[i]]+1


for i in range(2*N):
    if not hash_L[i]==0:
        if hash_L[i]==hash_R[i]:
            count=count+sheet_L[i]*sheet_R[i]
#print("{}".format(hash_L))
#print("{}".format(hash_R))
print("{}".format(count))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N = int(input())
A = list(map(int, input().split()))
count=0
L = [0]*N
R = [0]*N
hash_L=[0]*10000000000
hash_R=[0]*10000000000
for i in range(N):
    L[i]=A[i]+i
    hash_L[L[i]]=L[i]
    R[i]=-A[i]+i
    hash_R[R[i]]=R[i]

for i in range(2*N):
    if hash_L[i]==hash_R[i]:
        count=count+1

print("{}".format(count))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N = int(input())
A = list(map(int, input().split()))
count=0

for i in range(N):
    m=max[i:]
    for j in range(N-i-A[i]):
        k=i+j+A[i]
        
        if A[i]+A[k]==k-i:
            count = count+1
            #print("{} {}".format(i+1,k+1))
        if A[i]+m+i<k:
            break


print("{}".format(count))
Problem p02724 (python)

Fixed submission:
# -*- coding: utf-8 -*-

X = int(input())

a = int(X/500)
b = int((X-500*a)/5)
print("{}".format(1000*a+5*b))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

X = int(input())

a = int(X/500)
b = int((X-500*a)/5
print("{}".format(1000*a+5*b))
Problem p02677 (python)

Fixed submission:
import math
A,B,H,M = map(float,input().split())
X = math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(5.5*M-30*H)))
print(X)

Buggy submission (verdict: Runtime Error):
import math
A,B,H,M = map(float,input().split())
X = sqrt(A**2+B**2-2*A*B*math.cos(math.radians(5.5*M-30*H)))
print(X)
Problem p02684 (python)

Fixed submission:
N, K = map(int,input().split())
A = list(map(int,input().split()))
X = [-1 for j in range(N)]
X[0] = 0
Y = [0]
i = 0
Num = 0
MM = 0
for k in range(1,N):
  i = A[i]-1
  if k == K:
    MM = 1
    P = i
    break
  elif X[i] != -1:
    Num = X[i]
    break
  else:
    X[i] = k
    Y.append(i)
Y = Y[Num:]
B = (K-Num)%len(Y)
if MM == 1:
  print(P+1)
else:
  print(Y[B]+1)

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
A = list(map(int,input().split()))
X = [-1 for j in range(N)]
X[0] = 0
Y = [0]
i = 0
Num = 0
MM = 0
for k in range(1,N):
  i = A[i]-1
  if k == K:
    MM = 1
    P = i
  elif X[i] != -1:
    Num = X[i]
    break
  else:
    X[i] = k
    Y.append(i)
Y = Y[Num:]
B = (K-Num)%len(Y)
if MM == 1:
  print(P+1)
else:
  print(Y[B]+1)

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
A = list(map(int,input().split()))
X = [-1 for j in range(N)]
X[0] = 0
Y = [0]
i = 0
Num = 0
MM = 0
for k in range(1,N):
  i = A[i]-1
  if k == K:
    MM = 1
    P = i
  elif X[i] != -1:
    Num = X[i]
    break
  else:
    X[i] = k
    Y.append(i)
Y = Y[Num:]
B = (K-Num)%len(Y)
if MM = 1:
  print(P+1)
else:
  print(Y[B]+1)

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
A = list(map(int,input().split()))
X = [-1 for j in range(N)]
X[0] = 0
Y = [0]
i = 0
Num = 0
MM = 0
for k in range(1,N):
  i = A[i]-1
  if k = K:
    MM = 1
    P = i
  elif X[i] != -1:
    Num = X[i]
    break
  else:
    X[i] = k
    Y.append(i)
Y = Y[Num:]
B = (K-Num)%len(Y)
if MM = 1:
  print(P+1)
else:
  print(Y[B]+1)
Problem p02696 (python)

Fixed submission:
A, B, N = input().split()
A = float(A)
B = float(B)
N = float(N)
import math
value = math.floor(A*(B-1)/B)
a = int(math.floor(A*N/B)-A*math.floor(N/B))
if N < B-1:
  print(a)
else:
  print(value)

Buggy submission (verdict: Runtime Error):
A, B, N = input().split()
A = float(A)
B = float(B)
N = float(N)
import math
value = math.floor(A*(B-1)/B)
max = 0
for i in range(B):
  a = int(math.floor(A*x/B)-A*math.floor(x/B))
  if a > max:
    max = a
if N < B-1:
  print(a)
else:
  print(value)
Problem p02813 (python)

Fixed submission:
def f(x):
    return x-1
import itertools
import math
N = int(input())
P = list(map(int, input().split()))
P = list(map(f, P))
Q = list(map(int, input().split()))
Q = list(map(f, Q))
S = list(range(N))
permutation = list(itertools.permutations(S))
a,b = 0,0
for i in range(len(permutation)):
    if P == list(permutation[i]):
        a = i
    if Q == list(permutation[i]):
        b = i
print(int(math.fabs(a-b)))

Buggy submission (verdict: Runtime Error):
import itertools
import math
N = input()
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
permutation = list(itertools(N))
for i in range(len(permutation)):
  if P == permutation[i]:
    a = i
  elif Q == permutation[i]:
    b = i
print(math.fabs(a-b))
Problem p03031 (python)

Fixed submission:
N, M = map(int, input().split())
K = [[0] for i in range(M)]
adjacent = [[0]*N for i in range(M)]
for i in range(M):
    A = list(input().split())
    K[i] = A[0]
    for j in A[1:]:
        adjacent[i][int(j)-1] = 1
P = list(input().split())
X = 0
for i in range(2**N):
  a = 0
  b = [0]*N
  for j in range(N):
    if i%2 == 1:
      b[j] = 1
    i = i//2
  for j in range(M):
    if  sum([x*y for (x,y) in zip(b, adjacent[j])])%2 == int(P[j]):
      a += 1
  if a == M:
    X += 1
print(X)

Buggy submission (verdict: Runtime Error):
N, M = input().split()
K = []
P = []
adjacent = [[0] for i in range(M)]
for i in range(M):
  A = list(input())
  K[i] = A[0]
  adjacent[i] = A[1:]
P = list(input())
X = 0
a = [[0] for i in range(M)]
for i in range(2**N):
  b = []
  for j in range(N):
    if i%2 == 1:
      b.append(j)
    i = i//2
  for j in range(M):
    if len(set(b)&set(adjacent[j]))%2 == P[j]:
      a[j] = 1
  if sum(a) == M:
    X += 1
print(X)
Problem p03722 (python)

Fixed submission:
N, M = map(int, input().split())
adjacent = []
score = ['None' for i in range(N)]
score[0] = 0
for i in range(M):
    a, b, c = map(int, input().split())
    adjacent.append([a-1, b-1, c])
for i in range(N):
    for j in adjacent:
      if score[j[1]] == 'None' and score[j[0]] != 'None':
        score[j[1]] = score[j[0]] + j[2]
      if score[j[1]] != 'None' and score[j[0]] != 'None':
        if score[j[1]] < score[j[0]] + j[2]:
          score[j[1]] = score[j[0]] + j[2]
    if i == N-2:
      t = score[N-1]
    if i == N-1:
      if t != score[N-1]:
        score[N-1] = 1e+15
if score[N-1] < 1e+15:
    print(t)
else:
    print('inf')

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
adjacent = []
score = ['None' for i in range(N)]
score[0] = 0
for i in range(M):
    a, b, c = map(int, input().split())
    adjacent.append([a-1, b-1, c])
for i in range(2N):
    for j in adjacent:
      if score[j[1]] == 'None' and score[j[0]] != 'None':
        score[j[1]] = score[j[0]] + j[2]
      if score[j[1]] != 'None' and score[j[0]] != 'None':
        if score[j[1]] < score[j[0]] + j[2]:
          score[j[1]] = score[j[0]] + j[2]
    if i == N-1:
      t = score[N-1]
    if i == 2N:
      if t != score[N-1]:
        score[N-1] = 1e+15
if score[N-1] < 1e+15:
    print(score[N-1])
else:
    print('inf')

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
adjacent = []
score = ['None' for i in range(N)]
score[0] = 0
for i in range(M):
    a, b, c = map(int, input().split())
    adjacent.append([a-1, b-1, c])
for i in range(N-1):
    for j in adjacent:
      if score[j[1]] == 'None' and score[j[0]] != 'None':
        score[j[1]] = score[j[0]] + j[2]
      if score[j[1]] != 'None' and score[j[0]] != 'None':
        if score[j[1]] < score[j[0]] + j[2]:
          score[j[1]] = score[j[0]] + j[2]
for j in adjacent:
    if score[j[1]] < score[j[0]] + j[2]:
        score[N-1] = 1e+15
if score[N-1] < 1e+15:
    print(score[N-1])
else:
    print('inf')
Problem p02658 (python)

Fixed submission:
limit = 1E18
n = int(input())
total = 1
# A string
line = str(input())

if line.startswith("0 ") or " 0" in line:
    print(0)
    exit()

for i in line.split():
    x = int(i)
    total *= x
    if total > limit:
        print(-1)
        exit()

print(-1 if total > limit else total)

Buggy submission (verdict: Runtime Error):
limit = 1E18
n = input()
total = 0
for i in range(n):
  x = input()
  total += x
  if total > limit:
    print(-1)
    exit()
    
print(total)
Problem p02658 (python)

Fixed submission:
N = int(input())
num = list(map(int, input().split()))
answer = 1
if 0 in num:
  print(0)
else:
  for i in range(N):
    if answer*num[i] <= 10**18:
      answer = answer*num[i]
      if i == N-1:
        print(answer)
    else:
      print(-1)
      break

Buggy submission (verdict: Runtime Error):
N = int(input())
num = list(map(int, input().split()))
ans = num.prod()
Problem p02802 (python)

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

penalty = [0] * n
isAC = [False] * n

for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "WA":
        if not isAC[p]:
            penalty[p] += 1
    else:
        isAC[p] = True
for i in range(n):
    if not isAC[i]:
        penalty[i] = 0
print(sum(isAC), sum(penalty))

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

penalty = [0] * n
isAC = [False] * n

for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == "WA":
        if not isAC[p]:
            penalty[p] += 1
    else:
        isAC[p] = True
for i in range(n)
    if not isAC[i]:
        penalty[i] = 0
print(sum(isAC), sum(penalty))
Problem p03220 (python)

Fixed submission:
n = int(input())
t, a = map(int, input().split())
li = list(map(int, input().split()))
x = 10**9
ind = 0
for i in range(n):
    mean = t - li[i] * 0.006
    sa = abs(mean - a)
    if sa < x:
        x = sa
        ind = i + 1
print(ind)

Buggy submission (verdict: Runtime Error):
n = int(input())
t, a = map(int, input().split())
li = list(map(int, input().split()))
x = 55
ind = 0
for i in li:
    mean = t - li[i] * 0.006
    sa = abs(mean - a)
    if sa < x:
        x = sa
        ind = i + 1
print(ind)
Problem p03448 (python)

Fixed submission:
a, b, c, x = [int(input()) for _ in range(4)]
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500 * i + 100 * j + 50 * k == x:
                count += 1
print(count)

Buggy submission (verdict: Runtime Error):
a, b, c, x = map(int, input().split())
count = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if i * 500 + j * 100 + k * 50 == x:
                count += 1
print(count)
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 = int(input())
b = int(input())
abyb = a * b
if abyb % 2 == 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
abyb = a * b
if abyb % 2 = 0:
    print("Even")
else:
    print("Odd")
Problem p03469 (python)

Fixed submission:
print("2018/01/" + input()[-2:])

Buggy submission (verdict: Runtime Error):
nums = [int(input()) for _ in range(int(input()))]
nums_dict = dict()
for i in nums:
    nums_dict[i] = True
print(len(nums_dict.keys()))
Problem p03471 (python)

Fixed submission:
n, y = map(int, input().split())
for senyen in range(n + 1):
    for gosenyen in range(n + 1 - senyen):
        manyen = n - senyen - gosenyen
        if senyen * 1000 + gosenyen * 5000 + manyen * 10000 == y:
            print(manyen, gosenyen, senyen)
            exit(0)
print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
n, yen = map(int, input().split())
for x in range(n + 1):
    for y in range(n - x + 1):
        z = n - x - y
        if yen == x * 10000 + y * 5000 + z * 1000:
            print(x + " " + y + " " + z)
            exit(0)
print("-1 -1 -1")
Problem p03478 (python)

Fixed submission:
n, a, b = map(int, input().split())
count = 0
for i in range(1, n+1):
    s = sum(int(x) for x in str(i))
    if a <= s <= b:
        count += i
print(count)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
total = 0
for i in range(1, n+1):
    x = sum([int(j) for j in str(i)])
        if a <= x <= b:
            total = total + x
print(total)
Problem p03485 (python)

Fixed submission:
a, b = map(int,input().split())
print((a + b + 1) // 2)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
x = (a + b) / 2
print(math.ceil(x))
Problem p02677 (python)

Fixed submission:
import math
def yo(a,b,th):
    thr = math.radians(th)
    cosa = math.cos(thr)
    tmp = float(a**2) + float(b**2) - float(2*b*a*cosa)
    re = float(math.sqrt(tmp))
    return re
A,B,h,m = map(int, input().split())
longdig = m * 6
shortdig = (h*60+m) * 0.5
theta = abs(longdig - shortdig)
print(yo(A,B,theta))

Buggy submission (verdict: Runtime Error):
import math
def yo(a,b,th):
    thr = math.radians(th)
    cosa = math.cos(thr)
    kk = 4.56425719433005567605
    ttt = (a**2 + b**2 - kk**2) / (2*a*b)
    acosa = math.acos(ttt)
    ttt = math.degrees(acosa)
    tmp = float(a**2) + float(b**2) - float(2*b*a*cosa)
    re = float(math.sqrt(tmp))
    return re
A,B,h,m = map(int, input().split())
longdig = ((h*60+m)%360) * 6
shortdig = (h*60+m) * 0.5
theta = abs(longdig - shortdig)
print(yo(A,B,theta))
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 p03547 (python)

Fixed submission:
dic = {"A":1,"B":2,"C":3,"D":4,"E":5,"F":6}
X,Y = input().split()
for key in dic:
    if key == X:
        x = dic[key]
    if key == Y:
        y = dic[key]
if x > y:
    print('>')
elif x < y:
    print('<')
else:
    print('=')

Buggy submission (verdict: Runtime Error):
dic = {"A":1,"B":2,"C":3,"D":4,"E":5,"F":6}
X = input('X>>')
Y = input('Y>>')
for key in dic:
    if key == X:
        x = dic[key]
    if key == Y:
        y = dic[key]
if x > y:
    print('>')
elif x < y:
    print('<')
else:
    print('=')
Problem p02719 (python)

Fixed submission:
#Input
n, k = map(int, input().split())

#Process
mod = n % k
if(mod > abs(mod - k)):
    Ans = abs(mod - k)
else:
    Ans = mod

#Output
print(Ans)

Buggy submission (verdict: Runtime Error):
#Input
n, k = map(int, input().split())

#Process
mod = n % k
if(mod > abs(mod - k)):
    Ans = aqbs(mod - k)
else:
    Ans = mod

#Output
print(Ans)
Problem p02747 (python)

Fixed submission:
s = input()

i = 0

if(len(s) % 2 != 0):
    ans = "No"
else:
    while i < len(s):
        if(s[i] == 'h' and s[i+1] == 'i'):
            ans = "Yes"
        else:
            ans = "No"
            break
        i += 2

print(ans)

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

i = 0
while i < len(s):
    if(s[i] == 'h' and s[i+1] == 'i'):
        ans = "Yes"
    else:
        ans = "No"
        break
    i += 2

print(ans)

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

i = 0
while i < len(s):
    if(s[i] == 'h' and s[i+1] == 'i'):
        ans = "Yes"
    else:
        ans = "No"
    i += 2

print(ans)
Problem p02760 (python)

Fixed submission:
#Input
l_A =  [[0 for i in range(3)] for j in range(3)]
l_A[0] = list(map(int, input().split()))
l_A[1] = list(map(int, input().split()))
l_A[2] = list(map(int, input().split()))

def detect_BINGO(l_Atf):
    #print(l_Atf)
    #横
    for i in range(3):
        f_detect = True
        for j in range(3):
            #print(f_detect, l_Atf[i][j])
            f_detect = f_detect and l_Atf[i][j]
        if(f_detect):
            #print("横" + str(i))
            return True
    #縦
    for i in range(3):
        f_detect = True
        for j in range(3):
            f_detect = f_detect and l_Atf[j][i]
        if(f_detect):
            #print("縦" + str(i))
            return True
    #斜
    f_detect = True
    for i in range(3):
        f_detect = f_detect and l_Atf[i][i]
    if(f_detect):
        #print("斜＼")
        return True
    f_detect = True
    for i in range(3):
        f_detect = f_detect and l_Atf[i][3-1-i]
    if(f_detect):
        #print("斜／")
        return True
    
    #BINGOなし
    return False

#Process
l_Atf = [[False for i in range(3)] for j in range(3)]
for i in range(int(input())):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if(l_A[j][k] == b):
                l_Atf[j][k] = True
    #print(l_Atf)

f_bingo = detect_BINGO(l_Atf)

#Output
if(f_bingo):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
#Input
l_A =  [[0 for i in range(3)] for j in range(3)]

def detect_BINGO(l_Atf):
    #print(l_Atf)
    #横
    for i in range(3):
        f_detect = True
        for j in range(3):
            #print(f_detect, l_Atf[i][j])
            f_detect = f_detect and l_Atf[i][j]
        if(f_detect):
            #print("横" + str(i))
            return True
    #縦
    for i in range(3):
        f_detect = True
        for j in range(3):
            f_detect = f_detect and l_Atf[j][i]
        if(f_detect):
            #print("縦" + str(i))
            return True
    #斜
    f_detect = True
    for i in range(3):
        f_detect = f_detect and l_Atf[i][i]
    if(f_detect):
        #print("斜＼")
        return True
    f_detect = True
    for i in range(3):
        f_detect = f_detect and l_Atf[3-1-i][3-1-i]
    if(f_detect):
        #print("斜／")
        return True
    
    #BINGOなし
    return False

#Process
l_Atf = [[False for i in range(3)] for j in range(3)]
for i in range(int(input())):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if(l_A[j][k] == b):
                l_Atf[j][k] = True
    #print(l_Atf)

#   print(l_Atf)
f_bingo = detect_BINGO(l_Atf)

#Output
if(f_bingo):
    print("Yes")
else:
    print("no")
Problem p02791 (python)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
min = float('inf')
ans = 0
for i in range(N):
    if P[i] <= min:
        min = P[i]
        ans += 1
    # if P[i] <= min(P[:(i+1)]):
    #     ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = list(map(int, input().split()))
min = float('inf')
ans = 0
for i in range(N):
  if P[i] <= min(P[:(i+1)]):
    ans += 1
print(ans)