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

Fixed submission:
import collections

n,m = map(int,input().split())
friend = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    friend[a].append(b)
    friend[b].append(a)

q = collections.deque()
visited = [0 for i in range(n)]

ans = 0
for i in range(n):
    tmp = 0
    if visited[i] == 0:
        visited[i] = 1
        tmp += 1
        for j in friend[i]:
            if visited[j] == 0:
                visited[j] = 1
                tmp += 1
                q.append(j)
        while q:
            s = q.pop()
            for k in friend[s]:
                if visited[k] == 0:
                    visited[k] = 1
                    tmp += 1
                    q.append(k)
    ans = max(ans,tmp)

print(max(ans,1))

Buggy submission (verdict: Runtime Error):
import collections

n,m = map(int,input().split())
friend = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    friend[a].append(b)
    friend[b].append(a)

q = collections.deque()
visited = [0 for i in range(n)]

def dfs():
    while q:
        s = q.pop()
        for i in friend[s]:
            if visited[i] == 0:
                tmp += 1
                q.append(i)

ans = 0
for i in range(n):
    if visited[i] == 0:
        visited[i] = 1
        tmp = 1
        for j in friend[i]:
            if visited[j] == 0:
                visited[j] = 1
                tmp += 1
                q.append(j)
        dfs()
    ans = max(ans,tmp)

print(ans)
Problem p02678 (python)

Fixed submission:
import collections

n,m = map(int,input().split())

s = {i:[] for i in range(n+1)}
for i in range(m):
    a,b = map(int,input().split())
    s[a].append(b)
    s[b].append(a)

bfs = [0]*(n+1)
try:
    bfs[1] = s[1][0]
except IndexError:
    print("No")
    exit()
q = collections.deque()
q.append({1:s[1]})

while  q:
    tmp = q.popleft()#現在地点からたどり着ける部屋の辞書
    for k,v in tmp.items():
        for room in v:
            if bfs[room] == 0:
                bfs[room] = k
                q.append({room:s[room]})

if bfs.count(0) <= 1:
    print("Yes")
    for i in bfs[2:]:
        print(i)
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import collections

n,m = map(int,input().split())

s = {i:[] for i in range(m+1)}
for i in range(m):
    a,b = map(int,input().split())
    s[a].append(b)
    s[b].append(a)

bfs = [0]*(n+1)
bfs[1] = s[1][0]
q = collections.deque()
q.append({1:s[1]})

now = 1
while  q:
    tmp = q.popleft()#現在地点からたどり着ける部屋の辞書
    for k,v in tmp.items():
        for room in v:
            if bfs[room] == 0:
                bfs[room] = k
                q.append({room:s[room]})

if bfs.count(0) <= 1:
    print("Yes")
    for i in bfs[2:]:
        print(i)
else:
    print("No")
Problem p02684 (python)

Fixed submission:
n,k = map(int,input().split())
s = list(map(int,input().split()))
s.insert(0,0)

visited = [0]*(n+1)
visited[1] = 1
q = [1]

def dp(town):
    if visited[town] == 1:
        ans = k%(len(q))
        print(q[ans])
        exit()
    else:
        visited[town] += 1
        q.append(town)

i = 1
next_town = s[1]
while True:
    if i == k:
        print(next_town)
        exit()
    if visited[next_town] == 1:
        break
    else:
        visited[next_town] += 1
        q.append(next_town)
        next_town = s[next_town]
        i += 1
    
index = q.index(next_town)
q = q[index:]
ans = (k-i)%len(q)
print(q[ans])

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

t = [0]*(n+1)
t[1] = 1
q = [1]

for i in range(1,k):
    if i == k:
        print(s[i])
        exit()
    if t[s[i]] == 0:
        t[s[i]] = 1
        q.append(s[i])
    elif t[s[i]] != 0:
        ans = k%(len(q))
        print(q[ans])
        exit()

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

t = [0]*(n+1)
t[1] = 1
q = [1]

for i in range(1,k):
    if t[s[i]] == 0:
        t[s[i]] = 1
        q.append(s[i])
    elif i == k:
        print(s[i])
        exit()
    elif t[s[i]] != 0:
        ans = k%(len(q))
        print(q[ans])
        exit()
Problem p02756 (python)

Fixed submission:
from collections import deque
string = input()
s = deque(string)
iteration = int(input())
reverse = 1

