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

Fixed submission:
import sys
from collections import deque

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

graph = [[] for _ in range(N)]

for a, b in AB:
    graph[a - 1].append(b)
    graph[b - 1].append(a)
    
queue = deque()
visited = [0] * N
sign_list = [0] * N 

queue.append(1)
visited[0] = 1

while queue:
    room = queue.popleft()
    next_rooms = graph[room - 1]
    for r in next_rooms:
        if visited[r - 1] == 0:
            queue.append(r)
            sign_list[r - 1] = room
            visited[r - 1] = 1

yes = True
for s in sign_list[1:]:
    if s == 0:
        yes = False

if yes:
    print("Yes")
    for s in sign_list[1:]:
        print(s)
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sys

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

tree = [[] for _ in range(N + 1)]
for a, b in AB:
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)

# 深さ優先探索
sign_list = [[] for _ in range(N)]
visited = [0] * N
visited[0] = 1

def dfs(tree, pos):
    visited[pos] = 1
    children = []
    for r in tree[pos]:
        if visited[r] == 0:
            children.append(r)
    for c in children:
        sign_list[c] = pos + 1
        dfs(tree, c)

dfs(tree, 0)

for i in range(1, N):
  print('Yes')
  print(sign_list[i])

Buggy submission (verdict: Runtime Error):
import sys

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

tree = [[] for _ in range(N + 1)]
for a, b in AB:
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)

# 深さ優先探索
sign_list = [[] for _ in range(N)]
visited = [0] * N
visited[0] = 1

def dfs(tree, pos):
    visited[pos] = 1
    children = []
    for r in tree[pos]:
        if visited[r] == 0:
            children.append(r)
    for c in children:
        sign_list[c] = pos + 1
        dfs(tree, c)

dfs(tree, 0)

for i in range(1, N):
  	print('Yes')
    print(sign_list[i])

Buggy submission (verdict: Runtime Error):
import sys

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

tree = [[] for _ in range(N + 1)]
for a, b in AB:
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)

# 深さ優先探索
sign_list = [[] for _ in range(N)]
visited = [0] * N
visited[0] = 1

def dfs(tree, pos):
    visited[pos] = 1
    children = []
    for r in tree[pos]:
        if visited[r] == 0:
            children.append(r)
    for c in children:
        sign_list[c] = pos + 1
        dfs(tree, c)

dfs(tree, 0)

for i in range(1, N):
    print(sign_list[i])
Problem p02888 (python)

Fixed submission:
import sys
import bisect

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

count = 0

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        c = bisect.bisect_left(L, L[i]+L[j])
        if c > j:
            count += c - j - 1
        else:
            pass
        
print(count)

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

N = int(sys.stdin.readline())
L = np.array(list(map(int, sys.stdin.readline().split())))
L = np.sort(L)

count = 0

for i in range(N - 2):
    a = L[i]
    for j in range(i + 1, N - 1):
        b = L[j]
        c_cand = L[j + 1:]
        c_num = np.count_nonzero(c_cand < a + b)
        count += c_num
        
print(count)
Problem p02900 (python)

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

def fctr1(n): 
    f = {}
    c = 0
    r = int(n ** 0.5)
    for i in range(2, r + 2):
        while n % i == 0:
            c += 1
            n = n // i
        if c != 0:
            f[i] = c
            c = 0
    if n != 1:
        f[n] = 1
    return f


a = fctr1(A)
b = fctr1(B)


cd_dic = {1: 1}
key_list = [1]

for k, v in a.items():
    if k in b:
        key_list.append(k)
        n = min(v, b[k])
        cd_dic[k] = n

print(len(cd_dic))

Buggy submission (verdict: Runtime Error):
import sympy

A, B = map(int, input().split())

def fctr1(n): 
    f = {}
    c = 0
    r = int(n ** 0.5)
    for i in range(2, r + 2):
        while n % i == 0:
            c += 1
            n = n // i
        if c != 0:
            f[i] = c
            c = 0
    if n != 1:
        f[n] = 1
    return f


a = fctr1(A)
b = fctr1(B)


cd_dic = {1: 1}
key_list = [1]

for k, v in a.items():
    if k in b:
        key_list.append(k)
        n = min(v, b[k])
        cd_dic[k] = n

