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

Fixed submission:
from collections import deque

H, W = map(int, input().split())
B = deque()
check = [[H*W for _ in range(W)] for _ in range(H)]
for h in range(H):
    a = input()
    if a.count("#") > 0:
        b = [(h, w) for w, e in enumerate(a) if e == "#"]
        B += b
        for bx, bw in b:
            check[bx][bw] = 0

move = [(1, 0), (-1, 0), (0, 1), (0, -1)]

while B:
    x, y = B.pop()
    for dx, dy in move:
        nx, ny = x + dx, y + dy
        if -1 < nx < H and -1 < ny < W:
            if check[nx][ny] > check[x][y] + 1:
                check[nx][ny] = check[x][y] + 1
                B.appendleft((nx, ny))
print(max(max(c) for c in check))

Buggy submission (verdict: Runtime Error):
from collections import deque

H, W = map(int, input().split())
B = deque()
check = [[False for _ in range(W)] for _ in range(H)]
for h in range(H):
    a = input()
    if a.count("#") > 0:
        b = [(h, w) for w, e in enumerate(a) if e == "#"]
        B += b
for bx, by in B:
    check[bx][by] = 0

move = [(1, 0), (-1, 0), (0, 1), (0, -1)]

while B:
    x, y = B.pop()
    for dx, dy in move:
        nx, ny = x + dx, y + dy
        if -1 < nx < H and -1 < ny < W:
            if check[nx][ny] == False:
                lx, ly = nx, ny
                check[nx][ny] = check[x][y] + 1
                B.appendleft((nx, ny))
print(check[lx][ly])

Buggy submission (verdict: Runtime Error):
from collections import deque

H, W = map(int, input().split())
# A = [[2000 for _ in range(W)] for _ in range(H)]
B = deque()
check = [[False for _ in range(W)] for _ in range(H)]
for h in range(H):
    a = input()
    if a.count("#") > 0:
        for w, e in enumerate(a):
            if e == "#":
                B.append((h, w))
                check[h][w] = 0
                # A[h][w] = 0

move = [(1, 0), (-1, 0), (0, 1), (0, -1)]

while B:
    x, y = B.pop()
    for dx, dy in move:
        nx, ny = x + dx, y + dy
        if -1 < nx < H and -1 < ny < W:
            if check[nx][ny] == False:
                lx, ly = nx, ny
                check[nx][ny] = check[x][y] + 1
                B.appendleft((nx, ny))
print(check[lx][ly])
Problem p02693 (python)

Fixed submission:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    K=int(readline())
    A,B=map(int,readline().split())
    if A%K==0:
        print("OK")
    elif A//K<B//K:
        print("OK")
    else:
        print("NG")
if __name__=="__main__":
    main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
import itertools
import numpy as np
from numba import njit

def main():
#入力
    readline=stdin.readline
    N,M,Q=map(int,readline().split())
    a=np.zeros(Q,dtype=np.int64)
    b=np.zeros(Q,dtype=np.int64)
    c=np.zeros(Q,dtype=np.int64)
    d=np.zeros(Q,dtype=np.int64)
    for i in range(Q):
        a[i],b[i],c[i],d[i]=map(int,readline().split())

    arrays=np.array(list(itertools.combinations_with_replacement(range(1,M+1),N)),dtype=np.int64)
    l=len(arrays)

    print(f(l,Q,a,b,c,d,arrays))
    
@njit("i8(i8,i8,i8[:],i8[:],i8[:],i8[:],i8[:,:])",cache=True)
def f(l,Q,a,b,c,d,arrays):
    max_res=0
    for i in range(l):
        res=0
        for j in range(Q):
            if arrays[i][b[j]-1]-arrays[i][a[j]-1]==c[j]:
                res+=d[j]
        max_res=max(max_res,res)
    return max_res

if __name__=="__main__":
	main()
Problem p02879 (python)

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

if(1<=a and a<=9 and 1<=b and b<=9):
   print(a*b)