for c in range(0,iteration):
    sousa = input().split()
    #操作１のとき
    if sousa[0] == "1":
        reverse = reverse*(-1)
    #操作２を行うとき
    elif sousa[1] == "1":
        if reverse == 1:
            s.appendleft(sousa[2])
        else:
            s.append(sousa[2])
    else:
        if reverse == 1:
            s.append(sousa[2])
        else:
            s.appendleft(sousa[2])

result = "".join(s)
if reverse == -1:
    result = result[::-1]


print(result)

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

string = input()
s = deque(string)
iteration = int(input())
reverse = 1

for c in range(0,iteration):
    sousa = input().split()
    #操作１のとき
    if sousa[0] == "1":
        reverse = reverse*(-1)
    #操作２を行うとき
    elif sousa[1] == "1":
        if reverse == 1:
            s.appendleft(sousa[2])
        else:
            s.append(sousa[2])
    else:
        if reverse == 1:
            s.append(sousa[2])
        else:
            s.appendleft(sousa[2])

if reverse == -1:
    s = s[::-1]

result = "".join(s)
print(result)
Problem p02761 (python)

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

s = [0]*n

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

if s[0] != 0:
    print(*s, sep ="")
elif s[0] == 0 and n == 1:
    print(0)
elif s[0] == 0 and n != 1:
    s[0] = 1
    print(*s, sep ="")
else:
    print(-1)

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

s = [0]*n

for i in range(m):
    keta, num = map(int,input().split())
    if s[keta-1] == 0 or s[keta-1] == num:
        s[keta-1] = num
    else:
        pirnt(-1)
        exit()

if s[0] != 0:
    print(*s, sep ="")
else:
    print(-1)
Problem p02882 (python)

Fixed submission:
import math

a,b,x = map(int,input().split())

if x == (a**2)*b:
    ans = 90
elif x == (a**2)*b/2:
    ans = 45
elif x < (a**2)*b/2:
    rad = math.atan(2*x/(a*b**2))
    ans = math.degrees(rad)
else:
    rad = math.atan(a**3/(2*a**2*b - 2*x))
    ans = math.degrees(rad)
print(90-ans)

Buggy submission (verdict: Runtime Error):
import math

a,b,x = map(int,input().split())

if x == (a**2)*b/2:
    ans = 45
elif x < (a**2)*b/2:
    rad = math.atan(2*x/(a*b**2))
    ans = math.degrees(rad)
else:
    rad = math.atan(a**3/(2*a**2*b - 2*x))
    ans = math.degrees(rad)
print(90-ans)
Problem p02888 (python)

Fixed submission:
import bisect
 
n = int(input())
a = list(map(int,input().split()))
a.sort()

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        index = bisect.bisect_left(a,a[i]+a[j])
        ans += index-j-1
        
print(ans)

Buggy submission (verdict: Runtime Error):
import math
import itertools
 
n = int(input())
a = list(map(int,input().split()))
a.sort()

ans = 0
for i in range(n-2):
    x = a[i]
    for j in range(i+1,n-1):
        y = a[j]
        for k in range(j+1,n):
            if a[k] < x+y
                ans += 1
            else:
                break

print(ans)
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)

n,q = map(int,input().split())

edges = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

counter = [0]*n
for i in range(q):
    p,x = map(int,input().split())
    counter[p-1] += x

def dfs(now,prev):
    for next in edges[now]:
        if next == prev:
            continue
        counter[next] += counter[now]
        dfs(next,now)

dfs(0,-1)
print(*counter)

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

edges = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

counter = [0]*n 
for i in range(q):
    p,x = map(int,input().split())
    counter[p-1] += x

def dfs(now,prev):
    for next in edges[now]:
        if next == prev:
            continue
        counter[next] += counter[now]
        dfs(next,now)

dfs(0,-1)
print(*counter)

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

edges = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

counter = [0]*n 
for i in range(q):
    p,x = map(int,input().split())
    counter[p-1] += x

def dfs(now,prev):
    for next in edges[now]:
        if next == prev:
            continue
        counter[next] += counter[now]
        dfs(next,now)

dfs(0,-1)
print(*counter)

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

edges = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

counter = [0 for i in range(n)]
for i in range(q):
    p,x = map(int,input().split())
    counter[p-1] += x

def dfs(now,prev):
    for next in edges[now]:
        if next == prev:
            continue
        counter[next] += counter[now]
        dfs(next,now)

