Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
S=sorted(set(input()))
ans=None
for i in range(97,97+26):
  if chr(i)!=S[i-97]:
    ans=chr(i)
    break
print(ans)


Fixed submission:
import sys
s = sorted(input())
a = ord('a')
for j in range(26):
    b = a
    for i in s:
        if a == ord(i):
            a += 1
            break
    if a == b:
        print(chr(a))
        sys.exit()
print('None')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))
B = []
for a in A:
    B.append(a)
    B = B[::-1]
print(*B,sep=" ")


Fixed submission:
n = int(input())
A = list(map(int,input().split()))
answer = A[1::2][::-1]+A[::2]
if n%2==1:
    answer=answer[::-1]
print(*answer)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n=int(input())
S=np.array(sorted([int(input()) for i in range(n)]))
for i in range(n-1):
    S=np.append(S,S[i+1:]+S[:n-i-1])
ans=0
for i in range(len(S)):
    if S[i]%10!=0:
        ans=max(ans,S[i])
print(ans)

Fixed submission:
n=int(input())
S=sorted([int(input()) for i in range(n)])
ans=sum(S)
if ans%10==0:
    for i in range(n):
        if (ans-S[i])%10!=0:
            ans-=S[i]
            break
print(ans if ans%10!=0 else 0)
Buggy python submission (verdict: Runtime Error):

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

A = [[input()] for i in range(n)]
B = [[input()] for i in range(m)]
ans = 0
for i in range(n-m+1):
    for j in range(n-m+1):
        temp=0
        for k in range(m):
            for l in range(m):
                if B[k][l]==A[i+k][j+l]:
                    temp+=1
                    ans = max(ans,temp)
                                    
print('Yes' if ans==m*m else 'No')

Fixed submission:
import sys

