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

Fixed submission:
X,N=map(int,input().split())
if N==0:
  print(X)
  exit()
P=list(map(int,input().split()))
nP=[]
min=10**15
for i in range(-200,200):
  if i not in P:
    nP.append(i)
anlist=[]
for i in nP:
  if min>abs(i-X):
    min=abs(i-X)
    anlist.append(i)
print(anlist[-1])

Buggy submission (verdict: Runtime Error):
X,N=map(int,input().split())
if N==0:
  print(X)
  exit()
P=list(map(int,input().split()))
nP=[]
min=10**15
for i in range(1,101):
  if i not in P:
    nP.append(i)
anlist=[]
for i in nP:
  if min>abs(i-X):
    min=abs(i-X)
    anlist.append(i)
print(anlist[-1])

Buggy submission (verdict: Runtime Error):
X,N=map(int,input().split())
if N==0:
  print("0")
  exit()
P=list(map(int,input().split()))
nP=[]
min=10**15
for i in range(1,101):
  if i not in P:
    nP.append(i)
anlist=[]
for i in nP:
  if min>abs(i-X):
    min=abs(i-X)
    anlist.append(i)
print(anlist[-1])
Problem p02675 (python)

Fixed submission:
N=input()
if N[-1]=="2" or N[-1]=="4" or N[-1]=="5" or N[-1]=="7" or N[-1]=="9":
  print("hon")
elif N[-1]=="0" or N[-1]=="1" or N[-1]=="6" or N[-1]=="8":
  print("pon")
elif N[-1]=="3":
  print("bon")

Buggy submission (verdict: Runtime Error):
N=int(input())
if N[-1]=="2" or N[-1]=="4" or N[-1]=="5" or N[-1]=="7" or N[-1]=="9":
  print("hon")
elif N[-1]=="0" or N[-1]=="1" or N[-1]=="6" or N[-1]=="8":
  print("pon")
elif N[-1]=="3":
  print("bon")
Problem p02684 (python)

Fixed submission:
N,K,*A=map(int, open(0).read().split())
x=1
C=[None]*N
C[0]=0
c=0
while c<K:
    x=A[x-1]
    c+=1
    if C[x-1] is None:
        C[x-1]=c
    else:
        a=C[x-1]
        b=c-a
        K=(K-a)%b+a+b
        while c<K:
            x=A[x-1]
            c+=1
        break
print(x)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
a=0
cnt=0
anlist=[]
while True:
  if A[A[a]-1]==1:
    break
  else:
    anlist.append(A[A[a]-1])
    a=A[a]-1
    cnt+=1
res=N%cnt
ans=anlist[res]
print(ans)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
a=0
cnt=0
anlist=[0]*K
while True:
  if A[A[a]-1]==1:
    break
  else:
    anlist[cnt]=A[A[a]-1]
    a=A[a]-1
    cnt+=1
res=N%cnt
ans=anlist[res]
print(ans)
Problem p02760 (python)

Fixed submission:
A=[list(map(int,input().split())) for i in range(3)]
N=int(input())
B=list(int(input()) for i in range(N))
x=[]
for i in range(3):
  for j in range(3):
    if A[i][j] in B:
      x.append(A[i][j])
if A[0][0] in x and A[1][0] in x and A[2][0] in x:
  print("Yes")
elif A[0][1] in x and A[1][1] in x and A[2][1] in x:
  print("Yes")
elif A[0][2] in x and A[1][2] in x and A[2][2] in x:
  print("Yes")
elif A[0][0] in x and A[0][1] in x and A[0][2] in x:
  print("Yes")
elif A[1][0] in x and A[1][1] in x and A[1][2] in x:
  print("Yes")
elif A[2][0] in x and A[2][1] in x and A[2][2] in x:
  print("Yes")
elif A[0][0] in x and A[1][1] in x and A[2][2] in x:
  print("Yes")
elif A[0][2] in x and A[1][1] in x and A[2][0] in x:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=[]
for i in range (2):
  for j in range(2):
    a.append(int(input()))
N=int(input())
for i in range(N):
  b[i]=int(input())
  
for i in range(2):
  for j in range(2):
    for k in range(N):
      if a[i][j]==b[k]:
        a[i][j]=1
      else:
        a[i][j]=0
        