dfs(0,-1)
print(*counter)
Problem p02983 (python)

Fixed submission:
l,r = map(int,input().split())

if r < 2019:
    print(l*(l+1)%2019)
    exit()

ans = 2019
for i in range(l,r):
    for j in range(i+1,r+1):
        ans = min(ans,(i*j)%2019)
        if ans == 0:
            print(0)
            exit()

print(ans)

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split())

if r < 2019:
    print(l*(l+1))
    exit()

for i in range(l,r+1):
    if i%2019 == 0:
        print(0)
        exit()

ans = (l*(l+1))%2019
print(error)
Problem p03087 (python)

Fixed submission:
n,q = map(int,input().split())
s = list(input())

count = [0]*n

num = 0
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        num += 1
    count[i] = num
count.insert(0,0)
count[-1] = count[-2]

for i in range(q):
    l,r = map(int,input().split())
    print(count[r-1] - count[l-1])

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

start_list = [0]*(n)
end_list = [0]*(n+1)

num = 0
for i in range(n):
    if s[i] == "A" and s[i+1] == "C":
        num += 1
    start_list[i] = num
    end_list[i+1] = num
start_list.insert(0,0)

for i in range(q):
    l,r = map(int,input().split())
    print(end_list[r-1] - start_list[l-1])
Problem p03262 (python)

Fixed submission:
import fractions as math

n,x = map(int,input().split())
s = list(map(int,input().split()))

a = []
for i in s:
    a.append(abs(i-x))

tmp = a[0]
for i in range(1,len(a)):
    tmp = math.gcd(tmp,a[i])

print(tmp)

Buggy submission (verdict: Runtime Error):
import bisect
import fractions

n,x = map(int,input().split())
s = list(map(int,input().split()))

s.sort()
index = bisect.bisect_left(s,x)
s.insert(index,x)

if n == 1:
    print(s[1]-s[0])
    exit()

for i in range(len(s)-1):
    tmp = s[i+1] - s[i]
    if tmp%2 != 0:
        print(1)
        exit()
    ans = fractions.gcd(tmp,ans)

print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

n,x = map(int,input().split())
s = list(map(int,input().split()))

s = list(set(s))
s.sort()
index = bisect.bisect_left(s,x)
index2 = bisect.bisect_right(s,x)
if index == 0:
    ans = abs(s[0] - x)
elif index2 == len(s)-1:
    ans = abs(x - s[-1])
else:
    s.insert(index,x)
    ans = min(abs(s[index] - s[index-1]), abs(s[index2] -s[index2+1]))
    
print(ans)
Problem p03611 (python)

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

MAX = max(s)
nums = [0]*(MAX+1)

if MAX == 0:
    print(n)
    exit()

for i in s:
    if i == 0:
        nums[0] += 1
        nums[1] += 1
    elif i == MAX:
        nums[-1] += 1
        nums[-2] += 1
    else:
        nums[i-1] += 1
        nums[i] += 1
        nums[i+1] += 1

print(max(nums))

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

MAX = max(s)
nums = [0]*(MAX+1)

for i in s:
    if i == 0:
        nums[0] += 1
        nums[1] += 1
    elif i == MAX:
        nums[-1] += 1
        if i != 0:
            nums[-2] += 1
    else:
        nums[i-1] += 1
        nums[i] += 1
        nums[i+1] += 1

print(max(nums))

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

MAX = max(s)
nums = [0]*(MAX+1)


for i in s:
    if i == 0:
        nums[0] += 1
        nums[1] += 1
    elif i == MAX:
        nums[-1] += 1
        nums[-2] += 1
    else:
        nums[i-1] += 1
        nums[i] += 1
        nums[i+1] += 1

print(max(nums))

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

nums = [0]*(max(s)+1)

for i in s:
    if i == 0:
        nums[0] += 1
        nums[1] += 1
    elif i == max(s):
        nums[-1] += 1
        nums[-2] += 1
    else:
        nums[i-1] += 1
        nums[i] += 1
        nums[i+1] += 1

print(max(nums))

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

nums = [0]*(max(s)+1)

for i in s:
    if i == 0:
        nums[0] += 1
        nums[1] += 1
    elif i == max(s):
        nums[-1] += 1
        nums[-2] += 1
    else:
        nums[i-1] += 1
        nums[i] += 1
        nums[i+1] += 1

print(max(nums))
Problem p03645 (python)

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