print(len(cd_dic))
Problem p02936 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x

def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])

dfs(1,0,0)

answer = ' '.join(map(str,value[1:]))
print(answer)

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


N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x

def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])

dfs(1,0,0)

answer = ' '.join(map(str,value[1:]))
print(answer)
Problem p02995 (python)

Fixed submission:
from fractions import gcd
A, B, C, D = map(int, input().split())

def lcm(x, y):
    return (x * y) // gcd(x, y)

C_count = B // C - A // C
if A % C == 0:
    C_count += 1
D_count = B // D - A // D
if A % D == 0:
    D_count += 1
CD_count = B // lcm(C, D) - A // lcm(C, D)
if A % lcm(C, D) == 0:
    CD_count += 1
div_count = C_count + D_count - CD_count
ans = B - A + 1 - div_count
print(ans)

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

C_count = B // C - A // C
if A % C == 0:
    C_count += 1
D_count = B // D - A // D
if A % D == 0:
    D_count += 1
CD_count = B // lcm(C, D) - A // lcm(C, D)
if A % lcm(C, D) == 0:
    CD_count += 1
div_count = C_count + D_count - CD_count
ans = B - A + 1 - div_count
print(ans)
Problem p03000 (python)

Fixed submission:
# coding: utf-8
# Your code here!
# 行数を取得
import sys
list=[]
for line in sys.stdin:
    list.append(line)

NandX=list[0].split()

N=int(NandX[0])
X=int(NandX[1])

L=list[1].split()
D=0
i=0

if N==1:
    print(1)
else:
    while D<=X and i<=N-1:
        D=D+int(L[i])
        i+=1
        
    if i==N and D<=X:
        print(N+1)
    else:
        print(i)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))

x = 0
for i in range(N + 1):
    if i == 0:
        x = 0
    else:
        x += L[i - 1]
        if x > X:
            ans = i
            break

print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
# 行数を取得
import sys
list=[]
for line in sys.stdin:
    list.append(line)

NandX=list[0].split()
N=int(NandX[0])
X=int(NandX[1])

L=list[1].split()
D=0
i=0
while D<=X:
    D=D+int(L[i])
    i+=1
print(i)
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(500*500)
N = int(sys.stdin.readline())
edges = [list(map(int,sys.stdin.readline().split())) for _ in range(N - 1)]
A = [[] for _ in range(N + 1)]
 
for edge in edges:
    A[edge[0]].append([edge[1],edge[2]])
    A[edge[1]].append([edge[0],edge[2]])
 
depth = [-1] * (N + 1)
depth[1] = 0
 
def dfs(A,s):
    for v in A[s]:
        if depth[v[0]] == -1:
            depth[v[0]] = depth[s] + v[1]
            dfs(A,v[0])    
dfs(A,1)
for d in depth[1:]:
    if d % 2 == 0:
        print(0)
    else:
        print(1)

Buggy submission (verdict: Runtime Error):
import sys
N = int(sys.stdin.readline())
edges = [list(map(int,sys.stdin.readline().split())) for _ in range(N - 1)]
A = [[] for _ in range(N + 1)]
 
for edge in edges:
    A[edge[0]].append([edge[1],edge[2]])
    A[edge[1]].append([edge[0],edge[2]])
 
depth = [-1] * (N + 1)
depth[1] = 0
 
def dfs(A,s):
    for v in A[s]:
        if depth[v[0]] == -1:
            depth[v[0]] = depth[s] + v[1]
            dfs(A,v[0])    
dfs(A,1)
for d in depth[1:]:
    if d % 2 == 0:
        print(0)
    else:
        print(1)
Problem p02885 (python)

Fixed submission:
A, B = map(int, input().split())
if A > 2 * B:
    print(A - 2 * B)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
if A > 2 * B:
    print(A - 2 * B)
else:
    pritn(0)
Problem p02717 (python)

Fixed submission:
X,Y,Z = map(int,input().split())
 
print('{} {} {} '.format(Z,X,Y))

Buggy submission (verdict: Runtime Error):
X,Y,Z = map(int,input().split())
 
print({} {} {} .format(Y,Z,X))