else:
   print(-1)

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

A=sorted(A)
F=sorted(F,reverse=True)
time=list()

for i in range(N):
   time.append(A[i]*F[i])

goal_max=max(time)
goal_min=0
goal_ave=int((goal_max+goal_min)/2)
goal=int((goal_max+goal_min)/2)

col={"-1":"NG"}
for i in range(goal_max+1):
   col[str(i)]=None

flag=True

while(flag):
   counter=0
   print(goal)
   for i in range(N):
      counter+=(A[i]-int(goal/F[i]))

   if(counter<=K):
      if col[str(goal-1)]=="NG":
         print(goal)
         flag=False
      else:
         col[str(goal)]="OK"
         if goal==int((goal+goal_ave)/2):
            goal=int((goal+goal_ave)/2)-1
            print("b")         
         #elif goal!=goal_ave:
         #   goal=int((goal+goal_ave)/2)
         #   print("a")
         else:
            goal=int((goal+goal_min)/2)
            print("c")

   elif(counter>K):
      if col[str(goal+1)]=="OK":
         print(goal+1)
         flag=False
      else:
         col[str(goal)]="NG"
         if goal==int((goal+goal_ave)/2):
            goal=int((goal+goal_ave)/2)+2
         #elif goal!=goal_ave:
         #   goal=int((goal+goal_ave)/2)    
         else:
            goal=int((goal+goal_max)/2)
Problem p02881 (python)

Fixed submission:
N=int(input())
K=list()

for i in range(1,int(N**0.5)+1):
  if(int(N/i)==N/i):
    M=int(N/i)  #N<=M
    L=i
    K.append(M+L-2)
    
print(min(K))

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

for i in range(1,int(N**0.5)+1):
  if(N/i in list(range(1,N+1))):
    M=int(N/i)  #N<=M
    L=i
    K.append(M+L-2)
    
print(min(K))
Problem p03077 (python)

Fixed submission:
import math
def main():
    N=int(input())
    A=int(input())
    B=int(input())
    C=int(input())
    D=int(input())
    E=int(input())
    min_num=N+1
    for i in (A,B,C,D,E):
        min_num=min(i,min_num)
    print(math.ceil(N/min_num)+4)
    
