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

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Mar  6 16:29:39 2019

@author: Yamazaki Kenichi
"""

H,W = map(int,input().split())
A = [input() for i in range(H)]
T = [[-1,0,0] for j in range(H*W)] 

def g(x,i,j):
    if x == '.':
        return 1 if (i+j)%2 == 0 else 2
    else:
        return 4 if (i+j)%2 == 0 else 3
def p(u):
    return T[u][0]
def findset(u):
    if p(u) == -1:
        return u
    else:
        T[u][0] = findset(p(u))
        return T[u][0]

def unite(u,v):
    if findset(u) == findset(v):
        return
#    if T[findset(u)[0]][findset(u)[1]][1]+T[findset(u)[0]][findset(u)[1]][0
#         ] >= T[findset(v)[0]][findset(v)[1]][0]+T[findset(v)[0]][findset(v)[1]][1]:
    T[findset(u)][1] += T[findset(v)][1]
    T[findset(u)][2] += T[findset(v)][2]
    T[findset(v)][0] = findset(u)
def unite_check(i1,j1,i2,j2):
    if g(A[i1][j1],i1,j1)%2 == 0 and g(A[i2][j2],i2,j2)%2 == 0:
        unite(i1 * W + j1, i2 * W + j2)
    elif g(A[i1][j1],i1,j1)%2 == 1 and g(A[i2][j2],i2,j2)%2 == 1:
        unite(i1 * W + j1, i2 * W + j2)

for i in range(H):
    for j in range(W):
        if g(A[i][j],i,j) <= 2:
            T[i * W + j][1] += 1
        else:
            T[i * W + j][2] += 1
        if i !=0:
            unite_check(i,j,i-1,j)
        if j !=0:
            unite_check(i,j,i,j-1)
ans = 0
for i in range(H):
    for j in range(W):
        if T[i * W + j][0] == -1:
            ans += T[i * W + j][1] * T[i * W + j][2]
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Mar  6 16:29:39 2019

@author: Yamazaki Kenichi
"""

H,W = map(int,input().split())
A = [input() for i in range(H)]
T = [[-1,0,0] for j in range(H*W)] 

def g(x,i,j):
    if x == '.':
        return 1 if (i+j)%2 == 0 else 2
    else:
        return 4 if (i+j)%2 == 0 else 3
def p(u):
    return T[u][0]
def findset(u):
    if p(u) == -1:
        return u
    else:
        T[u][0] = findset(p(u))
        return T[u][0]

def unite(u,v):
    if findset(u) == findset(v):
        return
#    if T[findset(u)[0]][findset(u)[1]][1]+T[findset(u)[0]][findset(u)[1]][0
#         ] >= T[findset(v)[0]][findset(v)[1]][0]+T[findset(v)[0]][findset(v)[1]][1]:
    T[findset(u)][1] += T[findset(v)][1]
    T[findset(u)][2] += T[findset(v)][2]
    T[findset(v)][0] = findset(u)
def unite_check(i1,j1,i2,j2):
    if g(A[i1][j1],i1,j1)%2 == 0 and g(A[i2][j2],i2,j2)%2 == 0:
        unite(i1 * H + j1, i2 * H + j2)
    elif g(A[i1][j1],i1,j1)%2 == 1 and g(A[i2][j2],i2,j2)%2 == 1:
        unite(i1 * H + j1, i2 * H + j2)

for i in range(H):
    for j in range(W):
        if g(A[i][j],i,j) <= 2:
            T[i * H + j][1] += 1
        else:
            T[i * H + j][2] += 1
        if i !=0:
            unite_check(i,j,i-1,j)
        if j !=0:
            unite_check(i,j,i,j-1)
ans = 0
for i in range(H):
    for j in range(W):
        if T[i * H + j][0] == -1:
            ans += T[i * H + j][1] * T[i * H + j][2]
print(ans)
Problem p03213 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Thu Jan  3 10:20:42 2019

@author: Yamazaki Kenichi
"""

N = int(input())

prime = [2]
for j in range(3,100):
    if all(j % i != 0 for i in prime) :
        prime.append(j)

N1 = 1
for i in range(1,N+1):
    N1 *= i 

prime1 = []
a02,a04,a14,a24,a74 =0,0,0,0,0
for j in prime:
    temp = 0
    while N1 % pow(j,temp) ==0:
        temp += 1
    a02 += 1 if temp > 2 else 0
    a04 += 1 if temp > 4 else 0
    a14 += 1 if temp > 14 else 0
    a24 += 1 if temp > 24 else 0
    a74 += 1 if temp > 74 else 0    
    prime1.append(temp)

ans = a74 +a24*(a02-1) +a14*(a04-1) +a04*(a04-1)//2*(a02-2)



print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Thu Jan  3 10:20:42 2019

@author: Yamazaki Kenichi
"""
from scipy.special import perm, comb

