problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p02641
u665852386
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = map(int, input().split())\nif n == 0:\n print(x)\nelse:\n p = list(map(int, input().split()))\n\n p.sort()\n y = 0\n\n for i in range(n):\n if p[i] <= x:\n y = i\n if i != n-1 and x < p[i+1]:\n break \n\n i = 0\n while 1 == 1:\n if x - i != p[y - i]:\n print(x - i)\n break\n if x + i != p[y + i]:\n print(x + i)\n break\n i =+ 1', 'x, n = map(int, input().split())\nif n == 0:\n print(x)\nelse:\n p = list(map(int, input().split()))\n\n p.sort()\n y = 0\n\n for i in range(n):\n if p[i] <= x:\n y = i\n if i != n-1 and x < p[i+1]:\n break \n\n i = 0\n while 1 == 1:\n if y - i < 0:\n print(p[0] - 1)\n break\n elif x - i != p[y - i]:\n print(x - i)\n break\n if n <= y + i:\n print(p[n - 1] + 1)\n break\n elif x + i != p[y + i]:\n print(x + i)\n break\n i = i + 1']
['Runtime Error', 'Accepted']
['s536279846', 's414682528']
[9080.0, 9232.0]
[2205.0, 25.0]
[443, 591]
p02641
u665873062
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['(X,N) = map(int,input().split())\np = list(map(int,input().split()))\nif N == 0:\n print(X)\nelse:\n for i in range N:\n if (X - i) not in p:\n print(X-i)\n break\n elif(X+i) not in p:\n print(X+i)\n break\n', '(X,N) = map(int,input().split())\nif N == 0:\n print(X)\nelse:\n p = list(map(int,input().split()))\n for i in range(N+1):\n if (X - i) not in p:\n print(X-i)\n break\n elif(X+i) not in p:\n print(X+i)\n break']
['Runtime Error', 'Accepted']
['s748196012', 's363434384']
[8968.0, 9180.0]
[24.0, 32.0]
[259, 265]
p02641
u666960126
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n = map(int, input().split())\na = []\nfor i in range(n):\n a.append(input())\nc = -1\nb = 0\nd = 101\ne = 0\nfor w in range(103):\n if c not in a:\n b = abs(x - c)\n if b < d:\n d = b\n e = c\n c += 1\n else:\n c += 1\n else:\n c += 1\nprint(e)', 'x,n = map(int, input().split())\na = []\nfor i in range(n):\n a.append(input())\nc = -1\nb = 0\nd = 101\ne = 0\nfor w in range(103):\n if c not in a:\n\tb = abs(x - c)\n if b < d:\n d = b\n e = c\n c += 1\n else:\n c += 1\n else:\n c += 1\nprint(e)', 'x,n = map(int, input().split())\na = list(map(int,input().split()))\nc = -1\nb = 0\nd = 101\ne = 0\nfor w in range(103):\n if c not in a:\n b = abs(x - c)\n if b < d:\n d = b\n e = c\n c += 1\n else:\n c += 1\n else:\n c += 1\nprint(e)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s164335948', 's437261179', 's071261230']
[9192.0, 9032.0, 9128.0]
[22.0, 20.0, 22.0]
[265, 262, 252]
p02641
u667024514
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n = map(int,input().split())\nif n == 0:\n print(x)\n exit()\nlis = list(map(int,input().split()))\nans = 100000000000\nfor i in range(0,102):\n if i not in lis:\n ans = min(ans,abs(i-n))\nprint(ans)', 'x,n = map(int,input().split())\nif n == 0:\n print(x)\n exit()\nlis = list(map(int,input().split()))\nans = 100000000000\nnum = 0\nfor i in range(102):\n if i not in lis:\n if ans > abs(i-x):\n ans = abs(i-x)\n num = i\nprint(num)\n']
['Wrong Answer', 'Accepted']
['s701271819', 's601112431']
[9188.0, 9184.0]
[23.0, 22.0]
[198, 253]
p02641
u671211357
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import bisect\nX,N=map(int,input().split())\nP=list(map(int,input().split()))\nhako=set(P)\nkari=[]\nif X<P[0]:\n print(X)\n exit()\nif X>P[-1]:\n print(X)\n exit()\nfor i in range(102):\n if i not in hako:\n kari.append(i)\n#print(kari)\nkari.sort()\ntekitpu=kari[bisect.bisect_left(kari,X)]\naho=kari[bisect.bisect_left(kari,X)-1]\n#print(tekitpu,aho)\nif abs(tekitpu-X)<abs(X-aho):\n print(tekitpu)\nelse:\n print(aho)\n', 'import bisect\nX,N=map(int,input().split())\nP=list(map(int,input().split()))\nP=set(P)\nA=[]\nfor i in range(102):\n if i not in P:\n A.append(i)\nzahyo=bisect.bisect_left(A,X)\nans=[]\nans.append([abs(X-A[zahyo]),A[zahyo]])\nans.append([abs(X-A[zahyo-1]),A[zahyo-1]])\nans.sort()\nprint(ans[0][1])']
['Runtime Error', 'Accepted']
['s993794727', 's278287815']
[9100.0, 9176.0]
[31.0, 27.0]
[428, 296]
p02641
u671239754
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import copy\nimport sys\nx,n = map(int, input().split())\nnums = list(map(int, input().split()))\nnums.sort()\nif len(nums) == 0:\n print(x)\n sys.exit()\nindex = nums.index(x)\nind = copy.deepcopy(index)\nans = 0\nwhile True:\n if ind < 0:\n break\n if nums[ind] != x and nums[ind+1] - nums[ind] > 2:\n ans = nums[ind+1] - 1\n break\n ind -= 1\nind = copy.deepcopy(index)\nwhile True:\n if ind > n-1:\n break\n if nums[ind] != x and nums[ind] - nums[ind-1] > 2:\n if abs(ans - x) > abs(nums[ind-1] + 1 - x):\n ans = nums[ind-1] + 1\n break\n ind += 1\nif index == 0:\n ans = x - 1\nif index == n-1:\n if ans != x - 1\n ans = x + 1\nprint(ans)\n', 'X, N = map(int, input().split())\nP = list(map(int, input().split()))\nQ = [q for q in range(-1, 102) if q not in P]\nans = min(Q, key=lambda q: (abs(q - X), q))\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s875412066', 's472250570']
[8964.0, 9080.0]
[24.0, 31.0]
[704, 170]
p02641
u672316981
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
["def main():\n x, n = map(int, input().split())\n p_lst = list(map(int, input().split()))\n\n if n == 0:\n minimum = x\n else:\n if x in p_lst:\n minimum = x\n\n else:\n lst = []\n flag = False\n\n while True:\n x1 = x\n x2 = x\n x1 += 1\n x2 -= 1\n\n if x1 not in p_lst:\n lst.append(x1)\n flag = True\n if x2 not in p_lst:\n lst.append(x2)\n flag = True\n\n if flag:\n break\n\n minimum = min(lst)\n\n print(minimum)\n\n\nif __name__ == '__main__':\n main()", "def main():\n x, n = map(int, input().split())\n p_lst = list(map(int, input().split()))\n\n if n == 0:\n minimum = x\n else:\n if x not in p_lst:\n minimum = x\n\n else:\n lst = []\n flag = False\n\n while True:\n x1 = x\n x2 = x\n x1 += 1\n x2 -= 1\n\n if x1 not in p_lst:\n lst.append(x1)\n flag = True\n if x2 not in p_lst:\n lst.append(x2)\n flag = True\n\n if flag:\n break\n\n minimum = min(lst)\n\n print(minimum)\n\n\nif __name__ == '__main__':\n main()", "def main():\n x, n = map(int, input().split())\n p_lst = list(map(int, input().split()))\n\n if n == 0:\n minimum = x\n else:\n if x not in p_lst:\n minimum = x\n\n else:\n lst = []\n flag = False\n x1 = x\n x2 = x\n\n while True:\n x1 += 1\n x2 -= 1\n\n if x1 not in p_lst:\n lst.append(x1)\n flag = True\n if x2 not in p_lst:\n lst.append(x2)\n flag = True\n\n if flag:\n break\n\n minimum = min(lst)\n\n print(minimum)\n\n\nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Time Limit Exceeded', 'Accepted']
['s647493189', 's673351378', 's591137615']
[9192.0, 9012.0, 9108.0]
[2205.0, 2206.0, 30.0]
[716, 720, 712]
p02641
u674347990
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
["targ, length = map(int, input().split(' '))\n\nbanned = [False] * 100\n\nbans = input()\nif bans != '':\n for ban in bans.split(' '):\n banned[int(ban) - 1] = True\n\nfor dist in range(100):\n if banned[targ - dist - 1]:\n print(targ - dist)\n exit()\n elif banned[targ + dist - 1]:\n print(targ + dist)\n exit()\n", "targ, length = map(int, input().split(' '))\n\nbanned = [False] * 100\n\nbans = input()\nif bans != '':\n for ban in bans.split(' '):\n banned[int(ban) - 1] = True\n\nfor dist in range(100):\n if targ - dist > 0:\n if not banned[targ - dist - 1]:\n print(targ - dist)\n exit()\n else:\n print(targ - dist)\n exit()\n if targ + dist <= 100:\n if not banned[targ + dist - 1]:\n print(targ + dist)\n exit()\n else:\n print(targ + dist)\n exit()"]
['Runtime Error', 'Accepted']
['s594778365', 's351816366']
[9184.0, 9208.0]
[24.0, 20.0]
[342, 526]
p02641
u674588203
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, N = map(int,input().split())\nif N == 0:\n print(X)\n exit()\n\np = list(map(int,input().split()))\nif p.count(X) == 0:\n print(X)\n exit()\n\n\nl = list(range(0,102)) \nflist = []\nfor i in range(len(l)):\n if p.count(l[i]) == 0:\n flist.append(l[i])\n\n\nflist.append(X)\nanslist = sorted(flist)\nt = anslist.index(X)\n\ndist1 = anslist[t] - anslist[t-1] \ndist2 = anslist[t+1] - anslist[t] \n if dist1 <= dist2:\n print(anslist[t-1])\n else:\n print(anslist[t+1])', 'X, N = map(int,input().split())\nif N == 0:\n print(X)\n exit()\n\np = list(map(int,input().split()))\nif p.count(X) == 0:\n print(X)\n exit()\n\n\nl = list(range(0,102)) \nflist = []\nfor i in range(len(l)):\n if p.count(l[i]) == 0:\n flist.append(l[i])\n\n\nflist.append(X)\nanslist = sorted(flist)\nt = anslist.index(X)\n\ndist1 = anslist[t] - anslist[t-1] \ndist2 = anslist[t+1] - anslist[t]) \n if dist1 <= dist2:\n print(anslist[t-1])\n else:\n print(anslist[t+1])', 'X, N = map(int,input().split())\nif N == 0:\n print(X)\n exit()\n\n\nflist = list(map(int,input().split()))\n\nif flist.count(X) == 0:\n print(X)\n exit()\n\n\nl = list(range(0,102)) \n\n\nplist = []\nfor i in range(len(l)):\n if flist.count(l[i]) == 0:\n plist.append(l[i])\n\n\nplist.append(X)\nanslist = sorted(plist)\nt = anslist.index(X)\n\ndist1 = anslist[t] - anslist[t-1] \ndist2 = anslist[t+1] - anslist[t] \nif dist1 <= dist2:\n print(anslist[t-1])\nelse:\n print(anslist[t+1])']
['Runtime Error', 'Runtime Error', 'Accepted']
['s114142883', 's955759398', 's386034954']
[9068.0, 9064.0, 9184.0]
[29.0, 25.0, 26.0]
[611, 612, 925]
p02641
u679806799
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
["def read_int():\n return int(input())\n\n\ndef read_ints():\n return map(int, input().split(' '))\n\n\nx, n = read_ints()\np = list(read_ints())\nans = -1\ndelta = 1000\nfor i in range(102):\n ok = True\n for j in p:\n if p == i:\n ok = False\n break\n if ok:\n d = abs(x - i)\n if d < delta:\n ans = i\nprint(ans)\n", "def read_int():\n return int(input())\n\n\ndef read_ints():\n return map(int, input().split(' '))\n\n\nx, n = read_ints()\np = []\nif n > 0:\n p = list(read_ints())\nans = -1\ndelta = 1000\nfor i in range(-1, 102):\n ok = True\n for j in p:\n if j == i:\n ok = False\n break\n if ok:\n d = abs(x - i)\n if d < delta:\n ans = i\n delta = d\nprint(ans)\n"]
['Runtime Error', 'Accepted']
['s015211737', 's239731122']
[9192.0, 9196.0]
[24.0, 23.0]
[362, 409]
p02641
u681409497
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n = map(int,input().split())\nif n == 0 or 0 not in absolute:\n print(x)\nelse:\n p = list(map(int,input().split()))\n absolute = list(map(lambda i:abs(i-x),p))\n ab = set(absolute)\n i = 1\n while i < 100:\n if absolute.count(i) == 2:\n i += 1\n else:\n opt = set([x-i,x+i])\n ans = opt - ab\n break\n\n print(min(ans))\n', 'x,n = map(int,input().split())\nif n == 0:\n print(x)\nelse:\n p = list(map(int,input().split()))\n absolute = list(map(lambda i:abs(i-x),p))\n if 0 not in absolute:\n print(x)\n else:\n ab = set(p)\n i = 1\n while i < 100:\n if absolute.count(i) == 2:\n i += 1\n else:\n opt = set([x-i,x+i])\n ans = opt - ab\n break\n\n print(min(ans))\n']
['Runtime Error', 'Accepted']
['s924470448', 's717072989']
[9196.0, 9076.0]
[22.0, 26.0]
[386, 451]
p02641
u682271925
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
["def main():\n x, n = map(int,input().split())\n li = list(map(int,input().split()))\n li2 = []\n ans = 0\n for i in range(102):\n check = True\n for j in li:\n if j == i:\n check = False\n if check:\n li2.append(i)\n for i in li2:\n if abs(ans - x) > abs(i - x):\n ans = i\n print(li2)\n print(ans)\n \n \nif __name__ == '__main__':\n main()", "def main():\n x, n = map(int,input().split())\n li = list(map(int,input().split()))\n li2 = []\n ans = 0\n for i in range(102):\n check = True\n for j in li:\n if j == i:\n check = False\n if check:\n li2.append(i)\n for i in li2:\n if abs(ans - x) > abs(i - x):\n ans = i\n print(ans)\n \n \nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Accepted']
['s546992415', 's471324832']
[9208.0, 9200.0]
[22.0, 22.0]
[424, 409]
p02641
u682822227
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['def serch_1(b,x):\n i=1\n an=0\n while 1:\n if b.count(x+i)==0:\n an=x+i\n break\n else:\n i=i+1\n return an\n\ndef serch_2(b,x):\n i=1\n an=0\n while 1:\n\t if b.count(x-i)==0:\n\t\t an=x-i\n\t\t break\n\t else:\n\t\t i=i+1\n return an\ndef hikaku(a,b,x):\n if abs(a-x)>=abs(b-x):\n \treturn b\n else:\n return a\nx = int(input())\nn = int(input())\na = list(map(int,input().split()))\nprint(serch_1(a,x),serch_2(a,x))\nif a.count(x)==0:\n\tprint(x)\nelse:\n\tprint(hikaku(serch_1(a,x),serch_2(a,x),x))\n\n ', 'def serch_1(b,x):\n i=1\n an=0\n while 1:\n if b.count(x+i)==0:\n an=x+i\n break\n else:\n i=i+1\n return an\n\ndef serch_2(b,x):\n i=1\n an=0\n while 1:\n\t if b.count(x-i)==0:\n\t\t an=x-i\n\t\t break\n\t else:\n\t\t i=i+1\n return an\ndef hikaku(a,b,x):\n if abs(a-x)>=abs(b-x):\n \treturn b\n else:\n return a\ns = list(map(int,input().split()))\n# n = int(input())\na = list(map(int,input().split()))\n# print(serch_1(a,x),serch_2(a,x))\nx=s[0]\nn=s[1]\nif a.count(x)==0:\n\tprint(x)\nelse:\n\tprint(hikaku(serch_1(a,x),serch_2(a,x),x))\n\n ']
['Runtime Error', 'Accepted']
['s475389023', 's378322648']
[9220.0, 9216.0]
[27.0, 33.0]
[567, 603]
p02641
u684814987
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['\nx, n = map(int, input().split())\nl = list(map(int, input().split()))\n\nif l == []:\n print(x)\n exit()\n\nfor i in range(100):\n x -= 1\n if x not in l:\n print(x)\n exit()', 'x, n = map(int, input().split())\nl = list(map(int, input().split()))\n\nif x not in l:\n print(x)\n exit()\n\nx_a = x\nfor i in range(100):\n x -= 1\n x_a += 1\n if x not in l:\n print(x)\n exit()\n if x_a not in l:\n print(x_a)\n exit()']
['Wrong Answer', 'Accepted']
['s636032632', 's592213508']
[9180.0, 9120.0]
[28.0, 29.0]
[190, 268]
p02641
u686174642
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
["# arr=input().strip().split(' ')\nx,n=[int(i) for i in input().strip().split(' ')]\narr=[int(i) for i in input().strip().split(' ')]\n\n\n# \tif x-i >0 :\n# \t\tpos.append(x-i)\n# \telse:\n\n\n\ndiff=[]\nfor i in arr:\n\tdiff.append(x-i)\ni=-1\nj=1\nwhile i in diff:\n\ti=i-1\nwhile j in diff:\n\tj=j+1\nprint(min(x+i,x+j))", "# arr=input().strip().split(' ')\ndef aa():\n x,n=[int(i) for i in input().strip().split(' ')]\n if n==0:\n print(x)\n return \n arr=[int(i) for i in input().strip().split(' ')]\n \n \n # \tif x-i >0 :\n # \t\tpos.append(x-i)\n # \telse:\n \n \n \n \n diff=[]\n for i in arr:\n\n diff.append(x-i)\n i=-1\n j=0\n while i in diff:\n i=i-1\n while j in diff:\n j=j+1\n if abs(i)<abs(j):\n print(x-i)\n else:\n print(x-j)\n # print(x+)\naa()"]
['Runtime Error', 'Accepted']
['s096609212', 's667192596']
[9100.0, 9100.0]
[25.0, 26.0]
[379, 597]
p02641
u686230543
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['n, x = map(int, input().split())\np = set(map(int, input().split()))\n\nans = 0\nfor i in range(1, 102):\n if i in p:\n continue\n if i < x:\n ans = i\n elif x - ans > i - x:\n ans = i\n break\nprint(ans)', 'n, x = map(int, input().split())\np = set(map(int, input().split()))\n\nans = 0\nfor i in range(1, 102):\n if i in p:\n continue\n if i < x:\n ans = i\n elif x - ans > i - x:\n \tans = i\n break\nprint(ans)', 'n, x = map(int, input().split())\np = set(map(int, input().split()))\n\nans = 0\nfor i in range(1, 102):\n if i in p:\n continue\n if i < x:\n ans = i\n elif x - ans > i - x\n \tans = i\n break\nprint(ans)', 'n, x = map(int, input().split())\np = set(map(int, input().split()))\n\nans = 0\ndiff = x\nfor i in range(1, 102):\n if i in p:\n continue\n tmp = abs(i - x)\n if tmp < diff:\n diff = tmp\n ans = i\nprint(ans)', 'x, n = map(int, input().split())\np = set(map(int, input().split()))\n\nans = 0\ndiff = x\nfor i in range(1, 102):\n if i in p:\n continue\n tmp = abs(i - x)\n if tmp < diff:\n diff = tmp\n ans = i\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s064408448', 's110699236', 's709738827', 's899879385', 's303151447']
[8992.0, 9024.0, 8980.0, 8940.0, 9172.0]
[28.0, 23.0, 24.0, 28.0, 30.0]
[207, 206, 205, 209, 209]
p02641
u690442716
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['10 5\n4 7 10 6 5', 'X, N = list(map(int,input().split()))\nif N !=0:\n P = list(map(int,input().split()))\n ab = 100\n for i in range(-100,200):\n if i not in P:\n if abs(X-i)<ab:\n ab = abs(X-i)\n ans = i\n print(ans)\nelse:\n print(X)']
['Runtime Error', 'Accepted']
['s884876276', 's324615915']
[9080.0, 9192.0]
[23.0, 23.0]
[15, 232]
p02641
u692453235
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['\nX, N = map(int, input().split())\nP = list(map(int, input().split()))\nP = set(P)\n\nfor i in range(100):\n\n if X-i in P:\n continue\n else:\n print(X-i)\n break\n\n if X+i in P:\n continue\n else:\n print(X+i)\n break\n', '\nX, N = map(int, input().split())\nP = list(map(int, input().split()))\nP = set(P)\n\nfor i in range(100):\n\n if X-i in P:\n pass\n else:\n print(X-i)\n break\n\n if X+i in P:\n pass\n else:\n print(X+i)\n break\n']
['Wrong Answer', 'Accepted']
['s603065596', 's152973764']
[9112.0, 9168.0]
[23.0, 24.0]
[227, 219]
p02641
u694233896
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import sys\n\nX, N = map(int, input().split())\nP = list(map(int, input().split()))\nNL = [i for i in range(-1000,1000) if i == X or i not in P]\n\nif len(P) == 0:\n print(X)\n sys.exit()\n\nidx = NL.index(X)\nif abs(NL[idx + 1]) - X >= abs(NL[idx - 1]) - X ):\n print(NL[idx - 1])\nelse:\n print(NL[idx + 1])\n', 'import sys\n\nX, N = map(int, input().split())\nP = list(map(int, input().split()))\nNL = [ i for i in range(0, 102) if i == X or i not in P ]\n\nif len(P) == 0 or X not in P:\n print(X)\n sys.exit()\n\nprint(NL)\nidx = NL.index(X)\nif NL[idx + 1] - X >= X - NL[idx-1]:\n print(NL[idx-1])\nelse:\n print(NL[idx+1])\n\n', 'import sys\n\nX, N = map(int, input().split())\nP = list(map(int, input().split()))\nNL = [ i for i in range(0, 102) if i == X or i not in P ]\n\nif len(P) == 0 or X not in P:\n print(X)\n sys.exit()\n\nidx = NL.index(X)\nif NL[idx + 1] - X >= X - NL[idx-1]:\n print(NL[idx-1])\nelse:\n print(NL[idx+1])\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s732541455', 's947220242', 's587000592']
[9048.0, 9188.0, 9220.0]
[26.0, 25.0, 29.0]
[308, 313, 302]
p02641
u696684809
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import numpy as np\nimport sys\n\nx, n = map(int, input().split())\nif(n==0):\n print(x)\n sys.exit()\np = list(map(int, input().split()))\nq = [0]*n\nl = 1000\nfor i in range(n):\n q[i] = abs(p[i]-x)\nfor j in range(120):\n for k in range(n):\n l = min(abs(q[k]-j),l)\n if(not(l ==0)):\n for m in range(n):\n if(x + j -p[i] == abs(x + j -p[i])):\n print(x-j)\n sys.exit()\n else:\n print(x+j)\n sys.exit()\n ', 'import numpy as np\nimport sys\n\nx, n = map(int, input().split())\nif(n==0):\n print(x)\n sys.exit()\nc = 0\nb = 0\np = list(map(int, input().split()))\nfor i in range(102):\n for j in range(n):\n if(p[j] - x + i == 0):\n c+=1\n if(p[j] - x - i==0):\n b+=1\n if(b==0 or c==0):\n if(c==0):\n print(x-i)\n sys.exit()\n else:\n print(x+i)\n sys.exit()\n else:\n b=0\n c=0']
['Wrong Answer', 'Accepted']
['s953538236', 's634008381']
[26972.0, 27096.0]
[118.0, 117.0]
[440, 397]
p02641
u697340709
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = input().split()\n\nif (int(n)>0):\n add = 1\n count = 0\n p = list(map(int,input().split()))\n\n if (int(x) not in p):\n print(int(x))\n count=1\n\n\n while (count==0):\n for i in range(int(n)):\n if (abs(int(p[i])-int(x)) == add):\n count = count+1\n if (count==2):\n add = add+1\n count=0\n if (count==1):\n if (int(x)-add in p):\n print(int(x)+add)\n else:\n print(int(x)-add)\n if (count==0):\n print(int(x)-add)\n count=1\nelse:\n print(int(x))', 'x, n = input().split()\n\nif (int(n)>0):\n add = 1\n count = 3\n p = list(map(int,input().split()))\n\n if (int(x) not in p):\n print(int(x))\n count=1\n\n\n while (count==3):\n count = 0\n for i in range(int(n)):\n if (abs(int(p[i])-int(x)) == add):\n count = count+1\n if (count==2):\n add = add+1\n count=3\n if (count==1):\n if (int(x)-add in p):\n print(int(x)+add)\n else:\n print(int(x)-add)\n if (count==0):\n print(int(x)-add)\nelse:\n print(int(x))']
['Wrong Answer', 'Accepted']
['s074838991', 's147751014']
[9268.0, 9268.0]
[20.0, 22.0]
[512, 512]
p02641
u698756732
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import copy\nx,n = list(map(int, input("").split()))\np = list(map(int, input("").split()))\n\nmina =101\ny = []\nminc = []\n\nfor x not in p:\n print(x)\n exit()\n\nfor i in range(1,101):\n y.append(i)\n\nif n == 0:\n print(x)\nelse:\n for j in range(n):\n y.remove(p[j])\n\n z = copy.copy(y)\n\n for k in range(len(y)):\n if abs(x - y[k]) < mina:\n mina = abs(x - y[k])\n minb = y[k]\n z.remove(minb)\n\n minc.append(minb)\n mina = 101\n\n for m in range(len(z)):\n if abs(x - z[m]) < mina:\n mina = abs(x - z[m])\n minb = z[m]\n\n minc.append(minb)\n\n print(min(minc))', 'x,n = list(map(int, input("").split()))\np = list(map(int, input("").split()))\n\nfor i in range(101):\n if x-i not in p:\n print(x-i)\n exit()\n elif x+i not in p:\n print(x+i)\n exit()']
['Runtime Error', 'Accepted']
['s346281879', 's896188631']
[8968.0, 9184.0]
[19.0, 23.0]
[645, 211]
p02641
u699458609
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, N = map(int, input().split())\nif N == 0:\n print(X)\n exit()\nP = list(map(int, input().split()))\n \ni = 0\nwhile 1:\n for d in [-1, +1]:\n if not X+i*d in P:\n print(X+i*d)\n break\n i += 1', 'X, N = map(int, input().split())\nif N == 0:\n print(X)\n exit()\nP = list(map(int, input().split()))\n \nfor i in range(X+1):\n for d in [-1, +1]:\n if not X+i*d in P:\n print(X+i*d)\n break\n ', 'X, N = map(int, input().split())\nif N == 0:\n print(X)\n exit()\nP = list(map(int, input().split()))\n \nfor i in range(X+1):\n for d in [-1, +1]:\n if not (X+i*d) in P:\n print(X + i*d)\n exit()\n']
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s437438643', 's609936964', 's158676732']
[36224.0, 9164.0, 9172.0]
[2259.0, 32.0, 26.0]
[200, 204, 203]
p02641
u699944218
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, N = list(map(int,input().split()))\nif N == 0:\n print(X)\n exit()\np = list(map(int,input().split()))\nif N == 1:\n if p[0] == X:\n print(X-1)\n else:\n print(X)\n\nMAX = 0\nfor i in range(N):\n if MAX < X - p[i]:\n MAX = X - p[i]\n \nfor i in range(MAX):\n if X - i not in p:\n ans = X - i\n break\nfor i in range(MAX):\n if X + i not in p:\n ans = min(X - ans, ans - X) + X\n break\nprint(ans)', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\np = set(p)\nfor i in range(200):\n if X - i not in p:\n print(X - i)\n break\n if X + i not in p:\n print(X + i)\n break']
['Runtime Error', 'Accepted']
['s612097046', 's761674094']
[9184.0, 9196.0]
[29.0, 27.0]
[406, 217]
p02641
u700929101
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n = map(int,input().split(" "))\n\ndef minusx(f):\n return f-x\n\nif n !=0:\n plist =list(map(int,input().split(" ")))\n # print(x,n)\n # print(plist)\n plistx = list(map(minusx,plist))\n # print(plistx)\n plisty = list(map(abs,plistx))\n # print(plisty)\n plisty_max = max(plisty)\n print(plisty_max)\n\n if plisty_max == 0:\n plisty_max =1\n \n print(plisty_max)\n\n newlist = list(range(x-plisty_max,x+plisty_max+1))\n print(newlist)\n pset_diff = set(plist) ^ set(newlist)\n plist_diff = list(pset_diff)\n print(plist_diff)\n plist_plus = [i for i in plist_diff if i>0 and i<=100]\n print(plist_plus)\n\n for i in range(202):\n if x-i in plist_plus:\n print(x-i)\n break\n elif x+i in plist_plus:\n print(x+i)\n break\nelse:\n print(x)', 'x,n = map(int,input().split(" "))\n\ndef minusx(f):\n return f-x\n\nif n !=0:\n plist =list(map(int,input().split(" ")))\n for i in range(100):\n if x-i not in plist:\n print(x-i)\n break\n elif x+i not in plist:\n print(x+i)\n break\nelse:\n print(x)']
['Wrong Answer', 'Accepted']
['s707304444', 's765031836']
[9256.0, 9196.0]
[23.0, 24.0]
[835, 306]
p02641
u701893485
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['if __name__=="__main__":\n \n X, N = map(int, (input().split(\' \')))\n if N > 0:\n P = map(int, input().split(\' \'))\n P_max = max(P)\n P_min = min(P)\n if X in P:\n for i in range(0, 100):\n if (X-i) not in P:\n print(X-i)\n break\n\n elif (X+i) not in P:\n print(X+i)\n break\n elif X not in P:\n print(X)\n else:\n print(X)', ' X, N = map(int, (input().split(\' \')))\n if N > 0:\n P = sorted(map(int, input().split(\' \')))\n P_max = max(P)\n P_min = min(P)\n if X in P:\n for i in range(1, max(P_max-X + 1 , X-P_min +1)):\n if (X-i) not in P:\n print(X-i)\n break\n\n elif (X+i) not in P:\n print(X+i)\n break\n elif X not in P:\n print(X)\n else:\n print(" ")\n else:\n print(" ")\n\n', 'if __name__=="__main__":\n \n X, N = map(int, (input().split(\' \')))\n if N > 0:\n P = sorted(map(int, input().split(\' \')))\n P_max = max(P)\n P_min = min(P)\n if X in P:\n for i in range(100):\n if (X-i) not in P:\n print(X-i)\n break\n\n elif (X+i) not in P:\n print(X+i)\n break\n elif X not in P:\n print(X)\n else:\n print(X)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s135966150', 's581493974', 's535808480']
[9208.0, 8948.0, 9212.0]
[24.0, 21.0, 20.0]
[498, 532, 503]
p02641
u702018889
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
["x,y=map(int,input().split())\nif x*2>y:\n print('No')\nelse:\n if y%2==1 :\n print('No')\n else:\n if x*4<y :\n print('No')\n else:\n print('Yes')", 'x,n=map(int,input().split())\np=list(map(int,input().split()))\n \nfor d in range(x+1):\n for s in [-1,+1]:\n a=x+s*d\n if p.count(a) == 0:\n print(a)\n exit()']
['Wrong Answer', 'Accepted']
['s670670374', 's316571839']
[9192.0, 9152.0]
[28.0, 27.0]
[160, 190]
p02641
u704459429
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n =map(int, input().split())\nl = list(map(int, input().split()))\nif n == 0:\n print(x)\nelif not(x in l):\n print(x) \nelse:\n for i in range(n//2):\n if not(x - i in l):\n print(x-i)\n break\n elif not (x+i in l):\n print(x+i)\n break\n ', 'x, n =map(int, input().split())\nl = list(map(int, input().split()))\nif n == 0:\n print(x) \nelse:\n for i in range(n//2 + 2):\n if not(x - i in l):\n print(x-i)\n break\n elif not (x + i in l):\n print(x+i)\n break\n ']
['Wrong Answer', 'Accepted']
['s682356049', 's477956175']
[9192.0, 9056.0]
[21.0, 22.0]
[310, 282]
p02641
u704751556
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nif n == 0:\n print(x)\n exit()\n\n\nFlag = True\ni = 0\nwhile Flag:\n if not (x - i in p):\n print(x - i)\n break\n elif not (x + i not in p):\n print(x + i)\n break\n i += 1\n', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nif n == 0:\n print(x)\n exit()\n\n\nFlag = True\ni = 0\nwhile Flag:\n if (x - i) not in p:\n print(x - i)\n break\n elif (x + i) not in p:\n print(x + i)\n break\n i += 1\n']
['Wrong Answer', 'Accepted']
['s293854604', 's495886528']
[9124.0, 9116.0]
[31.0, 27.0]
[274, 270]
p02641
u707030679
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['\nx,n = map(int, input().split())\nif n!=0 :\n P = list(map(int, input().split()))\nelse:\n print(x)\n exit()\n\nP.sort()\nolp=lowp=min(P)-2\nohp=hip=max(P)+2\nl=len(P)-1\nfor i in range(len(P)):\n if P[i]>x :\n if olp<x :\n lowp=x\n break\n if P[i]-olp>1:\n lowp = P[i]-1\n olp=P[i]\n\nfor i in range(len(P)):\n if P[l-i]<x :\n break\n if ohp-P[l-i]>1:\n hip = P[l-i]+1\n ohp=P[l-i]\n\nprint( lowp, hip, x )\n\nans = lowp\nif x-lowp > hip-x :\n ans = hip\nprint( ans )', '\nx,n = map(int, input().split())\nif n!=0 :\n P = list(map(int, input().split()))\nelse:\n print(x)\n exit()\n\nP.sort()\nolp=lowp=min(P)-2\nohp=hip=max(P)+2\nl=len(P)-1\nfor i in range(len(P)):\n if P[i]>x :\n if olp<x :\n lowp=x\n break\n if P[i]-olp>1:\n lowp = P[i]-1\n olp=P[i]\n\nfor i in range(len(P)):\n if P[l-i]<x :\n break\n if ohp-P[l-i]>1:\n hip = P[l-i]+1\n ohp=P[l-i]\n\n# print( lowp, hip, x )\n\nans = lowp\nif x-lowp > hip-x :\n ans = hip\nprint( ans )']
['Wrong Answer', 'Accepted']
['s265969694', 's426512462']
[9148.0, 9172.0]
[28.0, 25.0]
[512, 514]
p02641
u714931250
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = map(int, input().split())\np = map(int, input().split())\np_list = sorted(list(p), reverse=False)\ndist_list = list(map(lambda y: abs(y-x), p_list))\nall_list = [[]]\nans = 0\nfor i in range(n):\n all_list.append([p_list[i], dist_list[i]])\ndel all_list[0] \nsort_list = sorted(all_list, key=lambda z:(z[1],z[0]))\nans = int(sort_list[0][0])\nprint(ans)', 'x,n = map(int,input().split())\nif n == 0:\n ans = x\nelse:\n p = [int(i.strip()) for i in input().split()]\n for i in range(n):\n ch_1 = x-i\n ch_2 = x+i\n if p.count(ch_1) == 0:\n ans = ch_1\n break\n elif p.count(ch_2) == 0:\n ans = ch_2\n break\n else:\n ans = x\nprint(p)', 'x, n = map(int, input().split())\np = map(int, input().split())\np_list = sorted(list(p), reverse=False)\ndist_list = list(map(lambda y: abs(y-x), p_list))\nall_list = [[]]\nans = 0\nfor i in range(n):\n all_list.append([p_list[i], dist_list[i]])\ndel all_list[0] \nsort_list = sorted(all_list, key=lambda z:(z[1],z[0]))\nans = int(sort_list[0][0])\nprint(ans)', 'x, n = map(int, input().split())\np = map(int, input().split())\np_list = sorted(list(p), reverse=False)\ndist_list = list(map(lambda y: abs(y-x), p_list))\nall_list = [[]]\nfor i in range(n):\n all_list.append([p_list[i], dist_list[i]])\ndel all_list[0] \nsort_list = sorted(all_list, key=lambda z:(z[1],z[0]))\nprint(sort_list)', 'x,n = map(int,input().split())\nif n == 0:\n ans = x\nelse:\n p = [int(i.strip()) for i in input().split()]\n for i in range(n+1):\n ch_1 = x-i\n ch_2 = x+i\n if p.count(ch_1) == 0:\n ans = ch_1\n break\n elif p.count(ch_2) == 0:\n ans = ch_2\n break\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s375850197', 's376570954', 's473009441', 's736910513', 's787329371']
[9156.0, 9096.0, 9148.0, 9188.0, 9112.0]
[27.0, 28.0, 27.0, 29.0, 28.0]
[415, 303, 415, 386, 283]
p02641
u722122988
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import collections\nimport sys\nx,n=map(int,input().split())\np=list(map(int,input().split()))\np=list(map(lambda i:abs(x-i),p))\nc=collections.Counter(p)\np.sort()\n\nfor i in range(len(p)):\n if p[i]!=(i+1)//2:\n if p[i-1]==p[i-2]:\n if x-p[i-1]-1 in p:\n print(x-p[i-1]+1)\n else:\n print(x-p[i-1]-1)\n sys.exit()\n elif i==1:\n if x-1 in p:\n print(x+1)\n else:\n print(x-1)\n sys.exit()\n elif i==0:\n print(x)\n sys.exit()\n else:\n if x-p[i] in p:\n print(x+p[i])\n else:\n print(x-p[i])\n sys.exit()\nprint(x)', 'import sys\nx,n=map(int,input().split())\nq=list(map(int,input().split()))\nq=q+[100000000]\np=list(map(lambda i:abs(x-i),q))\n\np.sort()\nif n==0:\n print(x)\n sys.exit()\nfor i in range(len(p)):\n if p[i]!=(i+1)//2:\n if i==0:\n print(x)\n sys.exit()\n elif i==1:\n print(x-1)\n sys.exit()\n elif p[i-1]==p[i-2]:\n print(x-p[i-1]-1)\n sys.exit()\n else:\n if x-p[i-1] in q:\n print(x+p[i-1])\n else:\n print(x-p[i-1])\n sys.exit()\n']
['Wrong Answer', 'Accepted']
['s586684493', 's708880441']
[9504.0, 9236.0]
[24.0, 23.0]
[596, 481]
p02641
u723345499
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = map(int, input().split())\np = list(map(int, input().split()))\n\n_x = x \nx_ = x\nwhile True:\n if _x not in p:\n print(_x)\n break\n if x_ not in p:\n print(x_)\n break\n _x -= 1\n x_ += 1', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nq = []\nr = []\nmin_ = 1000\nfor i in range(1, 101):\n if not i in p:\n q.append(i)\n \nfor j in q:\n k = int(abs(x - j))\n if min_ == k:\n r.append(before_j)\n r.append(j)\n min_ = min(k, min_)\n if min_ == k:\n before_j = j\n\nprint(min(r))', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n \n\n_x = x \nx_ = x\nwhile True:\n if _x not in p:\n print(_x)\n break\n if x_ not in p:\n print(x_)\n break\n _x -= 1\n x_ += 1', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nif n == 0:\n print(x)\nelse:\n q = []\n r = []\n min_ = 1000\n for i in range(1, 101):\n if not i in p:\n q.append(i)\n\n for j in q:\n k = int(abs(x - j))\n if min_ == k:\n r.append(before_j)\n r.append(j)\n min_ = min(k, min_)\n if min_ == k:\n before_j = j\n\n print(min(r))', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nif n == 0:\n print(x)\n\np = set(p)\nelse:\n _x = x \n x_ = x\n while True:\n _x -= 1\n x_ += 1\n if _x not in p:\n print(_x)\n break\n if x_ not in p:\n print(x_)\n break', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\np = set(p)\nfor i in range(200):\n if x - i not in p:\n print(x - i)\n break\n if n + i not in p:\n print(n + i)\n break', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nif n == 0:\n print(x)\nelse:\n q = []\n x_ = x\n _x = x\n for i in range(1, 101):\n if not i in p:\n q.append(i)\n while True:\n if _x - 1 in q:\n print(_x - 1)\n break\n elif x_ + 1in q:\n print(x_ + 1)\n break', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nfor i in range(200):\n if x - i not in p:\n print(x - i)\n break\n if n + i not in p:\n print(n + i)\n break', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nq = []\nr = []\nmin_ = 1000\nfor i in range(1, 101):\n if not i in p:\n q.append(i)\n \nfor j in q:\n k = int(abs(x - j))\n if min_ == k:\n r.append(before_j)\n r.append(j)\n min_ = min(k, min_)\n if min_ == k:\n before_j = j\n\nprint(min(r))', '\n\nx, n = map(int, input().split())\np = list(map(int, input().split()))\n\nif n == 0:\n print(x)\n \nelse:\n _x = x \n x_ = x\n while True:\n if _x not in p:\n print(_x)\n break\n if x_ not in p:\n print(x_)\n break\n _x -= 1\n x_ += 1']
['Time Limit Exceeded', 'Runtime Error', 'Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s151598983', 's369608932', 's370659963', 's389314767', 's493639854', 's712953916', 's789600340', 's845072751', 's987432385', 's426631865']
[9052.0, 9208.0, 9028.0, 9208.0, 9028.0, 9184.0, 9136.0, 9164.0, 9204.0, 9196.0]
[2205.0, 23.0, 2206.0, 23.0, 24.0, 22.0, 2205.0, 21.0, 23.0, 20.0]
[214, 346, 216, 428, 310, 217, 360, 206, 346, 316]
p02641
u727787724
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['n,m=map(int,input().split())\na=list(map(int,input().split()))\nif len(a)==0:\n print(n)\nelse:\n a.sort()\n if n not in a:\n print(n)\n else:\n cnt=0\n for i in range(n):\n if i in a:\n continue\n else:\n cnt=i\n print(cnt)', '# coding: utf-8\n# Your code here!\nn,m=map(int,input().split())\na=list(map(int,input().split()))\nif len(a)==0:\n print(n)\nelse:\n a.sort()\n if n not in a:\n print(n)\n else:\n cnt=0\n for i in range(102):\n if i in a:\n continue\n elif abs(cnt-n)>abs(i-n):\n cnt=i\n print(cnt)\n\n']
['Wrong Answer', 'Accepted']
['s916841920', 's430682569']
[9184.0, 9188.0]
[33.0, 28.0]
[249, 307]
p02641
u729083717
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, Y = map(int, input().split())\n\n\ndef myfunc(X, Y):\n for tsuru in range(X+1):\n turtle = X - tsuru\n legs = turtle * 4 + tsuru * 2\n\n if legs == Y:\n return "Yes"\n\n return "No"\n\nprint(myfunc(X,Y))', 'X, N = map(int, input().split())\nP = list(map(int, input().split()))\n\nnot_p = set(range(102)) - set(P)\n\nmin_value = 200\nmin_list = []\n\nfor v in not_p:\n dist = abs(X-v)\n\n if dist < min_value:\n min_value = dist\n min_list = [v]\n\n if dist == min_value:\n min_list.append(v)\n\nprint(min(min_list))\n']
['Wrong Answer', 'Accepted']
['s212439820', 's323188331']
[9168.0, 9188.0]
[21.0, 20.0]
[231, 321]
p02641
u729119068
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, N = map(int, input().split())\nA = [map(int, input().split())]\na = 0\nwhile True:\n if X-a in A:\n if X+a in A:\n a += 1\n else:\n print(X+a)\n break\n else:\n print(X-a)\n break', 'X, N = map(int, input().split())\nA = [map(int, input().split())]\na = 0\nwhile True:\n if X-a not in A:\n print(X-a)\n break\n if X+a not in A:\n print(X+a)\n break\n a += 1\n', 'X, N = map(int, input().split())\nA = [map(int, input().split())]\na = 0\nwhile True:\n if X-a in A:\n if X+a in A:\n a +=1\n else:\n print(X+a)\n exit()\n else:\n print(X-a)\n exit()', 'X, N = map(int, input().split())\nA = [int(input()) for i in range(N)]\na = 0\nwhile True:\n if X-a in A:\n if X+a in A:\n a +=1\n else:\n print(X+a)\n exit()\n else:\n print(X-a)\n exit()\n', 'X, N = map(int, input().split())\nA = list(map(int, input().split()))\na = 0\nwhile True:\n if X-a not in A:\n print(X-a)\n break\n if X+a not in A:\n print(X+a)\n break\n a += 1']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s157779664', 's208838279', 's435832773', 's859929459', 's165479196']
[8836.0, 8972.0, 9008.0, 8920.0, 9172.0]
[26.0, 26.0, 26.0, 27.0, 28.0]
[197, 188, 198, 204, 191]
p02641
u729133443
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n,*p=map(int,open(i:=0).read().split())\nwhile x in p:x+=i*-1**i;i+=1\nprint(x)', 'x,n,*p=map(int,open(i:=0).read().split())\nwhile x in p:x+=(-1)**i*i;i+=1\nprint(x)']
['Wrong Answer', 'Accepted']
['s354265332', 's114572687']
[9132.0, 9152.0]
[20.0, 23.0]
[79, 81]
p02641
u729535891
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['from bisect import bisect_left\nx, n = map(int, input().split())\nif n != 0:\n P = list(map(int, input().split()))\n P = sorted(P)\nelse:\n P = []\n\nflag = False\nans = []\nif x not in P or n == 0:\n ans.append(x)\nelse:\n idx = bisect_left(P, x)\n for i in range(n):\n for_num = P[idx] + 1\n bac_num = P[idx] - 1\n if for_num not in P:\n ans.append(for_num)\n flag = True\n if bac_num not in P:\n ans.append(bac_num)\n flag = True\n if flag:\n break\n\nprint(min(ans))', 'from bisect import bisect_left\nx, n = map(int, input().split())\nif n != 0:\n P = list(map(int, input().split()))\n P = sorted(P)\nelse:\n P = []\n\nflag = False\nans = []\nif x not in P or n == 0:\n ans.append(x)\nelse:\n idx = bisect_left(P, x)\n for i in range(1, 110):\n for_num = P[idx] + i\n bac_num = P[idx] - i\n if for_num not in P:\n ans.append(for_num)\n flag = True\n if bac_num not in P:\n ans.append(bac_num)\n flag = True\n if flag:\n break\n\nprint(min(ans))']
['Runtime Error', 'Accepted']
['s230026561', 's522874971']
[9156.0, 9148.0]
[28.0, 26.0]
[552, 557]
p02641
u731448038
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = map(int, input().split())\nP = list(map(int, input().split()))\nP.sort()\nnotP = [i for i in range(1, 101) if i not in P]\n\nans = notP[0]\nfor p in notP:\n delta = abs(x - p)\n if delta<ans:\n ans = p\n \nprint(ans)', 'x, n = map(int, input().split())\n\nimport sys\n\nif n==0:\n print(x)\n sys.exit()\n \nP = list(map(int, input().split()))\nP.sort()\nnotP = [i for i in range(0, 102) if i not in P]\n\nans = notP[0]\nmin_delta = abs(x - ans)\n\nfor p in notP:\n delta = abs(x - p)\n if delta<min_delta:\n ans = p\n min_delta = abs(x - ans)\n \nprint(ans)\n']
['Runtime Error', 'Accepted']
['s707188828', 's025830943']
[9192.0, 9192.0]
[26.0, 24.0]
[220, 331]
p02641
u734423776
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import collections\n\nN = int(input())\nh = list(map(int, input().split()))\nh.sort(reverse = True)\nl = []\nfor i in range(0, N):\n d = []\n for j in range(0, max(0, len(l))):\n if l[j] % h[i] == 0:\n d.append(l[j])\n for k in range(0, len(d)):\n l.remove(d[k])\n l.append(h[i])\nif len(collections.Counter(h)) == 1:\n l.clear()\nprint(len(l))', 'X, N = map(int, input().split())\nh = list(map(int, input().split()))\nans = []\nfor i in range(0, N+1):\n if X+i not in h:\n ans.append(X+i)\n if X-i not in h:\n ans.append(X-i)\n if ans != []:\n break\nprint(min(ans))']
['Runtime Error', 'Accepted']
['s222594909', 's463218757']
[9468.0, 9160.0]
[28.0, 22.0]
[368, 239]
p02641
u736524428
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, N = map(int, input().split())\np = list(input().split())\n\nans_enable = [True] * 102\nfor pi in p:\n ans_enable[pi] = False\n\ndiff = 0\n\ncheck_ok = ans_enable[X]\n\nans_small = True\n\nwhile not check_ok:\n diff += 1\n if ans_enable[X - diff]:\n check_ok = True\n ans_small = True\n elif ans_enable[X + diff]:\n check_ok = True\n ans_small = False\n\nprint(X - diff if ans_small else X + diff)', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nans_enable = [True] * 102\n\nfor pi in p:\n ans_enable[pi] = False\n\ndiff = 0\n\ncheck_ok = ans_enable[X]\n\nans_small = True\n\nwhile not check_ok:\n diff += 1\n if ans_enable[X - diff]:\n check_ok = True\n ans_small = True\n elif ans_enable[X + diff]:\n check_ok = True\n ans_small = False\n\nprint(X - diff if ans_small else X + diff)']
['Runtime Error', 'Accepted']
['s138955417', 's071728660']
[9196.0, 9196.0]
[27.0, 25.0]
[417, 428]
p02641
u736546944
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['[X, N] = list(map(int, input().split()))\nA = []\ntry:\n P = list(map(int, input().split()))\n list_int = [x for x in range(0, 102)]\n list_int_d = list(set(list_int) - set(P))\n list_int_d.sort()\n print(list_int_d)\n for i in list_int_d:\n A.append(abs(X - i))\n if 0 in A:\n print(X)\n else:\n Index = A.index(min(A))\n print(list_int_d[Index])\nexcept EOFError:\n print(X)', 'x, n = map(int, input().split())\ntry:\n list_P = [int(p) for p in input().split()]\n list_not_P = [x for x in range(102) if not x in list_P]\n list_abs = [abs(x - i) for i in list_not_P]\n Index = list_abs.index(min(list_abs))\n print(list_not_P[Index])\nexcept EOFError:\n print(x)']
['Wrong Answer', 'Accepted']
['s662074915', 's015246855']
[9068.0, 9192.0]
[22.0, 33.0]
[381, 281]
p02641
u738289281
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['a = input()\nb = input()\nt = int(a.split(" ")[0])\nlst = [int(x) for x in b.split(" ")]\nx = len(lst)\nif not x:\n print(t)\nfor i in range(x):\n if t - x not in lst:\n print(t - x)\n break\n if t + x not in lst:\n print(t + x)\n break\n', 'a = input()\n\nt, c = int(a.split(" ")[0]), int(a.split(" ")[1])\n\nif not c:\n print(t)\nelse:\n b = input()\n lst = [int(x) for x in b.split(" ")]\n\n for i in range(c+2):\n if t - i not in lst:\n print(t - i)\n break\n if t + i not in lst:\n print(t + i)\n break\n']
['Runtime Error', 'Accepted']
['s194364092', 's712577438']
[9112.0, 9100.0]
[28.0, 24.0]
[239, 320]
p02641
u740267532
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['def forbidden(x,p):\n res = []\n for num in range(101):\n if x!=num:\n res.append(abs(x-num))\n if x-min(res) not in p:\n return x-min(res)\n return x+min(res)\n\nif __name__ == "__main__":\n x,n = map(int,input().split())\n p = list(map(int,input().split()))\n if n==0:\n print(x)\n exit()\n print(forbidden(x,p))', 'x,n = map(int,input().split())\np = list(map(int,input().split()))\nif x not in p:\n print(x)\n exit()\na,b = x,x\nwhile True:\n a+=1\n b-=1\n if b not in p:\n print(b)\n break\n elif a not in p:\n print(a)\n break']
['Wrong Answer', 'Accepted']
['s313017574', 's791079009']
[9192.0, 9116.0]
[20.0, 21.0]
[362, 246]
p02641
u740284863
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n = map(int,input().split())\np = list(map(int,input().split()))\nans = []\nfor i in range(101):\n if i not in p:\n ans.append([i - x,i])\nans.sort()\nprint(ans[0][1])', 'x,n = map(int,input().split())\np = list(map(int,input().split()))\ni = 0\nwhile True:\n if x - i not in p:\n print(x-i)\n exit()\n elif x + i not in p:\n print(x+i)\n exit()\n i += 1']
['Wrong Answer', 'Accepted']
['s600832489', 's778136197']
[9160.0, 8960.0]
[23.0, 30.0]
[172, 210]
p02641
u742729271
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['N = int(input())\nA = list(map(int, input().split()))\nans = 0\nA = sorted(A)\nif N == 0:\n ans = 0\nelse:\n for i in range(len(A)-1,-1,-1):\n for j in range(0,i+1,1):\n if i==j:\n ans+=1\n if i==0 and A[0]==A[1]:\n ans-=1\n break\n if A[i]%A[j]==0:\n break\n if A[i]<A[j]*2:\n ans+=1\n break\n\nprint(ans)\n', 'N = int(input())\nA = list(map(int, input().split()))\nans = 0\nA = sorted(A)\nif N == 0:\n ans = 0\nelse:\n for i in range(len(A)-1,-1,-1):\n for j in range(0,i+1,1):\n if i==j:\n ans+=1\n if i==0 and A[0]==A[1]:\n ans-=1\n break\n if A[i]%A[j]==0:\n break\n if A[i]<A[j]*2:\n ans+=1\n break\n\nprint(ans)', 'X, N = map(int, input().split())\nif N!=0:\n p = list(map(int, input().split()))\nelse:\n p =[]\n\np = set(p)\ni=0\nwhile i<101:\n n = X-i\n if not(n in p):\n ans = n\n break\n n = X+i\n if not(n in p):\n ans = n\n break\n i+=1\n\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s680161110', 's745094012', 's904903639']
[9204.0, 9212.0, 9132.0]
[22.0, 19.0, 24.0]
[358, 357, 241]
p02641
u743272507
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n = map(int,input().split())\na = []\nif n != 0 : a = list(map(int,input().split()))\ntmp = 114514\nret = -114514\nfor i in range(-10,110):\n if not i in a and abs(x-i) < tmp\n ret = i\n tmp = abs(x-i)\nprint(ret)', 'x,n = map(int,input().split())\na = []\nif n != 0 : a = list(map(int,input().split()))\ntmp = 114514\nret = -114514\nfor i in range(-10,110):\n if not i in a and abs(x-i) < tmp:\n ret = i\n tmp = abs(x-i)\nprint(ret)\n']
['Runtime Error', 'Accepted']
['s536810044', 's626769143']
[8688.0, 9176.0]
[25.0, 28.0]
[209, 215]
p02641
u745805493
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = map(int, input().split())\nif n==0:\n print(x)\nelse:\n l1 = list(map(int,input().split()))\t\n l2 = list(range(1, 100))\n diff = set(l1) ^ set(l2)\n diff = list(diff)\n def sorting(numbers_array):\n return sorted(numbers_array, key=abs)\n\n sl = map(lambda a: a - x, diff)\n print(sorting(sl)[0])', 'x, n = map(int, input().split())\nif n==0:\n print(x)\nelse:\n l1 = list(map(int,input().split()))\t\n l2 = list(range(1, 100))\n diff = set(l1) ^ set(l2)\n diff = list(diff)\n def sorting(numbers_array):\n return sorted(numbers_array, key=abs)\n sl = map(lambda a: a - x, diff)\n print(sorting(sl)[0])\n', 'x, n = map(int, input().split())\nif n==0:\n print(x)\nelse:\n l1 = list(map(int,input().split()))\t\n l2 = list(range(-150, 200))\n diff = set(l1) ^ set(l2)\n diff = list(diff)\n def sorting(numbers_array):\n return sorted(numbers_array, key=abs)\n sl = map(lambda a: a - x, diff)\n print(sorting(sl)[0]+x)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s535474225', 's775535960', 's741482013']
[8908.0, 9200.0, 9248.0]
[24.0, 25.0, 22.0]
[316, 318, 322]
p02641
u749947386
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['xin = input().split()\nX, N = list(map(int, xin))\n\n\nxin = input().split()\np = list(map(int, xin))\n\ndist_min=1000\nmin_value=1000\n\nfor i in range(N):\n\tdist = abs(X-p[i])\n\tif ( dist==dist_min ):\n\t\tif(p[i]<min_value):\n\t\t\tmin_value = p[i]\n\telif ( dist < dist_min):\n\t\tdist_min = dist\n\t\tmin_value = p[i]\n\nprint(min_value)\n', 'xin = input().split()\nX, N = list(map(int, xin))\n\n\nxin = input().split()\np = list(map(int, xin))\n\nif (N == 0):\n\tprint(X)\n\texit()\n\n\ndist_min=N\nmin_value=X\n\n#p2 = range(X+N,X-N,-1)\n\n\nfor i in range(X+N,X-N-1,-1):\n\tflag=False\n\tfor j in range(N):\n\t\tif(i==p[j]):\n\t\t\tflag=True\n\tif( flag == True):\n\t\tcontinue\n\t\n\t\n\tdist = abs(X-i)\n\t\n\tif ( dist==dist_min ):\n\t\tif(i<min_value):\n\t\t\tmin_value = i\n\telif ( dist < dist_min):\n\t\tdist_min = dist\n\t\tmin_value = i\n\nprint(min_value)\n']
['Wrong Answer', 'Accepted']
['s233718882', 's845726861']
[9096.0, 9156.0]
[28.0, 31.0]
[314, 463]
p02641
u758656878
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import sys\n\n(x, n) = list(map(int, input().split()))\narr = list(map(int, input().split()))\n\nif(len(arr) == 0):\n print(x)\n sys.exit()\n\nif(x in arr):\n print(x)\n sys.exit()\n\ni = 1\nwhile True:\n if(not (x - i in arr)):\n print(x - i)\n sys.exit()\n \n if(not (x + i in arr)):\n print(x + i)\n sys.exit()\n i += 1\n', 'import sys\n\n(x, n) = list(map(int, input().split()))\narr = list(map(int, input().split()))\n\nif(len(arr) == 0):\n print(x)\n sys.exit()\n\nif(not(x in arr)):\n print(x)\n sys.exit()\n\ni = 1\nwhile True:\n if(not (x - i in arr)):\n print(x - i)\n sys.exit()\n \n if(not (x + i in arr)):\n print(x + i)\n sys.exit()\n i += 1\n']
['Wrong Answer', 'Accepted']
['s731804150', 's347585887']
[9128.0, 9108.0]
[21.0, 21.0]
[353, 358]
p02641
u759465878
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n = map(int, input().split())\ni = list(map(int, input().split()))\n\nif n ==0:\n print(x)\n \nif x not in i:\n print(x)\n \n else:\n p = 1\n while True:\n z = x - p\n if z not in i:\n print(z)\n break\n \n z = x + p\n if z not in i:\n print(z)\n break\n \n p = p +1\n \n \n \n \n \n \n \n \n \n\n', 'x,n = map(int, input().split())\nif n ==0:\n print(x)\nif n != 0:\n i = list(map(int, input().split()))\n\n\n \nif x not in i:\n print(x)\n break\n \nelse:\n p = 1\n while True:\n z = x - p\n if z not in i:\n print(z)\n break\n \n z = x + p\n if z not in i:\n print(z)\n break\n \n p = p +1\n ', 'x,n = map(int, input().split())\ni = list(map(int, input().split()))\n\nif n ==0:\n print(x)\n \nif x not in i:\n print(x)\n \n else:\n p = 1\n while True:\n z = x - p\n if z not in i:\n print(z)\n break\n \n z = x + p\n if z not in i:\n print(z)\n break\n \n p = p +1\n \n \n \n \n \n \n \n \n \n\n', 'x,n = map(int, input().split())\ni = list(map(int, input().split()))\n\nif n ==0:\n print(x)\n \nif x not in i:\n print(x)\n \n else:\n p = 1\n while True:\n z = x - p\n if z not in i:\n print(z)\n break\n \n z = x + p\n if z not in i:\n print(z)\n break\n \n p = p +1\n \n \n \n \n \n \n \n \n \n\n', 'x,n = map(int, input().split())\nif n ==0:\n print(x)\nif n != 0:\n i = list(map(int, input().split()))\n\n\n \n if x not in i:\n print(x)\n \n else:\n p = 1\n while True:\n z = x - p\n if z not in i:\n print(z)\n break\n \n z = x + p\n if z not in i:\n print(z)\n break\n \n p = p +1']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s008099152', 's106329967', 's226526302', 's890888284', 's552788315']
[8968.0, 9064.0, 9028.0, 9024.0, 9208.0]
[23.0, 21.0, 22.0, 24.0, 21.0]
[383, 331, 383, 383, 342]
p02641
u760760982
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n = map(int,input().split())\np = list(map(int,input().split()))\nprint(p)\nfor i in range(100):\n for j in p:\n if j == (x - i):\n break\n else:\n print(x - i)\n break\n for j in p:\n if j == (x + i):\n break\n else:\n print(x + i)\n break', 'x,n = map(int,input().split())\nif n == 0:\n print(x)\n exit()\n \np = input().split()\nfor i in range(100):\n for j in p:\n if int(j) == x - i:\n break\n else:\n print(x - i)\n break\n for j in p:\n if int(j) == x + i:\n break\n else:\n print(x + i)\n break']
['Wrong Answer', 'Accepted']
['s913169102', 's965596131']
[9184.0, 9184.0]
[26.0, 25.0]
[303, 325]
p02641
u760794812
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X,N = map(int,input().split())\nif N == 0:\n print(X)\n exit()\nA = list(map(int,input().split()))\nfor i in range(N):\n if (X - i) not in A:\n print(X-i)\n exit()\n elif (X + i ) not in A:\n print(X+i)', 'X,N = map(int,input().split())\nif N == 0:\n print(X)\n exit()\nA = list(map(int,input().split()))\nfor i in range(N*2):\n if (X - i) not in A:\n print(X-i)\n exit()\n elif (X + i ) not in A:\n print(X+i)\n exit()']
['Wrong Answer', 'Accepted']
['s281514116', 's174490701']
[9184.0, 9184.0]
[23.0, 21.0]
[205, 218]
p02641
u763550415
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import math\n\nX, N = map(int, input().split())\nif N == 0:\n print(X)\nelse:\n p = list(map(int, input().split()))\n q = [int(i)-10 for i in range(121)]\n print(q)\n\n for i in p:\n q.remove(i)\n\n ans = 0\n r0 = 100000\n for j in q:\n r = abs(j-X)\n if r0 > r:\n r0 = r\n ans = j\n print(ans)', 'import math\n\nX, N = map(int, input().split())\nif N == 0:\n print(X)\nelse:\n p = list(map(int, input().split()))\n q = [int(i)-10 for i in range(121)]\n #print(q)\n\n for i in p:\n q.remove(i)\n\n ans = 0\n r0 = 100000\n for j in q:\n r = abs(j-X)\n if r0 > r:\n r0 = r\n ans = j\n print(ans)']
['Wrong Answer', 'Accepted']
['s384105920', 's950431433']
[9104.0, 9132.0]
[29.0, 28.0]
[302, 303]
p02641
u766646838
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['N = int(input())\nc = list(map(int,input().split()))\n\nc.sort()\na = c[N-1]\nlist_c = [0]*(a+1)\nfor i in c:\n mal = 2\n b = i\n while i<=a:\n list_c[i]+=1\n i = b*mal\n mal+=1\ncount = 0\nfor i in c:\n if list_c[i]==1:\n count+=1\nprint(count)\n \n ', 'N,M = map(int,input().split())\nif M == 0:\n print(N)\nelse:\n c=list(map(int, input().split()))\n for i in range(N+1):\n for s in [-1,1]:\n a = N+s*i\n if c.count(a)==0:\n \tprint(a)\n \texit(0)']
['Runtime Error', 'Accepted']
['s069675555', 's157739264']
[9068.0, 9172.0]
[26.0, 28.0]
[255, 209]
p02641
u767821815
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['if N == 0:\n P = []\nelse:\n P = [int(x) for x in input().split()]\n\nfor i in range(100):\n q = X - i\n if q not in P:\n print(q)\n break\n q = X + i\n if q not in P:\n print(q)\n break', 'X,N = map(int,input().split())\n\nif N == 0:\n P = []\nelse:\n P = [int(x) for x in input().split()]\n\nfor i in range(100):\n q = X - i\n if q not in P:\n print(q)\n break\n q = X + i\n if q not in P:\n print(q)\n break']
['Runtime Error', 'Accepted']
['s653489390', 's060128431']
[9048.0, 9180.0]
[21.0, 23.0]
[219, 251]
p02641
u768256617
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
["x,n=map(int,input().split())\ntry:\n p=list(map(int,input().split()))\nexcept:\n print(x)\n exit()\nans=float('inf')\nfor i in range(1,101):\n if i not in p:\n ans=min(ans,abs(x-i))\n \n \nif x-ans not in p and (x-ans)>0 and (x-ans)<=x:\n print(x-ans)\n \nelif x-ans not in p and (x-ans)<=0:\n print(x+ans)", "x,n=map(int,input().split())\ntry:\n p=list(map(int,input().split()))\nexcept:\n print(x)\n exit()\nans=float('inf')\nfor i in range(300):\n if i not in p:\n ans=min(ans,abs(x-i))\n \n \nif x-ans not in p :\n print(x-ans)\n\nelse:\n print(x+ans)"]
['Wrong Answer', 'Accepted']
['s642370014', 's992838455']
[9208.0, 9192.0]
[23.0, 21.0]
[306, 241]
p02641
u769095634
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['from sys import exit\n\nx, n = map(int, input().split())\np = list(map(int, input().split()))\nfor d in range(x+1): \n for d in [-1, 1]:\n a = x + i*s\n if not a in p:\n print(a)\n exit()', 'from sys import exit\n\nx, n = map(int, input().split())\np = list(map(int, input().split()))\nfor d in range(x+1): \n for s in [-1, 1]:\n a = x + d*s\n if p.count(a) == 0:\n print(a)\n exit()']
['Runtime Error', 'Accepted']
['s406823759', 's098349175']
[9116.0, 9044.0]
[24.0, 34.0]
[316, 321]
p02641
u770077083
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n = map(int,input().split())\np = list(map(int,input().split()))\nflag = [True] * 101\n\nfor i in p:\n flag[i] = False\n\nfor i in range(101):\n low = max(x-i, 0)\n high = min(x+i, 100)\n if low:\n print(low)\n break\n elif high:\n print(high)\n break\n', 'x,n = map(int,input().split())\np = list(map(int,input().split()))\nflag = [True] * 102\n\nfor i in p:\n flag[i] = False\n\nfor i in range(101):\n low = max(x-i, 0)\n high = min(x+i, 101)\n if flag[low]:\n print(low)\n break\n elif flag[high]:\n print(high)\n break\n']
['Wrong Answer', 'Accepted']
['s734913747', 's206840188']
[9192.0, 9188.0]
[23.0, 22.0]
[282, 294]
p02641
u771383254
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import sys\n\nx, n = list(map(int, input().split()))\n\nif n == 0:\n print(x)\n sys.exit()\n \np = list(map(int, input().split()))\n\nmin_abs = 101\nmin_e = 0\nfor i in p[1:]:\n if abs(x-i) < min_abs:\n min_abs = abs(x-i)\n min_e = i\n\nfor i in range(1, int(len(p)/2)):\n if min_e - i not in p:\n print(min_e - i)\n break\n if min_e + i not in p:\n print(min_e + i)\n break', 'def main():\n x, n = list(map(int, input().split()))\n\n if n == 0:\n print(x)\n return\n p = list(map(int, input().split()))\n\n min_abs = 101\n min_e = 0\n for i in p:\n if abs(x-i) < min_abs:\n min_abs = abs(x-i)\n min_e = i\n\n if min_abs == 0 and min_e not in p:\n print(min_e)\n return\n\n for i in range(1, 101):\n if min_e - i not in p:\n print(min_e - i)\n return\n if min_e + i not in p:\n print(min_e + i)\n return\n \nmain()']
['Wrong Answer', 'Accepted']
['s817235888', 's051249950']
[9240.0, 9208.0]
[22.0, 21.0]
[375, 475]
p02641
u781262926
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n, *P = map(int, open(0).read().split())\nA = list(range(102))\nP = set(P)\nB = []\nm = 10**4\nfor a in A:\n if a not in P:\n if abs(x-a) < m:\n m = abs(x-a)\n B.append((m, a))\nprint(min([k for v, k in B if v == B[0][0]]))', 'x, n, *P = map(int, open(0).read().split())\nP = set(P)\nfor i in range(51):\n Q = {x-i, x+i} - P\n\tif Q:\n\t\tprint(min(Q))\n\t\tbreak', 'x, n, *P = map(int, open(0).read().split())\nP = set(P)\nfor i in range(51):\n Q = {x-i, x+i} - P\n if Q:\n print(min(Q))\n break']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s607574119', 's615335158', 's622420002']
[9208.0, 8988.0, 9124.0]
[25.0, 23.0, 24.0]
[248, 128, 143]
p02641
u782643389
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['xn = input().split()\ndata = input().split()\ndata_2 = []\n\nx = xn[0] \ndata.sort() \n\n\n\na = x-1\nwhile True:\n #check\n for i in range(len(data)):\n if data[i] == a:\n a = a - 1\n break\n else:\n data_2.append(a)\n break\n if a == data_2[0]:\n break\n\n\nb = x + 1\nwhile True:\n #check\n for i in range(len(data)):\n if data[i] == a:\n a = a + 1\n break\n else:\n data_2.append(a)\n break\n if b == data_2[1]:\n break\n\n\nif a < b:\n print(a)\nelse:\n print(b)', 'xn = input().split()\ndata_2 = []\nx = int(xn[0]) \n\nif int(xn[1]) == 0:\n print(x)\nelse:\n data_str = input().split()\n data = [int(s) for s in data_str] \n \n \n a = int(xn[0])\n #check\n while True: #while1\n while True: #while2\n for i in range(len(data)):\n if data[i] != a:\n continue\n else:\n a -= 1\n break \n else:\n data_2.append(a)\n break \n\n if len(data_2) == 1: \n break \n\n\n \n b = int(xn[0])\n while True: #while1\n while True: #while2\n for i in range(len(data)):\n if data[i] != b:\n continue\n else:\n b += 1\n break \n else:\n data_2.append(b)\n break \n\n if len(data_2) == 2: \n break \n\n\n \n if abs(x-a) <= abs(b-x):\n print(a)\n else:\n print(b)\n']
['Runtime Error', 'Accepted']
['s606731335', 's828603814']
[9156.0, 9128.0]
[21.0, 25.0]
[830, 1627]
p02641
u785266893
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = map(int, input().split())\nif n == 0:\n print(x)\n exit()\n\np = np.array(list(map(int, input().split())))\nfor i in range(100):\n if not x-i in p:\n print(x-i)\n exit()\n elif not x+i in p:\n print(x+i)\n exit()', 'x, n = map(int, input().split())\nif n == 0:\n print(x)\n exit()\n\np = list(map(int, input().split()))\nfor i in range(100):\n if not x-i in p:\n print(x-i)\n exit()\n elif not x+i in p:\n print(x+i)\n exit()\n']
['Runtime Error', 'Accepted']
['s611504740', 's923692236']
[9172.0, 9152.0]
[27.0, 26.0]
[247, 238]
p02641
u788608806
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import numpy as np\n\nX, N = map(int, input().split())\np = list(map(int, input().split()))\n\nabslis = [[]for i in range(102)]*102\nfor n in range(N-1):\n abslis[abs(p[n]-X)].append(p[n])\nif len(abslis[0]) == 0 :\n print(X)\nelse :\n for i in range(1,N-1):\n if len(abslis[i]) != 2: \n if len(abslis[i]) == 0:\n print(X-i)\n elif len(abslis[i]) ==1:\n print( X+(X-abslis[i][0]) ) \n break\n', 'import numpy as np\n\nX, N = map(int, input().split())\np = list(map(int, input().split()))\n\nabslis = [[]for i in range(102)]*102\nfor n in range(N):\n abslis[abs(p[n]-X)].append(p[n])\n\nif len(abslis[0]) == 0 :\n print(X)\nelse :\n # if len(abslis[1])==0:\n # print()\n for i in range(1,N+1):\n if len(abslis[i]) != 2: \n if len(abslis[i]) == 0:\n print(X-i)\n elif len(abslis[i]) ==1:\n print( X+(X-abslis[i][0]) ) \n break\n']
['Wrong Answer', 'Accepted']
['s698622455', 's887762675']
[27232.0, 27252.0]
[108.0, 104.0]
[455, 500]
p02641
u791070772
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
["x,n = map(int,input().split())\n\narr = []\n\nif n == 0:\n print(x)\nelse:\n tmp = input()\n num = tmp.split(' ')\n num_li = [int(i) for i in num]\n arr.extend(num_li)\n min = x\n max = x\n\n for i in range(10000):\n \n min -= 1\n max -= 1\n\n if min not in arr:\n print(min)\n break\n\n if max not in arr:\n print(max)\n break", "x,n = map(int,input().split())\n\narr = []\n\nif n == 0:\n print(x)\nelse:\n tmp = input()\n num = tmp.split(' ')\n num_li = [int(i) for i in num]\n arr.extend(num_li)\n min = x\n max = x\n\n for i in range(10000):\n\n if min not in arr:\n print(min)\n break\n\n if max not in arr:\n print(max)\n break\n \n min -= 1\n max += 1"]
['Wrong Answer', 'Accepted']
['s086023729', 's426799168']
[9200.0, 9232.0]
[22.0, 25.0]
[405, 413]
p02641
u793378082
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, N = map(int, input().split())\nA = list(map(int, input().split()))\nif N == 0:\n print(X)\nelse:\n while X in A:\n if X + 1 is A:\n print(X+2)\n elif X-1 is A:\n print(X+1)', 'X, N = map(int, input().split())\nA = list(map(int, input().split()))\nif N == 0:\n print(X)\nelse:\n while X in A:\n if X + 1 in A:\n print(X+2)\n elif X-1 in A:\n print(X+1)', 'x, y = map(int, input().split())\np = list(map(int, input().split()))\nif x not in p:\n print(x)\nelse:\n d = 1\n while True:\n if x - d not in p:\n print(x - d)\n break\n if x + d not in p:\n print(x + d)\n break\n d += 1']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s296988202', 's370122745', 's510492644']
[9088.0, 24476.0, 9184.0]
[2205.0, 2245.0, 22.0]
[206, 206, 241]
p02641
u796878730
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X,N = map(int,input().split())\nP = list(map(int,input().split()))\n\n\nP_n = [i for i in range(105) if i not in P]\nprint(P_n)\nabs_value = [abs(X-P_n[j]) for j in range(len(P_n))]\n\n\nmin_abs = min(abs_value)\nfor k in range(len(abs_value)):\n if abs_value[k] == min_abs:\n print(P_n[k])\n break', 'X,N = map(int,input().split())\nP = list(map(int,input().split()))\n\n\nP_n = [i for i in range(0,110,1) if i not in P]\nprint(P_n)\nabs_value = [abs(X-P_n[j]) for j in range(len(P_n))]\n\n\nmin_abs = min(abs_value)\nfor k in range(len(abs_value)):\n if abs_value[k] == min_abs:\n print(P_n[k])\n break', 'X,N = map(int,input().split())\nP = list(map(int,input().split()))\n\n\nP_n = [i for i in range(109) if i not in P]\nprint(P_n)\nabs_value = [abs(X-P_n[j]) for j in range(len(P_n))]\n\n\nmin_abs = min(abs_value)\nfor k in range(len(abs_value)):\n if abs_value[k] == min_abs:\n print(P_n[k])\n break', 'X,N = map(int,input().split())\nP = list(map(int,input().split()))\n\n\nP_n = [i for i in range(1,110,1) if i not in P]\nprint(P_n)\nabs_value = [abs(X-P_n[j]) for j in range(len(P_n))]\n\n\nmin_abs = min(abs_value)\nfor k in range(len(abs_value)):\n if abs_value[k] == min_abs:\n print(P_n[k])\n break', 'X,N = map(int,input().split())\nP = list(map(int,input().split()))\n\n\nP_n = [i for i in range(110) if i not in P]\nprint(P_n)\nabs_value = [abs(X-P_n[j]) for j in range(len(P_n))]\n\n\nmin_abs = min(abs_value)\nfor k in range(len(abs_value)):\n if abs_value[k] == min_abs:\n print(P_n[k])\n break', 'X,N = map(int,input().split())\nP = list(map(int,input().split()))\n\n\nP_n = [i for i in range(101) if i not in P]\nprint(P_n)\nabs_value = [abs(X-P_n[j]) for j in range(len(P_n))]\n\n\nmin_abs = min(abs_value)\nfor k in range(len(abs_value)):\n if abs_value[k] == min_abs:\n print(P_n[k])\n break', 'X,N = map(int,input().split())\nP = list(map(int,input().split()))\n\n\nP_n = [i for i in range(102) if i not in P]\nabs_value = [abs(X-P_n[j]) for j in range(len(P_n))]\n\n\nmin_abs = min(abs_value)\nfor k in range(len(abs_value)):\n if abs_value[k] == min_abs:\n print(P_n[k])\n break']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s046216673', 's220238186', 's292052026', 's505383867', 's527696424', 's553544357', 's572180401']
[9200.0, 9204.0, 9204.0, 9144.0, 9148.0, 9096.0, 9192.0]
[21.0, 22.0, 21.0, 22.0, 21.0, 22.0, 26.0]
[302, 306, 302, 306, 302, 302, 331]
p02641
u798445123
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, N = map(int, input().split())\np_list = [int(i) for i in input().split()]\n\nif N == 0:\n print(X)\nelse:\n check_list = []\n for i in range(1, 105+1):\n check_list.append(X-i)\n check_list.append(X+i)\n \n print(check_list)\n\n for el in check_list:\n if el not in p_list:\n break\n\n print(el)', 'X, N = map(int, input().split())\np_list = [int(i) for i in input().split()]\n\nif N == 0:\n print(X)\nelif X not in p_list:\n print(X)\nelse:\n check_list = []\n for i in range(1, 105+1):\n check_list.append(X-i)\n check_list.append(X+i)\n\n for el in check_list:\n if el not in p_list:\n break\n\n print(el)']
['Wrong Answer', 'Accepted']
['s674665326', 's710916769']
[9188.0, 9128.0]
[24.0, 24.0]
[334, 342]
p02641
u799215419
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, N = map(int, input().split())\np = list(map(int, input().split()))\n\ncandidates = []\n\nx = X\nwhile(True):\n if not x in p:\n candidates.append(x)\n break\n else:\n x += 1\nx = X\nwhile(True):\n if not x in p:\n candidates.append(x)\n break\n else:\n x -= 1\n\nprint(min(candidates))\n', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\ncandidates = []\n\nx = X\nwhile(True):\n if not x in p:\n candidates.append(x)\n break\n else:\n x += 1\nx = X\nwhile(True):\n if not x in p:\n candidates.append(x)\n break\n else:\n x -= 1\n\nif abs(X-candidates[0]) == abs(X-candidates[1]):\n print(min(candidates))\nelif abs(X-candidates[0]) > abs(X-candidates[1]):\n print(candidates[1])\nelse:\n print(candidates[0])\n']
['Wrong Answer', 'Accepted']
['s966985200', 's735660106']
[9112.0, 9180.0]
[26.0, 29.0]
[323, 482]
p02641
u800058906
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n=map(int,input().split())\na=list(map(int,input().split()))\n\ni=0\n\nwhile True:\n if not x-i in a:\n print(x-i)\n break\n if not x+i in a:\n print(x+1)\n break\n i+=1', 'import sys\n\nx,n=map(int,input().split())\np=list(map(int,input().split()))\np.sort()\n\nif n==0:\n print(x)\n sys.exit()\n\nif x not in p:\n print(x)\n sys.exit()\n \nq=list(i for i in range(p[0]-1,p[-1]+2))\n\nfor i in p:\n q.remove(i)\n\nans=[]\nc=x+n\nfor i in q:\n if c>abs(x-i):\n c=abs(x-i)\n ans.clear()\n ans.append(i)\n if c==abs(x-i):\n ans.append(i)\n\nprint(min(ans))']
['Wrong Answer', 'Accepted']
['s905476670', 's060546923']
[9148.0, 9152.0]
[26.0, 25.0]
[196, 404]
p02641
u802234211
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n = map(int,input().split())\nnump = list(map(int,input().split()))\nnump.sort()\nx_ind = -1\nnump_io = [0]*100\nfor i in range(n):\n nump_io[nump[i]-1] = 1\n if(nump[i]==x):\n x_ind = i\nif(x_ind == -1):\n print(x)\nelse: \n for i in range(1,50):\n if(list_io[(x-1)-i] == 0):\n print(x-i)\n break\n if(list_io[(x-1)+i] == 0):\n print(x+i)\n break\n\n', 'x,n = map(int,input().split())\nnump = list(map(int,input().split()))\nnump.sort()\nx_ind = -1\nnump_io = [0]*103\nfor i in range(n):\n nump_io[nump[i]-1] = 1\n if(nump[i]==x):\n x_ind = i\nif(x_ind == -1):\n print(x)\nelse: \n for i in range(1,51):\n if(nump_io[(x-1)-i] == 0):\n print(x-i)\n break\n if(nump_io[(x-1)+i] == 0):\n print(x+i)\n break\n# print(nump_io)\n\n']
['Runtime Error', 'Accepted']
['s704585794', 's876702395']
[9216.0, 9088.0]
[21.0, 24.0]
[421, 438]
p02641
u804711544
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = map(int, input().split())\np = [int(_) for _ in input().split()]\n\nnot_in_p = [i for i in range(0, 102) if i not in p]\nnip_temp = list(map(lambda s: abs(x - s), not_in_p))\n\naddress = nip_temp.index(min(nip_temp))\nprint(p[address])\n', 'import sys\nx, n = map(int, input().split())\np = [int(_) for _ in input().split()]\n\nif n == 0:\n print(x)\n sys.exit()\n\nfor i in range(n+1):\n if x-i in p:\n if x+1 in p:\n continue\n else:\n print(x+i)\n sys.exit()\n else:\n print(x-i)', 'import sys\nx, n = map(int, input().split())\np = list(map(int, input().split()))\nif n == 0:\n print(x)\n sys.exit()\n\nnot_in_p = []\nfor i in range(0, 102):\n if i not in p:\n not_in_p.append(abs(x-i))\n else:\n not_in_p.append(102)\n\naddress = not_in_p.index(min(not_in_p))\nprint(not_in_p[address])', 'import sys\nx, n = map(int, input().split())\np = list(map(int, input().split()))\nif n == 0:\n print(x)\n sys.exit()\n\nnot_in_p = []\nfor i in range(0, 102):\n if i not in p:\n not_in_p.append(i)\n else:\n not_in_p.append(102)\n\naddress = not_in_p.index(min(not_in_p))\nprint(not_in_p[address])', 'import sys\nx, n = map(int, input().split())\np = list(map(int, input().split()))\nif n == 0:\n print(x)\n sys.exit()\n\np.sort()\npMax = max(p)\nnot_in_p = [-1]\nfor i in range(102):\n if i not in p:\n not_in_p.append(i)\n\nj = 0\nfor k in not_in_p:\n if k - x == 0:\n print(k)\n sys.exit()\n\n else:\n not_in_p[j] -= x\n j += 1\n', 'import sys\nx, n = map(int, input().split())\np = [int(_) for _ in input().split()]\n\nif n == 0:\n print(x)\n sys.exit()\n\nnot_in_p = []\nfor i in range(0, 102):\n if i not in p:\n not_in_p.append(i)\n\nnip_temp = []\nfor i in not_in_p:\n nip_temp.append(abs(x-i))\n\naddress = nip_temp.index(min(nip_temp))\nprint(not_in_p[address])\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s352523798', 's428517049', 's546028519', 's635171354', 's719098980', 's799693076']
[9156.0, 9188.0, 9096.0, 9200.0, 9196.0, 9148.0]
[24.0, 24.0, 20.0, 21.0, 22.0, 19.0]
[236, 291, 315, 308, 354, 337]
p02641
u805852597
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import numpy as np\nx, n = map(int, input().split())\nnum_list = list(map(int,input().split()))\nnum_100 = list(range(1, 101))\n\nfor num in num_list:\n numbers = num_100.remove(num)\n\nnumbers1 = np.array(numbers)\nnumbers2 = numbers - x\nnumbers3 = np.abs(numbers)\nmin_index = numbers.argmin()\nprint(numbers1[min_index])', 'import numpy as np\nx, n = map(int, input().split())\nnum_list = list(map(int,input().split()))\nnum_list = sorted(num_list)\nnum_100 = list(range(1, 101))\n\nfor num in num_list:\n numbers = num_100.remove(num)\n\nnumbers1 = np.array(numbers)\nnumbers2 = numbers - x\nnumbers3 = np.abs(numbers)\nmin_index = numbers.argmin()\nprint(numbers1[min_index])', 'import numpy as np\nx, n = map(int, input().split())\nnum_list = list(map(int,input().split()))\nnum_list = sorted(num_list)\nnum_100 = list(range(-100, 102))\n\nif n ==0:\n print(x)\nelse:\n for num in num_list:\n num_100.remove(num)\n\n numbers1 = np.array(num_100)\n numbers2 = numbers1 - x\n numbers3 = np.abs(numbers2)\n min_index = numbers3.argmin()\n print(numbers1[min_index])']
['Runtime Error', 'Runtime Error', 'Accepted']
['s034375088', 's357591550', 's624049668']
[27152.0, 27144.0, 27184.0]
[111.0, 112.0, 116.0]
[315, 343, 375]
p02641
u808585569
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X,N = map(int, input().split())\nif N ==0:\n print(X)\n exit() \nif N ==0:\n print(X)\n exit() \nif p.count(X) == 0:\n print(X)\n exit()\nfor a in range(1000):\n if p.count(X-a) ==0:\n print(X-a)\n exit()\n elif p.count(X+a) ==0:\n print(X+a)\n exit()\n', 'X,N = map(int, input().split())\nif N ==0:\n print(X)\n exit() \nif N !=0:\n p = list(map(int, input().split()))\nif p.count(X) == 0:\n print(X)\n exit()\nfor a in range(1000):\n if p.count(X-a) ==0:\n print(X-a)\n exit()\n elif p.count(X+a) ==0:\n print(X+a)\n exit()\n']
['Runtime Error', 'Accepted']
['s654158095', 's792783418']
[9132.0, 9220.0]
[25.0, 24.0]
[256, 273]
p02641
u809108154
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import sys\n \nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n \nX, N, *p = map(int, read().split())\np=list(p)\n \nfor d in range(X + 1):\n\tfor s in [-1, +1]:\n\t\ta = X + s * d\n\t\tif p.count(a) == 0:\n\t\t\tprint(a)\n\t\t\t#exit(0)\n', 'import sys\nreadline=sys.stdin.readline\n\nX,N=map(int,readline().split())\nP=set(list(map(int,readline().split())))\n\nx = X\nwhile x in P:\n x -= 1\nminX = x\n\nx = X\nwhile x in P:\n x += 1\nmaxX=x\n\nif abs(minX - X) <= abs(maxX - X):\n print(minX)\nelse:\n print(maxX)\n']
['Wrong Answer', 'Accepted']
['s982285190', 's279726847']
[9076.0, 9180.0]
[27.0, 28.0]
[273, 259]
p02641
u809963697
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = map(int, input().split())\nlists = list(input().split())\nfor i in range(n):\n lists[i] = int(lists[i])\nfor i in range(n):\n lists[i] = lists[i] - x\nloop = True\nnumber = x\nwhile True:\n if number in lists:\n number = number - 1\n else:\n break\nnumber_2 = x\nwhile True:\n if number in lists:\n number = number + 1\n else:\n break\nif abs(number - x) > abs(number_2 - x):\n print(number_2)\nelse:\n print(number)', 'x, n = map(int, input().split())\nlists = list(input().split())\nfor i in range(n):\n lists[i] = int(lists[i])\nloop = True\nnumber = x\nwhile True:\n if number in lists:\n number = number - 1\n else:\n break\nnumber_2 = x\nwhile True:\n if number_2 in lists:\n number_2 = number_2 + 1\n else:\n break\nif abs(number - x) > abs(number_2 - x):\n print(number_2)\nelif abs(number - x) == abs(number_2 - x):\n print(number)\nelse:\n print(number)']
['Wrong Answer', 'Accepted']
['s238229036', 's421068711']
[9212.0, 9200.0]
[21.0, 22.0]
[421, 441]
p02641
u810066979
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['\n\nx, n = map(int, input().split())\ntry:\n\tp_li = list(map(int, input().split()))\nexcept:\n\tprint(x)\n\texit()\n\nfor i in range(1000):\n\t\n\tif not((x - i) in p_li):\n\t\tprint(x - i)\n\t\tbreak\n\t\n\tif not((x - i) in p_li):\n\t\tprint(x - i)\n\t\tbreak', 'x, n = map(int, input().split())\ntry:\n\tp_li = list(map(int, input().split()))\nexcept:\n\tprint(x)\n\texit()\n\nfor i in range(100000):\n\t\n\tif not((x - i) in p_li):\n\t\tprint(x - i)\n\t\tbreak\n\t\n\tif not((x + i) in p_li):\n\t\tprint(x + i)\n\t\tbreak']
['Wrong Answer', 'Accepted']
['s656517200', 's383390579']
[9148.0, 9104.0]
[25.0, 32.0]
[230, 230]
p02641
u810348111
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import sys\nX,N = map(int,input().split())\nzettai = 10000\nans = 0\nif N == 0:\n print(X)\n sys.exit()\n \na = list(map(int,input().split()))\n\nprint(a)\n\nfor i in range(101,1,-1):\n b = abs(X-i)\n if i in a:\n continue\n elif b <= zettai:\n zettai = b\n ans = i\n\nprint(ans)', 'import sys\nX,N = map(int,input().split())\nzettai = 10000\nans = 0\nif N == 0:\n print(X)\n sys.exit()\n \na = list(map(int,input().split()))\n\n\n\nfor i in range(102,-1,-1):\n b = abs(X-i)\n if i in a:\n continue\n elif b <= zettai:\n zettai = b\n ans = i\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s682796642', 's138477240']
[9200.0, 9180.0]
[25.0, 23.0]
[298, 292]
p02641
u810356688
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
["import sys\ndef input(): return sys.stdin.readline().rstrip()\ndef main():\n x,n=map(int,input().split())\n P = list(map(int,input().split()))\n n_lis = [0]*102\n print(n_lis)\n for p in P:\n n_lis[p] += 1\n dis = 0\n while 1:\n if n_lis[x-dis] == 0:\n print(x-dis)\n break\n elif n_lis[x+dis] == 0:\n print(x+dis)\n break\n dis += 1\n\nif __name__=='__main__':\n main()", "import sys\ndef input(): return sys.stdin.readline().rstrip()\ndef main():\n x,n=map(int,input().split())\n P = list(map(int,input().split()))\n n_lis = [0]*102\n for p in P:\n n_lis[p] += 1\n dis = 0\n while 1:\n if n_lis[x-dis] == 0:\n print(x-dis)\n break\n elif n_lis[x+dis] == 0:\n print(x+dis)\n break\n dis += 1\n\nif __name__=='__main__':\n main()"]
['Wrong Answer', 'Accepted']
['s951579535', 's509070575']
[9140.0, 9144.0]
[26.0, 27.0]
[446, 429]
p02641
u814265211
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, N = list(map(int, input().split()))\nP = list(map(int, input().split()))\nP.sort()\nprint(P)\n\nl = [i for i in range(1, 101)]\nl = list(set(l) - set(P))\nprint(l)\n\nfor i, v in enumerate(l):\n if v > X:\n print(l[i] if l[i]-X < X-l[i-1] else l[i-1])\n exit()\n\nprint(X)', 'X, N = list(map(int, input().split()))\nP = list(map(int, input().split()))\n\nl = [i for i in range(102)]\nl = list(set(l) - set(P))\n\nprint(min(l, key=lambda n: abs(X - n)))']
['Wrong Answer', 'Accepted']
['s532182345', 's131565388']
[9140.0, 9060.0]
[29.0, 27.0]
[278, 170]
p02641
u816171517
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,y=map(int,input().split())\na=0\ns=0\nif y/x>=2:\n for i in range(x+1):\n for k in range(x-i+1):\n a=4*i+2*k\n\n if a==y:\n s+=1\nelse:pass\n\nif s>=1:\n print("Yes")\n\nelse:\n print("No")\n', 'x,n=map(int,input().split())\nimport sys\n\nif n>=1:\n p=list(map(int,input().split()))\nelse:\n print(x)\n sys.exit()\ns=[]\nd={}\nl={}\nfor i in range(-105,200):\n if i not in p:\n s.append(i)\n\n\nfor k in s:\n\n d[k]=abs(x-k)\n\n\nl=[m[0] for m in d.items() if m[1]==min(d.values())]\nprint(min(l))\n']
['Wrong Answer', 'Accepted']
['s716322432', 's857957108']
[9184.0, 9188.0]
[20.0, 26.0]
[229, 303]
p02641
u816631826
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, N = map(int, input().split())\njudge = 102*[1]\nif N==0: # if n == 0 exit\n\tprint(X)\n\texit()\n \nP = list(map(int, input().split())) # peratte the p into a list\nfor i in range(N):\n\tjudge[P[i]] = 0\n \nupcnt = 0 # initalize the count\nwhile judge[X+upcnt]==0:\n\tupcnt+=1 #increament the count\n \ndowncnt = 0\n\n# Time complixity O(N)', 'X, N = map(int, input().split()) #asking for input\np = list(map(int, input().split())) #asking for input\nfor d in range(X + 1): #doing loop\n for s in [-1, +1]:\n a = X + s * d\n if p.count(a) == 0:\n print(a)\n exit(0)\n']
['Wrong Answer', 'Accepted']
['s233788078', 's370853958']
[9036.0, 9128.0]
[24.0, 30.0]
[323, 284]
p02641
u821251381
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X,N,*P = map(int,open(0).read().split())\nif P != []:\n P = sorted(list(map(int,P.split())),reverse=True)\nelse:\n print(X)\n exit()\n\nmin_diff = 101\nmin_val = 101\n\nif N == 100:\n if X <=50:\n ans = 0\n else:\n ans = 101\nelse:\n for i in range(100,-1,-1):\n #print(i,min_val,min_val)\n if not i in P:\n if abs(X-i) <= min_diff and min_val >i:\n \tmin_diff = abs(X-i)\n \tmin_val = i\n ans = min_val\nprint(ans)', 'X,N,*P = map(int,open(0).read().split())\nif P != []:\n P = sorted(list(P),reverse=True)\nelse:\n print(X)\n exit()\n\nmin_diff = 101\nmin_val = 101\n\nfor i in range(101,-1,-1):\n #print(i,min_val,min_val)\n if not i in P:\n if abs(X-i) <= min_diff and min_val >=i:\n min_diff = abs(X-i)\n min_val = i\n ans = min_val\nprint(ans)']
['Runtime Error', 'Accepted']
['s343157178', 's959002173']
[9204.0, 8972.0]
[25.0, 31.0]
[424, 332]
p02641
u822090837
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X,N=map(int, input().split())\np=list(map(int,input().split()))\np.sort() \nfor k in range(0,51):\n if not X-k in p:\n print(X-k)\n break \n elif not X+k in p_list:\n print(X+k)\n break', 'X,N=map(int, input().split())\np=list(map(int,input().split())) \nif N==0:\n print(X)\nelse:\n for k in range(0,58):\n if not X-k in p:\n print(X-k)\n break \n elif not X+k in p_list:\n print(X+k)\n break', 'X,N=map(int, input().split())\np=list(map(int,input().split()))\np.sort() \nif N==0:\n print(X)\nelse:\n for k in range(0,51):\n if not X-k in p:\n print(X-k)\n break \n elif not X+k in p_list:\n print(X+k)\n break', 'X,N=map(int, input().split())\np=list(map(int,input().split()))\np.sort() \nfor k in range(0,51):\n if not X-k in p:\n print(X-k)\n break \n elif not X+i in p_list:\n print(X+i)\n break\n ', 'X,N=map(int, input().split())\np=list(map(int,input().split())) \nif N==0:\n print(X)\nelse:\n for k in range(0,51):\n if not X-k in p:\n print(X-k)\n break \n elif not X+k in p_list:\n print(X+k)\n break', 'X,N=map(int, input().split())\np=list(map(int,input().split())) \nif N==0:\n print(X)\nelse:\n for k in range(0,51):\n if not X-k in p:\n print(X-k)\n break \n elif not X+k in p:\n print(X+k)\n break']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s209871639', 's447579644', 's635067757', 's712076115', 's947945121', 's505676039']
[9176.0, 9180.0, 9180.0, 9108.0, 9180.0, 9172.0]
[24.0, 26.0, 27.0, 24.0, 26.0, 24.0]
[213, 259, 269, 222, 259, 254]
p02641
u828261239
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n = map(int,input().split())\nif(n==0):\n print(x)\n return\n\np = list(map(int,input().split()))\n\nl = list(range(min(p),max(p)+1))\n\nrl = set(l) - set(p)\nm = max(p)\nfor i in rl:\n \n if(abs(i-x) < m):\n m = abs(i-x)\n ans = i\n\nprint(ans)', 'def resolve():\nx,n = map(int,input().split())\nif(n==0):\n print(x)\n exit\n\np = list(map(int,input().split()))\n\nl = list(range(min(p),max(p)+1))\n\nrl = set(l) - set(p)\nm = max(p)\nfor i in rl:\n if(abs(i-x) < m):\n m = abs(i-x)\n ans = i\nprint(ans)', 'x,n = map(int,input().split())\np = list(map(int,input().split()))\n\n\nm = 100\nans=100\n\nfor i in range(0,103):\n if(i in p):\n continue\n\n elif(abs(i-x) < m):\n m = abs(i-x)\n ans = i\n\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s351231086', 's468475257', 's428985280']
[9064.0, 8924.0, 8992.0]
[29.0, 30.0, 29.0]
[259, 266, 216]
p02641
u828263279
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
["x, n = input().split(' ')\nline = input()\nif line == '':\n print(x)\n exit()\n\nx = int(x)\n\nalist = line.split(' ')\nfor i in range(int(n)):\n alist[i] = int(alist[i])\nif not x in alist:\n print(x)\n exit()\n\nblist = [i for i in range(1,101)]\nbset = set(blist)\naset = set(alist)\ncset = bset-aset\nclist = list(cset)\nclist.append(x)\nclist.sort()\n\ncount = 0\nfor i,v in enumerate(alist):\n if v == int(x):\n count = i\nif count == 0:\n print(alist[1])\nelif count == 99:\n print(alist[-2])\nelse:\n minx = x - alist[count-1]\n maxx = alist[count+1]-x\n if minx > maxx:\n print(alist[count+1])\n else:\n print(alist[count-1])", "x, n = input().split(' ')\nline = input()\nif line == '':\n print(x)\n exit()\n\nx = int(x)\n\nalist = line.split(' ')\nfor i in range(int(n)):\n alist[i] = int(alist[i])\nif not x in alist:\n print(x)\n exit()\n\nblist = [i for i in range(1,101)]\nbset = set(blist)\naset = set(alist)\ncset = bset-aset\nclist = list(cset)\nclist.append(x)\nclist.sort()\n\ncount = 0\nfor i,v in enumerate(clist):\n if v == x:\n count = i\n print(len(clist),i,v,x)\nif count == 0:\n print(clist[1])\nelif count == len(clist)-1:\n print(clist[-2])\nelse:\n minx = x - clist[count-1]\n maxx = clist[count+1]-x\n if minx > maxx:\n print(clist[count+1])\n else:\n print(clist[count-1])", "x, n = input().split(' ')\nline = input()\nif line == '':\n print(x)\n exit()\n\nx = int(x)\n\nalist = line.split(' ')\nfor i in range(int(n)):\n alist[i] = int(alist[i])\nif not x in alist:\n print(x)\n exit()\n\nblist = [i for i in range(0,102)]\nbset = set(blist)\naset = set(alist)\ncset = bset-aset\nclist = list(cset)\nclist.append(x)\nclist.sort()\n\ncount = 0\nfor i,v in enumerate(clist):\n if v == x:\n count = i\nif count == 0:\n print(clist[1])\nelif count == len(clist)-1:\n print(clist[-2])\nelse:\n minx = x - clist[count-1]\n maxx = clist[count+1]-x\n if minx > maxx:\n print(clist[count+1])\n else:\n print(clist[count-1])"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s142417230', 's535985467', 's137998535']
[9268.0, 9272.0, 9264.0]
[20.0, 22.0, 23.0]
[654, 691, 659]
p02641
u833738197
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
["x,n = map(int,input().split())\nP = list(map(int,input().split()))\n\n\nall_l = [i for i in range(1,101)]\nfor p in P:\n all_l.remove(p)\n\nans = []\nc = 0\ndic = {}\nfor a in all_l:\n if c == 0:\n diff = abs(x-a)\n c+=1\n diff_now = abs(x-a)\n diff = min(diff,diff_now)\n #print(diff,diff_now)\n memo = diff_now\n \n if memo == diff:\n dic['{}'.format(str(a))] = diff\n \n \nl = []\nfor k,v in dic.items():\n l.append(v)\nm = min(l)\nk_list = []\nfor k,v in dic.items():\n if v==m:\n k_list.append(k)\n#print(k_list)\nint(max(k_list))", "x,n = map(int,input().split())\nP = list(map(int,input().split()))\n\n\nall_l = [i for i in range(1,101)]\nfor p in P:\n all_l.remove(p)\n\nans = []\nc = 0\ndic = {}\nfor a in all_l:\n if c == 0:\n diff = abs(x-a)\n c+=1\n diff_now = abs(x-a)\n diff = min(diff,diff_now)\n #print(diff,diff_now)\n memo = diff_now\n \n if memo == diff:\n dic['{}'.format(str(a))] = diff\n \n \nl = []\nfor k,v in dic.items():\n l.append(v)\nm = min(l)\nk_list = []\nfor k,v in dic.items():\n if v==m:\n k_list.append(k)\n#print(k_list)\nmax(k_list)", '#c\nx,n = map(int,input().split())\np_list = list(map(int,input().split()))\n\ndis = 1000\nfor i in range(-100,102):\n if i not in p_list:\n sub = abs(x-i)\n dis = min(dis,sub)\n \nif x-dis in p_list:\n print(x+dis)\nelse:\n print(x-dis)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s172515708', 's211926535', 's730265996']
[9264.0, 9240.0, 9156.0]
[23.0, 22.0, 27.0]
[604, 599, 258]
p02641
u835095496
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
["def run(x, n, num_array):\n '''\n '''\n if len(num_array) == 0:\n print(x)\n return\n \n i = 1\n while True:\n if x - i not in num_array:\n print(x - i)\n print('x-i: x={}, i={}'.format(x, i))\n return\n if x + i not in num_array:\n print(x + i)\n print('x+i: x={}, i={}'.format(x, i))\n return\n i += 1\n \n\nif __name__ == '__main__':\n x, n = list(map(int, input().split()))\n num_array = list(map(int, input().split()))\n run(x, n, num_array)", "def run(x, n, num_array):\n '''\n '''\n if len(num_array) == 0:\n print(x)\n return\n \n i = 0\n while True:\n if x - i not in num_array:\n print(x - i)\n return\n elif x + i not in num_array:\n print(x + i)\n return\n i += 1\n \n\nif __name__ == '__main__':\n x, n = list(map(int, input().split()))\n num_array = list(map(int, input().split()))\n run(x, n, num_array)"]
['Wrong Answer', 'Accepted']
['s532966953', 's311382630']
[9088.0, 9036.0]
[31.0, 24.0]
[558, 460]
p02641
u836080851
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['a = list(map(int,input().split()))\nx = a[0]\nn = a[1]\nif n>0:\n b = list(map(int,input().split()))\n c = list(range(0,101))\n for i in range(n):\n if b[i] in c:\n c.remove(b[i])\n k = 1000\n kn = 0\n for i in range(100-n):\n if k>abs(x-c[i]):\n k = x-c[i]\n kn = c[i]\n print(kn)\nelse:\n print(x)\n ', 'a = list(map(int,input().split()))\nx = a[0]\nn = a[1]\nif n>0:\n b = list(map(int,input().split()))\n c = list(range(-n,101+n))\n\n \n for i in range(n):\n if b[i] in c:\n c.remove(b[i])\n\n \n k = 1000\n kn = 0\n\n for i in range(len(c)):\n if k>abs(x-c[i]):\n k = x-c[i]\n kn = c[i]\n print(kn)\nelse:\n print(x)\n ']
['Wrong Answer', 'Accepted']
['s308778411', 's779798192']
[9212.0, 9208.0]
[24.0, 23.0]
[324, 327]
p02641
u840570107
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = map(int, input().split())\nlis = []\n\nif n == 0:\n print(x)\nelse:\n lis = list(map(int, input().split()))\n if x not in lis:\n print(x)\n else:\n y = x + 1\n z = x - 1\n while True:\n print(y,z)\n if y in lis and z in lis:\n y += 1\n z -= 1\n elif z not in lis:\n print(z)\n break\n elif y not in lis:\n print(y)\n break\n \n', 'x, n = map(int, input().split())\nlis = []\n\nif n == 0:\n print(x)\nelse:\n lis = list(map(int, input().split()))\n if x not in lis:\n print(x)\n else:\n y = x + 1\n z = x - 1\n while True:\n if y in lis and z in lis:\n y += 1\n z -= 1\n elif z not in lis:\n print(z)\n break\n elif y not in lis:\n print(y)\n break\n \n']
['Wrong Answer', 'Accepted']
['s223377485', 's076143572']
[9120.0, 9192.0]
[28.0, 27.0]
[390, 373]
p02641
u840958781
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['if n==0:\n print(x)\n quit()\np=list(map(int,input().split()))\nif x not in p:\n print(x)\n quit()\np.sort()\nans=[]\n\nfor i in range(p[0],p[-1]+1):\n if i not in p:\n ans.append(i)\nans.append(100000000)\nfor i in range(len(ans)):\n if ans[i]>x:\n if abs(x-ans[max(i-1,0)]) <= abs(x-ans[i]):\n print(ans[max(i-1,0)])\n else:\n print(ans[i])\n quit()', 'x,n=map(int,input().split())\nif n==0:\n print(x)\n quit()\np=list(map(int,input().split()))\nif x not in p:\n print(x)\n quit()\ni=0\nwhile True:\n if x-i not in p:\n print(x-i)\n quit()\n elif x+i not in p:\n print(x+i)\n quit()\n i+=1']
['Runtime Error', 'Accepted']
['s515559377', 's407304709']
[9116.0, 9192.0]
[22.0, 22.0]
[406, 270]
p02641
u841531687
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['from bisect import bisect_left\n\nx, n = map(int, input().split())\n\nif n > 0:\n p = sorted(list(map(int, input().split())))\n\n l = bisect_left(p, x)\n print(l,p[l])\n \n for i in range(1,1000):\n #print(p[l]+i)\n if p[l]+i in p:\n pass\n else:\n a = p[l]+i\n break\n\n for i in range(1, -1000, -1):\n if p[l]-i in p:\n pass\n else:\n b = p[l]-i\n break\n print(min(a,b))\nelse:\n print(x)', 'import sys\n\nx,n = map(int, input().split())\np = sorted(list(map(int, input().split())))\nres = [x,-1]\nfor i in range(101):\n a = x - i\n b = x + i\n if a not in p:\n print(a)\n sys.exit()\n if b not in p:\n print(b)\n sys.exit', 'import sys\n\nx,n = map(int, input().split())\np = sorted(list(map(int, input().split())))\nres = [x,-1]\nfor i in range(101):\n a = x - i\n b = x + i\n if a not in p:\n print(a)\n sys.exit()\n if b not in p:\n print(b)\n sys.exit()']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s884698661', 's934434587', 's578449099']
[9216.0, 9132.0, 9196.0]
[24.0, 23.0, 22.0]
[494, 257, 259]
p02641
u842388336
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = map(int, input().split())\nif n == 0:\n print(x)\nelse:\n list_ = list(map(int, input().split()))\n\ndiff = 0\nwhile True:\n if x-diff not in list_:\n print(x-diff)\n break\n if x+diff not in list_:\n print(x-diff)\n break\n diff+=1', 'x, n = map(int, input().split())\nif n == 0:\n print(x)\nelse:\n list_ = list(map(int, input().split()))\n\n diff = 0\n while True:\n if x-diff not in list_:\n print(x-diff)\n break\n if x+diff not in list_:\n print(x+diff)\n break\n diff+=1']
['Runtime Error', 'Accepted']
['s720785227', 's095365187']
[9180.0, 9180.0]
[27.0, 27.0]
[242, 260]
p02641
u843768197
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, y = map(int, input().split())\np = list(map(int, input().split()))\nans_s = x\nans_l = x\ncount_s = 0\ncount_l = 0\n\nwhile count_s == 0:\n if ans_s in p:\n ans_s -= 1 \n count_s = 1\n print(ans_s)\n else:\n count_s = 0 \n\nwhile count_l == 0:\n if ans_l in p:\n ans_l += 1\n count_l = 1\n print(ans_l)\n else:\n count_l = 0\nif abs(x - ans_s) < abs(ans_l - x):\n print(ans_s-1)\nelse:\n print(ans_l+1)', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\ncounter = 0\n\nfor i in range(1, 101):\n if x in p:\n if counter == 0:\n x -= i\n counter = 1\n else:\n x += i\n counter = 0\n else:\n exit\nprint(x)']
['Wrong Answer', 'Accepted']
['s563361136', 's280667620']
[9160.0, 9132.0]
[2205.0, 29.0]
[454, 278]
p02641
u844123804
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['target = input().split()\ntarget = [int(i) for i in target]\narr = input().split()\narr = [int(i) for i in arr]\n\nif len(arr)==0:\n print(target[0])\nelse:\n i=0\n while(1):\n if target[0]-i in arr:\n i+=1\n else:\n print(target[0]-i)\n break', 'target = input().split()\ntarget = [int(i) for i in target]\ntry:\n arr = input().split()\n arr = [int(i) for i in arr]\nexcept:\n arr = []\n\nif len(arr)==0:\n print(target[0])\nelse:\n i=0\n while(1):\n if target[0]-i in arr and target[0]+i in arr:\n i+=1\n elif target[0]-i not in arr:\n print(target[0]-i)\n break\n elif target[0]+i not in arr:\n print(target[0]+i)\n break']
['Wrong Answer', 'Accepted']
['s407730096', 's754515870']
[9188.0, 9220.0]
[22.0, 24.0]
[253, 397]
p02641
u844895214
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
["import sys \nfrom collections import deque\nsys.setrecursionlimit(10**6)\ndef S(): return sys.stdin.readline().rstrip()\ndef SL(): return map(str,sys.stdin.readline().rstrip().split())\ndef I(): return int(sys.stdin.readline().rstrip())\ndef IL(): return map(int,sys.stdin.readline().rstrip().split())\ndef LS(): return list(sys.stdin.readline().rstrip().split())\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\ndef main():\n x,y = IL()\n bit = 2**x\n for i in range(bit):\n tmp = 0\n for j in range(x):\n if (i>>j)&1:\n tmp += 2\n else:\n tmp += 4\n if y<tmp:\n continue\n if tmp == y:\n print('Yes')\n exit()\n print('No')\n return\n\nif __name__=='__main__':\n main()", "import sys \nfrom collections import deque\nsys.setrecursionlimit(10**6)\ndef S(): return sys.stdin.readline().rstrip()\ndef SL(): return map(str,sys.stdin.readline().rstrip().split())\ndef I(): return int(sys.stdin.readline().rstrip())\ndef IL(): return map(int,sys.stdin.readline().rstrip().split())\ndef LS(): return list(sys.stdin.readline().rstrip().split())\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\n\ndef main():\n x,n = IL()\n p = LI()\n i=0\n while True:\n if i==0:\n if not x in p:\n print(x)\n exit()\n else:\n if not x-i in p:\n print(x-i)\n exit()\n if not x+i in p:\n print(x+i)\n exit()\n i+=1\n return\n\nif __name__=='__main__':\n main()"]
['Wrong Answer', 'Accepted']
['s431373927', 's750488675']
[9416.0, 9476.0]
[2205.0, 26.0]
[806, 816]
p02641
u845847173
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, N = map(int, input().split())\np_list = [str(e) for e in input().split()]\n\nfor i in range(N + 1):\n x = X - i\n y = X + i\n if str(x) in p_list == 0:\n print(x)\n break\n elif str(y) in p_list == 0:\n print(y)\n break', 'X, N = map(int, input().split())\np_list = [int(e) for e in input().split()]\n\nt = 0\nfor i in range(N + 1):\n x = X - i\n y = X + i\n if x in p_list:\n t += 0\n else:\n print(x)\n break\n if y in p_list:\n t += 0\n else:\n print(y)\n break']
['Wrong Answer', 'Accepted']
['s315344241', 's144113319']
[9124.0, 9200.0]
[24.0, 20.0]
[251, 285]
p02641
u848680818
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import numpy as np\nx,n =map(int,input().split())\n\nif n==0:\n print(x)\nelse:\n P =list(map(int,input().split()))\n l = list(range(2*x))\n result = list(set(l) - set(P))\n abs = list(np.abs(np.array(result)-x))\n abs.remove(0)\n min = min(abs)\n print(abs)\n print(result[abs.index(min)])', 'import numpy as np\nx,n =map(int,input().split())\n\nif n==0:\n print(x)\nelse:\n P =list(map(int,input().split()))\n for i in range(100):\n if (x-i) not in P:\n print(x-i)\n break\n elif (x+i) not in P:\n print(x+i)\n break']
['Runtime Error', 'Accepted']
['s282469834', 's047610957']
[27044.0, 27156.0]
[105.0, 101.0]
[278, 223]
p02641
u849229491
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n = map(int,input().split())\np = list(map(int,input().split()))\ntmp = []\nfor i in range(-101,101):\n tmp.append(i)\n\nif n == 0:\n print(x)\nelse:\n for i in p:\n tmp.remove(i)\n \n ans = []\n for i in tmp:\n a = abs(x-i)\n ans.append(a)\n\n b = min(ans)\n print(ans)\n c = x+b\n d = x-b\n\n if c and d in tmp:\n print(d)\n elif c in tmp:\n print(c)\n elif d in tmp:\n print(d)', 'x,n = map(int,input().split())\np = list(map(int,input().split()))\ntmp = []\nfor i in range(-101,102):\n tmp.append(i)\n\nif n == 0:\n print(x)\nelse:\n for i in p:\n tmp.remove(i)\n \n ans = []\n for i in tmp:\n a = abs(x-i)\n ans.append(a)\n \n b = min(ans)\n \n c = x+b\n d = x-b\n \n if c and d in tmp:\n print(d)\n elif c in tmp:\n print(c)\n elif d in tmp:\n print(d)\n']
['Wrong Answer', 'Accepted']
['s522777790', 's438558102']
[9220.0, 9140.0]
[25.0, 21.0]
[436, 429]
p02641
u852870914
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['\n\nfrom collections import defaultdict, deque\nfrom itertools import permutations\nfrom sys import stdin,stdout\nfrom bisect import bisect_left, bisect_right\nfrom copy import deepcopy\nimport heapq\n\nint_input=lambda : int(stdin.readline())\nstring_input=lambda : stdin.readline().split()\nmulti_int_input =lambda : map(int, stdin.readline().split())\nmulti_input = lambda : stdin.readline().split()\nlist_input=lambda : list(map(int,stdin.readline().split()))\nstring_list_input=lambda: list(string_input())\nMOD = pow(10,9)+7\n\n\nx, n = multi_int_input()\n\narr = list_input()\n\narr = set(arr)\n\na = 1\n\nwhile(True):\n l = x+a\n r = x - a\n\n if (l not in arr):\n print(l)\n break\n elif (r not in arr):\n print(r)\n break', '\n\nfrom collections import defaultdict, deque\nfrom itertools import permutations\nfrom sys import stdin,stdout\nfrom bisect import bisect_left, bisect_right\nfrom copy import deepcopy\nimport heapq\n\nint_input=lambda : int(stdin.readline())\nstring_input=lambda : stdin.readline().split()\nmulti_int_input =lambda : map(int, stdin.readline().split())\nmulti_input = lambda : stdin.readline().split()\nlist_input=lambda : list(map(int,stdin.readline().split()))\nstring_list_input=lambda: list(string_input())\nMOD = pow(10,9)+7\n\n\nx, n = multi_int_input()\n\narr = list_input()\n\narr = set(arr)\n\na = 0\n\nwhile(True):\n l = x - a\n r = x + a\n\n if (l not in arr):\n print(l)\n break\n elif (r not in arr):\n print(r)\n break\n\n a+=1']
['Wrong Answer', 'Accepted']
['s054748921', 's008940579']
[9540.0, 9596.0]
[2205.0, 27.0]
[762, 774]