n,m = map(int,input().split())
A = [list(input()) for i in range(n)]
B = [list(input()) for i in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            if k == 0:
                C = [A[i][j:m+j]]
            else:
                C += [A[i+k][j:m+j]]
        if B == C:
            print('Yes')
            sys.exit()
print('No')

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

A = [[input()] for i in range(n)]
B = [[input()] for i in range(m)]
ans = 0
for i in range(n-m):
    for j in range(n-m):
        temp=0
        for k in range(m):
            for l in range(m):
                if B[k][l]==A[i+k][j+l]:
                    temp+=1
                    ans = max(ans,temp)
                                    
print('Yes' if ans==m*m else 'No')

Fixed submission:
import sys

n,m = map(int,input().split())
A = [list(input()) for i in range(n)]
B = [list(input()) for i in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            if k == 0:
                C = [A[i][j:m+j]]
            else:
                C += [A[i+k][j:m+j]]
        if B == C:
            print('Yes')
            sys.exit()
print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
k,s = map(int,input().split())
sum = [i+j+l for i in range(k+1) for j in range(k+1) for l in range(k+1)]
print(sum.count(s))


Fixed submission:
import numpy as np
import sys
k,s = map(int,input().split())
sum = 0
for i in range(k+1):
    for j in range(k+1):
        if i + j <= s and i + j + k >= s:
            sum += 1
print(sum)
Buggy python submission (verdict: Runtime Error):
A,B,C = (input() for i in range(3))
count_A=1
count_B=0
count_C=0
arr = A[0]
for i in range(len(A)+len(B)+len(C)):
    if arr=='a':
        count_A+=1
    elif arr=='b':
        count_B+=1
    else:
        count_C+=1
    if count_A==len(A):
        print('A')
        break
    elif count_B==len(B):
        print('B')
        break
    elif count_C==len(C):
        print('C')
        break
    arr = A[count_A] if arr=='a' else B[count_B] if arr=='b' else C[count_C]

Fixed submission:
a = input()
b = input()
c = input()
win = 'a'
while len(a)>=0 and len(b)>=0 and len(c)>=0:
    if win == 'a':
        if len(a)==0:
            break
        win = a[0]
        a = a[1:]
    elif win == 'b':
        if len(b)==0:
            break
        win = b[0]
        b = b[1:]
    else:
        if len(c)==0:
            break
        win = c[0]
        c = c[1:]
print('A' if win == 'a' else 'B' if win == 'b' else 'C')

Buggy python submission (verdict: Runtime Error):
A,B,C = (input() for i in range(3))
count_A=1
count_B=0
count_C=0
arr = A[0]
for i in range(len(A)+len(B)+len(C)):
    arr = A[count_A] if arr=='a' else B[count_B] if arr=='b' else C[count_C]
    if arr=='a':
        count_A+=1
    elif arr=='b':
        count_B+=1
    else:
        count_C+=1
    if count_A==len(A):
        print('A')
        break
    elif count_B==len(B):
        print('B')
        break
    elif count_C==len(C):
        print('C')
        break
    else:
        continue

Fixed submission:
a = input()
b = input()
c = input()
win = 'a'
while len(a)>=0 and len(b)>=0 and len(c)>=0:
    if win == 'a':
        if len(a)==0:
            break
        win = a[0]
        a = a[1:]
    elif win == 'b':
        if len(b)==0:
            break
        win = b[0]
        b = b[1:]
    else:
        if len(c)==0:
            break
        win = c[0]
        c = c[1:]
print('A' if win == 'a' else 'B' if win == 'b' else 'C')

Buggy python submission (verdict: Runtime Error):
A,B,C = (input() for i in range(3))
count_A=1
count_B=0
count_C=0
arr = A[0]
for i in range(len(A)+len(B)+len(C)-1):
    arr = A[count_A] if arr=='a' else B[count_B] if arr=='b' else C[count_C]
    if arr=='a':
        count_A+=1
    elif arr=='b':
        count_B+=1
    else:
        count_C+=1
    if count_A==len(A):
        print('A')
        break
    elif count_B==len(B):
        print('B')
        break
    elif count_C==len(C):
        print('C')
        break
    else:
        continue

Fixed submission:
a = input()
b = input()
c = input()
win = 'a'
while len(a)>=0 and len(b)>=0 and len(c)>=0:
    if win == 'a':
        if len(a)==0:
            break
        win = a[0]
        a = a[1:]
    elif win == 'b':
        if len(b)==0:
            break
        win = b[0]
        b = b[1:]
    else:
        if len(c)==0:
            break
        win = c[0]
        c = c[1:]
print('A' if win == 'a' else 'B' if win == 'b' else 'C')
Buggy python submission (verdict: Runtime Error):
N, M, K = map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
time = 0
books = 0
A.append(200001)
B.append(200002)

while time <= K:
    if A[0] < B[0]:
        time += A.pop(0)
    elif B[0] < A[0]:
        time += B.pop(0)
    elif B[0] == A[0]:
        if B[1] > A[1]:
            time += A.pop(0)
        else:
            time += B.pop(0)
    books += 1
if books == 0:
    print(0)
else:
    print(books - 1)

Fixed submission:
a = int(input())
print(a+(a*a)+(a*a*a))

Buggy python submission (verdict: Runtime Error):
 a=input(int())
print(a+a**2+a**3)

Fixed submission:
a = int(input())
print(a+a**2+a**3)

Buggy python submission (verdict: Runtime Error):
int a=input()
print(a+a**2+a**3)

Fixed submission:
a = int(input())
print(a+a**2+a**3)

Buggy python submission (verdict: Runtime Error):

a = input()
print(a+a**2+a**3)

Fixed submission:
a = int(input())
print(a+a**2+a**3)

Buggy python submission (verdict: Runtime Error):

a = input()
print(a+a ** 2+a ** 3)

Fixed submission:
a = int(input())
print(a+a**2+a**3)

Buggy python submission (verdict: Runtime Error):

a = input()
print(a+a**2+a**3)

Fixed submission:
a = int(input())
print(a+a**2+a**3)

Buggy python submission (verdict: Runtime Error):
import sys
a = input()
print(a+a^2+a^3)

Fixed submission:
a = int(input())
print(a+a**2+a**3)

Buggy python submission (verdict: Runtime Error):
a=input()
ans=a+a^2+a^3
print(ans)

Fixed submission:
a = int(input())
print(a+a**2+a**3)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = []
count = 0

for i in range(n):
    tmp = input()
    if tmp not in s:
        count += 1
    s.append(tmp)

print(count)

Fixed submission:
# よりシンプルな解答

n = int(input())
s = [input() for _ in range(n)]

print(len(set(s)))

Buggy python submission (verdict: Runtime Error):
n = int(input())
count = 0

for i in range(n):
    s[i] = input()
    if s[i] in s:
        count += 1

print(count)

Fixed submission:
# よりシンプルな解答

n = int(input())
s = [input() for _ in range(n)]

print(len(set(s)))
Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())
A = list(map(int, input().split()))

ans = 1
for num in range(N):
    if 0 in A:
        ans = 0
        break
    ans *= A[num]
    if ans > math.pow(10, 18):
        ans = -1
        break

print(ans)

Fixed submission:
import math

N = int(input())
A = list(map(int, input().split()))

ans = 1
for num in range(N):
    ans *= A[num]
    if ans > math.pow(10, 18):
        ans = -1
        break

if 0 in A:
    ans = 0

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())
A = list(map(int, input().split()))