N = int(input())

prime = [2]
for j in range(3,100):
    if all(j % i != 0 for i in prime) :
        prime.append(j)

def a(x):
    for i in range(N):
        if prime.count((N-i)//x)>0:
            return prime.index((N-i) // x )
    return -1
        
a02 = a(2)+1
a04 = a(4)+2 if (N>=9 and N<12) else a(4)+1 
a14 = a(14)+1
if N < 26:
    a24 = 0
elif N < 54:
    a24 = 1
elif N < 100:
    a24 = 2
else:
    a24 = 3

b74 = 1 if N > 78 else 0
b24 =a24*(a02-1)
b14 =a14*(a04-1)
b04 =int(comb(a04,2))*(a02-2)
    
if N < 10:
    ans = 0
else:
    ans = b74 + b24 + b14 + b04

print(ans)
Problem p02713 (python)

Fixed submission:
import math

K = int(input())
ans = 0

for i in range(1,K+1):
  for j in range(1,K+1):
    ij = math.gcd(i, j)
    for k in range(1,K+1):
      ans += math.gcd(ij, k)

print(ans)

Buggy submission (verdict: Runtime Error):
import math

K = int(input())
ans = 0

for i in range(1,K+1):
  for j in range(1,K+1):
    ab = math.gcd(a, b)
    for k in range(1,K+1):
      ans += math.gcd(ab, c)

print(ans)
Problem p03501 (python)

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

if N * A > B:
  print(B)
else:
  print(N * A)

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

if N * A > B:
  print(B)
else
  print(N * A)
Problem p03671 (python)

Fixed submission:
bells = sorted(list(map(int,input().split())))
print(bells[0] + bells[1])

Buggy submission (verdict: Runtime Error):
bells = sorted(list(map(int,input().split())))
print(bells[0] + bell[1])
Problem p03024 (python)

Fixed submission:
string = input()
sum_of_o = 0
for i in string:
    if i == 'o':
        sum_of_o += 1
 
if 15-len(string) >= 8 - sum_of_o:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
for i in string:
    sum_of_win = 1
    if i == 'o':
        sum_of_win += 1
    if i == 'x':
        sum_of_win -= 1
if sum_of_win >= 0:
    print("YES")
else:
    print("NO")
Problem p03030 (python)

Fixed submission:
N = int(input())
array = []
for i in range(N):
    array.append(list(map(str, input().split())))
array_new = sorted(array, key=lambda x: (x[0], -int(x[1])))
for i in range(N):
    print(int(array.index(array_new[i])+1))

Buggy submission (verdict: Runtime Error):
N = int(input())
array = []
for i in range(N):
    array.append(list(map(str, input().split())))
array_new = sorted(array, key=lambda x: (x[0], -x[1]))
for i in range(N):
    print(int(array.index(array_new[i])+1))
Problem p03035 (python)

Fixed submission:
A, B = map(int, input().split())
if A >= 13:
    print(B)
elif A <= 12 and A >= 6:
    print(int(B/2))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ID = []
for i in range(M):
    K = list(map(int, input().split())) 
    ID.append(list(range(K[0], K[1]+1)))
if len(ID) == 1:
    print(len(list(range(K[0], K[1]+1))))
else:
    match = set(ID[0]) & set(ID[1])
    for i in range(M):
        match = set(ID[i]) & match
    print(len(match))
Problem p03125 (python)

Fixed submission:
A, B = map(int, input().split())
if B % A ==0:
    print(A+B)
else:
    print(B-A)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())
a = np.zeros((N,M))
for i in range(N):
    K = list(map(int, input().split())) 
    for j in K[1:]:
        a[i][j-1] = 1
b = a.sum(axis=0)
print(len(np.where(b==N)[0]))
Problem p03163 (python)

Fixed submission:
def read_int():
    return int(input().strip())
 
 
def read_ints():
    return list(map(int, input().strip().split(' ')))
 
 
def solve():
    """
    OPT[N][W] = maximum value obtained with first N items and weights up to W
    OPT[N][W] = max(OPT[N-1][W-w[N]]+v[N], OPT[N-1][W])
    OPT[0][0] = 0
    """
    N, W = read_ints()
    w, v = [], []
    for _ in range(N):
        w0, v0 = read_ints()
        w.append(w0)
        v.append(v0)
    OPT = [[0]*(W+1) for _ in range(N+1)]
    for i in range(1,N+1):
        for j in range(1,W+1):
            OPT[i][j]=OPT[i-1][j]
            if j-w[i-1]>=0:
                OPT[i][j]=max(OPT[i][j],OPT[i-1][j-w[i-1]]+v[i-1])
    return OPT[-1][-1]
if __name__ == '__main__':
    print(solve())

Buggy submission (verdict: Runtime Error):
N,W=[int(i) for i in input().split()]
w=[]
v=[]
for i in range(N):
    a,b=[int(i) for i in input().split()]
    w.append(a)
    v.append(b)
dic={}
for i in range(N):
    dic[v[i]]=w[i]
v.sort()
val=0
wei=0
i=N-1
while wei<W:
    if wei+dic[v[i]]<=W:
         wei+=dic[v[i]]
         val+=v[i]
    i-=1
print(val)
Problem p03164 (python)

Fixed submission:
N, W = map(int, input().split())
w = [0]*N
v = [0]*N
for i in range(N):
    w[i], v[i] = map(int, input().split())

V = sum(v)
dp = [[10**100]* (V + 1) for _ in range(N+1)]

dp[0][0] = 0
for i in range(N):
    for j in range(V+1):
        dp[i+1][j] = dp[i][j]
        if j-v[i] >= 0:
            dp[i+1][j] = min(dp[i+1][j], dp[i][j-v[i]] + w[i])
        

ans = 0
for j in range(V + 1):
    if dp[N][j] <= W:
        ans = j

print(ans)

Buggy submission (verdict: Runtime Error):
def read_int():
    return int(input().strip())
 
 
def read_ints():
    return list(map(int, input().strip().split(' ')))
 
 
def solve():
    """
    OPT[N][W] = maximum value obtained with first N items and weights up to W
    OPT[N][W] = max(OPT[N-1][W-w[N]]+v[N], OPT[N-1][W])
    OPT[0][0] = 0
    """
    N, W = read_ints()
    w, v = [], []
    for _ in range(N):
        w0, v0 = read_ints()
        w.append(w0)
        v.append(v0)
    OPT = [[0]*(W+1) for _ in range(N+1)]
    for i in range(1,N+1):
        for j in range(1,W+1):
            OPT[i][j]=OPT[i-1][j]
            if j-w[i-1]>=0:
                OPT[i][j]=max(OPT[i][j],OPT[i-1][j-w[i-1]]+v[i-1])
    return OPT[-1][-1]
if __name__ == '__main__':
    print(solve())
Problem p03166 (python)

Fixed submission:
def addEdge(adj, u, v):
    adj[u].append(v)
def dfs(node,dp,vis,adj):
    vis[node] = True 
    for i in range(len(adj[node])):
        if not vis[adj[node][i]]: 
            dfs(adj[node][i], dp,vis,adj)
        dp[node] = max(dp[node], 1 + dp[adj[node][i]])
import sys
sys.setrecursionlimit(10**9)
n, m = map(int, input().split())
adj = [[] for i in range(n + 1)] 
for i in range(m):
    u,v=map(int, input().split())
    addEdge(adj,u,v)
dp=[0]*(n+1)
vis=[False]*(n+1)
for i in range(1,n+1):
    if not vis[i]:
        dfs(i,dp,vis,adj)
ans=0
for i in range(1, n + 1):   
    ans = max(ans, dp[i])  
print(ans)

Buggy submission (verdict: Runtime Error):
def addEdge(adj, u, v):
    adj[u].append(v)
def dfs(node,dp,vis,adj):
    vis[node] = True 
    for i in range(len(adj[node])):
        if not vis[adj[node][i]]: 
            dfs(adj[node][i], dp,vis,adj)
        dp[node] = max(dp[node], 1 + dp[adj[node][i]])
        
n, m = map(int, input().split())
adj = [[] for i in range(n + 1)] 
for i in range(m):
    u,v=map(int, input().split())
    addEdge(adj,u,v)
dp=[0]*(n+1)
vis=[False]*(n+1)
for i in range(1,n+1):
    if not vis[i]:
        dfs(i,dp,vis,adj)
ans=0
for i in range(1, n + 1):   
    ans = max(ans, dp[i])  
print(ans)
Problem p03240 (python)

Fixed submission:
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]

