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

Fixed submission:
N,K = map(int,input().split())
if K == 1:
    print(0)
else:
    print(N-K)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
print(N-K)
Problem p03006 (python)

Fixed submission:
import collections
N = int(input())
ball_location = []
for i in range(N):
    x,y = map(int, input().split())
    ball_location.append([x,y])

vector = []
if N <= 2:
    print(1)
else:
    for i in range(N):
        first_point = ball_location[i]
        
        for next_point in ball_location[0:i] + ball_location[i+1:]:
            p = next_point[0] - first_point[0]
            q = next_point[1] - first_point[1]
            vector.append(str(p) + "," + str(q))
            
    print(N - collections.Counter(vector).most_common()[0][1])

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
ball_location = []
for i in range(N):
    x,y = map(int, input().split())
    ball_location.append([x,y])

vector = []

for i in range(N):
    first_point = ball_location[i]
    
    for next_point in ball_location[0:i] + ball_location[i+1:]:
        p = next_point[0] - first_point[0]
        q = next_point[1] - first_point[1]
        vector.append(str(p) + "," + str(q))
        
print(N - collections.Counter(vector).most_common()[0][1])
Problem p03035 (python)

Fixed submission:
s = input().split()
A = int(s[0])
B = int(s[1])

if A >= 13:
    print(B)
elif A <= 5:
    print(0)
else:
    print(int(B/2))

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

if A >= 13:
    print(B)
elif A <= 5:
    print(0)
else:
    print(B/2)
Problem p03060 (python)

Fixed submission:
N = input()
V = input().split()
C = input().split()
ret_X_Y = 0
V = [int(i) for i in V]
C = [int(i) for i in C]
for i in range(len(V)):
    if (V[i] - C[i]) > 0:
        ret_X_Y += V[i] - C[i]
print(ret_X_Y)

Buggy submission (verdict: Runtime Error):
N = input()
V = input().split()
C = input().split()
ret_X_Y = 0

for i in range(len(V)):
    if (V[i] - C[i]) > 0:
        ret_X_Y += V[i] - C[i]
print(ret_X_Y)
Problem p02641 (python)

Fixed submission:
def main():
    import sys
    X, N = map(int, sys.stdin.readline().split())
    P = list(map(int, sys.stdin.readline().split()))
    
    i = 0
    while True:
        if X-i in P:
            pass
        else:
            print(X-i)
            break
        if X +i in P:
            pass
        else:
            print(X+i)
            break
        i+=1
    


if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    X, N = map(int, sys.stdin.readline().split())
    P = list(map(int, sys.stdin.readline().split()))
    ans = []
    for i in range(0, 101):
        if X-i<0:
            break
        if not (X-i) in P:
            ans +=[i]
            break
    for i in range(0, 101):
        if X+i >100:
            break
        if not (X+i) in P:
            ans +=[i]
            break
    
    if ans[0]-ans[1] !=0:
        print(min(ans)+X)
    else:
        print(ans[0])



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

Fixed submission:
#168D
def main():
    import sys
    
    N, M =map(int, sys.stdin.readline().split())
    AB = [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]
    
    edge = [[] for _ in range(N)]
    for ab in AB:
        edge[ab[0]-1] += [ab[1]-1]
        edge[ab[1]-1] += [ab[0]-1]
    
    #print(edge)
    
    L = [-1 for i in range(N)] #道標(親p)を調べる
    
    #p:親 c:子
    def bfs(p):
        from collections import deque
        queue = deque([p])
        L[p] =0
        while queue:
            p = queue.popleft()
            for c in edge[p]:
                if L[c]==-1: #-1のとき未開
                    #print(c)
                    L[c] = p+1 #道標(どこから来たか)
                    #L[c] = L[now]+1 #階層の深さ
                    queue.append(c)
        
    
    bfs(0)
    print('Yes')
    for i in L[1:]:
        print(i)


if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys, math, bisect

N, M= map(int, sys.stdin.readline().split())
AB = [tuple(map(int, sys.stdin.readline().split())) for _ in range(M)]

edge =[[] for _ in range(N)]
for ab in AB:
    bisect.insort(edge[ab[0]-1], (ab[1]-1))
    bisect.insort(edge[ab[1]-1], (ab[0]-1))
    