s1 = set()
s2 = set()
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        s1.add(b)
    elif b == 1:
        s1.add(a)
    elif a == n:
        s2.add(b)
    elif b == n:
        s2.add(a)

if s1.isdisjoint(s2):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

Buggy submission (verdict: Runtime Error):
import collections

n,m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]
print(s)#[[1, 2], [2, 3]]

q = collections.deque()
q.append(1)

for k in range(2):
    for j in range(len(q))
        tmp = q.pop()
        for i in s:
            if tmp in i:
                if tmp > i[0]:
                    q.append(i[0])
                else:
                    q.append(i[1])

if n in q:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Problem p03861 (python)

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

a_ = a//x
b_ = b//x

if a%x == 0:
    print(b_ - a_ + 1)
else:
    print(b_- a_)

Buggy submission (verdict: Runtime Error):
import math

a,b,x = map(int,input().split())

for i in range(a,b+1):
    if i % x == 0:
        num = i
        break

print((b-num)//x + 1 )
Problem p04045 (python)

Fixed submission:
n,k = map(int,input().split())
d = list(map(int,input().split()))

n_str = str(n)
l = len(n_str)
a = [i for i in range(10) if i not in d]

#同じ桁の時
ans = ""
for i in range(l):
    for j in a:
        if j == int(n_str[i]):
            ans += str(j)
            break
        elif j > int(n_str[i]):
            ans += str(j) + str(a[0])*(l-i-1)
            print(ans)
            exit()

if len(ans)>0:
    if int(ans) >= n:
        print(ans)
        exit()

if 0 in a:
    ans = str(a[1]) + str(a[0])*l
else:
    ans = str(a[0])*(l+1)

print(ans)

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

n_str = str(n)
l = len(n_str)
a = [i for i in range(10) if i not in d]

#同じ桁の時
ans = ""
for i in range(l):
    for j in a:
        if j == int(n_str[i]):
            ans += str(j)
            break
        elif j > int(n_str[i]):
            ans += str(j) + str(a[0])*(l-i-1)
            print(ans)
            exit()

if int(ans) >= n:
    print(ans)
    exit()

if 0 in a:
    ans = str(a[1]) + str(a[0])*l
else:
    ans = str(a[0])*(l+1)

print(ans)
Problem p03565 (python)

Fixed submission:
import sys
input = sys.stdin.readline
s = input().rstrip("\n")
t = input().rstrip("\n")
flg = False

for i in range(len(s)-len(t)+1):
    cnt = 0
    for j in range(len(t)):
        #print(s[i+j],t[j])
        if s[i+j] == t[j] or s[i+j] == '?':
            cnt+=1
        #print(cnt,len(t))
    if cnt == len(t):
        temp=i
        flg = True
        #print(cnt)
 
if not flg:
    print("UNRESTORABLE")
else:
    li = list(s.replace("?","a"))
    #print(li)
    for j in range(len(t)):
        #print(li[cnt+j], t[j])
        li[temp+j] = t[j]
    print("".join(li))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
s = input().rstrip("\n")
t = input().rstrip("\n")
flg = False
#cnt = 0

if len(s)-len(t)+1<0:
	print("UNRESTOABLE")
    sys.exit(0)
 
for i in range(len(s)-len(t)+1):
    cnt = 0
    for j in range(len(t)):
        #print(s[i+j],t[j])
        if s[i+j] == t[j] or s[i+j] == '?':
            cnt+=1
        #print(cnt,len(t))
    if cnt == len(t):
        cnt=i
        flg = True
        #print(cnt)
        break
 
if not flg:
    print("UNRESTORABLE")
else:
    li = list(s.replace("?","a"))
    #print(li)
    for j in range(len(t)):
        #print(li[cnt+j], t[j])
        li[cnt+j] = t[j]
    print("".join(li))
Problem p02548 (python)

Fixed submission:
N=int(input())
a=1
count=0
while a<N:
  count=count+(N-1)//a
  a=a+1
else:
  print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
total=0
import sympy
for i in range(1,N):
  total=total+sympy.divisor_count(i)
print (total)

Buggy submission (verdict: Runtime Error):
import sympy
N=int(input())
total=0
for i in range(1,N):
  total=total+sympy.divisor_count(i)
print (total)

Buggy submission (verdict: Runtime Error):
import sympy
N=int(input())
count=0
for i in range(1,N):
  count=count+sympy.divisor_count(i)
print (count)

Buggy submission (verdict: Runtime Error):
import sympy
N=int(input())
count=0
for i in range(1,N)
  count=count+sympy.divisor_count(i)
print (count)
Problem p02898 (python)

Fixed submission:
N, K = map(int, input().split())
H = list(map(int, input().split()))
count = 0
for h in H:
    if h >= K:
        count = count+1
print(count)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
H=list(map(int,input().split()))
count=0
for h in H:
  if h>=K:
  count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
H=list[map(int,input().split())]
count=0
for h in H:
  if h>=K:
  count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
H=list[map(int,input().split())]
count=0
for h in H:
  if h>K:
  count+=1
print(count)
Problem p03219 (python)

Fixed submission:
X,Y=map(int,input().split())
print(X+Y//2)

Buggy submission (verdict: Runtime Error):
X,Y=map(int,input().split())
print(X+y/2)
Problem p03502 (python)

Fixed submission:
N=int(input())
n=sum(map(int,str(N)))
print("Yes" if N%n==0 else "No")

Buggy submission (verdict: Runtime Error):
N=input()
a=sum(map(int,str(N)))
if N%a==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=input()
a=sum(map(int,str(N)))
if N%a==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=input()
n=sum(map(int,str(N)))
if N%n==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=input()
n=sum(map(int,N))
if N%n==0:
  print("Yes")
else :
  print("No")
Problem p03635 (python)

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

Buggy submission (verdict: Runtime Error):
n,m =map(int,imput().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n,m =map(int,imput().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n,m =map(int(),imput().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n,m =map(int(),imput().split)
print((n-1)*(m-1))
Problem p03698 (python)

Fixed submission:
S=input()
print("yes" if len(S)==len(set(S)) else "no")

Buggy submission (verdict: Runtime Error):
S=input
print("yes" if len(S)==len(set(S)) else "no")

Buggy submission (verdict: Runtime Error):
S=input
print("yes" if len(S)=len(set(S)) else "no")
Problem p03796 (python)

Fixed submission:
import math
N=int(input())
print(math.factorial(N) % (10**9+7))

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
print(math.factrial(N)%(10**9+7))
Problem p02602 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = [0]*(n-k)
for i in range(k, n):
  ans[i-k] = (a[i]>a[i-k])
for i in range(0, n-k):
  print('Yes' if ans[i] else 'No')

Buggy submission (verdict: Runtime Error):
import numpy as np

n, k = map(int, input().split())
a = tuple(map(int, input().split()))
i = 1
prev = np.prod(a[:k])

while i+k <= n:
  tmp = np.prod(a[i:i+k])
  if tmp > prev:
    print('Yes')
  else:
    print('No')
  prev = tmp
  i += 1
Problem p02640 (python)

Fixed submission:
x, y = list(map(int, input().split()))

flg = True

for i in range(x+1):
  if i*2 + (x-i)*4 == y:
    print('Yes')
    flg = False
    break
    
if flg:print('No')

Buggy submission (verdict: Runtime Error):
x, y = list(map(int, input().split()))

flg = true
for i in range(x):
  if 2*i + 4*(x-i) == y:
    print('Yes'):
    flg = False
      break
      
if flg:print('No')
Problem p02761 (python)

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

s, c = [], []
for _ in range(m):
  s_, c_ = map(int, input().split())
  s.append(s_)
  c.append(c_)

for i in range(10**n):
  ans = str(i)
  if len(ans) == n and all([ans[s[j]-1] == str(c[j]) for j in range(m)]):
    print(ans)
    exit()

print(-1)

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

s, c = [], []
for _ in range(m):
  s_, c_ = map(int, input().split())
  s.append(s_)
  c.append(c_)

flg = False
for i in range(10**n):
  for j in range(m):
    if str(i)[s[j]-1] != str(c[j]):
      break
  else:
    print(i)
    flg = True
    break
if not flg:
  print(-1)
Problem p02772 (python)

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

flg = True
for i in range(n):
  if a[i]%2 == 0:
    if a[i]%3 == 0 or a[i]%5 == 0:
      pass
    else:
      flg = False
if flg: print("APPROVED")
else: print("DENIED")

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

flg = True
for i in range(n):
  if a[i]%2 == 0:
    cnt += 1
    if a[i]%3 == 0 or a[i]%5 == 0:
      pass
    else:
      flg = False
if flg: print("APPROVED")
else: print("DENIED")