ans = 1
for num in range(N):
    ans *= A[num]
    if 0 in A:
        ans = 0
        break
    elif ans > math.pow(10, 18):
        ans = -1
        break

print(ans)

Fixed submission:
import math

N = int(input())
A = list(map(int, input().split()))

ans = 1
for num in range(N):
    ans *= A[num]
    if ans > math.pow(10, 18):
        ans = -1
        break

if 0 in A:
    ans = 0

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())
A = list(map(int, input().split()))

ans = 1
for num in range(N):
    ans *= A[num]

if ans > math.pow(10, 18):
    print(-1)
else:
    print(ans)

Fixed submission:
import math

N = int(input())
A = list(map(int, input().split()))

ans = 1
for num in range(N):
    ans *= A[num]
    if ans > math.pow(10, 18):
        ans = -1
        break

if 0 in A:
    ans = 0

print(ans)
Buggy python submission (verdict: Runtime Error):
h,w,k=map(int,input().split())
table=[]
cntr=[]
cntc=[]
for i in range(h):
  row=str(input())
  table.append(row)
  cntr.append(row.count('#'))

for i in range(w):
  b_num=0
  for j in range(h):
    if table[j][i]=="#":
      b_num+=1
  cntc.append(b_num)
total=sum(cntr)
def myfunc(r,c):
    if r==0 and c==0:
        return 0
    elif r==0:
        return cntc[c-1]
    elif c==0:
        return cntr[r-1]
    else:
        return (cntr[r-1] + cntc[c-1]) if table[r-1][c-1]!="#" else (cntr[r-1] + cntc[c-1]-1)
ans=0    
for i in range(h):
    for j in range(i+1,h,1):
        if k == total-(cntr[i]+cntr[j]):
            ans+=1
for i in range(w):
    for j in range(i+1,h,1):
        if k == total-(cntc[i]+cntc[j]):
            ans+=1
for i in range(h+1):
    for j in range(w+1):
        #print(myfunc(i,j))
        if k==(total-myfunc(i,j)):
            ans+=1
print(ans)

Fixed submission:
h,w,k=map(int,input().split())
table=[]
for i in range(h):
  row=str(input())
  table.append(row)

ans = 0
for maskR in range(1 << h):
    for maskC in range(1 << w):
        black = 0
        for i in range(h):
            for j in range(w):
                if ((maskR >> i) & 1) == 0 and ((maskC >> j) & 1) == 0 and table[i][j] == '#': 
                    black = black + 1
        if black == k: 
            ans = ans + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
A=[0]
for i in range(n):
  A.append(a[i])
B=[0]
for i in range(m):
  B.append(b[i])