#print(edge)
sys.setrecursionlimit(100000)


def dfs(now, cnt =1, before=-1):#before:一つ前に通ったノード
    #if before==-1:
        #print(now)
    for c in edge[now]: #c:子
        if not c ==before: #無限ループを防ぐ
            #print(c)
            if c==0:
                L.append(cnt)
                break
            else:
                dfs(c, cnt+1, now) #再帰

ans = []
for i in range(1, N):
    L = []
    dfs(i)
    ans.append(min(L))
print('Yes')
for a in ans:
    print(a)
Problem p02732 (python)

Fixed submission:
#ABC159D
import sys, math
from collections import Counter

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

def comb(n):
    return int(math.factorial(n)/(2*math.factorial(n-2)))

total = 0
L = Counter(A)
for v in L.values():
    if v>=2:
        total += comb(v)

for k in range(N):
    print(total - (L[A[k]]-1))

Buggy submission (verdict: Runtime Error):
import sys
import math
from collections import Counter
n = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
def comb(n):
  return int(math.factrial(n)/(math.factrial(n-2)*2))
for k in range(n):
  ans =0
  L=A[:k]+A[k+1:]
  for v in Counter(L).values():
    if v>=2:
      ans +=comb(v)
  print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import math
from collections import Counter
n = int(sys.stdin.readline())
A = map(int, sys.stdin.readline().split())
def comb(n):
  return int(math.factrial(n)/(math.factrial(n-2)*2))
for k in range(n):
  ans =0
  L=A[:k]+A[k+1:]
  for v in Counter(L).values():
    if v>=2:
      ans +=comb(v)
  print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import math
from collections import Counter
n = int(sys.stdin.readline())
A = map(int, sys.stdin.readline().split())
def comb(n):
  return math.factrial(n)/(math.factrial(n-2)*2)
for k in range(n):
  ans =0
  L=A[:k]+A[k+1:]
  for v in Counter(L).values():
    if v>=2:
      ans +=comb(v)
  print(ans)
Problem p02900 (python)

Fixed submission:
import sys
import math

A, B = map(int, sys.stdin.readline().split())
C, D = max(A, B), min(A, B)

#ユーグリッド互除法
while True:
    amari = C%D
    C, D = D, amari
    if amari ==0:
        gcd = C
        break
#print(gcd)

#素因数分解
L = [1]
n = int(math.sqrt(gcd))
for i in range(2, n+1):
    while True:
        if gcd%i ==0:
            L.append(i)
            gcd = gcd//i
        else:
            break
if gcd>1:
    L.append(gcd)
L = set(L)
print(len(L))

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
from collections import deque
A, B = map(int, sys.stdin.readline().split())

a, b = deque([]), deque([])
for i in range(A, 0, -1):
    if A%i ==0:
        a.append(i)
    
for i in range(B, 0, -1):
    if B%i ==0:
        b.append(i)

a,b = set(a), set(b)
L = a&b
#print(L)
cnt =0
for l in L:
    tmp = 0
    for i in range(l-1, 1, -1):
        if l%i==0:
            tmp +=1
            break
    if tmp ==0:
        cnt+=1
print(cnt)
Problem p02909 (python)

Fixed submission:
#import sys
S = input()
#L = ["Sunny", "Cloudy", "Rainy"]

if S == "Sunny":
    print("Cloudy")
elif S =="Cloudy":
    print("Rainy")
elif S == "Rainy":
    print("Sunny")

Buggy submission (verdict: Runtime Error):
import sys
n = int(sys.stdin.readline())
S = sys.stdin.readline().rstrip()


dp = [[0 for i in range(n)] for j in range(n)]
#初期条件
for j in range(1, n):
    if S[0] == S[j]:
        dp[0][j] = 1
    else:
        dp[0][j] = 0

#print(dp)

