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
u230621983
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())\nans1 = x\nwhile ans1 in p:\n ans1 += 1\nans2 = x\nwhile ans2 in p:\n ans2 -= 1\n\nprint(min(ans1,ans2))', 'x, n, *p = map(int, open(0).read().split())\nans1 = x\nwhile ans1 in p:\n ans1 += 1\nans2 = x\nwhile ans2 in p:\n ans2 -= 1\n\nif abs(ans2-x) < abs(ans1-x):\n print(ans2)\nelif abs(ans2-x) > abs(ans1 - x):\n print(ans1)\nelse:\n print(min(ans1,ans2))']
['Wrong Answer', 'Accepted']
['s661993592', 's426868996']
[9108.0, 9216.0]
[23.0, 22.0]
[146, 252]
p02641
u231570044
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 P = set(list(map(int, input().split())))\nelse:\n print(X)\n exit(0)\n\ndist = 100\nr = None\nfor i in range(100, -1, -1):\n if not i in P and abs(X-i) <= dist:\n dist = abs(X-i)\n print (i, dist)\n r = i\n\nprint(r)\n', 'X, N = list(map(int, input().split()))\nif N!=0:\n P = set(list(map(int, input().split())))\nelse:\n print(X)\n exit(0)\n\ndist = 100\nr = None\nfor i in range(105, -1, -1):\n if not i in P and abs(X-i) <= dist:\n dist = abs(X-i)\n r = i\n\nprint(r)\n']
['Wrong Answer', 'Accepted']
['s074954092', 's119733319']
[9124.0, 9072.0]
[24.0, 28.0]
[286, 262]
p02641
u232652798
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 = [int(x) for x in input().split()]\narray = [int(x) for x in input().split()]\nplus = X\nminus = X\nif N == 0:\n print(X)\n exit()\nwhile True:\n plus += 1\n minus -= 1\n print(plus)\n print(minus)\n if minus not in array:\n print(minus)\n exit()\n if plus not in array:\n print(plus)\n exit()\n\n\n', 'X, N = [int(x) for x in input().split()]\narray = [int(x) for x in input().split()]\nplus = X\nminus = X\nif N == 0:\n print(N)\n exit()\nwhile True:\n plus += 1\n minus -= 1\n print(plus)\n print(minus)\n if minus not in array:\n print(minus)\n exit()\n if plus not in array:\n print(plus)\n exit()\n\n\n', 'X, N = [int(x) for x in input().split()]\narray = [int(x) for x in input().split()]\nplus = X\nminus = X\nif N == 0:\n print(X)\n exit()\nwhile True:\n plus += 1\n minus -= 1\n\n print(minus)\n if minus not in array:\n print(minus)\n exit()\n if plus not in array:\n print(plus)\n exit()\n\n\n', 'X, N = [int(x) for x in input().split()]\n\ndef main(X, N):\n if N == 0:\n return X\n arrp = [int(x) for x in input().split()]\n minus = X\n plus = X\n while True:\n if minus not in arrp:\n print(minus)\n exit()\n if plus not in arrp:\n print(plus)\n exit()\n minus -= 1\n plus += 1\n\nprint(main(X, N))']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s288264428', 's424358655', 's826816108', 's446996115']
[8976.0, 9052.0, 9120.0, 9204.0]
[30.0, 28.0, 30.0, 26.0]
[337, 337, 322, 379]
p02641
u234410680
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 p = list(map(int, input().split()))\n ans = 9999999999\n lists = []\n if n == 0:\n print(x)\n exit()\n for i in range(-1000, 1000):\n if not i in p:\n lists.append(i)\n for i in lists:\n if ans > abs(x - i):\n ans = abs(x-i)\n m = i\n \n print(m)', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\nans = 9999999999\nlists = []\nif n == 0:\n print(x)\n exit()\nfor i in range(-1000, 1000):\n if not i in p:\n lists.append(i)\nfor i in lists:\n if ans > abs(x - i):\n ans = abs(x-i)\n m = i\nprint(m)']
['Runtime Error', 'Accepted']
['s763978188', 's117175520']
[8792.0, 8936.0]
[25.0, 31.0]
[356, 290]
p02641
u235027735
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 ans = x\n\nd = float('inf')\n\nfor i in range(n+1):\n tmpx = x + 1 + n//2 - i\n if not tmpx in p:\n tmpd = abs(x -tmpx) \n if d >= tmpd:\n d = tmpd\n if ans >= tmpx:\n ans = tmpx\n\nprint(ans)\n\n\n", "x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nif n == 0:\n ans = x\n\nd = float('inf')\n\nfor i in range(n+1):\n tmpx = x + 1 + n//2 - i\n if not tmpx in p:\n tmpd = abs(x -tmpx) \n if d >= tmpd:\n d = tmpd\n if ans >= tmpx:\n ans = tmpx\n\nprint(ans)\n\n\n", "x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nif n == 0:\n ans = x\n\nd = float('inf')\n\nfor i in range(n+1):\n tmpx = x + 1 + n//2 - i\n if not tmpx in p:\n tmpd = abs(x -tmpx) \n if d >= tmpd:\n d = tmpd\n if ans > tmpx\n ans = tmpx\n\nprint(ans)\n\n\n", "x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nif n == 0:\n ans = x\nelse:\n ans = float('inf')\n\nd = float('inf')\n\nfor i in range(n+2):\n tmpx = x + 1 + n//2 - i\n if not tmpx in p:\n tmpd = abs(x -tmpx) \n if d >= tmpd:\n d = tmpd\n if ans >= tmpx:\n ans = tmpx\n\nprint(ans)\n\n\n"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s307627154', 's803295371', 's965846469', 's876768921']
[9184.0, 9132.0, 9044.0, 9212.0]
[29.0, 27.0, 25.0, 26.0]
[324, 324, 322, 353]
p02641
u236536206
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())\nif n==0:\n print(x)\n sys.exit()\nelse:\n p=list(map(int,input().split()))\n res=1000\n ans=0\n for i in range(1,101):\n p.append(i)\n if len(p)==len(set(p)):\n if res>=abs(x-i):\n res=abs(x-i)\n ans=i\n del p[-1]\n for i in range(n):\n if x+(x-ans)!=p[i]:\n print(x+(x-ans))\n sys.exit()\n print(ans)', 'import sys\nx,n=map(int,input().split())\nif n==0:\n print(x)\n sys.exit()\nelse:\n p=list(map(int,input().split()))\n res=1000\n for i in range(1,101):\n p.append(i)\n if len(p)==len(set(p)):\n if res>=abs(x-i):\n res=abs(x-i)\n ans=i\n del p[-1]\n for i in range(n):\n if x+(x-ans)!=p[i]:\n print(x+(x-ans))\n sys.exit()\n print(ans)', 'import sys\nx,n=map(int,input().split())\nif n==0:\n print(x)\n sys.exit()\nelse:\n p=list(map(int,input().split()))\n res=1000\n ans=0\n for i in range(101,-101,-1):\n p.append(i)\n if len(p)==len(set(p)):\n if res>=abs(x-i):\n res=abs(x-i)\n ans=i\n del p[-1]\n print(ans)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s122055081', 's879890429', 's088555178']
[9212.0, 9160.0, 9144.0]
[21.0, 21.0, 19.0]
[438, 428, 341]
p02641
u242576923
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\na = input()\na, b = a.split()\na = int(a)\nif int(b) == 0:\n print(a)\n exit()\nn = input()\nn = [int(i) for i in n.split()]\nli = list(range(-101, 101))\nprint(li)\nfor i in n:\n li.remove(i)\nmini = [np.inf, 0]\nfor i in li:\n if abs(i - a) == mini[0]:\n if i < mini[1]:\n mini = [abs(i - a), i]\n elif abs(i - a) < mini[0]:\n mini = [abs(i - a), i]\nprint(mini[1])', 'import numpy as np\n\na = input()\na, b = a.split()\na = int(a)\nif int(b) == 0:\n print(a)\n exit()\nn = input()\nn = [int(i) for i in n.split()]\nli = list(range(-250, 250))\nfor i in n:\n li.remove(i)\nmini = [np.inf, 0]\nfor i in li:\n if abs(i - a) == mini[0]:\n if i < mini[1]:\n mini = [abs(i - a), i]\n elif abs(i - a) < mini[0]:\n mini = [abs(i - a), i]\nprint(mini[1])']
['Wrong Answer', 'Accepted']
['s112421309', 's689889120']
[27148.0, 27164.0]
[115.0, 100.0]
[384, 374]
p02641
u243572357
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())\nlst = [int(input()) for _ in range(n)]\na = 100\nb = ''\n\nfor i in range(1, 102):\n if i in lst:\n continue\n\n if a > abs(x-i):\n a = abs(x-i)\n b = i\n\nprint(i)", 'x, n = map(int, input().split())\nlst = [int(input()) for _ in range(n)]\na = 100\nb = 0\n\nfor i in range(1, 102):\n if i in lst:\n continue\n\n if a > abs(x-i):\n a = abs(x-i)\n b = i\n\nprint(i)', 'x, n = map(int, input().split())\nlst = []\nif n > 0:\n lst = list(map(int, input().split()))\na = 100\nb = 0\n\nfor i in range(0, 102):\n if i in lst:\n continue\n\n if a > abs(x-i):\n a = abs(x-i)\n b = i\n\nprint(i)', 'x, n = map(int, input().split())\nlst = list(map(int, input().split()))\na = 100\nb = 0\n\nfor i in range(1, 102):\n if i in lst:\n continue\n\n if a > abs(x-i):\n a = abs(x-i)\n b = i\n\nprint(i)', 'x, n = map(int, input().split())\nlst = []\nif n > 0:\n lst = list(map(int, input().split()))\na = 100\nb = 0\n\nfor i in range(0, 102):\n if i in lst:\n continue\n\n if a > abs(x-i):\n a = abs(x-i)\n b = i\n\nprint(b)']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s236994603', 's523354293', 's537719431', 's685362801', 's471048456']
[9172.0, 9104.0, 8952.0, 9032.0, 8832.0]
[25.0, 26.0, 31.0, 31.0, 28.0]
[196, 195, 215, 194, 215]
p02641
u244416620
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 p = list(map(int, input().split()))\nelse:\n print(x)\n\n# x, n = 10, 5\n# p = [4, 7, 10, 6, 5]\n\n\n\npl = min(p)-1\npr = max(p)+1\nnpl = list(range(pl, pr))\nnp = list(set(npl) - set(p))\nnp.sort()\n\n\nmx = x\nres = x\nfor k in np:\n t = abs(k - x)\n if t < mx:\n mx = t\n res = k\n\nprint(k)', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\n\n# x, n = 10, 5\n# p = [4, 7, 10, 6, 5]\n\n\n\np.sort()\npl = min(p)-1\npr = max(p)+1\nnpl = list(range(pl, pr))\nnp = list(set(npl) - set(p))\nnp.sort()\n\n\nmx = x\nres = x\nfor k in np:\n t = abs(k - x)\n if t < mx:\n mx = t\n res = k\n\nprint(k)', 'x, n = map(int, input().split())\nif n != 0:\n p = list(map(int, input().split()))\n\n# x, n = 10, 5\n# p = [4, 7, 10, 6, 5]\n\n\n\npl = min(p)-1\npr = max(p)+1\nnpl = list(range(pl, pr))\nnp = list(set(npl) - set(p))\nnp.sort()\n\n\nmx = x\nres = x\nfor k in np:\n t = abs(k - x)\n if t < mx:\n mx = t\n res = k\n\nprint(k)', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\nif n == 0:\n print(x)\n exit()\n \n# x, n = 10, 5\n# p = [4, 7, 10, 6, 5]\n\n# x, n = 6, 5\n# p = [4, 7, 10, 6, 5]\n\n# x, n = 1, 1\n# # p = list(range(1, 101))\n# p = [1]\n\n\npl = min(p)-1\npr = max(p)+2\nnpl = list(range(pl, pr))\nnp = list(set(npl) - set(p))\nif len(np) == 0:\n print(x)\n exit()\nnp.sort()\n\n\nmx = x\nres = np[0]\nfor k in np:\n t = abs(k - x)\n if t < mx:\n mx = t\n res = k\n \nprint(res)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s069093803', 's457290151', 's860207974', 's676030327']
[9196.0, 9136.0, 9196.0, 9228.0]
[21.0, 19.0, 20.0, 24.0]
[470, 450, 453, 607]
p02641
u244466744
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\nmin =10000\ntemp = 0\n\nfor i in range(-1000, 1000):\n temp = abs(X - i)\n \n if temp < min and i not in p:\n min = temp\n \nprint(min)\n', 'x, N = int(input().split())\np = list(map(int, int().split()))\n\nmin =10000\ntemp = 0\n\nfor i in range(-1000, 1000):\n temp = abs(X - i)\n \n if temp < min and i not in p:\n min = temp\n \nprint(min)', 'x, N = int(input().split())\np = list(map(int, input().split()))\n\nmin =10000\ntemp = 0\n\nfor i in range(-1000, 1000):\n temp = abs(X - i)\n \n if temp < min and i not in p:\n min = temp\n \nprint(min)\n', 'x, N = map(int, input().split())\np = list(map(int, input().split()))\n\nmin =10000\ntemp = 0\n\nfor i in range(-1000, 1000):\n temp = abs(x- i)\n \n if temp < min and i not in p:\n min = temp\n \nprint(min)\n', 'x, N = map(int, input().split())\np = list(map(int, input().split()))\n\nmin =10000\ntemp = 0\nnum = 10000\n\nfor i in range(-1000, 1000):\n temp = abs(x- i)\n \n if temp < min and i not in p:\n min = temp\n num = i\n \nprint(num)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s274286112', 's510191410', 's517074086', 's665753385', 's136779225']
[8988.0, 9120.0, 9040.0, 9132.0, 9076.0]
[22.0, 25.0, 22.0, 34.0, 28.0]
[206, 198, 201, 205, 229]
p02641
u250554058
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()))\nlist_p = [i for i in range(-1, 102)] \nt = x\nnum = x\n\nif(x == n):\n print(x - 1)\n sys.exit()\n\nfor i in p:\n list_p[i + 1] = -2\n\nfor i in range(len(list_p)):\n if(list_p[i] == -2):\n continue\n else:\n if(abs(list_p[i] - x) <= t):\n t = abs(list_p[i] - x)\n num = min(num, list_p[i])\n\nprint(num) \n', 'import sys\n\nx, n = map(int, input().split())\np = list(map(int, input().split()))\nlist_p = [i for i in range(-1, 102)] \nt = x\nnum = x\n\nif(x == n):\n print(x - 1)\n sys.exit()\n\nfor i in p:\n list_p[i + 1] = -2\n\nfor i in range(len(list_p)):\n if(list_p[i] == -2):\n continue\n else:\n if(abs(list_p[i] - x) <= t):\n if(abs(list_p[i] - x) != t):\n t = abs(list_p[i] - x)\n num = list_p[i]\n elif:\n t = abs(list_p[i] - x):\n num = min(num, list_p[i])\n\nprint(num) \n', 'import sys\n\nx, n = map(int, input().split())\np = list(map(int, input().split()))\nlist_p = [i for i in range(-1, 102)] \nt = x\nnum = x\n\nfor i in p:\n list_p[i + 1] = -2\n\nfor i in range(len(list_p)):\n if(list_p[i] == -2):\n continue\n else:\n if(abs(list_p[i] - x) <= t):\n if(abs(list_p[i] - x) < t):\n t = abs(list_p[i] - x)\n num = list_p[i]\n elif(abs(list_p[i] - x) == t):\n t = abs(list_p[i] - x)\n num = min(num, list_p[i])\nprint(num) \n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s615407707', 's958283183', 's282820238']
[9216.0, 9016.0, 9108.0]
[21.0, 24.0, 23.0]
[389, 496, 477]
p02641
u255943004
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(i) for i in input().split()]\nfor i in range(1,100):\n if i in P:\n pass\n else:\n if abs(X-ans) > abs(X-i):\n ans = i\nprint(ans) if N != 0 else print(X)', 'X,Y = map(int,input().split())\nP = [int(i) for i in input().split()]\ntemp1 = 1000\nans = 1000\nfor p in P:\n temp2 = abs(X-p)\n if temp1 > temp2 and temp2 != 0:\n ans = p\n temp1 = temp2\nprint(ans)', 'X,N = map(int,input().split())\nA = [int(i) for i in input().split()]\n\nans = 0\n\nfor i in range(1,102):\n if i in A:\n pass\n else:\n if abs(ans - X) > abs(i-X):\n ans = i\nprint(ans)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s355957482', 's754585410', 's893375042']
[9188.0, 9120.0, 9104.0]
[24.0, 24.0, 28.0]
[218, 211, 188]
p02641
u257823704
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.
['temp1 = input().split(" ")\ntemp1 = [int(i) for i in temp1]\nx = temp1[0]\nn = temp1[1]\n\nif not n == 0:\n temp2 = input().split(" ")\n temp2 = [int(i) for i in temp2]\nelse:\n temp2 = []\n\ncounter = 1\nwhile True:\n if n == 0:\n print(x)\n break\n\n mx = x - counter\n px = x + counter\n\n if not mx in pn:\n print(mx)\n break\n if not px in pn:\n print(px)\n break\n\n counter += 1', 'temp1 = input().split(" ")\ntemp1 = [int(i) for i in temp1]\nx = temp1[0]\nn = temp1[1]\n\nif not n == 0:\n temp2 = input().split(" ")\n temp2 = [int(i) for i in temp2]\nelse:\n temp2 = input()\n temp2 = []\n\npn = temp2\n\ncounter = 0\nwhile True:\n if n == 0:\n print(x)\n break\n\n mx = x - counter\n px = x + counter\n\n if not mx in pn:\n print(mx)\n break\n if not px in pn:\n print(px)\n break\n\n counter += 1']
['Runtime Error', 'Accepted']
['s630869747', 's595915328']
[9152.0, 9148.0]
[25.0, 22.0]
[427, 459]
p02641
u263660661
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.
['package main\n\nimport (\n\t"fmt"\n\t"math"\n\t"sort"\n)\n\nfunc main() {\n\tvar X, N int\n\tfmt.Scanf("%d", &X)\n\tfmt.Scanf("%d", &N)\n\n\tP := make([]int, N)\n\tfor i := 0; i < N; i++ {\n\t\tfmt.Scanf("%d", &P[i])\n\t}\n\tsort.Ints(P)\n\tfmt.Println(P)\n\n\tvar a int = -1\n\tif len(P) > 0 {\n\t\tfor p := 0; p < 102; p++ {\n\t\t\tif math.Abs(float64(X) - float64(p)) < math.Abs(float64(X) - float64(a)) && !Contain(P, p) {\n\t\t\t\ta = p\n\t\t\t}\n\t\t}\n\t} else {\n\t\ta = X\n\t}\n\tfmt.Println(a)\n}\n\nfunc Contain(s []int, e int) bool {\n\tfor _, v := range s {\n\t\tif e == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n', 'X, N = map(int, input().split())\nP = sorted(list(map(int, input().split())))\n\na = -1\nif len(P) > 0:\n for p in range(0, 102):\n if abs(X - p) < abs(X - a) and (p not in P):\n a = p\nelse:\n a = X\n\nprint(a)\n']
['Runtime Error', 'Accepted']
['s288995020', 's408480769']
[8948.0, 9176.0]
[23.0, 24.0]
[554, 225]
p02641
u266795424
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()))\nif not a[1] ==0:\n b = list(map(int,input().split()))\n b2 = sorted(b)\n if abs(a[0]-b2[0]) <= abs(a[0]-b2[a[1]-1]):\n c = b2[0]-a[0]\n else:\n c = b2[a[1]-1]-a[0] \n if a[0] < b2[0]:\n print(a[0])\n elif a[0] > b2[a[1]-1]:\n print(a[0])\n else:\n for i in range(a[1]-1):\n if abs(b2[i+1]-b[i])>1:\n for j in range(b2[i+1]-b2[i]-1):\n if abs(c) > abs(b2[i]-a[0]+j+1):\n c = b2[i]-a[0]+j+1\n print(c+a[0])\nelse:\n print(a[0])', 'a = list(map(int,input().split()))\nif not a[1] ==0:\n b = list(map(int,input().split()))\n b2 = sorted(b)\n if abs(a[0]-b2[0]) <= abs(a[0]-b2[a[1]-1]):\n c = b2[0]-a[0]-1\n else:\n c = b2[a[1]-1]-a[0]+1\n if a[0] < b2[0]:\n print(a[0])\n elif a[0] > b2[a[1]-1]:\n print(a[0])\n else:\n for i in range(a[1]-1):\n if abs(b2[i+1]-b[i])>1:\n for j in range(b2[i+1]-b2[i]-1):\n if abs(c) > abs(b2[i]-a[0]+j+1):\n c = b2[i]-a[0]+j+1\n elif abs(c) == abs(b2[i]-a[0]+j+1) and c > b2[i]-a[0]+j+1:\n c = b2[i]-a[0]+j+1\n print(c+a[0])\nelse:\n print(a[0])']
['Wrong Answer', 'Accepted']
['s438018003', 's001970451']
[9260.0, 9280.0]
[23.0, 24.0]
[605, 708]
p02641
u268762839
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 == 100:\n print("")\nelif n > 0:\n ps = list(map(int, input().split()))\nelse:\n print(x)\nexit()\nnums = [n for n in range(1, 101) if n not in ps]\n\nabs_plus = sorted([n-x for n in nums if n-x >= 0])\nabs_minus = sorted([-(n-x) for n in nums if n-x < 0])\nif abs_plus == []:\n print(x-abs_minus[0])\nelif abs_minus == []:\n print(x+abs_plus[0])\nelif abs_plus[0] >= abs_minus[0]:\n print(x-abs_minus[0])\nelse:\n print(x+abs_plus[0])', 'x, n = map(int, input().split())\nif n > 0:\n ps = list(map(int, input().split()))\nelse:\n print(x)\n exit()\nnums = [n for n in range(-1, 102) if n not in ps]\n\nabs_plus = sorted([n-x for n in nums if n-x >= 0])\nabs_minus = sorted([-(n-x) for n in nums if n-x < 0])\nif abs_plus == []:\n print(x-abs_minus[0])\nelif abs_minus == []:\n print(x+abs_plus[0])\nelif abs_plus[0] >= abs_minus[0]:\n print(x-abs_minus[0])\nelse:\n print(x+abs_plus[0])']
['Wrong Answer', 'Accepted']
['s802150664', 's084669879']
[9228.0, 9224.0]
[23.0, 21.0]
[476, 452]
p02641
u271064067
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 p = list(map(int,input().split()))\n p = []\nelse:\n print(x)\n\np_change = []\nm = 0\nfor i in p:\n p_change.append(abs(i-x))\n\nif x in p:\n for i in range(n):\n if i != 0 and p_change.count(i) != 2:\n m = i\n break\n if x-m in p:\n print(x+m)\n else:\n print(x-m)\nelse:\n print(x)', 'x, n = map(int,input().split())\nif n != 0:\n p = list(map(int,input().split()))\np_change = []\nm = 0\nif n == 0:\n print(x) \n\nfor i in p:\n p_change.append(abs(i-x))\n\nif x in p_change:\n\tpass\nelse:\n print(x)\n \nfor i in range(n):\n if i != 0 and p_change.count(i) != 2:\n m = i\n break\nif x-m in p_change:\n print(x+m)\nelse:\n print(x-m)\n\n\n', 'x, n = map(int,input().split())\nif n != 0:\n p = list(map(int,input().split()))\np_change = []\nm = 0\nif n == 0:\n print(x)\nelse:\n for i in p:\n p_change.append(abs(i-x))\n \n if x in p:\n for i in range(n+1):\n if i != 0 and p_change.count(i) != 2:\n m = i\n break\n if x-m in p:\n print(x+m)\n else:\n print(x-m)\n else:\n print(x)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s259191938', 's881678354', 's890189253']
[9208.0, 9196.0, 9212.0]
[23.0, 22.0, 24.0]
[369, 360, 425]
p02641
u275710783
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())\nif N == 0:\n print(X)\nelse:\n p = sorted(list(map(int, input().split())))\n ok = [i for i in range(p[0]-1, p[-1]+1) if i not in p]\n print(ok)\n ix = np.argmin(list(map(lambda a: abs(X-a), ok)))\n print(ok[ix])\n', 'import numpy as np\nX, N = map(int, input().split())\nif N == 0:\n print(X)\nelse:\n p = sorted(list(map(int, input().split())))\n ok = [i for i in range(-101, 201) if i not in p]\n ix = np.argmin(list(map(lambda a: abs(X-a), ok)))\n print(ok[ix])\n']
['Wrong Answer', 'Accepted']
['s858981098', 's830762859']
[27016.0, 26988.0]
[116.0, 117.0]
[275, 255]
p02641
u275726913
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=set(map,int(input().split()))\nprint(min([i for i in range(102) if i not in a],key=lambda y:abs(x-y)))', 'x, n = map(int, input().split())\na = set(map(int, input().split()))\nprint(min([i for i in range(102) if i not in a], key=lambda y:abs(x-y)))']
['Runtime Error', 'Accepted']
['s965897720', 's956708161']
[9068.0, 9172.0]
[22.0, 25.0]
[132, 140]
p02641
u278260569
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 X_u = X - 1\n X_l = X + 1\n while judge:\n X_u += 1\n X_l -= 1\n if X_u not in p and X_l not in p:\n print(X_l)\n break\n elif X_u not in p:\n print(X_u)\n break\n elif X_l not in p:\n print(X_l)\n break\n else:\n if X_u == X_l:\n p.remove(X_u)\n else:\n p.remove(X_u)\n p.remove(X_l)', 'X ,N = map(int,input().split())\nif N == 0:\n print(X)\nelse:\n p = list(map(int,input().split()))\n\n add_minus = -1\n while True:\n add_minus += 1\n if (X - add_minus) not in p:\n print(X - add_minus)\n break\n elif (X + add_minus) not in p:\n print(X+add_minus)\n break\n ']
['Runtime Error', 'Accepted']
['s917923140', 's751477926']
[9144.0, 9176.0]
[21.0, 24.0]
[552, 344]
p02641
u279266699
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\ndiff = 1000\nfor i in range(-100, 110):\n if i in p:\n continue\n if abs(i - x) < diff:\n diff = abs(i - x)\n print(diff)\n ans = i\n\nprint(ans)', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\ndiff = 1000\nfor i in range(-100, 110):\n if i in p:\n continue\n if abs(i - x) < diff:\n diff = abs(i - x)\n ans = i\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s267434924', 's833616355']
[9188.0, 9188.0]
[22.0, 23.0]
[240, 220]
p02641
u281733053
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.
['lst1 = input().split()\nlst2 = input().split()\n\nfirst = int(lst1[0])\nnow = 0\nplm = 1\nflag = 0\nwhile flag == 0:\n if plm == -1:\n plm = 1\n else:\n now += 1\n plm = -1\n for i in lst2:\n if first+now*plm == int(i):\n break\n flag = 1\nprint(first+now*plm)', 'lst1 = input().split()\nlst2 = input().split()\nkey = int(lst1[0])\nlst = []\nfor i in range(102):\n lst.append(i)\nfor i in lst2:\n lst.remove(int(i))\nfor i in range(len(lst)):\n if lst[i] > key:\n break\nif lst[i] - key < key - lst[i-1]:\n print(lst[i])\nelse:\n print(lst[i-1])']
['Wrong Answer', 'Accepted']
['s337317788', 's967317466']
[9164.0, 9200.0]
[2205.0, 22.0]
[298, 289]
p02641
u282908818
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()))\ndiffer=[]\n\nif N == 0:\n print(X)\nelse:\n for i in range(0,102):\n if i not in P:\n differ.append(abs(X - i))\n else:\n differ.append(1000)\n ans = differ.index(min(differ))\n print(differ)\n print(ans)\n', 'X, N = map(int, input().split())\nP = list(map(int, input().split()))\ndiffer=[]\n\nif N == 0:\n print(X)\nelse:\n for i in range(1,100):\n if i not in P:\n differ.append(abs(X - i))\n else:\n differ.append(1000)\n \n ans = differ.index(min(differ))\n\n print(differ)\n print(ans+1)\n', 'X, N = map(int, input().split())\nP = list(map(int, input().split()))\ndiffer=[]\n\nif N == 0:\n print(X)\nelse:\n for i in range(0,100):\n if i not in P:\n differ.append(abs(X - i))\n else:\n differ.append(1000)\n ans = differ.index(min(differ))\n print(differ)\n print(ans)\n', 'X, N = map(int, input().split())\nP = list(map(int, input().split()))\ndiffer=[]\n\nif N == 0:\n print(X)\nelse:\n for i in range(0,102):\n if i not in P:\n differ.append(abs(X - i))\n else:\n differ.append(1000)\n ans = differ.index(min(differ))\n print(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s023315598', 's211122728', 's358705706', 's852660446']
[9188.0, 9188.0, 9056.0, 9184.0]
[19.0, 23.0, 23.0, 23.0]
[313, 321, 313, 295]
p02641
u283719735
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()))\na.sort()\n\nnota = list()\n\nfor i in range(1, 101):\n if i in a:\n continue\n nota.append(i)\n\nprint(nota)\nnota.sort()\nans = 1000\nminabs = 1000\nfor i in nota:\n if minabs > abs(i-x):\n minabs = abs(i-x)\n ans = i\n\nprint(ans)', 'x, n = map(int,input().split())\na = list(map(int, input().split()))\na.sort()\n\nnota = list()\n\nfor i in range(-1000, 1001):\n if i in a:\n continue\n nota.append(i)\n\nnota.sort()\nans = 1000\nminabs = 1000\nfor i in nota:\n if minabs > abs(i-x):\n minabs = abs(i-x)\n ans = i\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s735054853', 's073956207']
[9228.0, 9228.0]
[22.0, 25.0]
[312, 305]
p02641
u284261648
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, intput().split())\n\nm = -1\nfor a in p:\n if m == -1 or (abs(a - x) < abs(m - x)) or (abs(a - x) == abs(m - x) and a < m):\n m = a\n\nprint(m)', 'x, n = map(int, input().split())\nif n > 0:\n p = set(map(int, input().split()))\n i = 0\n while True:\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\n i += 1\nelse:\n print(x)\n \n']
['Runtime Error', 'Accepted']
['s146833199', 's051958621']
[9172.0, 9176.0]
[24.0, 23.0]
[187, 240]
p02641
u284262180
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())\nnum_list = list(map(int, input().split()))\ndif = 101\no_list = []\nnum_list.sort(reverse=True)\n\nif len(num_list) == 0:\n print(x)\n exit()\n\nfor i in range(1, max(num_list)):\n if i not in num_list:\n o_list.append(i)\n#\n# for num in num_list:\n# if abs(x - num) <= dif:\n# if x not in num_list:\n# ans = x\nans = x\no_list.sort(reverse=True)\n\nfor num in o_list:\n if abs(x - num) <= dif:\n # if x not in num_list:\n dif = x -num\n ans = num\n\nprint(ans)', 'x, n = map(int, input().split())\nnum_list = list(map(int, input().split()))\ndif = 100000\no_list = []\n\nif len(num_list) == 0:\n print(x)\n exit()\n#\n\n# if i not in num_list:\n# o_list.append(i)\n\nfor i in range(-1000, 1000):\n if i not in num_list:\n o_list.append(i)\n\no_list.sort(reverse=True)\n\nfor num in o_list:\n if abs(x - num) <= dif:\n # if x not in num_list:\n dif = abs(x -num)\n ans = num\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s636697101', 's472369571']
[9208.0, 9216.0]
[20.0, 25.0]
[533, 486]
p02641
u285022453
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\np_all = set(range(-101, 101)) - set(p)\nprint(p_all)\n\nmi = float('inf')\nans = 0\nfor i in p_all:\n if abs(x - i) < mi:\n mi = abs(x - i)\n ans = i\n\nprint(ans)\n", "x, n = map(int, input().split())\np = list(map(int, input().split()))\n\np_all = set(range(0, 102)) - set(p)\n# print(p_all)\n\nmi = float('inf')\nans = 0\nfor i in p_all:\n if abs(x - i) < mi:\n mi = abs(x - i)\n ans = i\n\nprint(ans)\n"]
['Wrong Answer', 'Accepted']
['s369679050', 's584569620']
[9196.0, 9116.0]
[24.0, 21.0]
[241, 240]
p02641
u286422818
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.
['d = {i: 1 for i in p}\nidx = X\nwhile True:\n if d.get(idx) is None:\n ans_plus = idx\n break\n else:\n idx += 1\n\nidx = X\nwhile True:\n if d.get(idx) is None:\n ans_minus = idx\n break\n else:\n idx -= 1\n\nif abs(X - ans_plus) < abs(X - ans_minus):\n print(ans_plus)\nelif abs(X - ans_plus) > abs(X - ans_minus):\n print(ans_minus)\nelse:\n print(ans_minus)', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nd = {i: 1 for i in p}\nidx = X\nwhile True:\n if d.get(idx) is None:\n ans_plus = idx\n break\n else:\n idx += 1\n\nidx = X\nwhile True:\n if d.get(idx) is None:\n ans_minus = idx\n break\n else:\n idx -= 1\n\nif abs(X - ans_plus) < abs(X - ans_minus):\n print(ans_plus)\nelse:\n print(ans_minus)']
['Runtime Error', 'Accepted']
['s533125655', 's259082873']
[9092.0, 9156.0]
[25.0, 27.0]
[402, 406]
p02641
u290014241
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()))\nfor i in range(N+1):\n if X-i not in p:\n print(X-i)\n break\n if X+i not in p:\n print(X+i)', 'X, N=list(map(int,input().split()))\np=list(map(int,input().split()))\nfor i in range(N+1):\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']
['Wrong Answer', 'Accepted']
['s990506644', 's174393593']
[9180.0, 9180.0]
[28.0, 28.0]
[183, 197]
p02641
u290983503
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()\nx_n_list = x_n.split()\nx = int(x_n_list[0])\nn = int(x_n_list[1])\nif n == 0:\n print(x)\nelse:\n allp = input()\n p_list = allp.split()\n p_l = [int(n) for n in p_list]\n if x not in p_l:\n print(x)\n else:\n for i in range(len(p_l)):\n if x - i in p_l:\n print(x - i - 1)\n break\n elif x + i in p_l:\n print(x + i + 1)\n break\n else:\n pass', 'x_n = input()\nx_n_list = x_n.split()\nx = int(x_n_list[0])\nn = int(x_n_list[1])\nif n == 0:\n print(x)\nelse:\n allp = input()\n p_list = allp.split()\n p_l = [int(n) for n in p_list]\n if x not in p_l:\n print(x)\n else:\n for i in range(len(p_l)):\n if x - i - 1 not in p_l:\n print(x - i - 1)\n break\n elif x + i + 1 not in p_l:\n print(x + i + 1)\n break\n else:\n pass']
['Wrong Answer', 'Accepted']
['s756240900', 's942854991']
[9232.0, 9148.0]
[23.0, 21.0]
[401, 417]
p02641
u293215208
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\nx, n = map(int,input().split())\nP = list(map(int, input().split()))\n\nPX = list(map(lambda p: p-x,P))\nCPX = collections.Counter(PX)\nans = 0\n\nfor i in range(max(max(P),x))\n if CPX[-i] == 0:\n ans = x -i\n break\n elif CPX[i] == 0:\n ans = x +i\n break\n\nprint(ans)', 'import collections\nx, n= map(int, input().split())\nP = list(map(int, input().split()))\n \nPX = list(map(lambda p: p-x,P))\nCPX = collections.Counter(PX)\nans = 0\n \nfor i in range(max(max(P),x)):\n if P = []:\n ans = x\n break\n elif CPX[-i] == 0:\n ans = x -i\n break\n elif CPX[i] == 0:\n ans = x +i\n break\n\nprint(ans)', 'import collections\nx, n= map(int, input().split())\nP = list(map(int, input().split()))\n \nPX = list(map(lambda p: p-x,P))\nCPX = collections.Counter(PX)\nans = 0\n \nfor i in range(100):\n elif CPX[-i] == 0:\n ans = x -i\n break\n elif CPX[i] == 0:\n ans = x +i\n break\n\nprint(ans)', 'import collections\nx, n= map(int, input().split())\nP = list(map(int, input().split()))\n \nPX = list(map(lambda p: p-x,P))\nCPX = collections.Counter(PX)\nans = 0\n \nfor i in range(100):\n elif CPX[-i] == 0:\n ans = x -i\n break\n elif CPX[i] == 0:\n ans = x +i\n break\n\nprint(ans)', 'import collections\nx, n= map(int, input().split())\nP = list(map(int, input().split()))\n \nPX = list(map(lambda p: p-x,P))\nCPX = collections.Counter(PX)\nans = 0\n\nfor i in range(100):\n if CPX[-i] == 0:\n ans = x -i\n break\n elif CPX[i] == 0:\n ans = x +i\n break\n\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s064898889', 's195624122', 's207934301', 's890295455', 's951009666']
[8844.0, 8920.0, 8800.0, 8944.0, 9352.0]
[30.0, 28.0, 26.0, 29.0, 31.0]
[289, 329, 284, 284, 281]
p02641
u293825440
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()))\nmin = 0\ni = 0\ncount = 0\nwhile True:\n if abs(X - i) == min:\n if i not in p:\n break\n elif min != 0:\n count += 1\n i = 0\n if count == 2:\n min += 1\n count = 0\n else:\n min += 1\n i = 0\n i += 1\n\nprint(i)', 'X,N = map(int,input().split())\np = list(map(int,input().split()))\nmin = 0\ni = 0\nwhile True:\n if abs(X - i) == min:\n if i not in p:\n break\n else:\n min += 1\n i = 0\n i += 1\n\nprint(i)', 'X,N = map(int,input().split())\np = list(map(int,input().split()))\ni = X + 1\nj = X - 1\nif X not in p:\n print(X)\n exit()\n \nwhile True:\n if j not in p:\n print(j)\n break\n elif j in p and i not in p:\n print(i)\n break\n i += 1\n j -= 1\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s020444668', 's053072779', 's540897204']
[9192.0, 9116.0, 9188.0]
[23.0, 24.0, 26.0]
[384, 232, 277]
p02641
u299599133
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 for i in range(1,102):\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 else:\n print(X)\n break', '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(1000):\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']
['Runtime Error', 'Accepted']
['s294659158', 's009492666']
[9052.0, 9176.0]
[26.0, 20.0]
[308, 267]
p02641
u302697704
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 plist =list(map(int,input().split()))\n maxN = max(plist)\n Anslist =[i for i in range(maxN+1)]\n print (Anslist)\n for i in range(len(plist)):\n Anslist.remove(plist[i])\n Anslist.remove(0)\n print(Anslist)\n\n ans = 0\n min=100\n for i in range(len(Anslist)):\n if min>abs(X-Anslist[i]):\n min = abs(X-Anslist[i])\n ans = Anslist[i]\n print(ans)\nelse :print(X)', 'X,N = map(int,input().split())\nif N!=0:\n plist =list(map(int,input().split()))\n print (plist)\n #maxN = max(plist)\n maxN = 100\n Anslist =[i for i in range(X+1)]\n #print (Anslist)\n for i in range(len(plist)):\n Anslist.remove(plist[i])\n Anslist.remove(0)\n #print(Anslist)\n\n ans = 0\n min=100\n for i in range(len(Anslist)):\n if min>abs(X-Anslist[i]):\n min = abs(X-Anslist[i])\n ans = Anslist[i]\n print(ans)\nelse :print(X)', 'X,N = map(int,input().split())\n\nmin = 100\n\nif N !=0:\n Plist = list(map(int,input().split()))\n anslist = [i for i in range(102)]\n anslist.append(-1)\n #anslist.remove(0)\n Plist = sorted(Plist)\n #print (anslist)\n for i in range(N):\n anslist.remove(Plist[i])\n temp =100\n for i in range(len(anslist)):\n if min >abs(anslist[i]-X) :\n min = abs(anslist[i]-X)\n temp = anslist[i]\n print (temp)\nelse :\n print (X)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s003390043', 's171313756', 's430354653']
[9164.0, 9084.0, 9164.0]
[29.0, 31.0, 28.0]
[415, 444, 430]
p02641
u303039933
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.
['# -*- coding: utf-8 -*-\nimport sys\nimport math\nimport os\nimport itertools\nimport string\nimport heapq\nimport _collections\nfrom collections import Counter\nfrom collections import defaultdict\nfrom functools import lru_cache\nimport bisect\nimport re\nimport queue\nimport decimal\n\n\nclass Scanner():\n @staticmethod\n def int():\n return int(sys.stdin.readline().rstrip())\n\n @staticmethod\n def string():\n return sys.stdin.readline().rstrip()\n\n @staticmethod\n def map_int():\n return [int(x) for x in Scanner.string().split()]\n\n @staticmethod\n def string_list(n):\n return [Scanner.string() for i in range(n)]\n\n @staticmethod\n def int_list_list(n):\n return [Scanner.map_int() for i in range(n)]\n\n @staticmethod\n def int_cols_list(n):\n return [Scanner.int() for i in range(n)]\n\n\nclass Math():\n @staticmethod\n def gcd(a, b):\n if b == 0:\n return a\n return Math.gcd(b, a % b)\n\n @staticmethod\n def lcm(a, b):\n return (a * b) // Math.gcd(a, b)\n\n @staticmethod\n def divisor(n):\n res = []\n i = 1\n for i in range(1, int(n ** 0.5) + 1):\n if n % i == 0:\n res.append(i)\n if i != n // i:\n res.append(n // i)\n return res\n\n @staticmethod\n def round_up(a, b):\n return -(-a // b)\n\n @staticmethod\n def is_prime(n):\n if n < 2:\n return False\n if n == 2:\n return True\n if n % 2 == 0:\n return False\n d = int(n ** 0.5) + 1\n for i in range(3, d + 1, 2):\n if n % i == 0:\n return False\n return True\n\n @staticmethod\n def fact(N):\n res = {}\n tmp = N\n for i in range(2, int(N ** 0.5 + 1) + 1):\n cnt = 0\n while tmp % i == 0:\n cnt += 1\n tmp //= i\n if cnt > 0:\n res[i] = cnt\n if tmp != 1:\n res[tmp] = 1\n if res == {}:\n res[N] = 1\n return res\n\n\ndef pop_count(x):\n x = x - ((x >> 1) & 0x5555555555555555)\n x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)\n x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f\n x = x + (x >> 8)\n x = x + (x >> 16)\n x = x + (x >> 32)\n return x & 0x0000007f\n\n\nMOD = int(1e09) + 7\nINF = int(1e15)\n\n\ndef solve():\n X, N = Scanner.map_int()\n P = Scanner.map_int()\n if N == 0:\n print(X)\n return\n t = INF\n for i in range(-1, 102):\n if i in P:\n continue\n t = min(t, abs(i - X))\n if t - X in P:\n print(X + t)\n else:\n print(X - t)\n\n\ndef main():\n \n # T = Scanner.int()\n # for _ in range(T):\n # solve()\n # print(\'YNeos\'[not solve()::2])\n solve()\n\n\nif __name__ == "__main__":\n main()\n', '# -*- coding: utf-8 -*-\nimport sys\nimport math\nimport os\nimport itertools\nimport string\nimport heapq\nimport _collections\nfrom collections import Counter\nfrom collections import defaultdict\nfrom functools import lru_cache\nimport bisect\nimport re\nimport queue\nimport decimal\n\n\nclass Scanner():\n @staticmethod\n def int():\n return int(sys.stdin.readline().rstrip())\n\n @staticmethod\n def string():\n return sys.stdin.readline().rstrip()\n\n @staticmethod\n def map_int():\n return [int(x) for x in Scanner.string().split()]\n\n @staticmethod\n def string_list(n):\n return [Scanner.string() for i in range(n)]\n\n @staticmethod\n def int_list_list(n):\n return [Scanner.map_int() for i in range(n)]\n\n @staticmethod\n def int_cols_list(n):\n return [Scanner.int() for i in range(n)]\n\n\nclass Math():\n @staticmethod\n def gcd(a, b):\n if b == 0:\n return a\n return Math.gcd(b, a % b)\n\n @staticmethod\n def lcm(a, b):\n return (a * b) // Math.gcd(a, b)\n\n @staticmethod\n def divisor(n):\n res = []\n i = 1\n for i in range(1, int(n ** 0.5) + 1):\n if n % i == 0:\n res.append(i)\n if i != n // i:\n res.append(n // i)\n return res\n\n @staticmethod\n def round_up(a, b):\n return -(-a // b)\n\n @staticmethod\n def is_prime(n):\n if n < 2:\n return False\n if n == 2:\n return True\n if n % 2 == 0:\n return False\n d = int(n ** 0.5) + 1\n for i in range(3, d + 1, 2):\n if n % i == 0:\n return False\n return True\n\n @staticmethod\n def fact(N):\n res = {}\n tmp = N\n for i in range(2, int(N ** 0.5 + 1) + 1):\n cnt = 0\n while tmp % i == 0:\n cnt += 1\n tmp //= i\n if cnt > 0:\n res[i] = cnt\n if tmp != 1:\n res[tmp] = 1\n if res == {}:\n res[N] = 1\n return res\n\n\ndef pop_count(x):\n x = x - ((x >> 1) & 0x5555555555555555)\n x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)\n x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f\n x = x + (x >> 8)\n x = x + (x >> 16)\n x = x + (x >> 32)\n return x & 0x0000007f\n\n\nMOD = int(1e09) + 7\nINF = int(1e15)\n\n\ndef solve():\n X, N = Scanner.map_int()\n P = Scanner.map_int()\n if N == 0:\n print(X)\n return\n t = INF\n for i in range(-1, 102):\n if i in P:\n continue\n t = min(t, abs(i - X))\n if X - t in P:\n print(X + t)\n else:\n print(X - t)\n\n\ndef main():\n \n # T = Scanner.int()\n # for _ in range(T):\n # solve()\n # print(\'YNeos\'[not solve()::2])\n solve()\n\n\nif __name__ == "__main__":\n main()\n']
['Wrong Answer', 'Accepted']
['s927469430', 's676537915']
[10728.0, 10728.0]
[36.0, 36.0]
[2891, 2891]
p02641
u303650160
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\ndef Forbidden_List(x,n,p):\n k = [abs(s - x) for s in p]\n for i in range(n):\n if i not in k: \n return 10 - i\n return 10 - n\n\nif __name__ == '__main__':\n input = sys.stdin.readline\n \n inp1 = input().rstrip().split()\n x,n = int(inp1[0]),int(inp1[1])\n if n == 0:\n print(x)\n else: \n inp2 = input().rstrip().split()\n p = list(map(int,inp2))\n print(Forbidden_List(x,n,p))", "import sys\n\ndef Forbidden_List(x,n,p):\n k = [abs(s - x) for s in p]\n for i in range(n):\n if i not in k: \n return 10 - i\n return 10 - n\n\nif __name__ == '__main__':\n input = sys.stdin.readline\n \n inp1 = input().rstrip().split()\n x,n = int(inp1[0]),int(inp1[1])\n if n == 0:\n print(x)\n else: \n \tinp2 = input().rstrip().split()\n \tp = list(map(int,inp2))\n\n print(Forbidden_List(x,n,p))", "import sys\n\ndef Forbidden_List(x,n,p):\n #k = [abs(s - x) for s in p]\n #print(k)\n print(x)\n for i in range(n):\n if x - i not in p: \n return x - i\n if x + i not in p:\n return x + i\n\nif __name__ == '__main__':\n input = sys.stdin.readline\n \n inp1 = input().rstrip().split()\n x,n = int(inp1[0]),int(inp1[1])\n if n == 0:\n print(x)\n else: \n inp2 = input().rstrip().split()\n p = list(map(int,inp2))\n print(Forbidden_List(x,n,p))", "import sys\n\ndef Forbidden_List(x,n,p):\n k = [abs(s - x) for s in p]\n for i in range(n):\n if i not in k: \n return 10 - i\n return 10 - n\n\nif __name__ == '__main__':\n input = sys.stdin.readline\n \n inp1 = input().rstrip().split()\n inp2 = input().rstrip().split()\n \n x,n = int(inp1[0]),int(inp1[1])\n if n == 0:\n print(x)\n else:\n p = list(map(int,inp2))\n\n print(Forbidden_List(x,n,p))", "import sys\n\ndef Forbidden_List(x,n,p):\n #k = [abs(s - x) for s in p]\n #print(k)\n print(x)\n for i in range(n//2 + n%2):\n if x - i not in p: \n return x - i\n if x + i not in p:\n return x + i\n return x - n//2 - n%2\n\nif __name__ == '__main__':\n input = sys.stdin.readline\n \n inp1 = input().rstrip().split()\n x,n = int(inp1[0]),int(inp1[1])\n if n == 0:\n print(x)\n else: \n inp2 = input().rstrip().split()\n p = list(map(int,inp2))\n print(Forbidden_List(x,n,p))", "import sys\n\ndef Forbidden_List(x,n,p):\n #k = [abs(s - x) for s in p]\n #print(k)\n print(x)\n for i in range(n//2 + n%2):\n if x - i not in p: \n return x - i\n if x + i not in p:\n return x + i\n return x - n\n\nif __name__ == '__main__':\n input = sys.stdin.readline\n \n inp1 = input().rstrip().split()\n x,n = int(inp1[0]),int(inp1[1])\n if n == 0:\n print(x)\n else: \n inp2 = input().rstrip().split()\n p = list(map(int,inp2))\n print(Forbidden_List(x,n,p))", "import sys\n\ndef Forbidden_List(x,n,p):\n print(x)\n for i in range(n//2 + n%2):\n if x - i not in p: \n return x - i\n if x + i not in p:\n return x + i\n return x - n//2 + n%2\n\nif __name__ == '__main__':\n input = sys.stdin.readline\n \n inp1 = input().rstrip().split()\n x,n = int(inp1[0]),int(inp1[1])\n if n == 0:\n print(x)\n else: \n inp2 = input().rstrip().split()\n p = list(map(int,inp2))\n print(Forbidden_List(x,n,p))", " import sys\n \ndef Forbidden_List(x,n,p):\n k = [abs(s - x) for s in p]\n for i in range(n):\n if i not in k: \n return 10 - i\n return 10 - n\n \nif __name__ == '__main__':\n input = sys.stdin.readline\n \n inp1 = input().rstrip().split()\n inp2 = input().rstrip().split()\n \n x,n = int(inp1[0]),int(inp1[1])\n if n == 0:\n print(x)\n else:\n p = list(map(int,inp2))\n \n print(Forbidden_List(x,n,p))", "import sys\n\ndef Forbidden_List(x,n,p):\n k = [abs(s - x) for s in p]\n print(k)\n for i in range(n):\n if i not in k: \n return x - i\n return x - n\n\nif __name__ == '__main__':\n input = sys.stdin.readline\n \n inp1 = input().rstrip().split()\n x,n = int(inp1[0]),int(inp1[1])\n if n == 0:\n print(x)\n else: \n inp2 = input().rstrip().split()\n p = list(map(int,inp2))\n print(Forbidden_List(x,n,p))", "import sys\n\ndef Forbidden_List(x,n,p):\n for i in range(n//2 + n%2 + 1):\n if x - i not in p: \n return x - i\n if x + i not in p:\n return x + i\n\nif __name__ == '__main__':\n input = sys.stdin.readline\n \n inp1 = input().rstrip().split()\n x,n = int(inp1[0]),int(inp1[1])\n if n == 0:\n print(x)\n else: \n inp2 = input().rstrip().split()\n p = list(map(int,inp2))\n print(Forbidden_List(x,n,p))"]
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s129780356', 's147317797', 's292895837', 's305395184', 's378831951', 's546418773', 's615271215', 's723812319', 's878905789', 's278474117']
[9108.0, 8896.0, 9008.0, 8960.0, 9196.0, 9068.0, 9048.0, 8748.0, 9208.0, 9196.0]
[29.0, 26.0, 28.0, 27.0, 27.0, 25.0, 32.0, 23.0, 27.0, 26.0]
[433, 432, 490, 434, 523, 514, 480, 439, 442, 449]
p02641
u307622233
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\ninput = sys.stdin.readline\n\n\ndef main():\n x, n = [int(i) for i in input().split()]\n p = set([int(i) for i in input().split()])\n\n for i in range(1, 101):\n if i in p:\n continue\n\n if i <= x:\n ans = i\n elif x - ans > i - x:\n ans = i\n else:\n print(ans)\n\n\nif __name__ == '__m", "import sys\ninput = sys.stdin.readline\n\n\ndef main():\n x, n = [int(i) for i in input().split()]\n p = set([int(i) for i in input().split()])\n\n for i in range(1, 101):\n left = right = None\n if x - i in p:\n left = True\n if x + i in p:\n right = True\n\n if left and right:\n continue\n elif not left:\n ans = x + 1\n elif not right:\n ans = x - 1\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()", "# import numpy as np\nimport sys\ninput = sys.stdin.readline\n\n\ndef main():\n x, n = [int(i) for i in input().split()]\n p = set([int(i) for i in input().split()])\n\n ans = x\n for i in range(-1, 102):\n if i in p:\n continue\n\n if i <= x:\n ans = i\n else:\n if x - ans > i - x:\n ans = i\n break\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s360623643', 's957868659', 's417908909']
[9056.0, 9232.0, 9192.0]
[24.0, 23.0, 23.0]
[353, 495, 431]
p02641
u308918401
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 i=1\n print(list)\n while i<1000:\n if not((x-i) in list):\n print(x-i)\n break\n if not((x+i) in list):\n print(x+i)\n break\n i+=1\n', 'x,n=map(int,input().split())\nif n == 0:\n print(x)\nelse:\n list=list(map(int,input().split()))\n if x in list:\n print(x)\n else:\n i=1\n while i<1000:\n if not((x-i) in list):\n print(x-i)\n break\n if not((x+i) in list):\n print(x+i)\n break\n i+=1', 'x,n=map(int,input().split())\nif n == 0:\n print(x)\nelse:\n list=list(map(int,input().split()))\n if not(x in list):\n print(x)\n else:\n i=1\n while i<1000:\n if not((x-i) in list):\n print(x-i)\n break\n if not((x+i) in list):\n print(x+i)\n break\n i+=1']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s088030235', 's550912076', 's725489016']
[9180.0, 9144.0, 9208.0]
[23.0, 20.0, 24.0]
[252, 292, 297]
p02641
u313445895
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\nif n==0:\n print(x)\np = list(range(n))\np = list(map(int, input().split()))\np_2 = list(range(n))\nfor i in range(n):\n p_2[i] = x-p[i]\n\nfor i in range(100):\n h = p_2.count(i)\n h_2 = p_2.count(-i)\n if h==0 and h_2!=0:\n print(x-i)\n break\n elif h!=0 and h_2==0:\n print(x+i)\n break\n elif h==0 and h_2==0:\n print(x-i)\n break', 'x, n = map(int, input().split())\n#if n==0:\n# print(x)\np = list(range(n))\np = list(map(int, input().split()))\np_2 = list(range(n))\nfor i in range(n):\n p_2[i] = x-p[i]\nfor i in range(100):\n h = p_2.count(i)\n h_2 = p_2.count(-i)\n if h==0 and h_2!=0:\n print(x-i)\n break\n elif h!=0 and h_2==0:\n print(x+i)\n break\n elif h==0 and h_2==0:\n print(x-i)\n break\n#if n==0:\n# print(x)']
['Runtime Error', 'Accepted']
['s027647576', 's470061137']
[9000.0, 9072.0]
[26.0, 29.0]
[413, 436]
p02641
u317423698
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\nimport operator\n\nreadline = sys.stdin.buffer.readline\na, b = map(int, readline().split())\nc = set(map(int, readline().split()))\n\nL = [(i, abs(i - a)) for i in range(0, 102) if i not in c]\nL.sort(key=operator.itemgetter(1))\nprint(L)', 'import sys\nimport operator\n\nreadline = sys.stdin.buffer.readline\na, b = map(int, readline().split())\nc = set(map(int, readline().split()))\n\nL = [(i, abs(i - a)) for i in range(1, 100) if i not in c]\nL.sort(key=operator.itemgetter(1))\nprint(L)', 'import sys\nimport operator\n\nreadline = sys.stdin.buffer.readline\na, b = map(int, readline().split())\nc = set(map(int, readline().split()))\n\nL = [(i, abs(i - a)) for i in range(0, 102) if i not in c]\nL.sort(key=operator.itemgetter(1))\nprint(L[0][0])']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s668270682', 's839735236', 's640845632']
[9304.0, 9256.0, 9124.0]
[29.0, 28.0, 26.0]
[242, 242, 248]
p02641
u320763652
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())\nx,n = map(int, "100 0".split())\n# line = list(map(int, input().split()))\nline = list(map(int, "".split()))\n\nplus = x\nminus = x\n\nif not x in line:\n print(x)\n exit()\n\nwhile True:\n\n if plus <= 100:\n plus += 1\n\n if minus >= 0:\n minus -=1\n\n\n if not minus in line:\n print(minus)\n exit()\n\n if not plus in line:\n print(plus)\n exit()\n\n if plus > 100 and minus < 0:\n exit()\n', 'x,n = map(int, input().split())\nline = list(map(int, input().split()))\n\nplus = x\nminus = x\n\nif not x in line:\n print(x)\n exit()\n\nwhile True:\n\n if plus <= 100:\n plus += 1\n\n if minus >= 0:\n minus -=1\n\n\n if not minus in line:\n print(minus)\n exit()\n\n if not plus in line:\n print(plus)\n exit()\n\n if plus > 100 and minus < 0:\n exit()\n']
['Wrong Answer', 'Accepted']
['s805827506', 's227686810']
[9188.0, 9128.0]
[20.0, 25.0]
[466, 396]
p02641
u322171361
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,b=input().split()\npp=input().split()\na=int(a)\nb=int(b)\np=[]\nfor pa in pp:\n p.append(int(pa))\nx=0\ny=-1\nwhile:\n if a+x not in p:\n aa=a+x\n break\n elif a+y not in p:\n aa=a+y\n break\n x+=1\n y+=-1\nprint(aa)', 'a,b=input().split()\npp=input().split()\na=int(a)\nb=int(b)\np=[]\nfor pa in pp:\n p.append(int(pa))\nx=0\ny=-1\nwhile True:\n if a+x not in p:\n aa=a+x\n break\n elif a+y not in p:\n aa=a+y\n break\n x+=1\n y+=-1\nprint(aa)']
['Runtime Error', 'Accepted']
['s783954059', 's079835672']
[8972.0, 9192.0]
[23.0, 22.0]
[244, 249]
p02641
u323859575
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\np_under = list(filter(lambda v: v<x, p))\np_upper = list(filter(lambda v: v>x, p))\np_under.sort(reverse=True)\np_upper.sort()\n\ncnt = 0\nwhile(True):\n if x - cnt not in p_under:\n print(x - cnt)\n break\n if x + cnt not in p_upper:\n print(x + cnt)\n break\n cnt += 1\n', 'x, n = map(int, input().split(" "))\n\nif n == 0:\n print(x)\nelse:\n p = list(map(int, input().split(" ")))\n\n p_under = list(filter(lambda v: v<=x, p))\n p_upper = list(filter(lambda v: v>=x, p))\n p_under.sort(reverse=True)\n p_upper.sort()\n\n cnt = 0\n while(True):\n if x - cnt not in p_under:\n print(x - cnt)\n break\n if x + cnt not in p_upper:\n print(x + cnt)\n break\n cnt += 1\n']
['Runtime Error', 'Accepted']
['s127294347', 's371087892']
[9140.0, 9128.0]
[23.0, 22.0]
[371, 460]
p02641
u325132311
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.
['num_input = [input() for i in range(2)]\nx = int(num_input[0].split()[0])\nn = int(num_input[0].split()[1])\n\nnum_list = [int(n) for n in num_input[1].split()]\nnum_list.sort()\n\nans=x\n\nif n!=0 and n!=1 and n!=100:\n if x in num_list:\n index=num_list.index(x)\n index_left=None\n index_right=None\n if index!=0:\n index_left=index-1\n if index!=n:\n index_right=index+1\n value_left=x-1\n value_right=x+1\n \n for i in range(n):\n if index_left is not None:\n if num_list[index_left]!=value_left:\n ans=value_left\n break\n if index_left!=0:\n index_left=index_left-1\n elif index_right is not None:\n if num_list[index_right]!=value_right:\n ans=value_right\n break\n if index_right!=n-1:\n index_right=index_right+1\n value_left=value_left-1\n value_right=value_right+1\n\nif n==1:\n ans=x-1\n\nif n==100:\n if x>50:\n ans=101\n if x<=50:\n ans=0\n\nprint(ans)', 'num_input = [input() for i in range(2)]\nx = int(num_input[0].split()[0])\nn = int(num_input[0].split()[1])\n\nnum_list = [int(n) for n in num_input[1].split()]\nnum_list.sort()\n\nans=x\n\nif n!=0 and n!=1 and n!=100:\n if x in num_list:\n index=num_list.index(x)\n\n value_left=x-1\n value_right=x+1\n\n if index!=0:\n index_left=index-1\n if index!=n-1:\n index_right=index+1\n \n if index==0:\n ans=x-1\n elif index==n-1:\n if num_list[index-1]==x-1:\n ans=x+1\n else:\n ans=x-1\n else:\n for i in range(n):\n if num_list[index_left]!=value_left:\n ans=value_left\n break\n elif num_list[index_right]!=value_right:\n ans=value_right\n break\n if index_left!=0:\n index_left=index_left-1\n if index_right!=n:\n index_right=index_right+1\n value_left=value_left-1\n value_right=value_right+1\n\nif n==1\n ans=x-1\n\nif n==100:\n if x<=50:\n ans=0\n if x>50:\n ans=101\n\nprint(ans)', 'num_input = [input() for i in range(2)]\nx = int(num_input[0].split()[0])\nn = int(num_input[0].split()[1])\n\nnum_list = [int(n) for n in num_input[1].split()]\nnum_list.sort()\n\nans=x\n\nif n!=0 and n!=1 and n!=100:\n if x in num_list:\n index=num_list.index(x)\n\n value_left=x-1\n value_right=x+1\n\n index_left=0\n index_right=n\n if index_left!=0:\n index_left=index-1\n if index_right!=n:\n index_right=index+1\n \n if index_left==0:\n ans=x-1\n elif index_right==n:\n if num_list[index_right-1]!=x-1:\n ans=x+1\n else:\n for i in range(n):\n if num_list[index_left]!=value_left:\n ans=value_left\n break\n elif num_list[index_right]!=value_right:\n ans=value_right\n break\n if index_left!=0:\n index_left=index_left-1\n if index_right!=n-1:\n index_right=index_right+1\n value_left=value_left-1\n value_right=value_right+1\n\nif n==1:\n ans=x-1\n\nif n==100:\n if x<=50:\n ans=0\n if x>50:\n ans=101\n\nprint(ans)', 'num_input = [input() for i in range(2)]\nx = int(num_input[0].split()[0])\nn = int(num_input[0].split()[1])\n\nnum_list = [int(n) for n in num_input[1].split()]\nnum_list.sort()\n\nans=x\n\nif n!=0 and n!=1 and n!=100:\n if x in num_list:\n index=num_list.index(x)\n\n value_left=x-1\n value_right=x+1\n\n if index!=0:\n index_left=index-1\n if index!=n-1:\n index_right=index+1\n \n if index==0:\n ans=x-1\n elif index==n-1:\n if num_list[index-1]==x-1:\n ans=x+1\n else:\n ans=x-1\n else:\n for i in range(n):\n if num_list[index_left]!=value_left:\n ans=value_left\n break\n elif num_list[index_right]!=value_right:\n ans=value_right\n break\n if index_left!=0:\n index_left=index_left-1\n if index_right!=n:\n index_right=index_right+1\n value_left=value_left-1\n value_right=value_right+1\n\nif n==1:\n ans=x-1\n\nif n==100:\n if x<=50:\n ans=0\n if x>50:\n ans=101\n\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s051288474', 's684469567', 's858634779', 's002027663']
[9300.0, 9104.0, 9284.0, 9284.0]
[23.0, 20.0, 26.0, 22.0]
[1150, 1220, 1248, 1221]
p02641
u325492232
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 abc170_c_1():\n \n def solve():\n x, n = map(int, input().split(' '))\n if n == 0:\n return x\n\n p = list(map(int, input().split(' ')))\n\n search_range_min = min(min(p), x) - 1\n search_range_max = max(max(p), x) + 1\n search_values = [i for i in range(search_range_min, search_range_max + 1) if i not in p]\n\n \n ans = min(search_values, key=lambda a: (abs(a - x)), x)\n\n \n # ans = min(search_values, key=lambda a: abs(a - x))\n\n return ans\n\n print(solve())\n\nif __name__ == '__main__':\n abc170_c_1()\n", "def abc170_c_2():\n \n def solve():\n x, n = map(int, input().split(' '))\n if n == 0:\n return x\n\n p = list(map(int, input().split(' ')))\n\n for i in range(100):\n for s in [-1, +1]:\n a = x + i * s\n if a not in p:\n return a\n print(solve())\n\nif __name__ == '__main__':\n abc170_c_2()"]
['Runtime Error', 'Accepted']
['s101103699', 's409227386']
[9016.0, 9196.0]
[27.0, 31.0]
[910, 577]
p02641
u328608670
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)\nelse:\n ps = list(map(int, input().split()))\n sub_abs = 0\n while True:\n if (X-sub_abs) not in ps:\n print(X-sub_abs)\n break\n if (X+sub_abs) not in ps:\n print(X+sub_abs)\n sub_abs += 1', 'X, N = list(map(int, input().split()))\nif N==0:\n print(X)\nelse:\n ps = list(map(int, input().split()))\n sub_abs = 0\n while True:\n if (X-sub_abs) not in ps:\n print(X-sub_abs)\n break\n if (X+sub_abs) not in ps:\n print(X+sub_abs)\n break\n sub_abs += 1']
['Wrong Answer', 'Accepted']
['s874678920', 's449577778']
[9180.0, 9180.0]
[22.0, 23.0]
[304, 322]
p02641
u329399746
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 = [int(i) for i in input().split(" ")]\n\nif N == 0:\n print(X)\n exit()\n\np = {int(i) for i in input().split(" ")}\n\nall_p = {i for i in range(max(p) + 1)}\nranges = all_p - p\n\nprint(ranges)\n\ndiff = 1e9\nans = 0\nfor i in ranges:\n if diff > abs(i - X):\n diff = abs(i - X)\n ans = i\n\nprint(ans)', 'X, N = [int(i) for i in input().split(" ")]\n\nif N == 0:\n print(X)\n exit()\n\np = {int(i) for i in input().split(" ")}\n\nall_p = {i for i in range(1000)}\nranges = all_p - p\n\ndiff = 1e9\nfor i in ranges:\n if diff > abs(i - X):\n diff = abs(i - X)\n\nans_1 = X + diff\nans_2 = X - diff\n\nfor i in ranges:\n if i == ans_2:\n print(ans_2)\n break\nelse:\n print(ans_1)']
['Wrong Answer', 'Accepted']
['s609962701', 's748616780']
[9076.0, 9100.0]
[24.0, 26.0]
[312, 385]
p02641
u330912904
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 solve(x, ls):\n y = 0\n m = x\n for i in range(1, 102):\n if i in ls:\n continue\n if abs(x - i) < m:\n y = i\n m = abs(x - i)\n return y\n\n\ndef main(istr, ostr):\n x, n = list(map(int, istr.readline().strip().split()))\n ls = list(map(int, istr.readline().strip().split()))\n result = solve(x, ls)\n print(result, file=ostr)\n', 'def solve(x, ls):\n y = 0\n m = x\n for i in range(1, 102):\n if i in ls:\n continue\n if abs(x - i) < m:\n y = i\n m = abs(x - i)\n return y\n\n\ndef main(istr, ostr):\n x, n = list(map(int, istr.readline().strip().split()))\n ls = list(map(int, istr.readline().strip().split()))\n result = solve(x, ls)\n print(result, file=ostr)\n\n\nif __name__ == "__main__":\n import sys\n\n main(sys.stdin, sys.stdout)\n']
['Wrong Answer', 'Accepted']
['s269125033', 's665233550']
[9116.0, 9200.0]
[27.0, 27.0]
[387, 464]
p02641
u335599768
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 = list(map(int, input().split()))\ny = set(map(int, input().split()))\n\nif x[1] == 0:\n min = x[0]\nelse:\n for i in range(1, x[1]):\n if (set() == {x[0]-i}&y) and (x[0]-i >= 0):\n min = x[0]-i\n break;\n elif set() == {x[0]+i}&y:\n min = x[0]+i\n break;\n', 'import sys\nx = list(map(int, input().split()))\ny = set(map(int, input().split()))\n\nfor i in range(x[1]+1):\n for j in [-1,1]:\n if set() == {x[0]+j*i}&y:\n print(x[0]+j*i)\n sys.exit()']
['Wrong Answer', 'Accepted']
['s187766600', 's871944330']
[9000.0, 9152.0]
[27.0, 27.0]
[310, 212]
p02641
u335950809
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.
['ans = []\nx,n = map(int,input().split())\nl = list(map(int,input().split()))\n\nl.sort()\n\nans.append(x)\n\nnl = [0] * 100\n\n\nfor i in l:\n nl[i] = i\n\nif(not (n == 0)):\n \n mx = x+1\n if(mx < 100):\n for i in range(x+1,len(nl)+1):\n if( nl[i] == 0):\n ans.append(mx)\n break\n mx = mx + 1\n \n \n mi = x - 1\n if(mi > 1):\n for i in range(x-1,1,-1):\n if( nl[i] == 0):\n ans.append(mi)\n break\n mx = mx + 1 \n\nprint(min(ans))\n', '#C\n\nans = []\nx,n = map(int,input().split())\nl = list(map(int,input().split()))\n\nl.sort()\n\nans.append(x)\n\nprint(x,n)\nprint(l)\n\nnl = [0] * 100\n\n\nfor i in l:\n nl[i] = i\n\nif(not (n == 0)):\n \n mx = x+1\n if(mx < 100):\n for i in range(x+1,len(nl)+1):\n if( nl[i] == 0):\n ans.append(mx)\n break\n mx = mx + 1\n \n \n mi = x - 1\n if(mi > 1):\n for i in range(x-1,1,-1):\n if( nl[i] == 0):\n ans.append(mi)\n break\n mx = mx + 1 \n\nprint("ans=",ans)\nprint(min(ans))\n', 'import sys\n\nX, 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 print(a," = ",X ," + ",s," * ",d)\n if p.count(a) == 0:\n print(a)\n sys.exit(0)', '#C\n\nans = []\nx,n = map(int,input().split())\nl = list(map(int,input().split()))\n\nl.sort()\n\n\nnl = [0] * 100\n\n\nfor i in l:\n nl[i] = i\n\nif(not (n == 0)):\n\n mx = x+1\n if(mx < 100):\n for i in range(x+1,len(nl)+1):\n if( nl[i] == 0):\n ans.append(mx)\n break\n mx = mx + 1\n \n \n mi = x - 1\n if(mi > 1):\n for i in range(x-1,1,-1):\n if( nl[i] == 0):\n ans.append(mi)\n break\n mi = mi - 1\n\nprint(min(abs(n),abs(mi),abs(mx)))', 'def workC():\n \n x,n = map(int,input().split())\n l = list(map(int,input().split()))\n\n if n == 0:\n return x\n \n if n == 100:\n return 0\n \n for i in range(x,maxx):\n if not i in l:\n u = i\n #dic.setdefault(i,abs(i-x))\n break\n \n for i in range(x,minx,-1):\n if not i in l:\n d = i\n #dic.setdefault(i,abs(x-i))\n break\n \n if abs(x-u) == abs(x-d):\n return min(u,d)\n elif abs(x-u) < abs(x-d):\n return u\n else:\n return d\n\nans = workC()\nprint(ans)', 'import sys\n\nX, 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 sys.exit(0)']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s040767451', 's162064765', 's215721608', 's259456957', 's344518486', 's875793973']
[9224.0, 9184.0, 9196.0, 9244.0, 9020.0, 9164.0]
[26.0, 23.0, 26.0, 23.0, 29.0, 29.0]
[568, 611, 262, 548, 588, 220]
p02641
u337573893
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\nif N == 0:\n print(X)\n \nelse:\n P = list(map(int, input().split()))\n A = [0]\n for i in range(1, 102):\n if (i in P) == False:\n A.append(i)\n \n c = 0\n for j in range(len(A)):\n if abs(X - A[j]) < abs(X - c):\n c = A[j]\n else:\n c = c\n print(A)\n \n ', 'X, N = map(int, input().split())\n\nif N == 0:\n print(X)\n \nelse:\n P = list(map(int, input().split()))\n A = [0]\n for i in range(1, 102):\n if (i in P) == False:\n A.append(i)\n \n c = 101\n for j in range(len(A)):\n if abs(X - A[len(A)-int(j)-1]) <= abs(X - c):\n c = A[len(A)-int(j)-1]\n else:\n c = c\n print(c)\n \n \n']
['Wrong Answer', 'Accepted']
['s261770186', 's402131434']
[9144.0, 9092.0]
[30.0, 29.0]
[312, 344]
p02641
u343977188
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_bar=[]\nfor i in range(0,101):\n if i not in p:\n p_bar.append(i)\n\nd_min=1000\nfor i in p_bar:\n d = abs(X-i)\n if d < d_min:\n d_min = d\nif X-d_min >= 0:\n print(X-d_min)\nelse:\n print(X+d_min)\n', 'X,N=map(int,input().split())\np=list(map(int,input().split()))\np_bar=[]\nfor i in range(0,102):\n if i not in p:\n p_bar.append(i)\n\nd_min=1000\ni_min = 0\nfor i in p_bar:\n d = abs(X-i)\n if d < d_min:\n d_min = d\n i_min = i\nprint(i_min)\n']
['Wrong Answer', 'Accepted']
['s221238933', 's080331816']
[9184.0, 9184.0]
[21.0, 22.0]
[261, 241]
p02641
u345577588
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()))\nfor d in range(X + 1):\n for s in [-1, +1]:\n a = X + s * d\nif p.count(a) == 0:\nprint(a)\nexit(0)\n', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\nfor d in range(X + 1):\nfor s in [-1, +1]:\na = X + s * d\nif p.count(a) == 0:\nprint(a)\nexit(0)\n', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\nfor d in range(X + 1):\n for s in [-1, +1]:\n \n a = X + s * d\n if p.count(a) == 0:\n print(a)\n exit(0)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s096313497', 's122048407', 's787422456']
[8972.0, 8956.0, 9176.0]
[28.0, 28.0, 30.0]
[178, 162, 215]
p02641
u346818994
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\nif N == 0:\n print(X)\n\nfor i in range(102):\n if X - i not in p:\n print(x - i)\n exit()\n \n if X + i not in p:\n print(x + i)\n exit()\n', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\n\nif N == 0:\n print(X)\n\nfor i in range(102):\n if x - i not in p:\n print(x - i)\n exit()\n \n if x + i not in p:\n print(x + i)\n exit()\n', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\n\nif N == 0:\n print(X)\n exit()\n\nfor i in range(102):\n if X - i not in p:\n print(X - i)\n exit()\n \n if X + i not in p:\n print(X + i)\n exit()\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s340616425', 's680457284', 's842770999']
[9180.0, 9180.0, 9172.0]
[25.0, 27.0, 31.0]
[240, 240, 251]
p02641
u347244019
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.
['# coding: utf-8\n# Your code here!\n\n\nx,n = map(int, input().split())\ndef deflis(n):\n tempn=int(n)\n return tempn-x\nnum_list = list(map(deflis, input().split()))\nnum_list.sort()\ncount=0\nmaxans=0\nminans=0\nmaxflag=False\nminflag=False\nminlist=[]\nmaxlist=[]\nfor num in num_list:\n if(num<0):\n minlist.append(num)\n else:\n maxlist.append(num)\n\nfor mintemp in range(len(minlist)):\n if(minlist[len(minlist)-mintemp-1]==minans):\n minans=minans-1\nfor maxtemp in maxlist:\n if(maxtemp==maxans):\n maxans=maxans+1\n\nif(abs(minans)>abs(maxans)):\n print(x+maxans)\nelse:\n print(x+minans)', '# coding: utf-8\n# Your code here!\n\n\nx,n = map(int, input().split())\ndef deflis(n):\n tempn=int(n)\n return tempn-x\nnum_list = list(map(deflis, input().split()))\nnum_list.sort()\ncount=0\nmaxans=0\nminans=0\nmaxflag=False\nminflag=False\nminlist=[]\nmaxlist=[]\nfor num in num_list:\n if(num<0):\n minlist.append(num)\n elif(num==0):\n minlist.append(num)\n maxlist.append(num)\n else:\n maxlist.append(num)\n\nfor mintemp in range(len(minlist)):\n if(minlist[len(minlist)-mintemp-1]==minans):\n minans=minans-1\nfor maxtemp in maxlist:\n if(maxtemp==maxans):\n maxans=maxans+1\n\nif(abs(minans)>abs(maxans)):\n print(x+maxans)\nelse:\n print(x+minans)']
['Wrong Answer', 'Accepted']
['s947425673', 's834166824']
[9196.0, 9180.0]
[24.0, 23.0]
[617, 691]
p02641
u347600233
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:\n p = {int(i) for i in input().split()}\nif n == 0:\n print(x)\nelse:\n if x not in p:\n print(x)\n else:\n flag = True\n abs_diff = 1\n while flag:\n for i in range(1, 3):\n ans = x + (-1)**i * abs_diff\n if ans not in p:\n flag = False\n break\n print(ans)\n abs_diff += 1', 'x, n = map(int, input().split())\nif n:\n p = {int(i) for i in input().split()}\nif n == 0:\n print(x)\nelse:\n if x not in p:\n print(x)\n else:\n flag = True\n abs_diff = 1\n while flag:\n for i in range(1, 3):\n ans = x + (-1)**i * abs_diff\n if ans not in p:\n flag = False\n print(ans)\n break\n abs_diff += 1']
['Wrong Answer', 'Accepted']
['s583609852', 's868741046']
[9208.0, 9084.0]
[24.0, 21.0]
[437, 445]
p02641
u348432940
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()) \nnum_list = list(map(int, input().split())) \nfor i in range(len(num_list)):\n num_list[i] = num_list[i]-X\nprint(num_list)\nfor i in range(101):\n if (-i in num_list) is False:\n print(X-i)\n break\n if (i in num_list) is False:\n print(X+i)\n break', '\nX, N = map(int, input().split()) \nnum_list = list(map(int, input().split())) \nfor i in range(len(num_list)):\n num_list[i] = num_list[i]-X\nfor i in range(101):\n if (-i in num_list) is False:\n print(X-i)\n break\n if (i in num_list) is False:\n print(X+i)\n break']
['Wrong Answer', 'Accepted']
['s226117899', 's319558305']
[9184.0, 8836.0]
[31.0, 28.0]
[331, 315]
p02641
u350093546
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 for i in range(1,101):\n if i not in a:\n print(i)\n break\n', 'x,n=map(int,input().split())\na=list(map(int,input().split()))\nif n==0:\n ans=x\nelse:\n ans=0\n for i in range(101):\n y=x-i\n if y not in a:\n ans=y\n break\n z=x+i\n if z not in a:\n ans=z\n break\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s350512126', 's529558715']
[9172.0, 9108.0]
[20.0, 22.0]
[159, 233]
p02641
u355078864
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 stdin\n\nx, n = [int(x) for x in stdin.readline().rstrip().split()]\nif n > 0:\n P = [int(x) for x in stdin.readline().rstrip().split()]\n\nmemos = [False] * 102\n\nfor p in P:\n memos[p] = True\n\ntgt = x\noffset = 1\nlook_down = True\nwhile True:\n\n if memos[tgt] == False:\n break\n if look_down:\n look_down = False\n tgt = tgt-offset\n else:\n look_down = True\n tgt = offset + offset\n offset += 1\n\nprint(tgt)\n', 'from sys import stdin\n\nx, n = [int(x) for x in stdin.readline().rstrip().split()]\nif n > 0:\n P = [int(x) for x in stdin.readline().rstrip().split()]\n\n memos = [False] * 102\n\n for p in P:\n memos[p] = True\n\n tgt = x\n offset = 1\n look_down = True\n while True:\n\n if memos[tgt] == False:\n break\n if look_down:\n look_down = False\n tgt = tgt-offset\n else:\n look_down = True\n tgt = offset + offset\n offset += 1\n\n print(tgt)\nelse:\n print(x)\n', 'from sys import stdin\n\nx, n = [int(x) for x in stdin.readline().rstrip().split()]\nif n > 0:\n P = [int(x) for x in stdin.readline().rstrip().split()]\n\n memos = [False] * 102\n\n for p in P:\n memos[p] = True\n\n tgt = x\n offset = 1\n look_down = True\n while True:\n\n if memos[tgt] == False:\n break\n if look_down:\n look_down = False\n tgt = x-offset\n else:\n look_down = True\n tgt = tgt + offset + offset\n offset += 1\n\n print(tgt)\nelse:\n print(x)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s290762891', 's854738411', 's937815580']
[9200.0, 9200.0, 9200.0]
[22.0, 23.0, 20.0]
[466, 553, 557]
p02641
u363599046
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,b = map(int, input().split())\nif b>0:\n\tp = list(map(int, input().split()))\nelse:\n\tprint(a)\n\texit()\n\nn = a\nm = a\n\nfor i in range(b):\n\tprint(n)\n\tprint(m)\n\tprint("")\n\tif n in p:\ta,b = map(int, input().split())\nif b>0:\n\tp = list(map(int, input().split()))\nelse:\n\tprint(a)\n\texit()\n\nn = a\nm = a\n\nfor i in range(b):\n\tif n in p:\t\n\t\tn = n-1\n\t\t\t\n\telse:\n\t\tif n < 1:\n\t\t\tcontinue\n\t\tprint(n)\n\t\texit()\n\n\tif m in p:\t\t\n\t\tm = m+1\n\telse:\n\t\tprint(m)\n\t\texit()\n\n\n\t\n\t\tn = n-1\n\t\tif n < 1:\n\t\t\tn = 1\n\telse:\n\t\tprint(n)\n\t\texit()\n\n\tif m in p:\t\t\n\t\tm = m+1\n\telse:\n\t\tprint(m)\n\t\texit()\n\n\n\t', 'a,b = map(int, input().split())\nif b>0:\n\tp = list(map(int, input().split()))\nelse:\n\tprint(a)\n\texit()\n\nn = a\nm = a\n\nfor i in range(b):\n\tprint(n)\n\tprint(m)\n\tprint("")\n\tif n in p:\t\n\t\tn = n-1\n\t\tif n < 1:\n\t\t\tn = 1\n\telse:\n\t\tprint(n)\n\t\texit()\n\n\tif m in p:\t\t\n\t\tm = m+1\n\telse:\n\t\tprint(m)\n\t\texit()\n\n\n\t', 'a,b = map(int, input().split())\nif b>0:\n\tp = list(map(int, input().split()))\nelse:\n\tprint(a)\n\texit()\n\nn = a\nm = a\n\nfor i in range(b+1):\n\t"""\n\tprint(n)\n\tprint(m)\n\tprint("")\n\t"""\n\tif n in p:\t\n\t\tn = n-1\t\t\t\n\telse:\n\n\t\tprint(n)\n\t\texit()\n\n\tif m in p:\t\t\n\t\tm = m+1\n\telse:\n\t\tprint(m)\n\t\texit()']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s037325906', 's211687921', 's296597858']
[9020.0, 9200.0, 9116.0]
[25.0, 27.0, 24.0]
[558, 291, 282]
p02641
u364774090
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 P = list(map(int, input().split()))\n ans = 0\n L = X\n L = X\n for _ in range(N // 2):\n L = L - 1\n H = H + 1\n if L not in P:\n print(L)\n break\n if H not in P:\n print(H)\n break\nelse:\n print(X)', 'X, N = list(map(int, input().split()))\nif N > 0:\n P = list(map(int, input().split()))\n l = X\n h = X\n while True:\n if l not in P:\n print(l)\n break\n if h not in P:\n print(h)\n break\n l -= 1\n h += 1\nelse:\n input()\n print(X)']
['Runtime Error', 'Accepted']
['s987083256', 's271077530']
[9188.0, 9192.0]
[25.0, 23.0]
[328, 309]
p02641
u366424761
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()))\ni = 0\nwhile True:\n ans = x - i\n if ans in P:\n ans = x + i\n if ans in P:\n continue\n else:\n print(ans)\n break\n else:\n print(ans)\n break\n i = i + 1', 'x,n = map(int,input().split())\nP = list(map(int,input().split()))\ni = 0\nif not x in P:\n print(x)\nelse:\n while True:\n ans = x - i\n if not ans in P:\n print(ans)\n break\n else: \n ans = x + i\n if not ans in P:\n print(ans)\n break\n i = i + 1']
['Time Limit Exceeded', 'Accepted']
['s828842552', 's182397011']
[9192.0, 9124.0]
[2205.0, 26.0]
[290, 345]
p02641
u366974168
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=input().split()\nfor i in range(n):\n if x-i not in a:\n print(x-i)\n exit()\n if x+i not in a:\n print(x+i)\n exit()', '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+1):\n if x-i not in a:\n print(x-i)\n exit()\n if x+i not in a:\n print(x+i)\n exit()']
['Wrong Answer', 'Accepted']
['s168314775', 's295619539']
[9120.0, 9124.0]
[32.0, 31.0]
[184, 201]
p02641
u369502636
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\nnum = []\nfor i in range(102):\n num.append(i)\nfor j in range(n):\n num.remove(p[j])\n\na = 1000000000000\nb = 0\nfor k in range(102-n):\n if(abs(x-num[k]) < a):\n a = abs(x-num[k])\n b = num[k]\n\nprint(b)\n\nprint(num)', 'x,n = map(int,input().split())\np = list(map(int,input().split()))\n\nnum = []\nfor i in range(102):\n num.append(i)\nfor j in range(n):\n num.remove(p[j])\n\na = 1000000000000\nb = 0\nfor k in range(102-n):\n if(abs(x-num[k]) < a):\n a = abs(x-num[k])\n b = num[k]\n\nprint(b)']
['Wrong Answer', 'Accepted']
['s166684113', 's119521163']
[9208.0, 9220.0]
[27.0, 23.0]
[296, 284]
p02641
u371132735
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.
['# abc170_c.py\nX , N = map(int,input().split())\nP = list(map(int,input().split()))\nans = (X,0)\nfor i in range(101):\n if P.count(i)==0:\n print(abs(X-i),i,X,ans)\n if ans[0] > abs(X-i):\n ans = (abs(X-i),i)\nprint(ans[1])\n\n', '# abc170_c.py\nX , N = map(int,input().split())\nP = list(map(int,input().split()))\nans = (X,0)\nfor i in range(1010):\n if P.count(i)==0:\n # print(abs(X-i),i,X,ans)\n if ans[0] > abs(X-i):\n ans = (abs(X-i),i)\nprint(ans[1])\n\n']
['Wrong Answer', 'Accepted']
['s582025088', 's231090992']
[9188.0, 9172.0]
[22.0, 26.0]
[245, 248]
p02641
u372201459
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 argparse\nimport collections\nimport logging.config\nimport sys\nimport csv\nimport numpy as np\n\ndef tester(x, y, p):\n c = []\n c.append(x)\n for i in range(y):\n c.append(int(x+(i//2+1)*(1-i%2-0.5)*-2))\n for i in range(y):\n if not(c[i] in p):\n return(c[i])\n break\n\ndef main():\n\n sa = input().split()\n sb = input().split()\n print (sa)\n print (sb)\n x = int(sa[0])\n y = int(sa[1])\n p = []\n for d in sb:\n p.append(int(d))\n print (tester(x,y,p))\n\nif __name__ == '__main__':\n main()\n", 'import argparse\nimport collections\nimport logging.config\nimport sys\nimport csv\nimport numpy as np\n\ndef tester(x, y, p):\n c = []\n c.append(x)\n for i in range(y+1):\n c.append(int(x+(i//2+1)*(1-i%2-0.5)*-2))\n for i in range(y+1):\n if not(c[i] in p):\n return(c[i])\n break\n\ndef main():\n\n sa = input().split()\n x = int(sa[0])\n y = int(sa[1])\n p = []\n if sa[1] != "0":\n sb = input().split()\n for d in sb:\n \tp.append(int(d)) \n print (tester(x,y,p))\n\n\nif __name__ == \'__main__\':\n main()\n']
['Wrong Answer', 'Accepted']
['s981560453', 's383241597']
[28864.0, 28904.0]
[131.0, 140.0]
[562, 569]
p02641
u375616706
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\nans=float("inf")\nval=-1\nfor p in P:\n if abs(p-X)<ans:\n val=p\n ans=abs(p-X)\nprint(val)\n', "X,N = map(int,input().split())\nP = set(map(int,input().split()))\n\n\ndiff=float('inf')\nans=-1\nfor i in range(-100,110):\n if i in P:\n continue\n d = abs(X-i)\n if d<diff:\n ans=i\nprint(ans)\n", "X,N = map(int,input().split())\nP = set(map(int,input().split()))\n\n\ndiff=float('inf')\nans=-1\nfor i in range(-100,110):\n if i in P:\n continue\n d = abs(X-i)\n if d<diff:\n diff=d\n ans=i\nprint(ans)\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s276219662', 's360657437', 's142272863']
[9180.0, 9172.0, 9176.0]
[22.0, 21.0, 21.0]
[170, 207, 222]
p02641
u375695365
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 = 1000\njugh = 1000\nfor i in range(0, 150):\n if abs(x-i) <= jugh and i not in p:\n jugh = abs(x-i)\n ans = i\n # print(ans)\nprint(jugh)\n', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\nans = 1000\nfor i in range(0, 150):\n if abs(x-i) <= ans and i not in p:\n ans = abs(x-i)\n # print(ans)\nprint(ans)\n', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\nans = 1000\njugh = 1000\nfor i in range(0, 150):\n if abs(x-i) < jugh and i not in p:\n jugh = abs(x-i)\n ans = i\n # print(ans)\nprint(ans)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s673719452', 's693637500', 's592792816']
[9100.0, 9076.0, 9140.0]
[26.0, 29.0, 28.0]
[225, 194, 223]
p02641
u376328830
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())\nlst = list(map(int,input().split()))\nans = lst[0]\n\nfor e in lst:\n if abs(e-n) < abs(e-ans):\n ans = e\n \n elif abs(e-n) == abs(e-ans):\n ans = min(e,ans)\n \n else:\n pass\n \nprint(ans)', 'x,n = map(int,input().split())\nlst = sorted(list(map(int,input().split())))\n\nans = x\nif ans in lst:\n pass\nelse:\n print(ans)\n exit()\n\nleft,right = ans-1,ans+1\n\nwhile True:\n if left in lst and right in lst:\n left -=1\n right += 1\n\n elif left in lst:\n print(right)\n exit()\n\n else:\n print(left)\n exit()\n\n\n\n\n\n']
['Runtime Error', 'Accepted']
['s382991114', 's091906355']
[9160.0, 9180.0]
[28.0, 27.0]
[227, 363]
p02641
u376392666
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.
['# coding: utf-8\n# Your code here!\na,b = map(int, input().split()) \n\nif b==0:\n #print(a)\n exit()\nnum_list = list(map(int, input().split()))\n\n \n\nnum=[True]*101\n#print(num)\n\n\nfor i in range(b):\n num[num_list[i]]=False\n\n\nnum[0]=False\nprint(num)\n\ncount=0\nmin_min=100\nmin_max=100\ni=a\n#print()\n#print(i)\n\nflag_i=0\nfrag_j=0\nif i==100 and num[100]==True:\n print(100)\n exit()\n \n#elif i==100 and 100 in num_list:\n \nif i==100:\n i=99\n \n \nwhile 1:\n if i-1==99:\n flag_i=1\n min_min=99\n break\n elif num[i-1]==True:\n min_min=i-a\n break\n i+=1\nj=a\n#print(min_min)\nprint(i)\ncount=0\n\nwhile 1:\n if j-1==0:\n flag_j=1\n min_max=100\n break\n elif num[j-1]==True:\n min_max=a-j\n j-=1\n#print(min_max)\nprint(j)\nif min_min<min_max:\n print(i)\n \nelse:\n# if flag_j==1:\n# j=j+1\n print(j-1)', '# coding: utf-8\n# Your code here!\na,b = map(int, input().split()) \n\nif b==0:\n #print(a)\n exit()\nnum_list = list(map(int, input().split()))\n\n \n\nnum=[True]*101\n#print(num)\n\n\nfor i in range(b):\n num[num_list[i]]=False\n\n\nnum[0]=False\n#print(num)\n\ncount=0\nmin_min=100\nmin_max=100\ni=a\n#print()\n#print(i)\n\nflag_i=0\nfrag_j=0\nif i==100 and num[100]==True:\n print(100)\n exit()\n \n#elif i==100 and 100 in num_list:\n \nif i==100:\n i=99\n \n \nwhile 1:\n if i-1==99:\n flag_i=1\n min_min=99\n break\n elif num[i-1]==True:\n min_min=i-a\n break\n i+=1\nj=a\n#print(min_min)\n#print(i)\ncount=0\n\nwhile 1:\n if j-1==0:\n flag_j=1\n min_max=100\n break\n elif num[j-1]==True:\n min_max=a-j\n j-=1\n#print(min_max)\n#print(j)\nif min_min<min_max:\n print(i)\n \nelse:\n# if flag_j==1:\n# j=j+1\n print(j-1)', 'x,y=map(int,input().strip().split())\nnums = list(map(int, input().strip().split()))\nans=0\nif y==0:\n print(x)\nelif x not in nums:\n print(x)\nelse:\n for i in range(0,102):\n if i not in nums:\n if abs(x-i)<abs(x-ans):\n ans=i\n print(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s502197621', 's717283448', 's000401768']
[9268.0, 9256.0, 9188.0]
[22.0, 21.0, 23.0]
[883, 886, 250]
p02641
u376754170
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\nif n != 0:\n ps = list(map(int, input().split()))\n\n ans = 0\n sa = x\n \n for i in range(0, 102):\n if i not in ps and abs(x-i) < sa:\n ans = i\n sa = x-i\n print(ans, sa)\n \n print(ans)\n \nelse:\n print(x)', 'x, n = map(int, input().split())\n\nif n != 0:\n ps = list(map(int, input().split()))\n\n ans = 0\n sa = x\n \n for i in range(0, 102):\n if i not in ps and abs(x-i) < sa:\n ans = i\n sa = x-i\n \n print(ans)\n \nelse:\n print(x)']
['Wrong Answer', 'Accepted']
['s735753784', 's284388943']
[9172.0, 9192.0]
[23.0, 22.0]
[296, 269]
p02641
u378691508
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=list(map(int, input().split()))\n#i=N\n\n\t\n\t\n\n\t\n\t\n\ni=N\nj=0\nwhile True:\n\tif X-j not in p_list:\n\t\tprint(X+j)\n\t\texit()\n\telif X+j not in p_list:\n\t\tprint(X-j)\n\t\texit()\n\telse:\n\t\tj+=1\n\n', 'X, N =map(int, input().split())\np_list=list(map(int, input().split()))\n#i=N\n\n\t\n\t\n\n\t\n\t\n\ni=N\nj=0\nwhile True:\n\tif X-j not in p_list:\n\t\tprint(X+j)\n\t\texit()\n\telif X+j not in p_list:\n\t\tprint(X-j)\n\t\texit()\n\telse:\n\t\tj+=1\n\n', 'N=int(input())\nans=""\ncheck="abcdefghijklmnopqrstuvwxyz"\n\nwhile N!=0:\n\tN-=1\n\tans+=check[N%26]\n\tN=N//26\n\nprint(ans[::-1])\n\n\n\n', 'X, N =map(int, input().split())\np_list=list(map(int, input().split()))\n#i=N\n\n\t\n\t\n\n\t\n\t\n\ni=N\nj=0\nwhile True:\n\tif X-j not in p_list:\n\t\tprint(X-j)\n\t\texit()\n\telif X+j not in p_list:\n\t\tprint(X+j)\n\t\texit()\n\telse:\n\t\tj+=1\n\n']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s242302707', 's368922786', 's606486505', 's103011748']
[9072.0, 9064.0, 9016.0, 9088.0]
[27.0, 31.0, 26.0, 28.0]
[334, 334, 199, 334]
p02641
u380187071
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()\nX = int(X)\nN = int(N)\n\nif N == 0:\n print(X)\n exit()\n\nP = input().split()\nfor i in range(len(P)):\n P[i] = int(P[i])\n\nif X not in P:\n print(X)\n\nflag_p = True\nflag_n = True\n\nabs_num = 0\nabs_num_p = X + 1\nabs_num_n = X - 1\nwhile True:\n\n if abs_num_p in P:\n flag_p = True\n else:\n flag_p = False\n\n if abs_num_n in P:\n flag_n = True\n else:\n flag_n = False\n\n if(flag_n == True & flag_p == True):\n abs_num_p += 1\n abs_num_n -= 1\n continue;\n elif(flag_n == True & flag_p == False):\n print(abs_num_p)\n break;\n elif(flag_n == False):\n print(abs_num_n)\n break;', 'X, N = input().split()\nX = int(X)\nN = int(N)\n\nif N == 0:\n print(X)\n exit()\n\nP = input().split()\nfor i in range(len(P)):\n P[i] = int(P[i])\n\n\nflag_p = True\nflag_n = True\n\nabs_num = 0\nabs_num_p = X + 1\nabs_num_n = X - 1\nwhile True:\n\n if abs_num_p in P:\n flag_p = True\n else:\n flag_p = False\n\n if abs_num_n in P:\n flag_n = True\n else:\n flag_n = False\n\n if(flag_p == True & flag_n == True):\n abs_num_p += 1\n abs_num_n -= 1\n continue;\n elif(flag_n == True & flag_p == False):\n print(abs_num_p)\n break;\n elif(flag_n == False):\n print(abs_num_n)\n break;\n abs_num_p += 1\n abs_num_n -= 1\n', 'X, N = input().split()\nX = int(X)\nN = int(N)\n\nif N == 0:\n print(X)\n exit()\n\nP = input().split()\nfor i in range(len(P)):\n P[i] = int(P[i])\n\nif X not in P:\n print(X)\n exit()\n\n\nabs_num_p = X + 1\nabs_num_n = X - 1\nwhile True:\n\n if abs_num_p in P:\n flag_p = True\n else:\n flag_p = False\n\n if abs_num_n in P:\n flag_n = True\n else:\n flag_n = False\n if( flag_p == True and flag_n == True ):\n abs_num_p += 1\n abs_num_n -= 1\n continue;\n elif(flag_p == True and flag_n == False):\n print(abs_num_n)\n break;\n elif(flag_p == False and flag_n == True ):\n print(abs_num_p)\n break;\n elif(flag_p == False and flag_n == False):\n print(abs_num_n)\n break;\n\n i += 1\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s348464988', 's773537593', 's060324102']
[9240.0, 9232.0, 9232.0]
[2205.0, 23.0, 25.0]
[680, 691, 779]
p02641
u380524497
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.
["IN = iter(Input.split('\\n')).__next__\ndef input():\n return IN()\n\n###################################################\n\nx, n = map(int, input().split())\nif n == 0:\n print(x)\n exit()\nP = set(map(int, input().split()))\n\nd_min = 1000\nans = 1000\nfor num in range(-1, 102):\n if num in P:\n continue\n \n d = abs(x-num)\n if d < d_min:\n d_min = d\n ans = num\n\nprint(ans)", 'x, n = map(int, input().split())\nif n == 0:\n print(x)\n exit()\n \nP = set(map(int, input().split()))\n\nd_min = 1000\nans = 1000\nfor num in range(-1, 102):\n if num in P:\n continue\n \n d = abs(x-num)\n if d < d_min:\n d_min = d\n ans = num\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s298418918', 's799182985']
[8928.0, 9200.0]
[20.0, 21.0]
[399, 283]
p02641
u380669795
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())\np = [int(i) for i in input().split()]\nq = []\n\nif n == 0 or x not in p:\n print(x)\n sys.exit() \n\nfor i in range(1, 101-x):\n if x + i not in p:\n q.append(x + i)\n if x - i not in p:\n q.append(x - i)\n break\nprint(min(q))', 'X,N = map(int,input().split())\n \np = list(map(int,input().split()))\n \nimport sys\nfor i in range(51):\n \n if X-i not in p:\n print (X-i)\n sys.exit()\n elif X+i not in p:\n print (X+i)\n sys.exit()']
['Runtime Error', 'Accepted']
['s173490629', 's123954457']
[9200.0, 9184.0]
[22.0, 19.0]
[274, 224]
p02641
u382169668
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(" "))\ndata = list(map(int, input().split(" ")))\npoint = 0\ni = -1\nwhile(1):\n if x not in data:\n print(x)\n break\n elif x+i not in data:\n print(x+i)\n break\n elif x+(-1*i) not in data:\n print(x+(-1*i))\n break\n else:\n i=i-1', 'X, N = map(int, input().split(" "))\ndata = list(map(int, input().split(" ")))\npoint = 0\ni = -1\nwhile(1){\n\tif x not in data:\n \t\tprint(x)\n \t\tbreak;\n \telif x+i not in data:\n \t\tprint(x+i)\n break\n elif x+(-1*i) not in data:\n print(x+(-1*i))\n break\n else:\n \t\ti=i-1 \n}', 'x, N = map(int, input().split(" "))\ntry:\n data = list(map(int, input().split(" ")))\nexcept:\n data = []\npoint = 0\ni = 0\nwhile(1):\n if x not in data:\n print(x)\n break\n elif x+i not in data:\n print(x+i)\n break\n elif x+(-1*i) not in data:\n print(x+(-1*i))\n break\n else:\n i=i-1']
['Runtime Error', 'Runtime Error', 'Accepted']
['s353828657', 's978301882', 's628875534']
[9196.0, 8844.0, 9228.0]
[24.0, 22.0, 20.0]
[309, 294, 335]
p02641
u384576550
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()\np = list(map(int, input().split()))\n\nans = 0\nfor i in range(1, 102):\n if abs(X - i) < abs(ans - i) and i not in p and i != X:\n ans = i\n\nprint(ans)\n', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nans = 0\nfor i in range(1, 102):\n if abs(X - i) < abs(X - ans) and i not in p:\n ans = i\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s033864949', 's436437299']
[9176.0, 9156.0]
[20.0, 21.0]
[180, 178]
p02641
u387080888
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()))\nm=100\nans=0\nlis=list(range(101,-1,-1))\nfor k in lis:\n for l in range(N):\n if k==P[l]:\n lis[100-k]=0\nfor i in lis:\n if abs(i-X)<=m:\n m=abs(i-X)\n ans=i\nprint(ans)\n', 'N=int(input())\nA=list(map(int,input().split()))\nB=[0]*N\ncount=0\nfor i in range(N):\n for j in range(N):\n if A[i]%A[j]==0:\n count+=1\n if count==2:\n break\n if count==1:\n B[i]=1\n else:\n B[i]=0\n count=0\nprint(sum(B))', 'X,N=map(int,input().split())\nP=list(map(int,input().split()))\nm=100\nans=0\nlis=list(range(101,-1,-1))\nfor k in lis:\n for l in range(N):\n if k==P[l]:\n lis[101-k]=0\nfor i in lis:\n if abs(i-X)<=m:\n m=abs(i-X)\n ans=i\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s139315999', 's900125683', 's102592196']
[9200.0, 9200.0, 9204.0]
[23.0, 22.0, 26.0]
[261, 281, 260]
p02641
u394526356
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 not n:\n print(x) \nelse:\n l = list(map(int, input().split()))\n dic = {} \n for ll in l: dic[ll] = 1\n i = 1\n while true:\n if not dic.get(x-i,0):\n print(x-i)\n break\n elif not dic.get(x+i, 0):\n print(x+i) \n break\n i+=1', 'x, n = list(map(int, input().split()))\nif not n:\n print(x) \nelse:\n l = list(map(int, input().split()))\n dic = {} \n for ll in l: dic[l] = 1\n i = 1\n while true:\n if not dic.get(x-i,0):\n print(x-i)\n break\n elif not dic.get(x+i, 0):\n print(x+i) \n break\n i+=1', 'x, n = list(map(int, input().split()))\nif not n:\n print(x) \nelse:\n l = list(map(int, input().split()))\n dic = {} \n for ll in l: dic[ll] = 1\n i = 0\n while true:\n if not dic.get(x-i,0):\n print(x-i)\n break\n elif not dic.get(x+i, 0):\n print(x+i) \n break\n i+=1', 'x, n = list(map(int, input().split()))\nif not n:\n print(x) \nelse:\n l = list(map(int, input().split()))\n dic = {} \n for ll in l: dic[ll] = 1\n i = 0\n while True:\n if not dic.get(x-i,0):\n print(x-i)\n break\n elif not dic.get(x+i, 0):\n print(x+i) \n break\n i+=1']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s567272299', 's609257305', 's706615545', 's290859966']
[9132.0, 9064.0, 9140.0, 9196.0]
[26.0, 28.0, 24.0, 30.0]
[290, 289, 290, 290]
p02641
u394731058
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()))\nflg = false\nt = x\nwhile flg == False:\n if t in l:\n t -= 1\n else:\n ans = t\n flg = True\nflg = False\nt = x\nwhile flg == False:\n if t in l:\n t += 1\n else:\n if abs(x-ans) > abs(x-t):\n ans = t\n flg = True\nprint(ans)\n', 'x, n = map(int, input().split())\nl = list(map(int, input().split()))\nflg = False\nt = x\nwhile flg == False:\n if t in l:\n t -= 1\n else:\n ans = t\n flg = True\nflg = False\nt = x\nwhile flg == False:\n if t in l:\n t += 1\n else:\n if abs(x-ans) > abs(x-t):\n ans = t\n flg = True\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s940095056', 's175795826']
[9204.0, 9196.0]
[24.0, 24.0]
[306, 306]
p02641
u401390528
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\nlis=[]\nfor i in range(102):\n lis.append(i)\nprint(lis)\nlistA=[]\nwhile True:\n try:\n listA.append(list(map(int,input().split())))\n except:\n break;\nprint(listA)\n \nX_=listA[0]\nX=X_[0]\nN=X_[1]\nif N!=0:\n P =listA[1]\n \n arr = np.array(lis)\n P_max = max(P)\n P_min = min(P)-1\n arr=arr[arr<=P_max+1]\n arr=arr[arr>=P_min-1]\n lis=arr.tolist()\n for p in P:\n lis.remove(p)\n print(lis)\n lis_=[]\n for l in lis:\n lis_.append(abs(l-X))\n print(lis_)\n lis_min=min(lis_)\n \n def my_index(l, x, default=False):\n if x in l:\n return l.index(x)\n else:\n return default\n \n print(lis[my_index(lis_, lis_min)])\nelse:\n print(X)', 'import numpy as np\n\ndef my_index(l, x, default=False):\n if x in l:\n return l.index(x)\n else:\n return default\n\nlis=[]\nfor i in range(102):\n lis.append(i)\n#print(lis)\n\nlistA=[]\nwhile True:\n try:\n listA.append(list(map(int,input().split())))\n except:\n break;\n#print(listA)\n \nX_=listA[0]\nX=X_[0]\nN=X_[1]\nif N!=0:\n P =listA[1]\n \n arr = np.array(lis)\n P_max = max(P)\n P_min = min(P)-1\n arr=arr[arr<=P_max+1]\n arr=arr[arr>=P_min-1]\n lis=arr.tolist()\n for p in P:\n lis.remove(p)\n #print(lis)\n lis_=[]\n for l in lis:\n lis_.append(abs(l-X))\n #print(lis_)\n lis_min=min(lis_)\n \n print(lis[my_index(lis_, lis_min)])\nelse:\n print(X)']
['Wrong Answer', 'Accepted']
['s499712868', 's083440434']
[27272.0, 27288.0]
[110.0, 108.0]
[735, 736]
p02641
u403385724
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.
['XX, N = map(int, input().split(" "))\nif N == 0:\n print(X)\n exit()\nelse:\n p = list(map(int, input().split(" ")))\n c = -1\n for i in range(100):\n if i+1 not in p:\n if abs(X-(i+1)) < abs(X-c):\n c = i+1\n else:\n print(c)\n exit()', 'X, N = map(int, input().split(" "))\nif N == 0:\n print(X)\n exit()\nelse:\n p = list(map(int, input().split(" ")))\n c = 0\n for i in range(200):\n if i+1 not in p:\n if abs(X-(i+1)) < abs(X-c):\n c = i+1\n else:\n print(c)\n exit()']
['Runtime Error', 'Accepted']
['s849820254', 's919007075']
[9192.0, 9192.0]
[27.0, 21.0]
[261, 259]
p02641
u404629709
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=[i+1 for i in range(100)]\nflag=True\nflag2=True\nif n==0:\n flag=False\n print(x)\n\n\nif flag:\n p=list(map(int,input().split()))\n for i in p:\n lis.remove(i)\n if x>lis[-1]:\n print(lis[-1])\n flag2=False\n if flag2:\n for i in range(len(lis)):\n if lis[i]>x:\n id=i\n break\n if id>=1:\n if abs(x-lis[id])<abs(x-lis[id-1]):\n print(lis[id])\n else:\n print(lis[id-1])\n else:\n print(lis[0])x,n=map(int,input().split())\nlis=[i+1 for i in range(100)]\nflag=True\nflag2=True\nif n==0:\n flag=False\n print(x)\n\n\nif flag:\n p=list(map(int,input().split()))\n for i in p:\n lis.remove(i)\n if x>lis[-1]:\n print(lis[-1])\n flag2=False\n if flag2:\n for i in range(len(lis)):\n if lis[i]>x:\n id=i\n break\n if id>=1:\n if abs(x-lis[id])<abs(x-lis[id-1]):\n print(lis[id])\n else:\n print(lis[id-1])\n else:\n print(lis[0])', 'x,n=map(int,input().split())\nlis=[i-1 for i in range(103)]\nflag=True\nif n==0:\n flag=False\n print(x)\n\nif flag:\n p=list(map(int,input().split()))\n for i in p:\n lis.remove(i)\n #print(lis)\n for i in range(len(lis)):\n if lis[i]>x:\n index=i\n break\n if abs(x-lis[index])<abs(x-lis[index-1]):\n print(lis[index])\n else:\n print(lis[index-1])\n']
['Runtime Error', 'Accepted']
['s764829451', 's322376140']
[9088.0, 9208.0]
[23.0, 22.0]
[950, 362]
p02641
u405256066
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 stdin\nX,Y = [int(x) for x in stdin.readline().rstrip().split()]\nP = [int(x) for x in stdin.readline().rstrip().split()]\ntmp = 10**9+7\nP = set(list(range(0,101))) - set(P)\nP.sort(reverse=True)\n\n\nans = 0\nfor i in P:\n if abs(i-X) <= tmp:\n ans = i\n tmp = abs(i-X)\n \nprint(ans)\n ', 'from sys import stdin\nX, Y = [int(x) for x in stdin.readline().rstrip().split()]\nP = [int(x) for x in stdin.readline().rstrip().split()]\ntmp = 10**9+7\nP = set(list(range(-200, 200))) - set(P)\nP = list(P)\nP.sort(reverse=True)\n\n\nans = 0\nfor i in P:\n if abs(X-i) <= tmp:\n ans = i\n tmp = abs(X-i)\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s399968490', 's105725297']
[9160.0, 9244.0]
[24.0, 22.0]
[321, 321]
p02641
u406355300
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()))\nmin = 100\npp = list(map(lambda x: x-X, p))\ni = 0\nf = 0\nwhile f == 0:\n if not i in pp:\n res = X - i\n break\n if i >= 0:\n i = -1 * (i +1)\n else:\n i = -1 * i\nprint(res)\n\n\n', 'X,N = map(int,input().split())\np = list(map(int,input().split()))\nmin = 100\npp = list(map(lambda x: x-X, p))\ni = 0\nf = 0\nwhile f == 0:\n if not i in pp:\n res = X + i\n break\n if i >= 0:\n i = -1 * (i +1)\n else:\n i = -1 * i\nprint(res)\n\n\n']
['Wrong Answer', 'Accepted']
['s232615360', 's669274300']
[9112.0, 9120.0]
[27.0, 24.0]
[270, 270]
p02641
u407415713
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 = 0\nxhigh=0\nxlow=0\nif n==0:\n ans = x\nelse:\n if x not in p:\n ans=x\n else:\n xhigh=x+1\n xlow=x-1\n if xhigh in p and xlow in p:\n xhigh +=1\n xlow -=1\n else:\n if xlow in p:\n ans =xhigh\n else:\n ans = xlow\nprint(ans)', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\nans = 0\nxhigh=0\nxlow=0\nif n==0:\n ans = x\nelse:\n if x not in p:\n ans=x\n else:\n xhigh=x+1\n xlow=x-1\n while xhigh in p and xlow in p:\n xhigh +=1\n xlow -=1\n else:\n if xlow in p:\n ans =xhigh\n else:\n ans = xlow\nprint(ans)']
['Wrong Answer', 'Accepted']
['s677345766', 's160410438']
[9196.0, 8880.0]
[30.0, 25.0]
[399, 402]
p02641
u408375121
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 q = [True] * 101\n for i in range(n):\n q[p[i]] = False\n d_min = 10**3\n for j in range(1, 102):\n if q[j]:\n d = abs(x - j)\n if d_min > d:\n ans = j\n print(ans)', 'x, n = map(int, input().split())\nif n == 0:\n print(x)\nelse:\n p = list(map(int, input().split()))\n q = [True] * 102\n for i in range(n):\n q[p[i]] = False\n d_min = 10**3\n for j in range(1, 102):\n if q[j]:\n d = abs(x - j)\n if d_min > d:\n ans = j\n print(ans)\n', 'x, n = map(int, input().split())\nif n == 0:\n print(x)\nelse:\n p = list(map(int, input().split()))\n q = [True] * 102\n for i in range(n):\n q[p[i]] = False\n d_min = 10**3\n for j in range(102):\n if q[j]:\n d = abs(x - j)\n if d_min > d:\n d_min = d\n ans = j\n print(ans)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s460709886', 's941902352', 's390510726']
[9184.0, 9196.0, 9068.0]
[21.0, 20.0, 22.0]
[283, 284, 299]
p02641
u408620326
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 = [int(x) for x in input().strip().split()]\np = set([int(x) for x in input().strip().split()])\nans = 0\ndiff = X\nfor i in range(102):\n if i in p:\n continue\n if abs(X - i) < diff:\n ans = i\nprint(ans)', 'X, N = [int(x) for x in input().strip().split()]\np = [int(x) for x in input().strip().split()]\nans = 0\ndiff = X\nfor i in range(102):\n if abs(X - i) < diff:\n ans = i\nprint(ans)', 'X, N = [int(x) for x in input().strip().split()]\np = set([int(x) for x in input().strip().split()])\nans = 0\ndiff = X\nfor i in range(102):\n if i in p:\n continue\n if abs(X - i) < diff:\n ans = i\n diff = abs(X - i)\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s026508741', 's948983053', 's052161582']
[8936.0, 9184.0, 9064.0]
[28.0, 26.0, 33.0]
[210, 179, 232]
p02641
u410715775
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())\nlst = set(map(int,input().split()))\ndf = 0\nwhile True:\n if not (x + df) in lst: print(x + df)\n df = -df\n if not (x + df) in lst: print(x + df)\n df = -df\n df += 1', 'x, n = map(int,input().split())\nlst = set(map(int,input().split()))\ndf = 0\nwhile True:\n if not (x + df) in lst:\n print(x + df)\n exit()\n df = -df\n if not (x + df) in lst:\n print(x + df)\n exit()\n df = -df\n df -= 1']
['Time Limit Exceeded', 'Accepted']
['s386361480', 's611659928']
[44960.0, 9100.0]
[2263.0, 29.0]
[208, 254]
p02641
u414050834
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 p=list(map(int,input().split()))\n p2=map(lambda s:s-x,p)\na=0\ni=0\nif n==0:\n print(x)\nelse:\n while a==0:\n if i in p2:\n if i==0:\n i=-1\n elif i>0:\n i=-1*(i+1)\n else:\n i=-1*i\n else:\n print(x+i)\n a=1\n break\n', 'x,n=map(int,input().split())\nif n!=0:\n p=list(map(int,input().split()))\n p2=list(map(lambda s:s-x,p))\na=0\ni=0\nif n==0:\n print(x)\nelse:\n while a==0:\n if i in p2:\n if i==0:\n i=-1\n elif i>0:\n i=-1*(i+1)\n else:\n i=-1*i\n else:\n print(x+i)\n a=1\n break\n']
['Wrong Answer', 'Accepted']
['s827225466', 's484598964']
[9192.0, 9176.0]
[27.0, 24.0]
[301, 307]
p02641
u416258526
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 warnings\nwarnings.simplefilter('ignore')\n\nfrom numba import jit\n\nN = int(input())\nAs = list(map(int, input().split(' ')))\n\n\n@jit\ndef test(As):\n not_divisible = 0\n for num_i, Ai in enumerate(As):\n for num_j, Aj in enumerate(As):\n if num_i==num_j:\n continue\n if Ai%Aj==0:\n break\n else:\n not_divisible += 1\n print(not_divisible)\n \ntest(As)", "import itertools\nimport numpy as np\n\nX, N = list(map(int, input().split(' ')))\nps = input()\nif len(ps)!=0:\n ps = list(map(int, ps.split(' ')))\n\nps_sort = list(sorted(ps))\nnot_in_ps = np.array([[abs(i-X), i] for i in range(-1, 102) if i not in ps_sort])\nprint(not_in_ps[np.argmin(not_in_ps[:,0], 0), 1])"]
['Runtime Error', 'Accepted']
['s717572894', 's818467502']
[91728.0, 27152.0]
[372.0, 104.0]
[432, 305]
p02641
u418149936
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_ls = list(map(int, input().split(' ')))\n diff, rst = -1, 0\n for i in range(101, -1, -1):\n if diff == -1:\n diff = abs(X - i)\n rst = i\n else:\n diff = min(diff, abs(X - i))\n if diff == abs(X - i):\n rst = i\n print(rst)", "import sys\nimport os\nf = open('03_C - Forbidden List.txt', 'r')\nsys.stdin = f\n\nX, N = map(int, input().split(' '))\nif N == 0:\n print(X)\nelse:\n P_ls = list(map(int, input().split(' ')))\n diff, rst = -1, 0\n for i in range(101, -1, -1):\n if i not in P_ls:\n if diff == -1:\n diff = abs(X - i)\n rst = i\n else:\n diff = min(diff, abs(X - i))\n if diff == abs(X - i):\n rst = i\n print(rst)", "X, N = map(int, input().split(' '))\nif N == 0:\n print(X)\nelse:\n P_ls = list(map(int, input().split(' ')))\n diff, rst = -1, 0\n for i in range(101, -1, -1):\n if i not in P_ls:\n if diff == -1:\n diff = abs(X - i)\n rst = i\n else:\n diff = min(diff, abs(X - i))\n if diff == abs(X - i):\n rst = i\n print(rst)"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s898618482', 's948871621', 's539171180']
[9132.0, 9076.0, 9132.0]
[28.0, 25.0, 30.0]
[368, 501, 422]
p02641
u424467986
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 java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint X = scan.nextInt();\n\t\tint N = scan.nextInt();\n\t\tInteger p[] = new Integer[N];\n\t\t//int min = Math.abs(100 - X);\n\t\tint min = 100;\n int result = X;\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tp[i] = scan.nextInt();\n\t\t}\n\n\t\tfor (int i = 0; i <= 200; i++) {\n\t\t\tif (Math.abs(X - i) < min && !Arrays.asList(p).contains(i)) {\n\t\t\t\tmin = Math.abs(X - i);\n\t\t\t\tresult = i;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}\n\n}', "X, N = map(int, input().split(' '))\nP = []\nif N > 0:\n P = sorted(list(map(int, input().split(' '))))\n ans = 0\n i = 0\n while True:\n if (X-i) not in P:\n ans = (X-i)\n break\n elif (X+i) not in P:\n ans = (X+i)\n break\n else:\n i += 1\n\nif N > 0:\n print(ans)\nelse:\n print(X)"]
['Runtime Error', 'Accepted']
['s185983050', 's191425168']
[8908.0, 9172.0]
[27.0, 28.0]
[567, 305]
p02641
u433375322
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.
['s = list(map(int,input().split()))\nt = 0\nh = 0\na = s.pop(0)\nb = s.pop(0)\nprint(a)\nprint(b)\nd = 0\nfor i in range(a+1,a+2+b):\n c = 1\n for k in range(0,b):\n if i == s[k]:\n c = 0\n break\n if c==1:\n t = i\n break\nfor i in range(a-1,a-2-b,-1):\n c = 1\n for k in range(0,b):\n if i == s[k]:\n c = 0\n break\n if c==1:\n h = i\n break\nif abs(t-a)>=abs(h-a):\n print (h)\nelse:\n print(t)\n ', 'x,n=map(int,input().split())\nl=list(map(int,input().split()))\na=0\nfor i in range(100):\n if x-i not in l:\n ans=x-i-1\n a=i+1\n break\nfor i in range(100):\n if x+i not in l:\n ansb=x+i+1\n ab=i+1\n break\nif a>ab:\n print(ansb)\nelse:\n print(ans)', 's = list(map(int,input().split()))\nt = 0\nh = 0\na = s.pop(0)\nb = s.pop(0)\nprint(a)\nprint(b)\nd = 0\nif b ==0:\n print(a)\nelse:\n for i in range(a+1,a+2+b):\n c = 1\n for k in range(0,b):\n if i == s[k]:\n c = 0\n break\n if c==1:\n t = i\n break\n for i in range(a-1,a-2-b,-1):\n c = 1\n for k in range(0,b):\n if i == s[k]:\n c = 0\n break\n if c==1:\n h = i\n break\n if abs(t-a)>=abs(h-a):\n print (h)\n else:\n print(t)\n ', 's = list(map(int,input().split()))\nd = 0\nu = 0\nt = 0\n \nfor i in range(s[0],s[0]+s[1]+1):\n for k in range(s[1]):\n if k ==s[0]:\n continue\n if k ==s[1]:\n continue \n if i == k:\n d==0\n break\n if d == 1:\n t = i\n break\nfor i in range(s[0],s[0]-s[1]-1):\n for k in range(s[1]):\n if k ==s[0]:\n continue\n if k ==s[1]:\n continue \n if i == k:\n d==0\n break\n if d == 1:\n t = i\n break\nprint(max(u,t))\n ', 'x,n=map(int,input().split())\nl=list(map(int,input().split()))\nflag=0\ni=0\nwhile flag==0:\n if x-i not in l:\n flag=1\n ansa=x-i\n i+=1\nflag=0\ni=0\nwhile flag==0:\n if x+i not in l:\n flag=1\n ansb=x+i\n i+=1\nif abs(ansa-x)<=abs(ansb-x):\n print(ansa)\nelse:\n print(ansb)']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s337701961', 's529240442', 's537895602', 's788999954', 's651444259']
[9236.0, 9188.0, 9236.0, 9160.0, 9208.0]
[24.0, 27.0, 21.0, 25.0, 27.0]
[418, 289, 489, 474, 304]
p02641
u433380437
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()))\ny=x\nz=x\nif x not in p:\n print(x)\n exit()\nfor i in range(2*len(p)):\n y-=1\n z+=1\n if y not in p:\n print(y)\n print('owari')\n exit()\n if z not in p:\n print(z)\n print('owari')\n exit()\n ", 'x,n=map(int,input().split())\np=list(map(int,input().split()))\ny=x\nz=x\nif x not in p:\n print(x)\n exit()\nfor i in range(2*len(p)):\n y-=1\n z+=1\n if y not in p:\n print(y)\n exit()\n if z not in p:\n print(z)\n exit()\n ']
['Wrong Answer', 'Accepted']
['s822478500', 's988773475']
[9092.0, 9196.0]
[28.0, 27.0]
[305, 259]
p02641
u437215432
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\nif n == 0:\n p = set([])\nelse:\n p = list(map(int, input().split()))\np = list(map(int, str.split()))\na = list(set(range(201)) - set(p))\nabs_diff = [abs(i - x) for i in a]\nmin_abs_diff = min(abs_diff)\nfor i, j in zip(a, abs_diff):\n if j == min_abs_diff:\n print(i)\n break\n', '# ABC170C\n\nx, n = map(int, input().split())\n\nif n == 0:\n p = set([])\nelse:\n p = list(map(int, input().split()))\na = list(set(range(201)) - set(p))\nabs_diff = [abs(i - x) for i in a]\nmin_abs_diff = min(abs_diff)\nfor i, j in zip(a, abs_diff):\n if j == min_abs_diff:\n print(i)\n break\n']
['Runtime Error', 'Accepted']
['s627877653', 's783741363']
[8976.0, 9132.0]
[22.0, 29.0]
[325, 304]
p02641
u439757045
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()))\ndef y(x,l):\n k=1\n if x-k not in l:\n return (x-k)\n\n elif x-k not in l:\n return (x+k)\n else:\n k+=1\nprint(y(x,l))', 'x,n=map(int,input().split())\nl=list(map(int,input().split()))\ndef y(x,l):\n k=0\n while k>-1:\n if x-k not in l:\n return (x-k)\n\n elif x+k not in l:\n return (x+k)\n else:\n k+=1\n\nprint(y(x,l))']
['Wrong Answer', 'Accepted']
['s320031073', 's273136649']
[9180.0, 9184.0]
[23.0, 24.0]
[205, 246]
p02641
u440608859
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\nx,n=map(int,input().split())\nl=list(map(int,input().split()))\nv=collections.Counter(l)\nif n==0:\n print(x)\nelse:\n for i in range(101):\n if x not in v:\n ans=x\n break\n \n if x+1 not in v:\n ans=x+1\n break\n if x-1 not in v:\n ans=x-1\n break\n print(ans)\n \n\n ', 'import collections\nx,n=map(int,input().split())\nif n!=0:\n l=list(map(int,input().split()))\n v=collections.Counter(l)\nif n==0:\n print(x)\nelse:\n for i in range(101):\n if x not in v:\n ans=x\n break\n \n if x-i not in v:\n ans=x-i\n break\n if x+i not in v:\n ans=x+i\n break\n print(ans)\n \n\n ']
['Runtime Error', 'Accepted']
['s227548581', 's357604224']
[9480.0, 9480.0]
[25.0, 24.0]
[391, 408]
p02641
u441246928
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 a = list(range(10000000))\n ab = 101\n an = []\n for i in range(-1.N):\n a.remove(P[i])\n a = a\n for j in range(101 - N):\n ab = min(ab,abs(X - a[j]))\n if X - ab in a :\n print(X - ab)\n elif X + ab in a:\n print(X + ab)\n \n \n\n ', 'X,N = map(int,input().split())\nif N == 0 :\n print(X)\nelse :\n P = list(map(int,input().split()))\n a = list(range(10000000))\n ab = 101\n an = []\n for i in range(N):\n a.remove(P[i])\n a = a\n for j in range(0,102):\n ab = min(ab,abs(X - a[j]))\n if X - ab in a :\n print(X - ab)\n elif X + ab in a:\n print(X + ab)']
['Runtime Error', 'Accepted']
['s617490792', 's051993533']
[8964.0, 404632.0]
[19.0, 1227.0]
[387, 365]
p02641
u445580781
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())\nb = list(map(int,input().split()))\nfor i in b:\n a[i] = 1\nt = 1\nans = 0\nwhile 1:\n if x-t not in b:\n ans = x - t\n break\n if x+t not in b:\n ans = x + t\n break\n t += 1\nprint(ans)', 'x , n = map(int , input().split())\nb = []\nif n!=0:\n b = list(map(int,input().split()))\nt = 0\nans = 0\nwhile 1:\n if x-t not in b:\n ans = x - t\n break\n if x+t not in b:\n ans = x + t\n break\n t += 1\nprint(ans)']
['Runtime Error', 'Accepted']
['s122618271', 's128542454']
[8968.0, 9192.0]
[25.0, 26.0]
[249, 244]