ans=0
j=m
for i in range(n+1):
  while B[j]>(k-A[i]):
    j-=1
  ans=max(ans,i+j)
print(ans)

Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
A=[0]
for i in range(n):
  A.append(A[i]+a[i])
B=[0]
for i in range(m):
  B.append(B[i]+b[i])
ans=0
j=m
for i in range(n+1):
  if A[i]>k:
      break
  while B[j]>(k-A[i]):
    j-=1
  ans=max(ans,i+j)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
for _ in range(q):
  b,c=map(int,input().split())
  a=[c if x==b else x for x in a]
  print(sum(a))


Fixed submission:
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
num=defaultdict(int)
sm=0
for e in a:
    sm+=e
    num[e]+=1
q=int(input())
for _ in range(q):
  b,c=map(int,input().split())
  ans= sm+(c-b)*num[b]
  num[c]+=num[b]
  num[b]=0
  sm=ans
  print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
for _ in range(q):
  b,c=map(int,input().split())
  for idx, item in enumerate(a):
    if item == b:
        a[idx] = c
  print(sum(a))

Fixed submission:
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
num=defaultdict(int)
sm=0
for e in a:
    sm+=e
    num[e]+=1
q=int(input())
for _ in range(q):
  b,c=map(int,input().split())
  ans= sm+(c-b)*num[b]
  num[c]+=num[b]
  num[b]=0
  sm=ans
  print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = list(map(int,input().split()))

arr.sort()
res = 1
flg = True
for i in arr:
    res*=i
    if res >10**18:
        flg = False
        print('-1')
    # print(res, res >=10**18)
if(flg):print(res)


Fixed submission:
A,B = map(int,input().split())
print(A*B)
Buggy python submission (verdict: Runtime Error):
A,B,H,M=map(float,input().split())
from math import sin, cos, pi

C = abs(30*H-5.5*M)
C = C if C <= 180 : 360-C
c =sqrt(A**2+B**2-2*A*B*cos(C*pi/180))
print(C)

Fixed submission:
A,B,H,M=map(float,input().split())
from math import sin, cos, pi,sqrt

C = abs(30*H-5.5*M)
C = C if C <= 180 else 360-C
c =sqrt(A**2+B**2-2*A*B*cos(C*pi/180))
print(c)
Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())
if a+b >= k:
    print(a)
else: 
    print(a-abs(k-a-b))


Fixed submission:
S = input()
T = input()
if T[:len(T)-1] == S:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())
if k <= a+b:print(a)
else: print(a-(k-a-b))

Fixed submission:
S = input()
T = input()
if T[:len(T)-1] == S:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
hei = int(h / 2) if h % 2 == 0 else (int(h / 2) + 1)
wid = int(h / 2) if h % 2 == 0 else int((h - 1) / 2)
res = int(w / 2) * (hei + wid) if w % 2 == 0 else (int(w / 2) * (hei + wid)) + hei
print(res)


Fixed submission:
arr = "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".split(", ")
K = int(input())
print(arr[K-1])
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

for n in range(0, 10000):
  a2 = int(n * 8 / 100)
  b2 = int(n * 8 / 100)
  if a2 == a and b2 == b:
    print(n)
    exit()

Fixed submission:
a = input()

if 'A' in a and 'B' in a:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = []
for i in range(3):
  tmp = input()
  a.append(list(map(int, tmp.split())))

n = int(input())
b = []
for j in range(n):
    b.append(int(input()))

# print(a)
# print(b)

for i in range(3):
    for j in range(3):
        if a[i][j] in b:
           a[i][j] = 0
# print(a)

def check(a):
    #　たてビンゴ
    for i in range(3):
        if (a[i][0] == 0 & a[i][1] == 0 & a[i][2] == 0):
            print('Yes')
            exit()
    # 横ビンゴ
        if a[i] == [0, 0, 0]:
            print('Yes')
            exit()
    # 斜めビンゴ
    if a[0][0] == 0 & a[1][1] == 0 & a[2][2] == 0:
            print('Yes')
            exit()
    if a[0][2] == 0 & a[1][1] == 0 & a[2][0] == 0:
            print('Yes')
            exit()
    print('No')