Buggy submission (verdict: Runtime Error):
X,Y,Z = map(int,input().split())
 
print(Y Z X)
Problem p02741 (python)

Fixed submission:
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]
K = input()
K = int(K)
print(N[K-1])

Buggy submission (verdict: Runtime Error):
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]
K = input()
K = int(K)
print(N[K])
Problem p02742 (python)

Fixed submission:
H , W = map(int, input() .split())

if W == 1:
    N = 1

elif H == 1:
    N = 1

else:   
    if H % 2 ==0:
        N = H * W / 2
        
            
    elif H % 2 ==1:
        if W % 2 ==0:
            N = H * W / 2
        else:
            N = int(H * W / 2) + 1

print(int(N))

Buggy submission (verdict: Runtime Error):
H , W = map(int, input() .split())

if W == 1:
    N = 1
if W !=1:   
	if H % 2 ==0:
        N = H * W / 2
    
    if H == 1:
        N = 1
    else:
        N = int(H * W / 2) + 1

print(N)

Buggy submission (verdict: Runtime Error):
H , W = map(int, input() .split())

if W == 1:
    N = 1
if N !=0:   
    if H % 2 ==0:
        N = H * W / 2
    
    if H == 1:
        N = 1
    else:
        N = int(H * W / 2) + 1

print(N)

Buggy submission (verdict: Runtime Error):
H , W = map(int, input() .split(""))


if H % 2 ==0:
    N = H * W / 2

else:
    N = int(H * W / 2) + 1

print(N)

Buggy submission (verdict: Runtime Error):
H , W = map(int, input() .split(","))


if H % 2 ==0:
    N = H * W / 2

else:
    N = int(H * W / 2) + 1

print(N)

Buggy submission (verdict: Runtime Error):
H,W= map(int, input() .spilit())


if H % 2 ==0:
    N = H * W / 2

else:
    N = int(H * W / 2) + 1

print(N)

Buggy submission (verdict: Runtime Error):
H,W= map(int, input(), spilit())


if H % 2 ==0:
    N = H * W / 2

else:
    N = int(H * W / 2) + 1

print(N)

Buggy submission (verdict: Runtime Error):
H = int(input())
W = int(input())

if H % 2 ==0:
  N = H * W / 2

else:
  N = int(H * W / 2) + 1

print(N)

Buggy submission (verdict: Runtime Error):
H = int(input())
W = int(input())

if H % 2 ==0:
    N = H * W / 2

else:
    N = int(H * W / 2) + 1

print(N)

Buggy submission (verdict: Runtime Error):
H = input()
W = input()
H = int(H)
W = int(W)

if H % 2 == 0:
	N = H * W / 2
else:
  	N = int(H * W) / 2 + 1
print(N)

Buggy submission (verdict: Runtime Error):
H = input()
W = input()
H = int(H)
W = int(W)
if H % == 0:
	N = H * W / 2 
else:
  	N = int (H * W) / 2 + 1
Problem p02765 (python)

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

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

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N,K = MI()

A = LI()

for j in range(K, N+1):
    if j == K:
        continue
    if A[j-K-1] < A[j-1]:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N,K = MI()

A = LI()

multi = {}

start = 1
for k in range(0,K):
    start = start * A[k]

for j in range(K, N+1):
    if j == K:
        multi[j] = start
        continue
    start = start // A[j-K-1] * A[j-1]
    multi[j] = start

    if j-1 in multi:
        if multi[j] > multi[j-1]:
            print("Yes")
        else:
            print("No")
Problem p02608 (python)

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

ans = [0 for _ in range(10050)]

for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
           v = (i+j+k)**2 - (i*j + j*k + k*i)
           if v < 10050:
            ans[v] += 1

for i in range(N):
    print(ans[i+1])

Buggy submission (verdict: Runtime Error):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

ans = [0 for _ in range(10**4)]

for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
           v = (i+j+k)**2 - (i*j + j*k + k*i)
           if v < 10**4:
            ans[v] += 1

for i in range(N):
    print(ans[i+1])
Problem p02613 (python)

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()
c0, c1, c2, c3 = 0,0,0,0
for i in range(N):
    s = S()
    if s == "AC":
        c0 += 1
    elif s == "WA":
        c1 += 1
    elif s == "TLE":
        c2 += 1
    elif s == "RE":
        c3 += 1