for cx in range(101):
    for cy in range(101):
        for r in xyh:
            if r[2] > 0:
                ch = r[2] + abs(r[0] - cx) + abs(r[1] - cy)
                break
        j = False
        for r in xyh:
            if r[2] != max((ch - abs(r[0] - cx) - abs(r[1] - cy)),0):
                j = True
                break
        if not j:
            print(cx,cy,ch)

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

for cx in range(101):
    for cy in range(101):
        for i,r in enumerate(xyh):
            if r[2] > 1:
                ch = r[2] + abs(r[0] - cx) + abs(r[1] - cy)
                break
        j = False
        for i,r in enumerate(xyh):
            if r[2] != max((ch - abs(r[0] - cx) - abs(r[1] - cy)),0):
                j = True
                break
        if not j:
            print(cx,cy,ch)

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

for cx in range(101):
    for cy in range(101):
        for i,r in enumerate(xyh):
            if r[2] > 1:
                ch = r[2] + abs(r[0] - cx) + abs(r[1] - cy)
        j = False
        for i,r in enumerate(xyh):
            if r[2] != ch - abs(r[0] - cx) - abs(r[1] - cy):
                j = True
                break
        if not j:
            print(cx,cy,ch)
Problem p02765 (python)

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

Buggy submission (verdict: Runtime Error):
N, R = map(int, input().split())
if N => 10:
  O = R