check(a)

Fixed submission:
n = int(input())

def calc(n):
    if n % 2 != 0:
        return int(n / 2) + 1
    else:
        return int(n / 2)

print(calc(n))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = []
for i in range(3):
  tmp = input()
  a.append(list(map(int, tmp.split())))

n = int(input())
# print('n', n)
b = []
for j in range(n):
    b.append(int(input()))

# print('a', a)
# print('b', b)

def rep(a):
    for i in range(3):
        for j in range(3):
            if a[i][j] in b:
            a[i][j] = 0

def check(a):
    #　たてビンゴ
    # 斜め
    if a[0][0] == 0 & a[1][1] == 0 & a[2][2] == 0:
            print('Yes')
            exit()
    if a[0][2] == 0 & a[1][1] == 0 & a[2][0] == 0:
            print('Yes')
            exit()
    for i in range(3):
        if (a[0][i] == 0 & a[1][i] == 0 & a[2][i] == 0):
            print('Yes')
            exit()
        if a[i] == [0, 0, 0]:
            print('Yes')
            exit()
    print('No')

rep(a)
check(a)

Fixed submission:
# -*- coding: utf-8 -*-
a = []
for i in range(3):
  tmp = input()
  a.append(list(map(int, tmp.split())))

n = int(input())
# print('n', n)
b = []
for j in range(n):
    b.append(int(input()))

# print('a', a)
# print('b', b)

for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            a[i][j] = 0

def check(a):
    #　たてビンゴ
    # 斜め
    if a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0:
            print('Yes')
            exit()
    if a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0:
            print('Yes')
            exit()
    for i in range(3):
        if (a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0):
            print('Yes')
            exit()
        if a[i] == [0, 0, 0]:
            print('Yes')
            exit()
    print('No')

check(a)
Buggy python submission (verdict: Runtime Error):
n, r = input().split()

def calc(n, r):
  if n >= 10:
    return n
  else:
    return 100*(10-r)

return calc(n,r)

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

def calc(n, r):
  if n >= 10:
    return r
  else:
    return r + 100*(10-n)

print(calc(n, r))
Buggy python submission (verdict: Runtime Error):
N,X = map(int, input().split())
target = list(map(int, input().split()))

distances = [abs(i - X) for i in target]

def GCD(x,y):
    if x == 0:
        return y
    else:
        return GCD(y, x % y)
res = 0
for d in distances:
    res = GCD(res, d)
print(res)

Fixed submission:
N,X = map(int, input().split())
target = list(map(int, input().split()))

distances = [abs(i - X) for i in target]

def GCD(x,y):
    if y == 0:
        return x
    else:
        return GCD(y, x % y)
res = 0
for d in distances:
    res = GCD(res, d)
print(res)
Buggy python submission (verdict: Runtime Error):
m=int(input())
import math

N=math.factorial(m)
n= int(N**.5)
res = len(str(N))
arr = []
tmp = N
for i in range(2,n+1):
    if tmp % i == 0:
        while tmp % i == 0:
            arr.append(i)
            tmp //= i
if tmp != 1: arr.append(tmp)
arr += [1, N]
print(len(arr) % (10**9+7))

Fixed submission:
N = int(input())

primes = set()
for i in range(2,N+1):
    for p in primes:
        if i % p == 0:
            break
    else:
        primes.add(i)

len_prime = len(primes)
d = dict(zip(list(primes), [1 for i in range(len_prime)]))

for i in range(2, N+1):
    while i != 1:
        for p in primes:
            if i % p == 0:
                d[p]+= 1
                i //= p
res = 1
for i in d.values():
    res*=i
print(res % 1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]

a = sorted(a)

for i in range(q):
    flag = 0
    for j in range(len(a)):
        if a[j] == bc[i][0]:
            a[j] = bc[i][1]
            flag += 1
        elif flag > 1:
            break

        # print(a)
    
    print(sum(a))

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]