if a[0][0]=1 and a[0][1]=1 and a[0][2]=1:
  print("Yes")
elif a[1][0]=1 and a[1][1]=1 and a[1][2]=1:
  print("Yes")
elif a[2][0]=1 and a[2][1]=1 and a[2][2]=1:
  print("Yes")
elif a[0][0]=1 and a[1][0]=1 and a[2][0]=1:
  print("Yes")
elif a[0][1]=1 and a[1][1]=1 and a[2][1]=1:
  print("Yes")
elif a[0][2]=1 and a[1][2]=1 and a[2][2]=1:
  print("Yes")
elif a[0][0]=1 and a[1][1]=1 and a[2][2]=1:
  print("Yes")
elif a[0][2]=1 and a[1][1]=1 and a[2][0]=1:
  print("Yes")
else:
  print("No")
Problem p02761 (python)

Fixed submission:
N,M = map(int,input().split())
sc = [tuple(map(int,input().split())) for _ in range(M)]
sc = set(sc)
 
ans = -1
begin = 10**(N-1) - (1 if N == 1 else 0)
end = 10**N
for i in range(begin,end):
    num = str(i)
    for s,c in sc:
        if int(num[s-1]) != c:
            break
    else: ans = i
    if ans != -1:
        break
 
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
SC=[list(map(int,input().split())) for i in range(M)]
begin=10**N-1
end=10**N
if N==1:
  print(SC[0][1])
for i in range(begin,end):
  i=str(i)
  for s,c in SC:
    if i[s-1]!=c:
      break
  else:
    print(i)
    exit()
print(-1)
Problem p02765 (python)

Fixed submission:
N,R=map(int,input().split())
if N>=10:
  print(R)
else:
  print(R+100*(10-N))

Buggy submission (verdict: Runtime Error):
N,R=map(int,input().split())
ans=R+100*(10-K)
print(ans)
Problem p02791 (python)

Fixed submission:
n = int(input())
p_n = list(map(int, input().split()))
ans = 1
p_i_1 = [p_n[0]]
m = p_n[0]
for i in range(1, n):
    if m > p_n[i]:
        ans += 1
    m = min(m, p_n[i])
    p_i_1.append(p_n[i])
    if m == 1:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
P=list(map(int,input().split()))
cnt=1
x=[]
i=0
while True:
  max=P[0]
  if max==1:
    break
  if max>=P[i+1]:
    cnt+=1
    max=P[i+1]
  i+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
N=int(input())
P=list(map(int,input().split()))
cnt=1
x=[]
i=0
while True:
  max=P[0]
  if max>=P[i+1]:
    cnt+=1
    max=P[i+1]
  i+=1
  if max==1:
    break
print(cnt)

Buggy submission (verdict: Runtime Error):
N=int(input())
P=list(map(int,input().split()))
cnt=0
x=[]
i=0
while True:
  max=P[0]
  if max>=P[i+1]:
    cnt+=1
    max=P[i+1]
  i+=1
  if i==N-1:
    break
print(cnt)
Problem p02802 (python)

Fixed submission:
N,M=map(int,input().split())
AC=[0]*N
WA=[0]*N
wa=0
for i in range(M):
    p,s=input().split()
    p=int(p)-1
    if AC[p]==0 and s=="AC":
        AC[p]=1
        wa+=WA[p]
    WA[p]+=1
print(sum(AC),wa)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
PS=[list(input().split()) for i in range(M)]
AC=[0]*N
WA=[0]*N
for p,s in PS:
  p=int(p)
  if s=="AC" and AC[p]==0:
    AC[p]=1
  elif s=="WA":
    WA[p]+=1
wa=0
for i in WA:
  wa+=i
print(sum(AC),wa)
Problem p02923 (python)

Fixed submission:
N=int(input())
H=list(map(int,input().split()))
a=0
alist=[]
if N==1:
  print(0)
  exit()
for i in range(N-1):
  if H[i]>=H[i+1]:
    if i!=N-2:
      a+=1
    else:
      a+=1
      alist.append(a)
  elif H[i]<H[i+1]:
    alist.append(a)
    a=0
print(max(alist))