if __name__=="__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N=int(input())
    A=int(input())
    B=int(input())
    C=int(input())
    D=int(input())
    E=int(input())
    for i in (A,B,C,D,E):
        min_num=min(i,min_num)
    print((N//min_num+1)+4)
    
if __name__=="__main__":
    main()
Problem p02754 (python)

Fixed submission:
def count(b, total, N):
  r = N%total
  if r < b:
    return r
  else:
    return b

data = input()
N, b, r = [int(i) for i in data.split()]

total = b + r

ball = int(N/total) * b + count(b, total, N)
print(ball)

Buggy submission (verdict: Runtime Error):
def count(b, total, N):
    remain = N%total
    if remain < b:
        return remain
    else:
        return b

data = input()
N, b, r = [int(i) for i in data.split()]
 
ball = int(N/total) * b + count(b, b+r, N)
print(ball)

Buggy submission (verdict: Runtime Error):
def count(b, total, N):
    remain = N%total
    if remain < b:
        return remain
    else:
		return b

data = input()
N, b, r = [int(i) for i in data.split()]

ball = int(N/total) * b + count(b, b+r, N)
print(ball)

Buggy submission (verdict: Runtime Error):
def count(b, total, N):
    remain = N%total
    if remain < b:
        return remain
    else:
        return b
      
data = input()
N, b, r = [int(i) for i in data.split()]
 
ball = int(N/total) * b + count(b, b+r, N)
print(ball)

Buggy submission (verdict: Runtime Error):
def count(b, total, N):
    remain = N%total
    if remain < b:
        return remain
    else:
        return b
      
N, b, r = [int(i) for i in data.split()]

ball = int(N/total) * b + count(b, b+r, N)
print(ball)

Buggy submission (verdict: Runtime Error):
def count(b):
    remain = N%total
    if remain < b:
        return remain
    else:
        return b
      
 
data = input()

N, b, r = [int(i) for i in data.split()]

ball = int(N/total) * b + count()
print(ball)
Problem p02759 (python)

Fixed submission:
num = input()
num = int(num)

page = int(num/2)

if num%2 != 0:
  page += 1

print(page)

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

page = math.ceil(num/2)
print(page)

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

print(int(num/2))
Problem p02726 (python)

Fixed submission:
from collections import deque
from collections import Counter
N, X, Y = map(int, input().split())

res = deque()

for x in range(1, N):
    for y in range(x + 1, N+1):
        res.append(min(abs(x-y), 1 + abs(X-x) + abs(Y-y)))
resd = Counter(res)

for i in range(1, N):
    if i in resd.keys():
        print(resd[i])
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
from collections import deque
from collections import Counter
N, X, Y = map(int, input().split())

res = deque()

for x in range(1, N):
    for y in range(x + 1, N+1):
        res.append(min([abs(x-y), 1 + abs(X-x) + abs(Y-y)))
resd = Counter(res)

for i in range(1, N):
    if i in resd.keys():
        print(resd[i])
    else:
        print(0)
Problem p02951 (python)

Fixed submission:
input_int = input().split()
input_int = [int(x) for x in input_int]

if input_int[0] > input_int[1] + input_int[2]:
    print(0)
else:
    ans = input_int[2] - input_int[0] + input_int[1]
    print(ans)

Buggy submission (verdict: Runtime Error):
input_int = input().split()

if input_int[0] >= input_int[1] + input_int[2]:
    print('0')
else:
    print(input_int[2] - input_int[0] + input_int[1])
Problem p02712 (python)

Fixed submission:
fizzBuzz = []
inputNumber = int(input())
for i in range(inputNumber + 1):
    if i % 3 == 0 and i % 5 == 0:
        metCondition = 'FizzBuzz'
    elif i % 5 == 0:
        metCondition = 'Buzz'
    elif i % 3 == 0:
        metCondition = 'Fizz'
    else:
        metCondition = i
    fizzBuzz.append(metCondition)
metCondition_2 = [num for num in fizzBuzz if isinstance(num, (int, float))]
print(sum(metCondition_2))

Buggy submission (verdict: Runtime Error):
 fizzBuzz = []
 inputNumber = int(input())
 for i in range(inputNumber + 1):
     if i % 3 == 0 and i % 5 == 0:
         metCondition = 'FizzBuzz'
     elif i % 5 == 0:
         metCondition = 'Buzz'
     elif i % 3 == 0:
         metCondition = 'Fizz'
     else:
         metCondition = i
     fizzBuzz.append(metCondition)
 metCondition_2 = [num for num in fizzBuzz if isinstance(num, (int, float))]
 print(sum(metCondition_2))
Problem p02729 (python)

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

Buggy submission (verdict: Runtime Error):
a = map(int, input().split())
print(n*(n-1)//2 + m*(m-1)//2)

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

Fixed submission:
s = input()
t =input()
c=0

for i in range(len(s)):
  if s[i]!=t[i]:
    c +=1

print(c)

Buggy submission (verdict: Runtime Error):
s,t = map(input().split())
c=0

for i in range(len(s)):
  if s[i]!=t[i]:
    c +=1

print(c)

Buggy submission (verdict: Runtime Error):
s,t = map(input())
c=0

for i in range(len(s)):
  if s[i]!=t[i]:
    c +=1

print(c)

Buggy submission (verdict: Runtime Error):
s,t = map(inut())
c=0

for i in range(len(s)):
  if s[i]!=t[i]:
    c +=1

print(c)
Problem p02693 (python)

Fixed submission:
K = input()
A, B = map(int, input().split())

list=[]
up = int(A)

for i  in  range(int(B)-int(A)):
	list = list + [up]
	up += 1
list = list + [up]

count = 0

for t in list:
	if int(t) % int(K) ==0:
  		count+=1

if count == 0:
  print('NG')
else:
  print('OK')

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

list=[]
up = int(A)

for i  in  range(int(B)-int(A)):
	list = list + [up]
	up += 1
list = list + [up]

count = 0

for t in list:
	if int(t) % int(K) ==0:
  		count+=1

if count == 0:
  print('NG')
else:
  print('OK')
Problem p02622 (python)

Fixed submission:
S = input()
T = input()
sum = 0
for i in range(len(S)):
  if S[i-1] != T[i-1]:
    sum = sum + 1
print(sum)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
sum = 0
for i in range(len(S)):
  if S[i-1] <> T[i-1]:
    sum = sum + 1
print(sum)
Problem p02676 (python)

Fixed submission:
K = int(input())
S = input()

if len(S) <= K:
  print(S)
else:
  print(S[0:K]+"...")

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

if len(S) <= K:
  print(S)
else:
  print(S[0:K],"...")

Buggy submission (verdict: Runtime Error):
S = str(input())
K = int(input())

if len(S) <= K:
  print(S)
else:
  print(S[0:K],"...")

Buggy submission (verdict: Runtime Error):
S = map(str, input())
K = input()

if len(S) <= K:
  print(S)
else:
  print(S[0:K],"...")
Problem p02759 (python)

Fixed submission:
N = int(input())

if not N%2 == 0:
  print(int(N/2+1))
else:
  print(int(N/2))

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

if N%2 <> 0:
  print(int(N/2+1))
else:
  print(int(N/2))
Problem p02627 (python)

Fixed submission:
a = input()
print('a' if a.islower() else 'A')

Buggy submission (verdict: Runtime Error):
s = input()
if s.isupps = input()
if s.isupper():
    print('A')
else:
    print('a')
Problem p02659 (python)

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

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

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

Buggy submission (verdict: Runtime Error):
a,b = map(float, input().split())
bb = b*100
c = a*bb/100
print(floor(c))
Problem p02688 (python)

Fixed submission:
N,K = map(int, input().split())
L = []
for i in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for j in range(d):
    L.append(A[j])
print(N-len(set(L)))

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
L = []
for i in range(N):
  d = int(input())
  if d == 1:
    A = list(int(input()))
  else:
    A = list(map(int, input().split()))
  for j in range(d):
    L.append(A[j])
print(N-len(set(L)))

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
L = []
for i in range(N):
  d = int(input())
  if d == 1:
    A = int(input())
  else:
    A = list(map(int, input().split()))
  for j in range(d):
    L.append(A[j])
print(N-len(set(L)))

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
L = []
for i in range(N):
  d = int(input())
  A = list(map(int, input().split()))
  for j in range(d):
    L.append(A[j])
print(N-len(set(L)))

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
L = []
for i in range(N):
  d = int(input)
  A = list(map(int, input().split()))
  for j in range(d):
    L.append(A[j])
print(N-len(set(L)))
Problem p02695 (python)

Fixed submission:
from itertools import combinations_with_replacement as cw
N,M,Q = map(int, input().split())
cand = cw([i+1 for i in range(M)],N)
fs = [list(map(int, input().split())) for i in range(Q)]

def calc(fs,As):
  count = 0
  for a,b,c,d in fs:
    if As[b-1] - As[a-1] == c:
      count += d
  return count
ans = 0
for As in cand:
  ans = max(ans,calc(fs,As))

print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
N,M,Q = map(int, input().split())
cand = list(itertools.combinations_with_replacement(N+M-1,N))
fs = [list(map(int, input().split())) for i in range(Q)]

def calc(fs,As):
  count = 0
  for a,b,c,d in fs:
    if As[b-1] - As[a-1] == a:
      count += d
	return count
ans = 0
for As in cand:
  ans = max(ans,calc(fs,As))

print(ans)
Problem p03767 (python)

Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)

ans = sum(a[2*i-1] for i in range(1,N+1))
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
a = a.sort(reverse=True)

ans = sum(a[2*i] for i in range(1,N+1))
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
a = a.sort(reverse=True)

for i in range(1,N+1):
  ans = sum(a[2*i-1])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
a = a.sort(reverse=True)

for i in range(N):
  suma[3*N-2*(i+1)])
ans = sum(array)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [list(map(int, input().split()))]
a = a.sort()
array = []
for i in range(N):
  array = array.append(a[3*N-2*(i+1)])
ans = sum(array)
print(ans)
Problem p02912 (python)

Fixed submission:
import heapq

n,m = (int(x) for x in input().split())

a = [int(i)*(-1) for i in input().split()]
heapq.heapify(a)
for _ in range(m):

    b  = -(heapq.heappop(a))//2
    heapq.heappush(a,-b)


print(-sum(a))

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

ans = 0

for k in range(m):
		max(a)=max(a)//2


for i in range(n):
	ans+=a[i]

print(ans)

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

ans = 0

for _ in range(m):
		max(a)=max(a)//2


for i in range(n):
	ans+=a[i]

print(ans)
Problem p02682 (python)

Fixed submission:
A, B, C, K = map(int, input().split())
if A >= K:
  print(K)
elif A + B >= K:
  print(A)
else:
  print(A - (K - A - B))

Buggy submission (verdict: Runtime Error):
A, B, C, K = map(int, input().split())
ABC_total = 0
A_list = [1,] * A
B_list = [0,] * B
C_list = [-1,] * C
ABC_list = A_list + B_list + C_list
for i in range(K):
  ABC_total += ABC_list[i]
print(ABC_total)
Problem p02699 (python)

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

Buggy submission (verdict: Runtime Error):
S = input()
print(sum([int(S[i:j])  % 2019 == 0 for i in range(len(S)) for j in range(i, len(S) + 1) if i < j]))

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
while A > 0 and C > 0:
  C -= B
  A -= D
print('Yes' if C <= 0 else 'No' )
Problem p02682 (python)

Fixed submission:
import sys
input = sys.stdin.readline
def main():
    A, B, C, K = map(int, input().split())
    rest = K
    ans = 0
    ans += min(A, rest)
    if K > A:
        rest -= A
        if rest > B:
            rest -= B
            ans -= min(rest, C)
    print(ans)
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
def main():
    A, B, C, K = map(int, input().split())
    nums = [1] * A + [0] * B + [-1] * C
    nums.sort(reverse=True)
    print(sum(nums[:K]))
if __name__ == "__main__":
    main()
Problem p02757 (python)

Fixed submission:
import sys
input = sys.stdin.readline
from collections import Counter
def main():
    N, P = map(int, input().split())
    S = list(map(int, input().rstrip("\r\n")))
    S.reverse()
    ans = 0
    if P == 2 or P == 5:
        for i in range(N):
            if S[i] % P == 0:ans += N-i
    else:
        A = [0] * N
        tenpow = 1
        for i in range(N):
            A[i] = (S[i]*tenpow) % P
            tenpow *= 10
            tenpow %= P
        D = [0] * (N+1)
        for i in range(N):
            D[i+1] = (D[i] + A[i]) % P
        c = Counter(D)
        for v in c.values():
            ans += v*(v-1)//2
    print(ans)
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from collections import Counter
import math
def main():
    N, P = map(int, input().split())
    S = input().rstrip("\r\n")[::-1]
    ans = 0
    if P == 2 or P == 5:
        for i in range(N):
            if int(S[i]) % P == 0:ans += N-i
    else:
        D = [0] * (N+1)
        D[0] = int(S[0]) % P
        for i in range(1, N):
            a = int(S[i]) * int(math.pow(10, i)) % P
            D[i] = (a + D[i-1]) % P
        c = Counter(D)
        for v in c.values():
            ans += v*(v-1)//2
    print(ans)
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from collections import Counter
import math
def main():
    N, P = map(int, input().split())
    S = input().rstrip("\r\n")[::-1]
    ans = 0
    if P == 2 or P == 5:
        for i in range(N):
            if int(S[i]) % P == 0:ans += N-i
    else:
        D = [0] * (N+1)
        for i in range(1, N+1):
            D[i] = ((int(S[i-1])*int(math.pow(10, i-1))) % P + D[i-1]) % P
        c = Counter(D)
        for v in c.values():
            ans += v*(v-1)//2
    print(ans)
if __name__ == "__main__":
    main()
Problem p02759 (python)

Fixed submission:
N = int(input())
x, y = divmod(N, 2)
print(x + y)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(2147483647)
input = sys.stdin.readline
N, M, K = map(int, input().split())
graph = [[] for _ in range(N)]
block = [[] for _ in range(N)]
connected_components = []
count = 0
counts = [0 for _ in range(N)]
seen = [False for _ in range(N)]
def dfs(v, c, seen, origin):
    global count
    seen[v] = True
    for node in graph[v]:
        if seen[node] == True:
            continue
        if node not in block[origin]:
            count += 1
        dfs(node, c+1, seen, origin)
def dfs_connected(v, order):
    seen[v] = True
    connected_components[order].append(v)
    for node in graph[v]:
        if seen[node] == True:
            continue
        dfs_connected(node, order)
 
for Mi in range(M):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
 
for Ki in range(K):
    a, b = map(int, input().split())
    block[a-1].append(b-1)
    block[b-1].append(a-1)
 
for v in range(N):
    if seen[v] == True:
        continue
    connected_components.append([])
    dfs_connected(v, v)
 
for components in connected_components:
    for component in components:
        seen = [False for _ in range(N)]
        count = 0
        dfs(component, count, seen, component)
        counts[component] = count-len(graph[component])
 
print(' '.join(map(str, counts)))

Buggy submission (verdict: Runtime Error):
bingo = []
bingo.append(list(map(int, input().split(' '))))
bingo.append(list(map(int, input().split(' '))))
bingo.append(list(map(int, input().split(' '))))
matched = [[False for _ in range(3)] for _ in range(3)]
N = int(input())
for n in range(N):
    num = int(input())
    for i in range(3):
        for j in range(3):
            if bingo[i][j] == num:
                matched[i][j] = True
is_bingo = False
if matched[0][0] and matched[1][1] and matched[2][2]:
    is_bingo = True
if matched[0][2] and matched[1][1] and matched[2][0]:
    is_bingo = True
if matched[0][0] and matched[0][1] and matched[0][2]:
    is_bingo = True
if matched[1][0] and matched[1][1] and matched[1][2]:
    is_bingo = True
if matched[2][0] and matched[2][1] and matched[2][2]:
    is_bingo = True
if matched[0][0] and matched[1][0] and matched[2][0]:
    is_bingo = True
if matched[0][1] and matched[1][1] and matched[2][1]:
    is_bingo = True
if matched[0][2] and matched[1][2] and matched[2][2]:
    is_bingo = True
if is_bingo:
    print('Yes')
else:
    print('No')
Problem p03785 (python)

Fixed submission:
N, C, K = map(int, input().split(' '))
bus = []
ans = 0
T = [int(input()) for _ in range(N)]
T.sort()

min_t = 0
i = 0
while i < N:
    ans += 1
    start = i
    while i < N and T[i] - T[start] <= K and i - start < C:
        i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
T = [int(input()) for _ in range(N)]
T.sort()

def init_bus():
    global bus, min_t, ans
    bus = []
    bus.append(t)
    min_t = t
    ans += 1

min_t = 0
for t in T:
    if len(bus) == 0:
        init_bus()
        continue
    if t - min_t < K and len(bus) < C:
        bus.append(t)
    else:
        init_bus()
print(ans)