else:
  O = R + 100*(10-N)
print(O)
Problem p02767 (python)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
sum = 0
min_sum = 100000000
P = 1
while P <= 100:
  for n in X:
    sum = sum +(n-P)**2
  if sum <= min_sum:
    min_sum = sum
  P = P + 1
  sum = 0
print(min_sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))
sum = 0
for x in X:
  sum = sum +(x-P)**2
print(sum)
Problem p02772 (python)

Fixed submission:
N = input()
A = list(map(int, input().split()))

for i in A:
    i = int(i)
    if i % 2 == 0:
        if i % 3 !=0 and i % 5 !=0:
            print("DENIED")
            exit()
print("APPROVED")

Buggy submission (verdict: Runtime Error):
A = list(map(int, input().split()))
N = int(input())
count = 0
for a in A:
 if (a % 2 == 0 and a % 3 != 0) and (a % 2 == 0 and a % 5 != 0):
   count = count + 1

if count >= 1 :
 print('DENIED')
else:
 print('APPROVED')

Buggy submission (verdict: Runtime Error):
A = list(map(int, input().split()))
N = int(input())
count = 0
for a in A:
  if (a % 2 == 0 and a % 3 != 0) and (a % 2 == 0 and a % 5 != 0):
    count = count + 1

if count >= 1 :
  print('DENIED')
else:
  print('APPROVED')

Buggy submission (verdict: Runtime Error):
A = list(map(int, input().split()))
count = 0
for a in A:
  if (a % 2 == 0 and a % 3 != 0) and (a % 2 == 0 and a % 5 != 0):
    count = count + 1

if count => 1 :
  print('DENIED')
else:
  print('APPROVED')
Problem p02783 (python)

Fixed submission:
H,A = map(int, input().split())
num = 0
while H >0:
  num += 1
  H -= A
print(num)

Buggy submission (verdict: Runtime Error):
H, N = input().split()
H = int(H)
#print(H)
#H, N = input().split()
lis = list(map(int,input().split()))
A =sum(lis)
if H > A:
    print("No")
else:
    print("Yes")
Problem p02784 (python)