Buggy submission (verdict: Runtime Error):
N=int(input())
H=list(map(int,input().split()))
a=0
alist=[]
for i in range(N-1):
  if H[i]>=H[i+1]:
    if i!=N-2:
      a+=1
    else:
      a+=1
      alist.append(a)
  elif H[i]<H[i+1]:
    alist.append(a)
    a=0
print(max(alist))
Problem p03086 (python)

Fixed submission:
S=input()
anlist=[]
check=["A","C","G","T"]
a=0
for i in S:
  if i in check:
    a+=1
  else:
    anlist.append(a)
    a=0
  anlist.append(a)
print(max(anlist))

Buggy submission (verdict: Runtime Error):
S=input()
anlist=[]
check=["A","C","G","T"]
a=0
for i in S:
  if i in check:
    a+=1
  else:
    anlist.append(a)
    a=0
print(max(anlist))
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 p03469 (python)

Fixed submission:
S=input()
S=S.replace("2017","2018")
print(S)

Buggy submission (verdict: Runtime Error):
S=input()
S[3]=8
print(S)
Problem p03493 (python)

Fixed submission:
N=input()
print(N.count("1"))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
count=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
print(N.count("1"))
Problem p02741 (python)

Fixed submission:
K = int(input())
n = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(n[K-1])

Buggy submission (verdict: Runtime Error):
    K = int(input())
    n = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    print(n[K-1])

Buggy submission (verdict: Runtime Error):
K = int(input())
n = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(n[K])
Problem p02756 (python)

Fixed submission:
from collections import deque

S = deque(input())
q = int(input().strip())


rev_count = 0
for i in range(q):
  query = input()
  if query[0] == "1":
    rev_count += 1
  elif query[0] == "2":
    query = query.strip().split(" ")
    if rev_count & 1 == 1:
      if query[1] == "1":
        S.append(query[2])
      else:
        S.appendleft(query[2])
    else:
      if query[1] == "1":
        S.appendleft(query[2])
      else:
        S.append(query[2])

if rev_count & 1 == 1:
  S.reverse()

print("".join(S))

Buggy submission (verdict: Runtime Error):
S = [input()]
q = int(input().strip())

for i in range(q):
  query = input()
  if query[0] == "1":
    S.reverse()
  elif query[0] == "2":
    query = query.strip().split(" ")
    if query[1] == "1":
      S.insert(query[2])
    else:
      S.append(query[2])

print("".join(S))
Problem p03161 (python)

Fixed submission:
n, k = map(int, input().strip().split(" "))
h = list(map(int, input().split(" ")))

dp = [0] * n
dp[1] = abs(h[0]-h[1])

for i in range(2, n):
    dp[i] = min([abs(h[i]-h[j])+dp[j] for j in range(max(0, i-k), i)])

print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().strip().split(" "))
h = list(map(int, input().split(" ")))

dp = [10**5] * (n+k+1)
dp[0] = 0

for i in range(n):
    for j in range(1, k+1):
        dp[i+j] = min(dp[i+j], abs(h[i]-h[i+j])+dp[i])

print(dp[n-1])
Problem p03162 (python)

Fixed submission:
N = int(input().strip())
h = [[0] * (N+1) for i in range(3)]
for i in range(1, N+1):
    a, b, c = map(int, input().split(" "))
    h[0][i] = max(h[1][i-1], h[2][i-1]) + a
    h[1][i] = max(h[0][i-1], h[2][i-1]) + b
    h[2][i] = max(h[0][i-1], h[1][i-1]) + c

print(max(h[0][N], h[1][N], h[2][N]))

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split(" "))
items = [tuple(map(int, input().split(" "))) for _ in range(N)]
dp = [[0]*(W+1) for i in range(N+1)]

for i in range(1, N+1):
    w, v = items[i-1]
    for j in range(1, W+1):
        if j >= w:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-w]+v)
        else:
            dp[i][j] = dp[i-1][j]

print(dp[N][W])
Problem p03166 (python)

Fixed submission:
import sys

sys.setrecursionlimit(100000)

def rec(v):
    global dp, path
    if dp[v] != -1:
        return dp[v]

    res = 0
    for i in path[v]:
        res = max(res, rec(i)+1)

    dp[v] = res
    return res



