Problem p02639 (python)

Fixed submission:
X = list(map(int, input().split()))
count = 1
for I in X:
  if I == 0:
    print(count)
    exit
  count += 1

Buggy submission (verdict: Runtime Error):
import sys

X,N = map(int,input().split())
P = list(map(int,input().split()))
if X < 1 or 100 < X:
    sys.exit()
if N < 0 or 100 < N:
    sys.exit()
if N == 0:
    print(X)
    sys.exit()

P_number = len(P)
if P_number < 1 or 100 < P_number:
    sys.exit()

res1 = 100
res2 = 100
res0 = 0
i = 0
j = 0
while i <= N:
    if (X - i) not in P:
        res1 = (X - i)
        break
    i += 1
while j <= N:
    if (X + j) not in P:
        res2 = (X + j)
        break
    j += 1
if i > j:
    res0 = res2
elif j > i:
    res0 = res1
elif i == j:
    res0 = res1
print(res0)

Buggy submission (verdict: Runtime Error):
import sys

X,N = map(int,input().split())
P = list(map(int,input().split()))
if X < 1 or 100 < X:
    sys.exit()
if N < 0 or 100 < N:
    sys.exit()
if N == 0:
    print(X)
    sys.exit()

P_number = len(P)
if P_number < 1 or 100 < P_number:
    sys.exit()

res1 = 100
res2 = 100
res0 = 0
i = 0
j = 0
while i < N:
    if (X - i) not in P:
        res1 = (X - i)
    i += 1
while j < N:
    if (X + j) not in P:
        res2 = (X + j)
    j += 1
if res2 > res1:
    res0 = res1
elif res1 > res2:
    res0 = res2
elif res2 == res1:
    res0 = res1
print(res0+X)

Buggy submission (verdict: Runtime Error):
import sys

X,N = map(int,input().split())
P = list(map(int,input().split()))
if X < 1 or 100 < X:
    sys.exit()
if N < 0 or 100 < N:
    sys.exit()
if N == 0:
    print(X)
    sys.exit()

P_number = len(P)
if P_number < 1 or 100 < P_number:
    sys.exit()

res1 = 100
res2 = 100
res0 = 0
i = 0
j = 0
while i < N:
    if (X - i) not in P:
        res1 = (X - i)
    i += 1
while j < N:
    if (X + j) not in P:
        res2 = (X + j)
    j += 1
if res2 > res1:
    res0 = res1
elif res1 > res2:
    res0 = res2
elif res2 == res1:
    res0 = res1
print(res0)

Buggy submission (verdict: Runtime Error):
import sys

X,N = map(int,input().split())
P = list(map(int,input().split()))
if X < 1 or 100 < X:
    sys.exit()
if N < 0 or 100 < N:
    sys.exit()
if N == 0:
    print(X)
    sys.exit()

P_number = len(P)
if P_number < 1 or 100 < P_number:
    sys.exit()

res1 = 100
res2 = 100
res0 = 0
i = 0
while i < N:
    if (X - i) not in P:
        res1 = (X - i)
    i += 1
while j < N:
    if (X + j) not in P:
        res2 = (X + j)
    j += 1
if res2 > res1:
    res0 = res1
else if res1 > res2:
    res0 = res2
else if res2 == res1:
    res0 = res1
print(res0)

Buggy submission (verdict: Runtime Error):
import sys

X,N = map(int,input().split())
P = list(map(int,input().split()))
if X < 1 or 100 < X:
    sys.exit()
if N < 0 or 100 < N:
    sys.exit()

P_number = len(P)
if P_number < 1 or 100 < P_number:
    sys.exit()

res = [100,100]
i = 0
while i < N:
    if res[0] >= abs(X - P[i]) and res[1] > P[i]:
        res[0] = abs(X - P[i])
        res[1] = P[i]
    i += 1
print(res[1])

Buggy submission (verdict: Runtime Error):
X = list(map(int, input().split()))
if X[0] > 100 or X[1] > 100:
  no_print
if X[1] > X[0]*4 or X[1] < X[0]*2:
  no_print
if X[1] % 2 == 1:
  no_print
 
number_check
  
def no_print():
  print(No)
  exit
 
def number_check():
  turtle = X[0]
  crane = 0
  i = 0
  while i < X[0]:
    result = turtle * 4 + crane * 2 
    if result > X[1]:
      crane += 1
      turtle -= 1
    if result == X[1]:
      print(Yes)
      exit
    if result < X[1]:
      turtle += 1
      crane -= 1
    i += 1

Buggy submission (verdict: Runtime Error):
X = list(map(int, input().split()))
count = 0
for I in X:
  if I == 0:
    print(count):
    exit
  count++

Buggy submission (verdict: Runtime Error):
1,2,3,4,5 = input()
count = 0
for I in input():
  if I == 0:
    print(count)
  count++