print("AC x " + str(c0))
print("WA x " + str(c1))
print("TLE x " + str(c2))
print("RE x " + str(c3))

Buggy submission (verdict: Runtime Error):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()
c0, c1, c2, c3 = 0,0,0,0
for i in range(N):
    if S() == "AC":
        c0 += 1
    elif S() == "WA":
        c1 += 1
    elif S() == "TLE":
        c2 += 1
    elif S() == "RE":
        c3 += 1

print("AC x " + c0)
print("WA x " + c1)
print("TLE x " + c2)
print("RE x " + c3)
Problem p02641 (python)

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

X,N = MI()

if N == 0:
    print(X)
    exit()

P = LI()

_min = 10**9
ans = []
for p in range(X+1):
    for i in [-1,1]:
        a = X + (i * p)
        if a not in P:
            print(a)
            exit()

Buggy submission (verdict: Runtime Error):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

X,N = MI()

if N == 0:
    print(X)
    exit()

P = LI()

_min = 10**9
ans = []
for p in range(1,101):
    if p in P:
        continue

    if abs(X-p) == _min:
        ans.append(p)
    elif abs(X-p) < _min:
        _min = abs(X-p)
        ans = []
        ans.append(p)

print(min(ans))
Problem p02658 (python)

Fixed submission:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

MAX = 10**18
result = 1
A = FLI()
if 0 in A:
    print(0)
    exit()
    
for i in A:
    result *= int(i)
    if result > MAX:
        print(-1)
        exit()

print(result)

Buggy submission (verdict: Runtime Error):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

MAX = 10**18
result = 1
for i in input().split():
    result *= i

if result > MAX:
    print(-1)
else:
    print(result)
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

num = [-1] * n
for s, c in sc:
    if num[s - 1] != -1 and num[s - 1] != c:
        print(-1)
        exit()
    if n > 1 and s == 1 and c == 0:
        print(-1)
        exit()
    num[s - 1] = c

if n > 1 and num[0] == -1:
    num[0] = 1

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

print("".join(str(x) for x in num))

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

s = [0] * m
c = [0] * m

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

result = [0] * n

for i in range(m):
    if result[s[i]-1] == 0:
      result[s[i]-1] = c[i]
    elif result[s[i]-1] > c[i]:
      result[s[i]-1] = c[i]

print(result)
if result[0] == 0:
    print(-1)
else:
    if result[1] == 0:
        print(-1)
    
    ans = ""
    for n in result:
        ans += n
    print(ans)
Problem p02953 (python)

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

for i in range(1, n, 1):
    if nums[i] < nums[i - 1]:
        print("No")
        exit()

    if nums[i] > nums[i - 1]:
        nums[i] -= 1

print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = [int(i) for i in input().split()]

bool = True
for i in range(len(nums)):
    if i == len(nums):
        break
    t = nums[i] - 1
    if t > nums[i+1]:
        bool = False

if bool:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = [int(i) for i in input().split()]

bool = True
for i in range(0, len(nums), 1):
    t = nums[i] - 1
    if t > nums[i+1]:
        bool = False

if bool:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = [int(i) for i in input().split()]

bool = True
for i in range(n):
    t = nums[i] - 1
    if t > nums[i+1]:
        bool = False

if bool:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
nums = [int(input()) for _ in range(n)]

bool = True
for i in range(n):
    t = nums[i] - 1
    if t > nums[i+1]:
        bool = False

if bool:
    print("Yes")
else:
    print("No")
Problem p03361 (python)

Fixed submission:
h, w = map(int, input().split())

s = [input() for _ in range(h)]

ans = 'Yes'

for i in range(1, h-1):
    for j in range(1, w-1):
        if s[i][j] == '#' and s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
            ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())

s = [input() for _ in range(h)]

ans = 'Yes'

for i in range(h):
    for j in range(w):
        if s[i][j] == '#' and s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
            ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())

s = [input() for _ in range(h)]

ans = 'Yes'

for i in range(1, h):
    for j in range(1, w):
        if s[i][j] == '#' and s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
            ans = 'No'

print(ans)