N, M = map(int, input().strip().split(" "))

dp = [-1] * N
path = [[] for _ in range(N)]

for _ in range(M):
    x, y = map(int, input().strip().split(" "))
    path[x-1].append(y-1)


result = 0
for i in range(N):
    result = max(result, rec(i))

print(result)

Buggy submission (verdict: Runtime Error):
def rec(v):
    global dp, path
    if dp[v] != -1:
        return dp[v]

    res = 0
    for i in path[v]:
        res = max(res, rec(i)+1)

    dp[v] = res
    return res



N, M = map(int, input().strip().split(" "))

dp = [-1] * N
path = [[] for _ in range(N)]

for _ in range(M):
    x, y = map(int, input().strip().split(" "))
    path[x-1].append(y-1)


result = 0
for i in range(N):
    result = max(result, rec(i))

print(result)
Problem p03167 (python)

Fixed submission:
H, W = map(int, input().split(" "))
m = [list(input().strip()) for _ in range(H)]
mod = 10**9 + 7

dp = [[0] * W for _ in range(H)]
dp[0][0] = 1

for h in range(H):
    for w in range(W):
        if h+1 < H and m[h+1][w] == ".":
            dp[h+1][w] += dp[h][w]
            dp[h+1][w] %= mod
        if w+1 < W and m[h][w+1] == ".":
            dp[h][w+1] += dp[h][w]
            dp[h][w+1] %= mod

print(dp[H-1][W-1])

Buggy submission (verdict: Runtime Error):
m = [list(input().strip()) for _ in range(H)]
mod = 10**9 + 7

dp = [[-1] * W for _ in range(H)]
dp[H-1][W-1] = 1
que = deque()
que.append((H-2, W-1))
que.append((H-1, W-2))
visited = set([(H-1, W-1)])
while len(que) > 0:
    h, w = que.popleft()
    visited.add((h, w))
    steps = 0
    if h < H-1 and m[h+1][w] == "." and ((h+1, w) in visited):
        steps += dp[h+1][w]
    if w < W-1 and m[h][w+1] == "." and ((h, w+1) in visited):
        steps += dp[h][w+1]
    steps %= mod
    dp[h][w] = steps

    if not ((h-1, w) in visited) and h-1 >= 0 and m[h-1][w] == ".":
        que.append((h-1, w))
    if not ((h, w-1) in visited) and w-1 >= 0 and m[h][w-1] == ".":
        que.append((h, w-1))

print(dp[0][0])
Problem p03169 (python)

Fixed submission:
N = int(input())

dp = [[[0.0]*(N+1) for _ in range(N+1)] for _ in range(N+1)]

dic = {}
dic[0] = 0
dic[1] = 0
dic[2] = 0
dic[3] = 0
for a in map(int, input().split(" ")):
    dic[a] += 1


for k in range(dic[3]+1):
    for j in range(dic[2]+1+dic[3]-k):
        for i in range(dic[1]+1+dic[2]-j+dic[3]-k):
            if i == 0 and j == 0 and k == 0:
                continue
            res = 0.0
            if i > 0:
                res += dp[i-1][j][k] * i
            if j > 0:
                res += dp[i+1][j-1][k] * j
            if k > 0:
                res += dp[i][j+1][k-1] * k
            res += N
            res *= (1.0 / (i+j+k))
            dp[i][j][k] = res

print(dp[dic[1]][dic[2]][dic[3]])

Buggy submission (verdict: Runtime Error):
sys.setrecursionlimit(100000)

N = int(input())

dp = [[[-1]*(N+1) for _ in range(N+1)] for _ in range(N+1)]


def rec(i, j, k):
    global dp, N

    if dp[i][j][k] >= 0.0:
        return dp[i][j][k]
    if i == 0 and j == 0 and k == 0:
        return 0.0

    res = 0.0
    if i > 0:
        res += rec(i-1, j, k) * i
    if j > 0:
        res += rec(i+1, j-1, k) * j
    if k > 0:
        res += rec(i, j+1, k-1) * k

    res += N
    res *= (1.0 / (i+j+k))

    dp[i][j][k] = res
    return dp[i][j][k]


dic = {}
dic[0] = 0
dic[1] = 0
dic[2] = 0
dic[3] = 0
for a in map(int, input().split(" ")):
    dic[a] += 1