for i in range(1, n-1):
    for j in range(i+1, n):
        if S[i] ==S[j]:
            dp[i][j] = min(dp[i-1][j-1] +1, n//2)
        else:
            dp[i][j] = 0

maxp = 0
for i in range(1, n-1):
    for j in range(i+1, n):
        if maxp < dp[i][j]:
            maxp = dp[i][j]
#print(dp)
print(maxp)

Buggy submission (verdict: Runtime Error):
import sys
S = sys.stdin.readline().rstrip()
L = ['Sunny', 'Cloudy', 'Rainy']
if S ==L[0]:
    print(L[1])
elif S ==L[1]:
    print(L[2])
elif S ==L[2]:
    printf(L[0])

Buggy submission (verdict: Runtime Error):
import sys
S = sys.stdin.readline().rstrip()
L = ['Sunny', 'Cloudy', 'Rainy']
if S ==L[0]:
    print(L[1])
elif S ==L[1]:
    print(L[2])
elif S ==L[2]:
    printf(L[0])
Problem p02918 (python)

Fixed submission:
import sys
import re
n, k = map(int, sys.stdin.readline().split())
S = sys.stdin.readline()

ptnr = 'R+'
ptnr = re.compile(ptnr)
ptnl = 'L+'
ptnl = re.compile(ptnl)

if len(ptnl.findall(S)) <=len(ptnr.findall(S)):
    f = 'L'
else:
    f = 'R'

score = 0
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        score+=1

idx = []
for i in range(n):
    if S[i] == f:
        idx.append(i)
idx.append(-10)

s =-1
e =-1
ten = [0]
for i in range(len(idx)-1):
    if s ==-1:
        s = idx[i]
    if idx[i]+1 != idx[i+1]:
        e = idx[i]
        if s==0 and e ==n-1:
            pass
        elif s ==-1 or e==-1:
            pass
        elif s ==0 or e ==n-1:
            ten.append(1)
        else:
            ten.append(2)
        s =-1
ten = sorted(ten, reverse=True)
print(score+ sum(ten[0:k]))

Buggy submission (verdict: Runtime Error):
import sys
import itertools
n, K = map(int, input().split())
S = list(input())

def main(S, score):
    L =[]
    for i in range(n):
        if S[i] =='R':
            L.append(i)
    L = list(itertools.combinations(L, 2))
    cnt = 0
    m = []
    for l in L:
        if cnt < S[l[0]:l[1]+1].count('R'):
            cnt = S[l[0]:l[1]+1].count('R')
            m = l
    M = S[m[0]:m[1]+1:]
    M = M[::-1]
    for i in range(len(M)):
        if M[i] == 'R':
            M[i] = 'L'
        elif M[i] == 'L':
            M[i] = 'R'
    S = S[0:m[0]] + M + S[m[1]+1:]

    ten = 0
    for i in range(n-1):
        if S[i] == S[i+1]:
            ten+=1
    if score < ten:
        score = ten
    return S, score
score = 0
for k in range(K):
    S, score = main(S, score)
    #print(S)
print(score)
Problem p02953 (python)

Fixed submission:
import sys
import numpy as np
input = sys.stdin.readline
n = int(input())

L = np.array(list(map(int, input().split())))

for i in range(n-1, 0, -1):
    if L[i]-L[i-1] ==-1:
        L[i-1] -=1

if np.all(L ==sorted(L)):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
input = sys.stdin.readline

n = int(input())
L = np.array(list(map(int, input().split())))
s = 0
f = True
while True:
    minL = np.min(L[s:])
    m_idx = np.where(L==minL)[0][-1]
    for i in range(s, m_idx):
        if L[i] - minL >=2:
            print('No')
            f = False
            break
    s = m_idx+1
    
    if s==n or f ==False:
        break

if f ==True:
    print('Yes')
Problem p03106 (python)

Fixed submission:
a,b,k =map(int, input().split())
c = min(a, b)
cnt = 0
for i in range(c, 0, -1):
    if a%i==0 and b%i==0:
        cnt +=1
    if cnt ==k:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
import math
a,b,k =map(int, input().split())
c = math.gcd(a,b)
cnt = 0
for i in range(c, 0, -1):
    if a%i==0 and b%i==0:
        cnt +=1
    if cnt ==k:
        print(i)
        break
Problem p03162 (python)

Fixed submission:
import sys
n = int(sys.stdin.readline())
L = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]

p = [[0 for _ in range(3)] for _ in range(n)]

p[0] = L[0].copy()
#print(p)
#print(L)

for d in range(1, n):
    for i in range(3):
        if i ==0:
            p[d][0] = max(p[d-1][1], p[d-1][2]) + L[d][0]
        elif i ==1:
            p[d][1] = max(p[d-1][0], p[d-1][2]) + L[d][1]
        elif i==2:
            p[d][2] = max(p[d-1][0], p[d-1][1]) + L[d][2]