Fixed submission:
H, N = input().split()
H = int(H)
#print(H)
#H, N = input().split()
lis = list(map(int,input().split()))
A =sum(lis)
if H > A:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
H, N = input().split()
lis = list(map(int,input().split())
A =sum(lis)
if H > A:
    print("No")
else:
    print("Yes")
Problem p02789 (python)

Fixed submission:
N,M = map(int, input().split())
if N==M:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
if N==M:
    print("Yes")
else:
    pritn("No")

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
if N==M:
    print("Yes")
else:
    pritn("NO")
Problem p02713 (python)

Fixed submission:
import math
from collections import Counter

K = int(input())

memo = {frozenset((i, j)): math.gcd(i, j) 
        for i in range(1, K+1) for j in range(i, K+1)}

counter = Counter([memo[frozenset((i, j))] 
                   for i in range(1, K+1) for j in range(1, K+1)])

total = 0
for i in range(1, K+1):
  for value, count in counter.items():
    total += memo[frozenset((i, value))] * count
    
print(total)

Buggy submission (verdict: Runtime Error):
import math
from collections import Counter

K = int(input())

memo = {frozenset((i, j)): math.gcd(i, j) 
        for i in range(1, K+1) for j in range(i, K+1)}

counter = Counter([memo[frozenset((i, j))] 
                   for i in range(1, K+1) for j in range(1, K+1)])

total = 0
for i in range(1, K+1):
  for value, count = counter.items():
    total += memo[frozenset((i, value))] * count
    
print(total)
Problem p02742 (python)

Fixed submission:
h, w = map(int, input().split())
if h==1 or w==1:
  print(1)
else:
  print((h*w+1)//2)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
return (h * w + 1)//2
Problem p02789 (python)

Fixed submission:
a, b = input().split()
print(['Yes', 'No'][a!=b])

Buggy submission (verdict: Runtime Error):
a, b = input().split()
return a == b
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
ans = [-1]*n

for i in range(m):
    s, c = map(int, input().split())
    if s == 1 and c == 0 and n != 1:
        print(-1)
        exit()
    if ans[s-1] == -1 or ans[s-1] == c:
        ans[s-1] = c
    else:
        print(-1)
        exit()

if ans[0] == -1 and n != 1:
    ans[0] = 1

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

print(*ans, sep="")

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ans = [-1]*n

if n = 1 and m = 0:
    print(0)
    exit()

for i in range(m):
    s, c = map(int, input().split())

    if s == 1 and c == 0:
        print(-1)
        exit()
        
    if ans[s-1] == -1 or ans[s-1] == c:
        ans[s-1] = c
    else:
        print(-1)
        exit()

if ans[0] == -1:
    ans[0] = 1

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

print(*ans, sep="")
Problem p02818 (python)

Fixed submission:
a, b, k = map(int, input().split())

if a != 0 and a >= k:
    a -= k
elif a != 0 and a < k:
    k -= a
    a = 0
    if b != 0 and b >= k:
        b -= k
    elif b != 0 and b < k:
        b = 0
elif a == 0:
    if b != 0 and b >= k:
        b -= k
    elif b != 0 and b < k:
        b = 0

print(a, b)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

if a != 0 and a >= k:
    a -= k
elif a != 0 and a < k:
    k -= a
    a = 0
    if b != 0 and b >= k:
        b -= k
    elif b != 0 and b < k:
        b = 0
elif a=0:
    if b != 0 and b >= k:
        b -= k
    elif b != 0 and b < k:
        b = 0

print(a, b)
Problem p03000 (python)

Fixed submission:
n, x = map(int, input().split())
l = list(map(int, input().split()))
count = 0
d = 0
for i in range(1, n+1):
    d += l[i-1]
    if d <= x:
        count += 1
    else:
        break
print(count+1)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = list(map(int, input().split()))
count = 0
d = 0
for i in range(1, n+2):
    d += l[i-1]
    if d <= x:
        count += 1
    else:
        break
print(count+1)
Problem p02696 (python)

Fixed submission:
import math

A, B, N= (int(x) for x in input().split())
#x = B * math.floor(N/B) - 1
x =  B - 1
if N < B:
    x = N
a = math.floor(A * x / B) - A * math.floor(x / B)
# b = math.floor(A * N / B) - A * math.floor(N / B)
print(a)

Buggy submission (verdict: Runtime Error):
import math

A, B, N= (int(x) for x in input().split())
#x = B * math.floor(N/B) - 1
x =  B - 1
if N < B
    x = N
a = math.floor(A * x / B) - A * math.floor(x / B)
b = math.floor(A * N / B) - A * math.floor(N / B)

if a > b:
    print(a)
else:
    print(b)
Problem p03455 (python)

Fixed submission:
input_val1, input_val2 = map(int, input().split())

prod = input_val1 * input_val2

if (prod % 2) == 0:
    print ('Even')
else:
    print('Odd')

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

my_pos_x = 0
my_pos_y = 0

for i in range(n):
    t, x, y = map(int, input().split())
    for j in range(t):
        if my_pos_x < x:
            my_pos_x = + 1
            continue
        elif my_pos_x > x:
            my_pos_x = - 1
            continue
        else:
            if my_pos_y < y:
                my_pos_y = + 1
                continue
            elif my_pos_y > y:
                my_pos_y = + -1
                continue
            else:
                my_pos_x += 1

if my_pos_x == x and my_pos_y == y:
    print("YES")
else:
    print("NO")

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

my_pos_x = 0
my_pos_y = 0

for i in range(n):
    place = list(map(int, input().split()))
    for j in range(place[0]):
        if my_pos_x < place[1]:
            my_pos_x = + 1
            continue
        elif my_pos_x > place[1]:
            my_pos_x = - 1
            continue
        else:
            if my_pos_y < place[2]:
                my_pos_y = + 1
                continue
            elif my_pos_y > place[2]:
                my_pos_y = + -1
                continue
            else:
                my_pos_x += 1

if my_pos_x == place[1] and my_pos_y == place[2]:
    print("YES")
else:
    print("NO")

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

if input_val mod == 0:
    print ('Odd')
else:
    print('Even')
Problem p02760 (python)

Fixed submission:
#7
a = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]

for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            a[i][j] = -1
bingo = 0

for i in range(3):
    if a[i][0] == a[i][1] == a[i][2] == -1:
        bingo = 1
        
for j in range(3):
    if a[0][j] == a[1][j] == a[2][j] == -1:
        bingo = 1

if a[0][0] == a[1][1] == a[2][2] == -1 or a[0][2] == a[1][1] == a[2][0]:
    bingo = 1

if bingo == 1:
    print('Yes')

else:
    print('No')

Buggy submission (verdict: Runtime Error):
#7
a = [[map(int,input().split())] for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]

for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            a[i][j] = -1
bingo = 0

for i in range(3):
    if a[i][0] == a[i][1] == a[i][2] == -1:
        bingo = 1
        
for j in range(3):
    if a[0][j] == a[1][j] == a[2][j] == -1:
        bingo = 1

if a[0][0] == a[1][1] == a[2][2] == -1 or a[0][2] == a[1][1] == a[2][0]:
    bingo = 1

if bingo == True:
    print('Yes')

else:
    print('No')
Problem p02761 (python)

Fixed submission:
#ABC157 Guess the number
n,m = map(int,input().split())
sc = [input().split() for _ in range(m)]
ans =[]

if n == 1:
    if len(sc)== 0:
        print('0')
    else:
        ans = []
        for i in range(m):
            ans.append(sc[i][1])
        if len(set(ans)) == 1:
            print(ans[0])
        else:
            print('-1')
    
else:
    for i in range(10**(n-1),10**n):
        cnt = 0
        seq = str(i)
        for j in range(m):
            if seq[int(sc[j][0])-1] == sc[j][1]:
                cnt += 1
        if cnt == m:
            ans.append(i)
        
    if len(ans) == 0:
        print('-1')
    else:
        print(min(ans))

Buggy submission (verdict: Runtime Error):
#ABC157 Guess the number
n,m = map(int,input().split())
sc = [input().split() for _ in range(m)]
ans =[]
if len(sc) == 0:
    print('0')
    exit()

if n == 1:
    d = []
    if m == 1:
        print(sc[0][1])
        exit()
    else:
        for i in range(m):
            d.append(sc[m][1])
        if set(d) == 1:
            print(d[0])
        else:
            print('-1')
            exit()
    
for i in range(10**(n-1),10**n):
    cnt = 0
    seq = str(i)
    for j in range(m):
        if seq[int(sc[j][0])-1] == sc[j][1]:
            cnt += 1
    if cnt == m:
        ans.append(i)
        
if len(ans) == 0:
    print('-1')
else:
    print(min(ans))

Buggy submission (verdict: Runtime Error):
#ABC157 Guess the number
n,m = map(int,input().split())
sc = [input().split() for _ in range(m)]
if len(sc) == 0:
    print('0')
    exit()

if n == 1:
    ans = []
    for i in range(m):
        ans.append(sc[m][1])
    if set(ans) == 1:
        print(ans[0])
    else:
        print('-1')
    exit()
    
for i in range(10**(n-1),10**n):
    cnt = 0
    seq = str(i)
    for j in range(m):
        if seq[int(sc[j][0])-1] == sc[j][1]:
            cnt += 1
    if cnt == m:
        ans.append(i)
        
if len(ans) == 0:
    print('-1')
else:
    print(min(ans))

Buggy submission (verdict: Runtime Error):
#ABC157 Guess the number
n,m = map(int,input().split())
sc = [input().split() for _ in range(m)]
ans = []
for i in range(0,10**n):
    cnt = 0
    seq = str(i)
    for j in range(m):
        if seq[int(sc[j][0])-1] == sc[j][1]:
            print(seq[int(sc[j][0])-1])
            cnt += 1
    if cnt == m:
        ans.append(i)
        
if len(ans) == 0:
    print('-1')
else:
    print(min(ans))