print(rec(dic[1], dic[2], dic[3]))
Problem p03126 (python)

Fixed submission:
#!/usr/bin/python3

N, M = map(int, input().split())

A = []
for k in range(N):
    Ai = [i for i in map(int, input().split())]
    _M = Ai.pop(0)
    A.append(Ai)

res = A[0]
for k in range(N - 1):
    res = list(set(res) & set(A[k + 1]))


print(len(res))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python3

N, M = map(int, input().split())

candidates = [i for i in range(N)]

for k in range(M - 1):
    A = map(int, input().split())
    for Ai in A:
        try:
            index = candidates.index(Ai)
            del candidates[index]
        except ValueError:
            pass

print(len(candidates))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

N, M = map(int, input().split())

candidates = [i for i in range(N)]

for k in range(M - 1):
    A = map(int, input().split())
    for Ai in A:
        try:
            index = candidates.index(Ai)
            del candidates[index]
        except ValueError:
            pass

print(len(candidates))
Problem p03701 (python)

Fixed submission:
N = int(raw_input())
s = sorted([int(raw_input()) for i in range(N)])


_sum = sum(s)


def select_min(l):
    if len(l) == 0:
        return 0
    cand = min(l)
    if cand % 10 > 0:
        return cand
    return select_min([i for i in l if i != cand])


if _sum != 0 and _sum % 10 == 0:
    cand = filter(lambda x: x > 0 and x % 10 != 0, s)
    debt = select_min(cand)
    _sum -= debt

if _sum == 0 or _sum % 10 == 0:
    print(0)
else:
    print(_sum)

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
s = sorted([int(raw_input()) for i in range(N)])


_sum = sum(s)


def select_min(l):
    cand = min(l)
    if cand % 10 > 0:
        return cand
    return select_min([i for i in l if i != cand])


if _sum != 0 and _sum % 10 == 0:
    cand = filter(lambda x: x > 0 and x % 10 != 0, s)
    debt = select_min(cand)
    _sum -= debt

print(_sum)

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
s = sorted([int(raw_input()) for i in range(N)])


_sum = sum(s)


def select_min(l):
    cand = min(l)
    if cand % 10 > 0:
        return cand
    return select_min([i for i in l if i != cand])


if _sum % 10 == 0:
    cand = filter(lambda x: x % 10 != 0, s)
    debt = select_min(cand)
    _sum -= debt

print(_sum)
Problem p03730 (python)

Fixed submission:
import sys

A, B, C = map(int, raw_input().split())

for i in range(1, 101):
    if C == 0 and (B * i % A) == 0 or \
            (C % A) == 0 and (B * i % A) == 0 or \
            (B * i % A) != 0 and (C % A) % (B * i % A) == 0:
        print('YES')
        sys.exit()

print('NO')

Buggy submission (verdict: Runtime Error):
import sys

A, B, C = map(int, raw_input().split())

for i in range(1, 101):
    if C == 0 and (B * i % A) == 0 or \
            (C % A) == 0 and (B * i % A) == 0 or \
            (C % A) % (B * i % A) == 0:
        print('YES')
        sys.exit()

print('NO')

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, raw_input().split())

if C == 0 and (B % A) == 0 or \
        (C % A) == 0 and (B % A) == 0 or \
        (C % A) % (B % A) == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, raw_input().split())

if (C % A) == 0 and (B % A) == 0 or \
        (C % A) % (B % A) == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, raw_input().split())

if (C % A) == 0 && (B % A) == 0 or \
        (C % A) % (B % A) == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, raw_input().split())

if (C % A) % (B % A) == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, raw_input())

if B + C <= 100:
    print('YES')
else:
    print('NO')
Problem p02683 (python)

Fixed submission:
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)


def main():
    N, M, X = map(int, input().split())
    CA_list = [list(map(int,list(input().split(" ")))) for i in range(N)]
    Ci_sum_list = []
    
    for i in range(2 ** N):
        sum_list = [0 for i in range(M + 1)]
        for j in range(N):
            if ((i >> j) & 1):
                sum_list = [x + y for (x, y) in  zip(sum_list, CA_list[j])]
                
        logging.info(sum_list)
        if [x for x in sum_list[1:] if x < X]:
            continue
        else:
            Ci_sum_list.append(sum_list[0])

    if Ci_sum_list:
        print(min(Ci_sum_list))
    else:
        print(-1)
        
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)