print(max(p[-1]))

Buggy submission (verdict: Runtime Error):
#DP C
import sys
N = int(sys.stdin.readline())
L = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
#print(L)

dp = [[0,0,0] for _ in range(N)]
dp[0] = L[0].copy()
for i in range(1, N):
    dp[i][0] = L[i][0] + max(dp[i-1][1], dp[i-1][2])
    dp[i][1] = L[i][1] + max(dp[i-1][0], dp[i-1][2])
    dp[i][2] = L[i][2] + max(dp[i-1][0], dp[i-1][1])
    #print(dp)
print(max(dp[-1]))
Problem p03163 (python)

Fixed submission:
import sys
n, W = map(int, sys.stdin.readline().split())
L = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]

dp = [[0 for _ in range(W+1)] for _ in range(n)]
for w in range(W+1):
    if w>=L[0][0]:
        dp[0][w] = L[0][1]

#print(dp)
for i in range(1, n):
    for w in range(W+1):
        if w <L[i][0]: #そもそも加えられないとき
            dp[i][w] = dp[i-1][w] #前回の状態を代入。
        else: #加えようとしたら入るとき
            dp[i][w] = max(dp[i-1][w-L[i][0]] + L[i][1], dp[i-1][w]) #max(加えた時の価値, 前回の状態)
            
#print(dp)
print(max(dp[-1]))

Buggy submission (verdict: Runtime Error):
#ABC164C
def main():
    import sys
    N, limit = map(int, sys.stdin.readline().split())
    L = tuple([tuple(map(int, sys.stdin.readline().split())) for _ in range(N)])
    dp = [[0 for _ in range(limit+1)] for _ in range(N)]
    dp[0][L[0][0]] = L[0][1] #初期値
    for i in range(1, N):
        dp[i] = dp[i-1].copy() #前回をコピー(初)
        w, v = L[i][0], L[i][1]
        dp[i][w] = max(v, dp[i][w])
        for j in range(limit+1-w):
            if dp[i-1][j] >0:
                dp[i][w+j] = max(v+ dp[i-1][j], dp[i][w+j])
            
    
    
    print(max(dp[-1]))



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

Fixed submission:
import sys
s = sys.stdin.readline().rstrip()
t = sys.stdin.readline().rstrip()

sn = len(s)
tn = len(t)

dp =[[0 for _ in range(tn+1)] for _ in range(sn+1)]

for i in range(sn):
    for j in range(tn):
        if s[i]==t[j]:
            dp[i+1][j+1] =dp[i][j]+1
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])
#print(dp)

L =[]
while sn>0 and tn>0:
    if dp[sn][tn] == dp[sn-1][tn]: #縦優先
        sn-=1
    elif dp[sn][tn] == dp[sn][tn-1]:
        tn-=1
    elif dp[sn][tn] == dp[sn-1][tn-1]+1:
        L.append(s[sn-1])
        sn-=1
        tn-=1
        
print(''.join(L[::-1]))

Buggy submission (verdict: Runtime Error):
#EDP-F
import sys

S = sys.stdin.readline().rstrip()
T = sys.stdin.readline().rstrip()
sn, tn = len(S), len(T)
dp = [[0 for j in range(tn)] for i in range(sn)]

#方針:その時点での最長数を入れる
for j in range(tn):
    dp[0][j] = dp[0][j-1]
    if S[0]==T[j]:
        dp[0][j] = 1
for i in range(sn):
    dp[i][0] = dp[i-1][0]
    if S[i]==T[0]:
        dp[i][0] = 1
        

for i in range(1, sn):
    for j in range(1, tn):
        if S[i] == T[j]:
            dp[i][j] = dp[i-1][j-1]+1
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])

#pprint.pprint(dp)

i,j= sn-1, tn-1
ans =''
while True:
    if i ==0:
        if dp[i][j]==1:
            ans+= S[0]
        print(ans[::-1])
        break
    if dp[i-1][j] == dp[i][j]:
        i-=1
    elif dp[i][j-1] == dp[i][j]:
        j-=1
    elif dp[i-1][j-1] +1 == dp[i][j]:
        ans += S[i]
        i-=1
        j-=1