cnt = [0 for i in range(0, 10**5 + 1)]
for i in a:
    cnt[i] += 1

total = sum(a)

for j in range(q):
    b = bc[j][0]
    c = bc[j][1]
    cnt[c] += cnt[b]
    total += (c-b)*cnt[b]
    cnt[b] = 0
    print(total)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]

a = sorted(a)

for i in range(q):
    
    for j in range(len(a)):
        if a[j] == bc[i][0]:
            a[j] = bc[i][1]
        # print(a)
    
    print(sum(a))

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]

cnt = [0 for i in range(0, 10**5 + 1)]
for i in a:
    cnt[i] += 1

total = sum(a)

for j in range(q):
    b = bc[j][0]
    c = bc[j][1]
    cnt[c] += cnt[b]
    total += (c-b)*cnt[b]
    cnt[b] = 0
    print(total)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]

for i in range(q):
    # print(bc[i][0])
    # index = a.index(bc[i][0])
    index = [j for j, x in enumerate(a) if x == bc[i][0]]
    # print(index)
    for k in index:
        a[k] = bc[i][1]
    # a[index] = bc[i][1]
    print(sum(a))

Fixed submission:
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]

cnt = [0 for i in range(0, 10**5 + 1)]
for i in a:
    cnt[i] += 1

total = sum(a)

for j in range(q):
    b = bc[j][0]
    c = bc[j][1]
    cnt[c] += cnt[b]
    total += (c-b)*cnt[b]
    cnt[b] = 0
    print(total)
Buggy python submission (verdict: Runtime Error):
x,n = map(int, input().split())

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

p = list(map(int,input().split()))

allList=[]

for i in range(1,101):
    allList.append(i)
    
diff = set(allList) ^ set(p)

diff = list(diff)
diff.append(x)
diff = sorted(diff)

# print(diff)

ind = diff.index(x)
# print(ind)

# if x == 100:
    

a = diff[ind-1]
if x != 100:
    b = diff[ind+1]
else:
    print(a)
    exit()

ax = abs(a-x)
bx = abs(b-x)

# print(ax,bx)

if ax==bx:
    if a < b:
        print(a)
    else:
        print(b)

if ax > bx:
    print(b)
    exit()

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

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

p = list(map(int,input().split()))

allList=[]

for i in range(-201,301):
    allList.append(i)

diff = set(allList) ^ set(p)



diff = list(diff)
diff.append(x)
diff = sorted(diff)

# print(diff)

ind = diff.index(x)
# print(ind)

# if x == 100:
    

a = diff[ind-1]
b = diff[ind+1]
# print(a,b)

ax = abs(x-a)
bx = abs(x-b)

# print(ax,bx)

if ax==bx:
    if a < b:
        print(a)
        exit()
    else:
        print(b)
        exit()

if ax > bx:
    print(b)
else:
    print(a)

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

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

p = list(map(int,input().split()))

allList=[]

for i in range(1,101):
    allList.append(i)
    
diff = set(allList) ^ set(p)

diff = list(diff)
diff.append(x)
diff = sorted(diff)

# print(diff)

ind = diff.index(x)
# print(ind)

a = diff[ind-1]
b = diff[ind+1]

ax = abs(a-x)
bx = abs(b-x)

# print(ax,bx)

if ax==bx:
    if a < b:
        print(a)
    else:
        print(b)

if ax > bx:
    print(b)
    exit()

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

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

p = list(map(int,input().split()))

allList=[]

for i in range(-201,301):
    allList.append(i)

diff = set(allList) ^ set(p)



diff = list(diff)
diff.append(x)
diff = sorted(diff)

# print(diff)

ind = diff.index(x)
# print(ind)

# if x == 100:
    

a = diff[ind-1]
b = diff[ind+1]
# print(a,b)

ax = abs(x-a)
bx = abs(x-b)

# print(ax,bx)

if ax==bx:
    if a < b:
        print(a)
        exit()
    else:
        print(b)
        exit()

if ax > bx:
    print(b)
else:
    print(a)