def main():
    N, M, X = map(int, input().split())
    CA_list = [list(map(int,list(input().split(" ")))) for i in range(M)]
    Ci_sum_list = []
    
    for i in range(2 ** N):
        sum_list = [0 for i in range(M + 1)]
        for j in range(N):
            if ((i >> j) & 1):
                sum_list = [x + y for (x, y) in  zip(sum_list, CA_list[j])]
                
        logging.info(sum_list)
        if [x for x in sum_list[1:] if x < X]:
            continue
        else:
            Ci_sum_list.append(sum_list[0])

    if Ci_sum_list:
        print(min(Ci_sum_list))
    else:
        print(-1)
        
if __name__ == "__main__":
    main()
Problem p02837 (python)

Fixed submission:
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N = int(input())

    A = []
    x = []
    y = []

    for i in range(N):
        Ai = int(input())
        xi = []
        yi = []
        A.append(Ai)
        x.append(xi)
        y.append(yi)

        for j in range(Ai):
            xij, yij = map(int, input().split(' '))
            xi.append(xij)
            yi.append(yij)

    logging.info(A)
    logging.info(x)
    logging.info(y)

    ok_list = []
    for bits in range(2 ** N):
        ok_flag = True
        for i in range(N):
            if (bits >> i) & 1 == 0:
                continue

            for j in range(A[i]):
                if (bits >> (x[i][j] - 1) & 1) != y[i][j]:
                    ok_flag = False

        if ok_flag:
            ok_list.append(bin(bits).count('1'))

    print(max(ok_list))

    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N = int(input())

    A = []
    x = []
    y = []

    for i in range(N):
        Ai = int(input())
        xi = []
        yi = []
        A.append(Ai)
        x.append(xi)
        y.append(yi)

        for j in range(Ai):
            xij, yij = map(int, input().split(' '))
            xi.append(xij)
            yi.append(yij)

    logging.info(A)
    logging.info(x)
    logging.info(y)

    ok_list = []
    for bits in range(2 ** N):
        ok_flag = True
        for i in range(N):
            if (bits >> i) & 1 == 0:
                continue

            for j in range(A[i]):
                if (bits >> (x[i][j] - 1) & 1) != y[i][j]:
                    ok_flag = False

    if ok_flag:
        ok_list.append(bin(bits).count('1'))

    print(max(ok_list))

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

Fixed submission:
import logging
import math

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)
            
def main():
    S = int(input())
    logging.info("Hello!")

    if S < 10 ** 9:
        print("0 0 1 0 1 " + str(S))
    else:
        X_3 =  10 ** 9 - (S % (10 ** 9))

        if X_3 == 10 ** 9:
            Y_3 = int(S / (10 ** 9))
            X_3 = 0
        else:
            Y_3 = int(S / (10 ** 9)) + 1
        
        
        print("0 0 1000000000 1 " + str(X_3) + " " + str(Y_3))
        
        
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
    import logging
    import math
     
    logging.basicConfig(level=logging.INFO, format="%(message)s")
    #logging.disable(logging.CRITICAL)
                
    def main():
        S = int(input())
        logging.info("Hello!")
     
        if S < 10 ** 9:
            print("0 0 1 0 1 " + str(S))
        else:
            X_2 = 10 ** 9
            Y_2 = 1
     
            Y_3 = int(S / (10 ** 9)) + 1
            X_3 =  10 ** 9 - (S % (10 ** 9))
            
            print("0 0 1000000000 1 " + str(X_3) + " " + str(Y_3))
            
            
    if __name__ == "__main__":
        main()
Problem p02999 (python)

Fixed submission:
X, A = (int(x) for x in input().split())

if X < A:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
logging.disable(logging.CRITICAL)

N, K = (int(x) for x in input().split())
L = list(int(x) for x in input().split())

logging.info(L)

counter = 0

for i in range(0, N):
    for j in range(i, N):
        if sum(L[i:j+1]) > K:
            counter = counter + 1

print(counter)