Problem p03387 (python)

Fixed submission:
import sys
L=list(map(int,sys.stdin.readline().split()))
cnt=0
while True:
  if L[0]==L[1]==L[2]:
    break
  L.sort()
  if L[2]-L[0]>=2:
    L[0]+=2
  elif L[2]-L[1]>=2:
    L[1]+=2
  elif L[0] !=L[1] or L[1] !=L[2]:
    L[0]+=1
    L[1]+=1
  cnt+=1
  
print(cnt)

Buggy submission (verdict: Runtime Error):
    L[0]+=2
  elif L[2]-L[1]>=2:
    L[1]+=2
  elif L[0] !=L[1] or L[1] !=L[2]:
    L[0]+=1
    L[1]+=1
  cnt+=1
  L.sort()
  if L[0]==L[1]==L[2]:
    break
print(cnt)
Problem p03476 (python)

Fixed submission:
#ABC084D
def main():
    import sys
    Q = int(sys.stdin.readline())
    LR = [tuple(map(int, sys.stdin.readline().split())) for _ in range(Q)]
    #print(LR)
    
    def calc(N):
        import math
        for i in range(3, int(math.sqrt(N))+1):
            while N % i==0:
                N =N//i
                return 0
        else:
            num = (N+1)//2
            #if num ==2:
                #return N
            for j in range(2, int(math.sqrt(num)+1)):
                while num % j==0:
                    num = num//j
                    return 0
            else:
                return N
    
     
    L = []
    for i in range(3, 10**5+1, 2):
        tmp = calc(i)
        if tmp !=0:
            L+=[tmp]
    #print(L)
    import bisect
    
    for row in LR:
        l = bisect.bisect_left(L, row[0])
        r = bisect.bisect_right(L, row[1])
        print(r-l)

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
#ABC084D
def main():
    import sys
    Q = int(sys.stdin.readline())
    LR = [tuple(map(int, sys.stdin.readline().split())) for _ in range(Q)]
    #print(LR)
    
    check = [1 for _ in range(10**5+1)]
    check[0], check[1] = 0, 0
    for i in range(2, 10**5+1):
        if check[i] ==0:
            continue
        elif check[i] ==1:
            for j in range(2*i, 10**5+1, i):
                check[j] =0
    check2 = check.copy()
    for i in range(2, 10**5+1):
        if check[i]==1:
            #print((i+1)/2, check[(i+1)//2])
            if (i+1)%2==0 and check[(i+1)//2] ==1:
                continue
            else:
                check2[i] = 0
    
    #print(check)
    for lr in LR:
        #print(lr[0], lr[1])
        print(check2[lr[0]:lr[1]+1].count(1))
                


if __name__ =='__main__':
    main()

Buggy submission (verdict: Runtime Error):
#ABC084D
def main():
    import sys
    Q = int(sys.stdin.readline())
    LR = [tuple(map(int, sys.stdin.readline().split())) for _ in range(Q)]
    #print(LR)
    
    def calc(N):
        import math
        for i in range(3, int(math.sqrt(N))+1):
            while N % i==0:
                N =N//i
                return 0
        else:
            num = (N+1)//2
            #if num ==2:
                #return N
            for j in range(2, int(math.sqrt(num)+1)):
                while num % j==0:
                    num = num//j
                    return 0
            else:
                return N
    
     
    L = []
    for i in range(3, 10**5+1, 2):
        tmp = calc(i)
        if tmp !=0:
            L+=[tmp]
    #print(L)
    import bisect
    
    for row in LR:
        l = bisect.bisect_left(L, row[0])
        r = bisect.bisect_right(L, row[1])
        print(r-l)

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

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import itertools


def main():
  h, w, _ = map(int, input().split())
  values = [[int(v == '#') for v in input().strip()] for _ in range(h)]
  flags = [[0] * w for _ in range(h)]
  areas = []

  for y, x in itertools.product(range(h), range(w)):
    if values[y][x] == 1:
      flags[y][x] = 1
      areas.append([x, y, x + 1, y + 1])

  for area in areas:
    sx, sy, ex, ey = area

    while True:
      if sx > 0 and sum(flags[y][sx - 1] for y in range(sy, ey)) == 0:
        for y in range(sy, ey):
          flags[y][sx - 1] += 1
        sx -= 1
      elif sy > 0 and sum(flags[sy - 1][x] for x in range(sx, ex)) == 0:
        for x in range(sx, ex):
          flags[sy - 1][x] += 1
        sy -= 1
      elif ex < w and sum(flags[y][ex] for y in range(sy, ey)) == 0:
        for y in range(sy, ey):
          flags[y][ex] += 1
        ex += 1
      elif ey < h and sum(flags[ey][x] for x in range(sx, ex)) == 0:
        for x in range(sx, ex):
          flags[ey][x] += 1
        ey += 1
      else:
        break

    area[0], area[1], area[2], area[3] = sx, sy, ex, ey

  rets = [[0] * w for _ in range(h)]

  for i, (sx, sy, ex, ey) in enumerate(areas, start=1):
    for x, y in itertools.product(range(sx, ex), range(sy, ey)):
      rets[y][x] = i

  for r in rets:
    print(' '.join(map(str, r)))


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import collections
import itertools
import numpy


def main():
  h, w, _ = map(int, input().split())
  values = numpy.array([[int(v == '#') for v in input().strip()] for _ in range(h)])
  flags = numpy.zeros_like(values)
  areas = []

  for y, x in itertools.product(range(h), range(w)):
    if values[y][x] == 1:
      flags[y][x] = 1
      areas.append([x, y, x, y])

  for area in areas:
    sx, sy, ex, ey = area

    while True:
      if sx > 0 and numpy.sum(flags[sy:ey + 1, sx - 1]) == 0:
        flags[sy:ey + 1, sx - 1] += 1
        sx -= 1
      elif sy > 0 and numpy.sum(flags[sy - 1, sx:ex + 1]) == 0:
        flags[sy - 1, sx:ex + 1] += 1
        sy -= 1
      elif ex + 1 < w and numpy.sum(flags[sy:ey + 1, ex + 1]) == 0:
        flags[sy:ey + 1, ex + 1] += 1
        ex += 1
      elif ey + 1 < h and numpy.sum(flags[ey + 1, sx:ex + 1]) == 0:
        flags[ey + 1, sx:ex + 1] += 1
        ey += 1
      else:
        break

    area[0], area[1], area[2], area[3] = sx, sy, ex, ey

  rets = numpy.zeros_like(values)

  for i, (sx, sy, ex, ey) in enumerate(areas, start=1):
    for x, y in itertools.product(range(sx, ex + 1), range(sy, ey + 1)):
      rets[y, x] = i

  for r in rets:
    print(' '.join(map(str, r)))


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

Fixed submission:
n, k, q = map(int, input().split())
v = [0] * n

for _ in range(q):
  v[int(input())-1] += 1

for x in v:
  if x + k - q > 0:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
v = [0] * n

for _ in range(q):
  v[int(input())+1] += 1

for x in v:
  if x + k - q > 0:
    print('Yes')
  else:
    print('No')
Problem p03006 (python)

Fixed submission:
import itertools


def main():
  n = int(input())
  p = [tuple(map(int, input().split())) for _ in range(n)]
  c = {}

  if n == 1:
    print(1)
    return

  for i, j in itertools.product(range(len(p)), repeat=2):
    if i == j:
      continue

    d = (p[j][0] - p[i][0], p[j][1] - p[i][1])

    if d not in c:
      c[d] = 1
    else:
      c[d] += 1

  print(len(p) - max(c.values()))


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
import itertools


def main():
  n = int(input())
  p = [tuple(map(int, input().split())) for _ in range(n)]
  c = {}

  if n == 1:
    print(1)
    return

  raise NotImplementedError()
  for i, j in itertools.combinations(range(len(p)), 2):
    d = (p[j][0] - p[i][0], p[j][1] - p[i][1])

    if d not in c:
      c[d] = 1
    else:
      c[d] += 1

  print(len(p) - max(c.values()))


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
import itertools

n = int(input())
p = [tuple(map(int, input().split())) for _ in range(n)]
c = {}

for i, j in itertools.combinations(range(len(p)), 2):
  d = (p[j][0] - p[i][0], p[j][1] - p[i][1])
  
  if d not in c:
    c[d] = 1
  else:
    c[d] += 1  

print(len(p) - max(c.values()))