Problem p02641 (python)

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

array = [[0]]*200
if n == 0:
    print(x)
else:
    for i in range(200):
        array[i] = 0
    tmp = input().split(' ')
    for i in range(n):
        array[int(tmp[i])] = 1
    
    dif_tmp = 999
    ret = 999
    for i in range(200):
        if array[199-i] == 0:
            if abs(x-(199-i)) <= dif_tmp:
                ret = 199-i
                dif_tmp = abs(x-(199-i))
    for i in range(1,100):
        if abs(x+i) <= dif_tmp:
            ret = -i
            dif_tmp = abs(x+i)
    print(ret)

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

array = [[0]]*100
if n == 0:
    print(x)
else:
    for i in range(100):
        array[i] = 0
    tmp = input().split(' ')
    for i in range(n):
        array[int(tmp[i])] += 1
    
    dif_tmp = 999
    ret = 999
    for i in range(100):
        if array[99-i] == 0:
            if abs(x-(99-i)) <= dif_tmp:
                ret = 99-i
                dif_tmp = abs(x-(99-i))
    for i in range(1,100):
        if abs(x+i) <= dif_tmp:
            ret = -i
            dif_tmp = abs(x+i)
    print(ret)

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

array = [[0]]*100

for i in range(100):
    array[i] = 0
tmp = input().split(' ')
for i in range(n):
    array[int(tmp[i])] += 1

dif_tmp = 999
ret = 999
for i in range(100):
    if array[99-i] == 0:
        if abs(x-(99-i)) <= dif_tmp:
            ret = 99-i
            dif_tmp = abs(x-(99-i))
for i in range(1,100):
    if abs(x+i) <= dif_tmp:
        ret = -i
        dif_tmp = abs(x+i)
print(ret)

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

array = [[0]]*100

for i in range(100):
    array[i] = 0
tmp = input().split(' ')
for i in range(n):
    array[int(tmp[i])] += 1
dif_tmp = 999
ret = 999
for i in range(100):
    if array[99-i] == 0:
        if abs(x-(99-i)) <= dif_tmp:
            ret = 99-i
            dif_tmp = abs(x-(99-i))
for i in range(100):
    if abs(x+i) <= dif_tmp:
        ret = -i
        dif_tmp = abs(x+i)
print(ret)

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

array = [[0]]*100

for i in range(100):
    array[i] = 0
tmp = input().split(' ')
for i in range(n):
    array[int(tmp[i])] += 1
dif_tmp = 999
ret = 999
for i in range(100):
    if array[99-i] == 0:
        if abs(x-(99-i)) < dif_tmp:
            ret = 99-i
            dif_tmp = abs(x-(99-i))
for i in range(100):
    if abs(x+i) <= dif_tmp:
        ret = -i
        dif_tmp = abs(x+i)
print(ret)

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

array = [[0]]*100

for i in range(100):
    array[i] = 0
tmp = input().split(' ')
for i in range(n):
    array[int(tmp[i])] += 1
dif_tmp = 999
ret = 999
for i in range(100):
    if array[99-i] == 0:
        if abs(x-(99-i)) < dif_tmp:
            ret = 99-i
            dif_tmp = abs(x-(99-i))
for i in range(100):
    if abs(x+i) <= dif_tmp:
        ret = -i
print(ret)

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

array = [[0]]*100

for i in range(100):
    array[i] = 0
tmp = input().split(' ')
for i in range(n):
    array[int(tmp[i])] += 1
dif_tmp = 999
ret = 999
for i in range(100):
    if array[99-i] == 0:
        if abs(x-(99-i)) < dif_tmp:
            ret = 99-i
            dif_tmp = abs(x-(99-i))
for i in range(100):
    if abs(x+i) < dif_tmp:
        ret = -i
print(ret)

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

array = [[0]]*100

for i in range(100):
    array[i] = 0
tmp = input().split(' ')
for i in range(n):
    array[int(tmp[i])] += 1
dif_tmp = 999
ret = 999
for i in range(100):
    if array[99-i] == 0:
        if abs(x-(99-i)) < dif_tmp:
            ret = 99-i
            dif_tmp = abs(x-(99-i))
            
print(ret)