Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
g = [[] for i in range(n)]

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

visited = [False] * n
def dfs(i, src, depth=0):
    global ans
    if depth==3:
        if not i in g[src]:
            g[src].append(i)
            g[i].append(src)
            ans+=1
    else:
        for t in g[i]:
            if visited[t]:
                continue
            else:
                visited[t] = True
                dfs(t, src, depth+1)
                visited[t] = False
    return

ans = 0
for i in range(n):
    visited[i] = True
    dfs(i, i, 0)
    visited[i] = False
print(ans)



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

n, m = map(int, input().split())
g = [[] for i in range(n)]

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

# 2部グラフかどうかを判定する
# 色の初期化、0:未着色
colors = [0]*n
def dfs(v, color):
    """
    parm v: node
    param color: 1 or -1
    """
    colors[v] = color
    for to in g[v]:
        if colors[to] == color:
            return False
        
        if colors[to] == 0:
            if not dfs(to, -color):
                return False
    return True

def is_bipartite():
    return dfs(0, 1)

if is_bipartite():
    # すべての対抗で辺が張れる
    print(colors.count(-1)*colors.count(1) - m)
else:
    # すべての対抗の辺が張れる
    print((n*(n-1))//2 - m)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
g = [[] for i in range(n)]

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

visited = [False] * n
def dfs(i, src, depth=0):
    global ans
    if depth==3:
        if not i in g[src]:
            g[src].append(i)
            g[i].append(src)
            ans+=1
    else:
        for t in g[i]:
            if visited[t]:
                continue
            else:
                visited[t] = True
                dfs(t, src, depth+1)
                visited[t] = False
    return

ans = 0
for i in range(n):
    visited[i] = True
    dfs(i, i, 0)
    visited[i] = False
print(ans)



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

n, m = map(int, input().split())
g = [[] for i in range(n)]

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

# 2部グラフかどうかを判定する
# 色の初期化、0:未着色
colors = [0]*n
def dfs(v, color):
    """
    parm v: node
    param color: 1 or -1
    """
    colors[v] = color
    for to in g[v]:
        if colors[to] == color:
            return False
        
        if colors[to] == 0:
            if not dfs(to, -color):
                return False
    return True

def is_bipartite():
    return dfs(0, 1)

if is_bipartite():
    # すべての対抗で辺が張れる
    print(colors.count(-1)*colors.count(1) - m)
else:
    # すべての対抗の辺が張れる
    print((n*(n-1))//2 - m)
Buggy python submission (verdict: Runtime Error):
print(list(input()).count('1'))	]


Fixed submission:
print(list(input()).count('1'))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
is_neighbor = [[True] * n for i in range(n)]

f = True
for i in range(n):
    if not f: break
    for s in range(n):
        if not f: break
        for t in range(n):
            if a[s][t] > a[s][i] + a[i][t]:
                f = False
                break
            elif i == s or i == t: continue
            elif a[s][t] == a[s][i] + a[i][t]:
                is_neighbor[s][t] = False
if f:
    ans = 0
    for i in range(n):
        for j in range(n):
            if is_neighbor[i][j]:
                ans+=a[i][j]
    print(ans//2)
else:
    print(-1)

Fixed submission:
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
is_neighbor = [[True] * n for i in range(n)]

f = True
for i in range(n):
    if not f: break
    for s in range(n):
        if not f: break
        for t in range(n):
            if a[s][t] > a[s][i] + a[i][t]:
                f = False
                break
            elif i == s or i == t: continue
            elif a[s][t] == a[s][i] + a[i][t]:
                is_neighbor[s][t] = False
if f:
    ans = 0
    for i in range(n):
        for j in range(n):
            if is_neighbor[i][j]:
                ans+=a[i][j]
    print(ans//2)
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
n, m, r = map(int, input().split())
goals = list(map(int, input().split()))
goals = [g-1 for g in goals]

g = [[pow(10, 16)] * n for i in range(n)]

for i in range(m):
    a, b , c = map(int,input().split())
    a-=1; b-=1
    g[a][b] = c
    g[b][a] = c

for i in range(n):
    for s in range(n):
        for t in range(n):
            g[s][t] = min(g[s][t], g[s][i] + g[i][t])

ans = float('inf')
for p in permutations(goals):
    cost = 0
    for s,t in zip(p[:-1], p[1:]):
        cost += g[s][t]
    ans = min(ans, cost)
print(ans)


Fixed submission:
from itertools import permutations
n, m, r = map(int, input().split())
goals = list(map(int, input().split()))
goals = [g-1 for g in goals]

g = [[pow(10, 16)] * n for i in range(n)]

for i in range(m):
    a, b , c = map(int,input().split())
    a-=1; b-=1
    g[a][b] = c
    g[b][a] = c

for i in range(n):
    for s in range(n):
        for t in range(n):
            g[s][t] = min(g[s][t], g[s][i] + g[i][t])

ans = float('inf')
for p in permutations(goals):
    cost = 0
    for s,t in zip(p[:-1], p[1:]):
        cost += g[s][t]
    ans = min(ans, cost)
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
g = [[] for i in range(n)]
for i in range(n-1):
    a, b, c = map(int, input().split())
    a-=1; b-=1
    g[a].append((b, c))
    g[b].append((a, c))
q, k = map(int, input().split())

# 前処理
dist = [-1] * n

def dfs(st, depth=0):
    dist[st] = depth
    for to, c in g[st]:
        if dist[to] >= 0: continue
        dfs(to, depth+c)

dfs(k-1, 0)

for i in range(q):
    x, y = map(int, input().split())
    x-=1; y-=1
    print(dist[x]+dist[y])



Fixed submission:
from collections import deque
import sys
sys.setrecursionlimit(10**7)
n = int(input())
g = [[] for i in range(n)]
for i in range(n-1):
    a, b, c = map(int, input().split())
    a-=1; b-=1
    g[a].append((b, c))
    g[b].append((a, c))
q, k = map(int, input().split())

# 前処理
dist = [-1] * n

def dfs(st, depth=0):
    dist[st] = depth
    for to, c in g[st]:
        if dist[to] >= 0: continue
        dfs(to, depth+c)

dfs(k-1, 0)

for i in range(q):
    x, y = map(int, input().split())
    x-=1; y-=1
    print(dist[x]+dist[y])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**8)
n, m = map(int, input().split())
g = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a-=1; b-=1
    g[a].append(b)
    g[b].append(a)

dist = [float('inf')] * n
def dfs(s, p, depth):
    dist[s] = min(dist[s], depth)
    for to in g[s]:
        if to==p: continue
        if dist[to] < dist[s]+1: continue
        dfs(to, s, depth+1)

dfs(0, -1, 0)

if dist[n-1] <= 2:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
n, m = map(int, input().split())
g = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a-=1; b-=1
    g[a].append(b)
    g[b].append(a)

dist = [float('inf')] * n
def dfs(s, p, depth):
    if depth>2: return
    dist[s] = min(dist[s], depth)
    for to in g[s]:
        if to==p: continue
        if dist[to] < dist[s]+1: continue
        dfs(to, s, depth+1)

dfs(0, -1, 0)

if dist[n-1] <= 2:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = list(map(int, input().split()))

l.sort(reversed=True)
print(sum(l[:k]))

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

l.sort(reverse=True)
print(sum(l[:k]))
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c = map(int, input().split())
i = 0
while a%2==0 or b%2==0 or c%2==0 or i<10**2:
    at = a//2
    bt = b//2
    ct = c//2
    a = bt + ct
    b = at + ct
    c = at + bt
    i+=1
if i > 10**2:
    print(-1)
else:
    print(i)

Fixed submission:
a, b, c = map(int, input().split())
i = 0
f = True
while a%2==0 and b%2==0 and c%2==0:
    at = a//2
    bt = b//2
    ct = c//2
    a = bt + ct
    b = at + ct
    c = at + bt
    i+=1
    if a == b == c:
        print(-1)
        f = False
        break
if f:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, c = map(int, input().split())
i = 0
while a%2==0 or b%2==0 or c%2==0 or i<10*3:
    at = a//2
    bt = b//2
    ct = c//2
    a = bt + ct
    b = at + ct
    c = at + bt
    i+=1
if i > 10**3:
    print(-1)
else:
    print(i)

Fixed submission:
a, b, c = map(int, input().split())
i = 0
f = True
while a%2==0 and b%2==0 and c%2==0:
    at = a//2
    bt = b//2
    ct = c//2
    a = bt + ct
    b = at + ct
    c = at + bt
    i+=1
    if a == b == c:
        print(-1)
        f = False
        break
if f:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from itertools import product

n = int(input())

def prime_factrize(a):
    ret = []
    while a%2 == 0:
        ret.append(2)
        a//=2
    f = 3
    while f * f <= a:
        if a % f == 0:
            ret.append(f)
            a//=f
        else:
            f+=2
    if a != 1:
        ret.append(a)
    return ret

f = prime_factrize(n)

def func(a, b):
    a = len(str(a))
    b = len(str(b))
    return max(a, b)

ans = float('inf')
for bit in product([0, 1], repeat=(len(f))):
    a = 1
    b = 1
    for i, v in enumerate(bit):
        if v == 0: a*=f[i]
        else: b*=f[i]
    ans = min(ans, func(a, b))
print(ans)
            




Fixed submission:
n = int(input())

def func(a, b):
    a = len(str(a))
    b = len(str(b))
    return max(a, b)

ans = float('inf')
for i in range(1, int(n**0.5)+1):
    if n%i==0: ans = min(ans, func(i, n//i))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, ma, mb = map(int, input().split())
items = []
for i in range(n):
    item = list(map(int, input().split()))
    items.append(item)

# dp[iまでの薬品を使用して][aの重量][bの重量]を達成する最小の予算
dp = [[[float('inf')]*401 for j in range(401)] for i in range(41)]
dp[0][0][0] = 0

for i in range(n):
    a, b, c = items[i]
    for anow in range(400):
        for bnow in range(400):
            # 使わない
            dp[i+1][anow][bnow] = min(dp[i+1][anow][bnow], dp[i][anow][bnow])
            # 使う
            if 0<=anow+a<401 and 0<=bnow+b<401:
                dp[i+1][anow+a][bnow+b] = min(dp[i+1][anow+a][bnow+b], dp[i][anow][bnow]+c)
                

ans = float('inf')
for a in range(1, 401):
    for b in range(1, 401):
        if ma*b==mb*a:
            ans = min(ans, dp[n][a][b])
if ans == float('inf'):
    print(-1)
else:
    print(ans)

Fixed submission:
n, ma, mb = map(int, input().split())
items = []
for i in range(n):
    item = list(map(int, input().split()))
    items.append(item)

# dp[iまでの薬品を使用して][aの重量][bの重量]を達成する最小の予算
dp = [[[float('inf')]*401 for j in range(401)] for i in range(41)]
dp[0][0][0] = 0

for i in range(n):
    a, b, c = items[i]
    for anow in range(400):
        for bnow in range(400):
            # 使わない
            dp[i+1][anow][bnow] = min(dp[i+1][anow][bnow], dp[i][anow][bnow])
            # 使う
            if 0<=anow+a<401 and 0<=bnow+b<401:
                dp[i+1][anow+a][bnow+b] = min(dp[i+1][anow+a][bnow+b], dp[i][anow][bnow]+c)
                

ans = float('inf')
for a in range(1, 401):
    for b in range(1, 401):
        if ma*b==mb*a:
            ans = min(ans, dp[n][a][b])
if ans == float('inf'):
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
pritn(input().replace(',', ' '))

Fixed submission:
print(input().replace(',', ' '))
Buggy python submission (verdict: Time Limit Exceeded):
import sys 
sys.setrecursionlimit(10**6)
s = input()
def dfs(t):
    if t==s:
        return True
    if t!=s[:len(t)]:
        return False
    for i in ['dream', 'dreamer','erase', 'eraser']:
            if dfs(t+i):
                return True
    else:
        return False
if dfs(''):
    print('YES')
else:
    print('NO')

Fixed submission:
import sys 
sys.setrecursionlimit(10**6)
s = input()
def dfs(s):
    while True:
        f = True
        for i in ['erase', 'eraser', 'dream', 'dreamer']:
            if s[-len(i):]==i:
                s = s[:-len(i)]
                if s=='':
                    return True
                f = False
        if f: return False
    
if dfs(s):
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
import sys 
sys.setrecursionlimit(10**6)
s = input()
def dfs(t):
    if t==s:
        return True
    if len(t)>=len(s):
        return False
    if s[len(t)] == 'd':
        for i in ['dream', 'dreamer']:
            if dfs(t+i):
                return True
    elif s[len(t)]:
        for i in ['erase', 'eraser']:
            if dfs(t+i):
                return True
    else:
        return False
if dfs(''):
    print('YES')
else:
    print('NO')

Fixed submission:
import sys 
sys.setrecursionlimit(10**6)
s = input()
def dfs(s):
    while True:
        f = True
        for i in ['erase', 'eraser', 'dream', 'dreamer']:
            if s[-len(i):]==i:
                s = s[:-len(i)]
                if s=='':
                    return True
                f = False
        if f: return False
    
if dfs(s):
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
import sys 
sys.setrecursionlimit(10**6)
s = input()
def dfs(t):
    if t==s:
        return True
    if len(t)>=len(s):
        return False
    for i in ['dream', 'dreamer', 'erase', 'eraser']:
        if dfs(t+i):
            return True
    return False
if dfs(''):
    print('YES')
else:
    print('NO')

Fixed submission:
import sys 
sys.setrecursionlimit(10**6)
s = input()
def dfs(s):
    while True:
        f = True
        for i in ['erase', 'eraser', 'dream', 'dreamer']:
            if s[-len(i):]==i:
                s = s[:-len(i)]
                if s=='':
                    return True
                f = False
        if f: return False
    
if dfs(s):
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
s = input()
def dfs(t):
    if t==s:
        return True
    if len(t)>=len(s):
        return False
    for i in ['dream', 'dreamer', 'erase', 'eraser']:
        if dfs(t+i):
            return True
    return False
if dfs(''):
    print('YES')
else:
    print('NO')

Fixed submission:
import sys 
sys.setrecursionlimit(10**6)
s = input()
def dfs(s):
    while True:
        f = True
        for i in ['erase', 'eraser', 'dream', 'dreamer']:
            if s[-len(i):]==i:
                s = s[:-len(i)]
                if s=='':
                    return True
                f = False
        if f: return False
    
if dfs(s):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n, a = map(int, input().split())
x = list(map(int, input().split()))

# dp[i][j][k]：　i枚目までのカードをj枚使用して合計kを作れる組み合わせ
dp = [[[0] * (3001) for j in range(n+1)] for i in range(n+1)]
dp[0][0][0] = 1

for i in range(n):
    _x = x[i]
    for j in range(n):
        for k in range(2501):
            dp[i+1][j+1][k+_x] += dp[i][j][k]
            dp[i+1][j][k] += dp[i][j][k]

ans = 0
for j in range(1, n+1):
    ans += dp[n][j][j*a]
print(ans)

Fixed submission:
import numpy as np
n, a = map(int, input().split())
x = list(map(int, input().split()))

# dp[i][j][k]：　i枚目までのカードをj枚使用して合計kを作れる組み合わせ
dp = np.zeros((n+1, n+1, 3001)).astype(np.int64)
dp[0][0][0] = 1

for i in range(n):
    _x = x[i]
    for j in range(n):
        dp[i+1, j+1, _x:] += dp[i, j, :-_x]
        dp[i+1, j, :] += dp[i, j, :]

ans = 0
for j in range(1, n+1):
    ans += dp[n, j, j*a]
print(ans)
Buggy python submission (verdict: Runtime Error):
from sympy import divisor_count
n = int(input)
count = 0
for c in range(1, n):
    count += divisor_count(c)
print(count)


Fixed submission:
n = int(input()) - 1
lst = [n // k for k in range(1, int(n**0.5+1))]
print(2 * sum(lst) - int(n**0.5)**2)

Buggy python submission (verdict: Runtime Error):
n = int(input)
count = 0
for c in range(1, n):
    count += divisor_count(c)
print(count)


Fixed submission:
n = int(input()) - 1
lst = [n // k for k in range(1, int(n**0.5+1))]
print(2 * sum(lst) - int(n**0.5)**2)
Buggy python submission (verdict: Runtime Error):
def manhattan(n, x, y):
    x2 = [0] * n
    y2 = [0] * n
    for i in range(n):
        x0, y0 = xy[i]
        x2[i] = x0 - y0
        y2[i] = x0 + y0
    print(max(max(x2) - min(x2), max(y2) - min(y2)))

n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i] , y[i] = map(int, input().split())
manhattan(n, x, y)


Fixed submission:
def manhattan(n, x, y):
    x2 = [0] * n
    y2 = [0] * n
    for i in range(n):
        x2[i] = x[i] - y[i]
        y2[i] = x[i] + y[i]
    print(max(max(x2) - min(x2), max(y2) - min(y2)))

n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i] , y[i] = map(int, input().split())
manhattan(n, x, y)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n = int(input())
a = list(map(int, input().split()))
suf = list(itertools.combinations(range(n), 2))
total = 0
mod = 10**9 + 7
for i, j in suf:
    # print(i, j)
    total = (total + (a[i] * a[j]) % mod) % mod
print(total)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0] * n
b[-1]= a[-1]
total = 0
mod = 10**9 + 7
for i in range(n-2, 0, -1):
    b[i] = a[i] + b[i + 1]
for i in range(n-1):
    total = (total + (a[i] * b[i + 1]) % mod) % mod
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
# ABC177E

def GCD(m, n):
    while n != 0:
        m, n = n, m % n
    return m

def f(a):
    n = len(a)
    pairwise_coprime = True
    for i in range(n - 1):
        for j in range(i + 1, n):
            if GCD(a[i], a[j]) != 1:
                pairwise_coprime = False
                break
        if pairwise_coprime == False:
            break
    gcd = a[0]
    for i in range(1, n):
        gcd = GCD(gcd, a[i])
    if pairwise_coprime == False and gcd == 1:
        return 'setwise coprime'
    elif pairwise_coprime:
        return 'pairwise coprime'
    else:
        return 'not coprime'

n = int(input())
a = list(map(int, input().split()))
print(f(a))


Fixed submission:
def GCD(m, n):
    while n != 0:
        m, n = n, m % n
    return m

def gcd_all(a):
    n = len(a)
    gcd = a[0]
    for i in range(1, n):
        gcd = GCD(gcd, a[i])
    return gcd

def f(a):
    mx = 10**6
    p = set([])
    sieve = [i for i in range(mx + 1)]
    for i in range(2, int(mx**0.5 + 1)):
        for j in range(2 * i, mx + 1, i):
            if sieve[j] > i:
                sieve[j] = i
    pairwise_coprime = True
    for i in a:
        p2 = set([])
        while i > 1:
            p2.add(sieve[i])
            i //= sieve[i]
        for j in p2:
            if j in p:
                pairwise_coprime = False
                break
            p.add(j)
        if pairwise_coprime == False:
            break
    gcd = gcd_all(a)
    if pairwise_coprime == False and gcd == 1:
        return 'setwise coprime'
    elif pairwise_coprime:
        return 'pairwise coprime'
    else:
        return 'not coprime'

n = int(input())
a = list(map(int, input().split()))
print(f(a))
Buggy python submission (verdict: Runtime Error):
n, x, t = map(int, input().split()))

print(-(-n // x) * t) 


Fixed submission:
# ABC176A

n, x, t = map(int, input().split())

print(-(-n // x) * t)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

mx = max(a)
table = [0] * (mx + 1)
for i in a:
    table[i] += 1

q = int(input())
total = sum(a)
for i in range(q):
    b, c, = map(int, input().split())
    total -= table[c] * c + table[b] * b
    table[c] += table[b]
    table[b] = 0
    total += table[c] * c
    print(total)


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

mx = 10**5
table = [0] * (mx + 1)
for i in a:
    table[i] += 1

q = int(input())
total = sum(a)
for i in range(q):
    b, c, = map(int, input().split())
    total -= table[c] * c + table[b] * b
    table[c] += table[b]
    table[b] = 0
    total += table[c] * c
    print(total)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
for i in range(q):
    b, c, = map(int, input().split())
    while b in a:
        ind = a.index(b)
        a[ind] = c
    print(sum(a))

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

mx = 10**5
table = [0] * (mx + 1)
for i in a:
    table[i] += 1

q = int(input())
total = sum(a)
for i in range(q):
    b, c, = map(int, input().split())
    total -= table[c] * c + table[b] * b
    table[c] += table[b]
    table[b] = 0
    total += table[c] * c
    print(total)
Buggy python submission (verdict: Runtime Error):
# ABC169A

x = map(int, input().split())
print(x.index(0)+1)


Fixed submission:
# ABC169A

x = list(map(int, input().split()))
print(x.index(0)+1)
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())

if n == 0:
    p = set([])
else:
    p = list(map(int, input().split()))
p = list(map(int, str.split()))
a = list(set(range(201)) - set(p))
abs_diff = [abs(i - x) for i in a]
min_abs_diff = min(abs_diff)
for i, j in zip(a, abs_diff):
    if j == min_abs_diff:
        print(i)
        break


Fixed submission:
# ABC170C

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

if n == 0:
    p = set([])
else:
    p = list(map(int, input().split()))
a = list(set(range(201)) - set(p))
abs_diff = [abs(i - x) for i in a]
min_abs_diff = min(abs_diff)
for i, j in zip(a, abs_diff):
    if j == min_abs_diff:
        print(i)
        break

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

if n == 0:
    print(100)
else:
    p = list(map(int, input().split()))
    a = list(set(range(1, 101)) - set(p))
    abs_diff = [abs(i - x) for i in a]
    min_abs_diff = min(abs_diff)
    for i, j in zip(a, abs_diff):
        if j == min_abs_diff:
            print(i)
            break


Fixed submission:
# ABC170C

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

if n == 0:
    p = set([])
else:
    p = list(map(int, input().split()))
a = list(set(range(201)) - set(p))
abs_diff = [abs(i - x) for i in a]
min_abs_diff = min(abs_diff)
for i, j in zip(a, abs_diff):
    if j == min_abs_diff:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
    print(x)
else:
    p = list(map(int, input().split()))
    a = set(range(1, 200))
    b = list(a - set(p))
    c = [abs(i - x) for i in b]
    import numpy as np
    pos = np.argmin(c)
    print(min([b[y] for y in c if y == pos]))


Fixed submission:
# ABC170C

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

if n == 0:
    p = set([])
else:
    p = list(map(int, input().split()))
a = list(set(range(201)) - set(p))
abs_diff = [abs(i - x) for i in a]
min_abs_diff = min(abs_diff)
for i, j in zip(a, abs_diff):
    if j == min_abs_diff:
        print(i)
        break