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
u449580152
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(0, 102):\n if x-i not in P or x+i not in P:\n if x-i not in P:\n print(x-i)\n exit(0)\n if x+i not in P:\n print(x+i)\n exit(0)', 'import numpy as np\nx, n = map(int, input().split())\nif n==0:\n print(x)\nelse:\n P = np.array(list(map(int, input().split())))\n Q = P - x\n W = [abs(i) for i in Q]\n W.sort()\n print(W[0])', 'x, n = map(int, input().split())\nif n==0:\n print(x)\nif n > 0:\n P = list(map(int, input().split()))\n for i in range(0,102):\n if x-i not in P or x+i not in P:\n if x-i not in P:\n print(x-i)\n exit(0)\n if x+i not in P:\n print(x+i)\n exit(0)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s369073481', 's683021832', 's525225906']
[9032.0, 27200.0, 9196.0]
[24.0, 100.0, 21.0]
[328, 188, 332]
p02641
u450288159
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 -*-\ndef main(): \n x, n = map(int, input().split())\n if n == 0:\n print(x)\n return\n p = list(map(int, input().split()))\n print(p)\n check = 0\n while(1):\n s = check//2\n if check%2 == 0:\n ans = x-s\n else:\n ans = x+s\n if not ans in p:\n print(ans)\n return\n check += 1\nmain()', '# -*- coding: utf-8 -*-\ndef main(): \n x, n = map(int, input().split())\n if n == 0:\n print(x)\n return\n p = list(map(int, input().split()))\n check = 0\n while(1):\n s = check//2\n if check%2 == 0:\n ans = x-s\n else:\n ans = x+s\n if not ans in p:\n print(ans)\n return\n check += 1\nmain()']
['Wrong Answer', 'Accepted']
['s103941725', 's125419769']
[9188.0, 9184.0]
[26.0, 27.0]
[401, 388]
p02641
u453634575
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())) \nimport numpy as np\n\nif x not in p:\n print(x)\nelse:\n t = [i for i in range(1,101)]\n for i in range(n): \n t.remove(p[i])\n# print(t)\n\n res = 100\n s = 1000\n print(len(t))\n for i in range(len(t)):\n# print(t[i])\n if s >= abs (x - t[len(t)-1-i]):\n s = abs (x - t[len(t)-1-i])\n res = t[len(t)-1-i]\n print(res)', 'x,n= list(map(int, input().split()))\np = list(map(int, input().split())) \nimport numpy as np\n\nif x not in p:\n print(x)\nelse:\n t = [i for i in range(-101,201)]\n for i in range(n): \n t.remove(p[i])\n# print(t)\n\n res = 100\n s = 1000\n for i in range(len(t)):\n# print(t[i])\n if s >= abs (x - t[len(t)-1-i]):\n s = abs (x - t[len(t)-1-i])\n res = t[len(t)-1-i]\n print(res)']
['Wrong Answer', 'Accepted']
['s815016480', 's320345736']
[27128.0, 27136.0]
[105.0, 1613.0]
[454, 439]
p02641
u454866890
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\tprint(X)\nelif N == 1:\n\tp = [int(input())]\n print(" ")\nelse:\n p = list(map(int, input().split()))\nfor d in range(N+1):\n\tfor s in [-1, +1]:\n\t\ta = X + s * d\n\t\tif p.count(a) == 0:\n\t\t\tprint(a)\n\t\t\texit(0)\n\n', 'X,N = list(map(int, input().split()))\np = list(map(int,input().split())) #list(map(int, input().split()))\nfor i in range(N + 1):\n a = X + i\n b = X - i\n if p.count(b) == 0:\n print(b)\n exit(0)\n elif p.count(a) == 0:\n print(a)\n exit(0)\n\n']
['Runtime Error', 'Accepted']
['s579919187', 's699970353']
[8900.0, 9144.0]
[24.0, 27.0]
[251, 250]
p02641
u459150945
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())\npn = list(map(int, input().split()))\ndiff = 100\nans = X\nif pn:\n for i in range(min(pn)+1, max(pn)):\n if i in pn:\n continue\n if abs(X-i) < diff:\n ans = i\nprint(ans)', 'X, N = map(int, input().split())\npn = list(map(int, input().split()))\ndiff = 100\nans = X\nif pn:\n for i in range(min(pn)-1, max(pn)+2):\n if i in pn:\n continue\n if abs(X-i) < diff:\n diff = abs(X-i)\n ans = i\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s324906515', 's311750473']
[9180.0, 9124.0]
[22.0, 21.0]
[235, 266]
p02641
u460340021
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, Y = map(int, input().split())\nif Y == 0:\n answer = X\nelse:\n list_1 = list(map(int, input().split()))\n\n mylist = list(range(1,101))\n\n list_2 = list(filter(lambda x: x not in list_1, mylist))\n\n import numpy as np\n\n abslist = np.abs(list_2)\n\n min_num = min(abslist)\n\n answer = X - min_num\n \nprint(answer)', 'X, Y = map(int, input().split())\nif Y == 0:\n answer = X\nelse:\n list_1 = list(map(int, input().split()))\n\n mylist = list(range(-100, 200))\n\n list_2 = list(filter(lambda x: x not in list_1, mylist))\n \n list_3 = list(map(lambda x: x - X, list_2))\n\n import numpy as np\n\n abslist = np.abs(list_3)\n\n min_num = min(abslist)\n\n answer_lisbef = [X - min_num, X + min_num]\n \n answer_lisaf = list(filter(lambda x: x not in list_1, answer_lisbef))\n \n answer = min(answer_lisaf)\nprint(answer)']
['Runtime Error', 'Accepted']
['s724190020', 's303203776']
[27092.0, 27168.0]
[114.0, 107.0]
[331, 520]
p02641
u465652095
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())\nLP = [list(map(int, input().split())) for i in range(N)]\n\nif N == 0:\n print(X)\n\nelse:\n for i in range(1,100):\n ans = X - i\n if ans not in LP:\n print(ans)\n break\n else:\n dans = X + i\n if dans not in LP:\n print(dans)\n break', 'X, N = map(int,input().split())\nLP = []\nfor i in range(N):\n LP.append(list(map(int, input().split())))\n\nif N == 0:\n print(X)\n\nelse:\n for i in range(100):\n ans = X - i\n if ans not in LP:\n print(ans)\n break\n else:\n dans = X + i\n if dans not in LP:\n print(dans)\n break', 'X, N = map(int,input().split())\nLP = [list(map(int, input().split())) for i in range(N)]\n\nif N == 0:\n print(X)\n\nelse:\n for i in range(100):\n ans = X - i\n if ans not in LP:\n print(ans)\n break\n else:\n dans = X + i\n if dans not in LP:\n print(dans)\n break', 'X, N = map(int,input().split())\nif N == 0:\n print(X)\n exit()\nLP = list(map(int, input().split()))\n\n\nfor i in range(100):\n ans = X - i\n if ans not in LP:\n print(ans)\n exit()\n else:\n dans = X + i\n if dans not in LP:\n print(dans)\n exit()']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s241286693', 's821787668', 's947764820', 's707791406']
[9200.0, 9136.0, 9196.0, 9112.0]
[23.0, 21.0, 26.0, 20.0]
[354, 369, 352, 299]
p02641
u473633103
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\nimport numpy as np\n\nx,n = map(int,input().split())\n\np = list(map(int,input().split()))\n\nm = np.array(list(range(-100,200)))\nm = (m-x)**2\nprint(m)\nfor i in (np.argsort(m)-101):\n if p.count(i) == 0:\n print(i)\n break\n', '# coding: utf-8\n# Your code here!\n\nimport numpy as np\n\nx,n = map(int,input().split())\n\nif n == 0:\n print(x)\n \nelse:\n p = list(map(int,input().split()))\n \n m = np.array(list(range(1,101)))\n m = (m-x)**2\n\n for i in (np.argsort(m)+1):\n if i not in p:\n print(i)\n', '# coding: utf-8\n# Your code here!\n\nnum = int(input())\n\nqm = 1000000000000001\n\nalf = [chr(i) for i in range(97, 97+26)]\n#print(alf)\n\nans = []\nf = False\n\nfor i in reversed(range(12)):\n if (num-num//26)//26**i >= 1:\n f = True\n\n if f:\n ans.append(alf[(num-i)//26**i-1])\n num = num % 26**i\nprint("".join(ans))\n', '# coding: utf-8\n# Your code here!\n\nimport numpy as np\n\nx,n = map(int,input().split())\n\np = list(map(int,input().split()))\n\nm = np.array(list(range(-100,200)))\nm = (m-x)**2\nfor i in (np.argsort(m)-101):\n if p.count(i) == 0:\n print(i)\n break\n', '# coding: utf-8\n# Your code here!\n\nimport numpy as np\n\nx,n = map(int,input().split())\n\np = list(map(int,input().split()))\n\nm = np.array(list(range(-200,400)))\nm = (m-x)**2\nfor i in (np.argsort(m)-200):\n if p.count(i) == 0:\n print(i)\n break\n\n']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s268652534', 's412092393', 's679749295', 's833075006', 's941474413']
[27276.0, 27180.0, 9172.0, 27292.0, 27216.0]
[117.0, 121.0, 24.0, 120.0, 116.0]
[266, 297, 332, 257, 258]
p02641
u475189661
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()))\nif (len(num_list) == 0) or X not in num_list:\n print(X)\nelse:\n d = 1\n while True:\n\tif X - d not in num_list:\n print(X -d)\n break\n elif X + d not in num_list:\n print(X + d)\n break\n else:\n d += 1', 'X,N = map(int, input().split())\nnum_list = list(map(int, input().split()))\nif (len(num_list) == 0) or X not in num_list:\n print(X)\nelse:\n d = 1\n while True:\n if X - d not in num_list:\n print(X -d)\n break\n elif X + d not in num_list:\n print(X + d)\n break\n else:\n d +=1']
['Runtime Error', 'Accepted']
['s486640282', 's004784505']
[9012.0, 9184.0]
[25.0, 28.0]
[302, 352]
p02641
u479937725
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 = X+1\n b = X-1\n\n if X not in P:\n print(X)\n \n else:\n while a not in P:\n break\n a+=1\n while b not in P:\n break\n b-=1\n \n if abs(X-a)>abs(X-b):\n print(a)\n else:\n print(b)', 'X,N = map(int,input().split())\n\nif N==0:\n print(X)\n\nelse:\n P = list(map(int,input().split()))\n if X not in P:\n print(X)\n \n else:\n a = X+1\n b = X-1\n \n while a in P:\n a+=1\n while b in P:\n b-=1\n \n if abs(X-a)<abs(X-b):\n print(a)\n else:\n print(b)\n']
['Wrong Answer', 'Accepted']
['s371058044', 's685089994']
[9204.0, 9196.0]
[23.0, 22.0]
[318, 319]
p02641
u481856377
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.
['y,n = map(int, input().split())\nlist = []\nlist = map(int, input().split())\nsum = 100\nans = 100\n\nfor i in list:\n if i > y:\n if i - y < sum:\n sum = i - y\n if ans > i:\n ans = i\n elif i < y:\n if y - i < sum:\n sum = y - i\n if ans > i:\n ans = i\n else:\n if ans > i:\n ans = i\n break\n\nprint(ans+1)\n', 'x,y = map(int, input().split())\np = list(map(int, input().split()))\n\nfor i in range(x+1):\n for j in [-1,+1]:\n a = x + j * i\n if p.count(a) == 0:\n print(a)\n exit(0)\n']
['Wrong Answer', 'Accepted']
['s504523504', 's321708532']
[9140.0, 9052.0]
[30.0, 25.0]
[415, 203]
p02641
u487044452
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\nif n == 0:\n print(x)\nelse:\n while True:\n if not x - i in p:\n print(x-i)\n break\n elif not x + i in p:\n print(x+i)\n else:\n i += 1', 'x,n = map(int,input().split())\np = list(map(int,input().split()))\ni = 0\nif n == 0:\n print(x)\nelse:\n for i in range(101)\n if not x - i in p:\n print(x-i)\n break\n elif not x + i in p:\n print(x+i)\n break\n else:\n i += 1', 'x,n = map(int,input().split())\np = list(map(int,input().split()))\ni = 0\nif n == 0:\n print(x)\nelse:\n for i in range(101):\n if not x - i in p:\n print(x-i)\n break\n elif not x + i in p:\n print(x+i)\n break\n else:\n i += 1']
['Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s297312977', 's836386135', 's020499650']
[23336.0, 9024.0, 9188.0]
[2241.0, 21.0, 21.0]
[270, 296, 297]
p02641
u490195279
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\n\ndef main(X, N, a):\n a.append(10000000000)\n a.append(-10000000000)\n a.sort()\n maxn = a[0]-1\n for i in range(len(a)-1):\n\n if a[i] >= X:\n if a[i+1]-a[i] > 1:\n if X-maxn>a[i]+1-X\n maxn = a[i]+1\n break\n if X-maxn < a[i]-X:\n break\n else:\n if a[i+1]-a[i] > 1:\n if a[i+1] > X and a[i] < X:\n maxn = X\n break\n maxn = a[i+1]-1\n\n return maxn\n\n\nX, N = map(int, input().split())\ntry:\n a = list(map(int, input().split()))\nexcept:\n a = []\nprint(main(X, N, a))\n', 'import numpy as np\n\n\ndef main(X, N, a):\n a.append(10000000000)\n a.append(-10000000000)\n a.sort()\n maxn = a[0]-1\n for i in range(len(a)-1):\n\n if a[i] >= X:\n if a[i+1]-a[i] > 1:\n if X-maxn>a[i]+1-X:\n maxn = a[i]+1\n break\n if X-maxn < a[i]-X:\n break\n else:\n if a[i+1]-a[i] > 1:\n if a[i+1] > X and a[i] < X:\n maxn = X\n break\n maxn = a[i+1]-1\n\n return maxn\n\n\nX, N = map(int, input().split())\ntry:\n a = list(map(int, input().split()))\nexcept:\n a = []\nprint(main(X, N, a))\n']
['Runtime Error', 'Accepted']
['s000947690', 's771682494']
[8980.0, 26992.0]
[25.0, 102.0]
[664, 669]
p02641
u490489966
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.
['# C\nx, n = map(int, input().split())\np = list(map(int, input().strip().split()))\nprint(p)\nans = 0\nif n == 0:\n print(x)\nelif x not in p:\n print(x)\nelse:\n for i in range(102):\n if i not in p:\n if abs(x - i) < abs(x - ans):\n ans = i\n print(ans)\n', '# C\nx, n = map(int, input().split())\np = list(map(int, input().split()))\nans = 0\nif n = 0:\n print(x)\nelif x not in p:\n print(x)\nelse:\n for i in range(102):\n if i not in p\n if abs(x - i) < abs(x - ans):\n ans = i\n print(ans)', '# C\nx, n = map(int, input().split())\np = list(map(int, input().split()))\nans = 0\nif n == 0:\n print(x)\nelif x not in p:\n print(x)\nelse:\n for i in range(102):\n if i not in p\n if abs(x - i) < abs(x - ans):\n ans = i\n print(ans)', '# C\nx, n = map(int, input().split())\np = list(map(int, input().split()))\nans = 0\nif n = 0:\n print(x)\nelif x not in p:\n print(x)\nelse:\n for i in range(102):\n if i not in p and abs(x - i) < abs(x - ans):\n ans = i\n print(ans)', '# C\nx, n = map(int, input().split())\np = list(map(int, input().split()))\n# print(p)\nans = 0\nif n == 0:\n print(x)\nelif x not in p:\n print(x)\nelse:\n for i in range(102):\n if i not in p:\n if abs(x - i) < abs(x - ans):\n ans = i\n print(ans)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s152787153', 's535841622', 's590333542', 's723012864', 's750646966']
[8980.0, 9024.0, 8952.0, 8996.0, 9180.0]
[23.0, 25.0, 24.0, 20.0, 23.0]
[283, 267, 268, 252, 281]
p02641
u491462774
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import bisect\nx, n = map(int, input().split())\npN = list(map(int, input().split()))\nplus_flag = 1\nminus_flag = 1\npN.sort()\nkey_index = bisect.bisect(pN, x) - 1\nplus_index = key_index\nminus_index = key_index\nif n == 0:\n print(x)\nelse:\n while(1):\n if minus_flag == 1:\n if pN[key_index] - 1 != pN[key_index-1]:\n print(pN[key_index] - 1)\n break\n else:\n minus_index = minus_index + 1\n\n if minus_index == 0:\n minus_flag = 0\n\n\n\n if plus_flag == 1:\n if pN[key_index] + 1 != pN[key_index+1]:\n print(pN[key_index] + 1)\n break\n else:\n plus_index = plus_index + 1\n\n if plus_index == n:\n plus_flag = 0', 'import bisect\nx, n = map(int, input().split())\npN = list(map(int, input().split()))\nplus_flag = 1\nminus_flag = 1\npN.sort()\nkey_index = bisect.bisect(pN, x) - 1\nplus_index = key_index\nminus_index = key_index\nprint(key_index)\nif n == 0:\n print(x)\nelse:\n while(1):\n if minus_index <= 0:\n minus_flag = 0\n \n if minus_flag == 1:\n if pN[minus_index] - 1 != pN[minus_index-1]:\n print(pN[minus_index] - 1)\n break\n else:\n minus_index = minus_index - 1\n\n \n\n if plus_index >= n:\n plus_flag = 0\n\n if plus_flag == 1:\n if pN[plus_index] + 1 != pN[plus_index+1]:\n print(pN[plus_index] + 1)\n break\n else:\n plus_index = plus_index + 1', 'import bisect\nx, n = map(int, input().split())\npN = list(map(int, input().split()))\n\npN.sort()\n\ndiff = 0\n\nif n == 0:\n print(x)\nelse:\n while(1):\n if x-diff not in pN:\n print(x-diff)\n exit()\n elif x+diff not in pN:\n print(x+diff)\n exit()\n diff+=1']
['Runtime Error', 'Runtime Error', 'Accepted']
['s429825584', 's918574305', 's630895280']
[9204.0, 9208.0, 9128.0]
[2205.0, 26.0, 28.0]
[778, 832, 315]
p02641
u491550356
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = map(int, input().split())\na = list(map(int, input().split()))\n\nabs_min = int(1e5)\nans = -1\nfor i in range(0, 102):\n if abs(x - i) < abs_min:\n abs_min = abs(x - i)\n ans = i\nprint(ans)', 'x, n = map(int, input().split())\na = list(map(int, input().split()))\n\nabs_min = int(1e5)\nans = -1\nfor i in range(0, 102):\n if i in a:\n continue\n if abs(x - i) < abs_min:\n abs_min = abs(x - i)\n ans = i\nprint(ans)']
['Wrong Answer', 'Accepted']
['s135939860', 's648079182']
[9180.0, 9120.0]
[28.0, 28.0]
[206, 238]
p02641
u496157893
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(input().split())\nlist = [int(x) for x in input().split()]\n\nmin_num = 150\n\nfor a in range(-10,110):\n counter = 0\n A = abs(X - a)\n for b in list:\n if a == b:\n counter = 1\n else:\n continue\n if counter == 1:\n continue\n else:\n if A == abs(X - a):\n min_num = (a, min_num)\n elif A > abs(X - a):\n min_num = a\n else:\n continue\n\nprint(min_num)', 'X,N = int(input().split())\nlist = [int(x) for x in input().split()]\n\nmin_num = 150\n\nfor a in range(X - N - 2, X + N + 3):\n counter = 0\n A = abs(X - a)\n for b in list:\n if a == b:\n counter = 1\n else:\n continue\n if counter == 1:\n continue\n else:\n if A == abs(X - a):\n min_num = (a, min_num)\n elif A > abs(X - a):\n min_num = a\n else:\n continue\n\nprint(min_num)', 'X,N = input().split()\nlist = [int(x) for x in input().split()]\n\nmin_num = [300, abs(int(X) - 300)]\n\nfor a in range(0,102):\n A = abs(int(X) - a)\n \n if a in list:\n continue\n \n else:\n if A > min_num[1]:\n continue\n \n elif A == min_num[1]:\n min_num[0] = min(a,min_num[0])\n min_num[1] = abs(int(X) - min_num[0])\n \n elif A < min_num[1]:\n min_num[0] = a\n min_num[1] = abs(int(X) - min_num[0])\n \nprint(min_num[0])']
['Runtime Error', 'Runtime Error', 'Accepted']
['s174798857', 's527516941', 's844795649']
[9136.0, 9012.0, 9204.0]
[23.0, 23.0, 27.0]
[455, 468, 539]
p02641
u497046426
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, = map(int, input().split())\ncand = set(range(101)) - set(P)\nans, temp = None, 10**10\nfor c in cand:\n t = abs(X - c)\n if t < temp:\n temp = t; ans = min(ans, c)\nprint(ans)', 'X, N = map(int, input().split())\n*P, = map(int, input().split())\ncand = set(range(-50, 151)) - set(P)\ncand = sorted([c for c in cand], key=lambda x: (abs(X - x), x))\nprint(cand[0])']
['Runtime Error', 'Accepted']
['s406146799', 's674345397']
[9196.0, 9192.0]
[23.0, 24.0]
[219, 180]
p02641
u497277272
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['def forbidden_list():\n condition = input()\n num_str = input()\n \n condition_list = condition.split()\n X = int(condition_list[0])\n N = int(condition_list[1])\n \n if N == 0:\n print(X)\n return\n \n num_list_str = num_str.split()\n num_list = []\n for i in num_list_str:\n num_list.append(int(i))\n \n num_list.sort()\n flag = True\n sub = 0\n tmp = X\n \n while flag:\n tmp = X + sub\n for i in num_list:\n count = 0\n if tmp == i:\n count = 1\n break\n if count == 0:\n print(tmp)\n return\n \n sub += 1\n tmp = X - sub\n print(tmp)\n for i in num_list:\n count = 0\n if tmp == i:\n count = 1\n break\n if count == 0:\n print(tmp)\n return\n \nforbidden_list()', 'def forbidden_list():\n condition = input()\n num_str = input()\n \n condition_list = condition.split()\n X = int(condition_list[0])\n N = int(condition_list[1])\n \n if N == 0:\n print(X)\n return\n \n num_list_str = num_str.split()\n num_list = []\n for i in num_list_str:\n num_list.append(int(i))\n \n num_list.sort()\n flag = True\n sub = 0\n tmp = X\n \n while flag:\n tmp = X + sub\n for i in num_list:\n count = 0\n if tmp == i:\n count = 1\n break\n if count == 0:\n print(tmp)\n return\n \n sub += 1\n tmp = X - sub\n for i in num_list:\n count = 0\n if tmp == i:\n count = 1\n break\n if count == 0:\n print(tmp)\n return\n \nforbidden_list()']
['Wrong Answer', 'Accepted']
['s855019498', 's856895064']
[9232.0, 9228.0]
[20.0, 25.0]
[913, 894]
p02641
u498575211
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=X\n\n\nmin= 1000\n\np.sort()\n\nfor i in range(100):\n if (i not in p ) and len(p) > 0:\n a = abs(i-X)\n if a<min:\n min=a\n ans = i\n', 'X, N=map(int, input().split())\np = list(map(int, input().split()))\nans=X\n\n\nmin= 100\n\np.sort()\n\nfor i in range(-200, 201):\n if (i not in p ) and len(p) > 0:\n a = abs(i-X)\n if a<min:\n min=a\n ans = i\nprint(ans)']
['Wrong Answer', 'Accepted']
['s037543420', 's973746240']
[9180.0, 9196.0]
[22.0, 22.0]
[209, 224]
p02641
u499106786
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, num = [int(i) for i in input().split(" ")]\nl = [int(i) for i in input().split(" ")]\n\nif num == 0:\n print(X)\nelse:\n for i in range(num):\n if X-i not in l:\n print(X-i):\n exit()\n elif X+i not in l:\n print(X+i)\n exit()\n print(X-num)', 'X, num = [int(i) for i in input().split(" ")]\n\n \nif num == 0:\n print(X)\nelse:\n l = [int(i) for i in input().split(" ")]\n for i in range(num):\n if X-i not in l:\n print(X-i)\n exit()\n elif X+i not in l:\n print(X+i)\n exit()\n print(X-num)']
['Runtime Error', 'Accepted']
['s854015397', 's119145263']
[9044.0, 9188.0]
[24.0, 22.0]
[260, 263]
p02641
u500376440
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.
['#include <bits/stdc++.h>\n#define rep(i,x,n) for(int i=x; i<(int)(n); i++)\n#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)\nusing namespace std;\n\nint main() {\n int X,N; cin >>X >>N;\n if (N==0) {cout <<X <<endl; return 0;}\n vector<int> p(N);\n rep(i,0,N) cin >>p[i];\n sort(p.begin(),p.end());\n int ans=0;\n int check=INT_MAX;\n rep_eq(i,p[0],p[N-1]) {\n bool check_flag=true;\n rep(j,0,N) {\n if (i==p[j]) {check_flag=false; break;}\n }\n if (check_flag) {\n if (abs(X-i)<check) {check=abs(X-i); ans=i;}\n }\n }\n cout <<ans <<endl;\n return 0;\n}\n', 'X,N=map(int,input().split())\nif N==0:\n print(X)\n exit()\np=list(map(int,input().split()))\nans=0\ncheck=100\nfor i in range(101+1):\n if i in p:\n continue\n if abs(X-i)<check:\n check=abs(X-i)\n ans=i\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s979024934', 's904023515']
[8900.0, 9188.0]
[22.0, 20.0]
[572, 217]
p02641
u503111914
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 = 100000000\nl = 1000000\nfor i in range(1,101):\n if P.count(i) == 0:\n #print(i)\n if abs(i-X) < l:\n l = abs(i-X)\n ans = min(i,ans)\n #print(ans,i,l)\nprint(ans)', 'X,N = map(int,input().split())\nP = list(map(int,input().split()))\nans = 100\nl = 101\nfor i in range(0,102):\n if P.count(i) == 0:\n if abs(i-X) < l:\n #print(i)\n l = abs(i-X)\n ans = i\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s192046872', 's096765248']
[9184.0, 9180.0]
[23.0, 25.0]
[276, 234]
p02641
u504194367
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\ntry:\n p = set(map(int, input().split()))\n num = set(range(-100,201))\n mem = []\n\n ref = sorted(list(num - p))\n\n for item in ref:\n mem.append(abs(item - X))\n \n print(ref)\n print(mem)\n print(ref[mem.index(min(mem))])\n\nexcept EOFError:\n print(X)', 'X, N = map(int, input().split())\n\ntry:\n p = set(map(int, input().split()))\n num = set(range(-1,201))\n mem = []\n\n ref = sorted(list(num - p))\n\n for item in ref:\n mem.append(abs(item - X))\n \n print(ref)\n print(mem)\n print(ref[mem.index(min(mem))])\n\nexcept EOFError:\n print(X)', 'X, N = map(int, input().split())\n\ntry:\n p = set(map(int, input().split()))\n num = set(range(-100,201))\n mem = []\n\n ref = sorted(list(num - p))\n\n for item in ref:\n mem.append(abs(item - X))\n \n print(ref[mem.index(min(mem))])\n\nexcept EOFError:\n print(X)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s013036235', 's382821110', 's951422960']
[9216.0, 9164.0, 9076.0]
[28.0, 30.0, 23.0]
[288, 286, 262]
p02641
u505730871
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import numpy as np\n\nx,n = [int(i) for i in input().split()]\ntable = [int(i) for i in input().split()]\ntable.sort()\nmin = min(table)\n\na = np.array(table)\na = a - x\na = np.abs(a)\na = np.sort(a)\n#print(a)\n\nfor i in range(n):\n if a[0] > 0:\n print(x)\n break\n elif a[i+1]-a[i]>1 and i>0:\n if a[i] > 0 and a[i] == a[i-1]:\n if x-a[i]-1 in b or x-a[i]-1 < min:\n print(x+a[i]+1)\n break\n else:\n print(x-a[i]-1)\n break\n else:\n if x-a[i] in b or x-a[i] < min:\n print(x+a[i])\n break\n else:\n print(x+a[i])\n break\n \n \n\n\n', 'def main():\n x,n = [int(i) for i in input().split()]\n table = list(map(int, input().split()))\n \n for i in range(101):\n if x - i not in table:\n print(x-i)\n exit()\n elif x + i not in table:\n print(x+1)\n exit()\n \t\nif __name__ == "__main__":\n main()', 'def main():\n x,n = [int(i) for i in input().split()]\n table = list(map(int, input().split()))\n \n for i in range(101):\n if x - i not in table:\n print(x-i)\n exit()\n elif x + i not in table:\n print(x+i)\n exit()\n \t\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s156740676', 's263104297', 's454318033']
[27236.0, 9164.0, 9168.0]
[106.0, 27.0, 26.0]
[602, 279, 279]
p02641
u507456172
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 numbers=list(range(102))\n ans=0\n\n for i in range(len(p)):\n numbers.remove(p[i])\n\n if numbers.count(X)==1:\n print(X)\n else:\n for j in range(100):\n if numbers.count(X-j)==1:\n ans=X-j\n break\n elif numbers.count(X+j)==1:\n ans=X+j\n break\n \u3000\u3000print(ans)\n', 'X,N=map(int,input().split())\nif N==0:\n print(X)\nelse:\n p=list(map(int,input().split()))\n numbers=list(range(-100,1000)\n ans=X\n\n for i in range(len(p)):\n numbers.remove(p[i])\n\n if numbers.count(X)==1:\n print(ans)\n else:\n for j in range(1000):\n if numbers.count(X-j)==1:\n ans=X-j\n break\n elif numbers.count(X+j)==1:\n ans=X+j\n break\n print(ans)', 'X,N=map(int,input().split())\nif N==0:\n print(X)\nelse:\n p=list(map(int,input().split()))\n numbers=list(range(-100,1000)\n ans=0\n\n for i in range(len(p)):\n numbers.remove(p[i])\n\n if numbers.count(X)==1:\n print(ans)\n else:\n for j in range(1000):\n if numbers.count(X-j)==1:\n ans=X-j\n break\n elif numbers.count(X+j)==1:\n ans=X+j\n break\n print(ans)', 'X,N=map(int,input().split())\nif N==0:\n print(X)\nelse:\n p=list(map(int,input().split()))\n numbers=list(range(102))\n ans=0\n\n for i in range(len(p)):\n numbers.remove(p[i])\n\n if numbers.count(X)==1:\n print(X)\n else:\n for j in range(100):\n if numbers.count(X-j)==1:\n ans=X-j\n break\n elif numbers.count(X+j)==1:\n ans=X+j\n break\n print(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s127580578', 's504015560', 's574746430', 's796515075']
[9000.0, 9028.0, 9028.0, 9208.0]
[25.0, 24.0, 20.0, 21.0]
[395, 396, 396, 390]
p02641
u514118270
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 math\nimport itertools\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\ndef s(): return input()\ndef i(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 9)\nmod = 10**9+7\n\nX,N = I()\np = l()\np.sort()\nfor i in range(N):\n if p[i] > X:\n if abs(p[i]-X) > abs(p[i-1]-X):\n print(p[i-1])\n exit()\n else:\n print(p[i])\n exit()\nprint(p[-1])', 'import sys\nimport math\nimport itertools\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\ndef s(): return input()\ndef i(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 9)\nmod = 10**9+7\nimport bisect\nX,N = I()\nif N == 0:\n print(X)\n exit()\np = l()\nA = [i for i in range(-1,102)]\nfor i in range(N):\n if p[i] in A:\n A.remove(p[i])\ni = bisect.bisect_left(A,X)\nif abs(A[i-1]-X) > abs(A[i]-X):\n print(A[i])\nelse:\n print(A[i-1])']
['Runtime Error', 'Accepted']
['s686351566', 's254261769']
[10096.0, 10080.0]
[28.0, 30.0]
[642, 681]
p02641
u515128734
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, N = map(int, input().split())\np = [map(int, input().split())]\n\nfor i in range(X + 1):\n for j in [-1, +1]:\n ans = X + i * j\n\n if p.count(ans) == 0:\n print(ans)\n break\n else:\n continue\n break\n', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nfor i in range(X + 1):\n for j in [-1, +1]:\n ans = X + i * j\n\n if p.count(ans) == 0:\n print(ans)\n break\n else:\n continue\n break\n']
['Wrong Answer', 'Accepted']
['s342702638', 's231585126']
[9172.0, 9048.0]
[30.0, 26.0]
[245, 249]
p02641
u516494592
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X,N = map(int, input().split())\ntry:\n p = list(map(int, input().split()))\nexcept EOFError:\n p = []\n \nint_list = [i for i in range(102)]\nforbidden_list = sorted(list(set(int_list) - set(p)))\nnum_X = int_list.index(X)\nc = 10000000\n \nif X in forbidden_list:\n print(X)\nelse:\n for i in range(len(forbidden_list) - 1):\n a = abs(X - forbidden_list[i])\n b = abs(X - forbidden_list[i + 1])\n if a == b:\n print(forbidden_list[i])\n break\n elif c > a:\n c = a\n elif c <= a and b >= a:\n print(forbidden_list[i])\n break\n elif b < a:\n print(forbidden_list[i + 1])\n break\n else:\n if a < b:\n print(forbidden_list[i])\n else:\n print(forbidden_list[i + 1])', 'X,N = map(int, input().split())\ntry:\n p = list(map(int, input().split()))\nexcept EOFError:\n p = []\n \nint_list = [i for i in range(102)]\nforbidden_list = sorted(list(set(int_list) - set(p)))\nnum_X = int_list.index(X)\nc = 10000000\n \nif X in forbidden_list:\n print(X)\nelse:\n for i in range(len(forbidden_list) - 1):\n a = abs(X - forbidden_list[i])\n b = abs(X - forbidden_list[i + 1])\n if a == b:\n print(forbidden_list[i])\n break\n elif c > a:\n c = a\n elif c <= a and b >= a:\n print(forbidden_list[i - 1])\n break\n elif b < a:\n print(forbidden_list[i])\n break\n else:\n if a < b:\n print(forbidden_list[i])\n else:\n print(forbidden_list[i + 1])']
['Wrong Answer', 'Accepted']
['s450910669', 's113112408']
[9272.0, 9252.0]
[24.0, 21.0]
[709, 709]
p02641
u516554284
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x,n=map(int,input().split())\ntry:\n a=list(map(int,input().split()))\n \n \n a=sorted(a)\n\n if x<a[0]:\n print(x)\n elif x>a[-1]:\n print(x)\n else:\n bb=list(range((a[0]-1),(a[-1])))\n b=list(range((a[0]-1),(a[-1])+n))\n for n in range(n):\n b.remove(a[n])\n \n f=len(b)\n\n\n d=abs(x-int(b[0]))\n ans=b[0]\n\n for n in range(f):\n c=abs(x-int(b[n]))\n if d>c:\n ans=b[n]\n d=c\n \n print(ans)\n\n print(bb)\nexcept:\n print(x)', 'x,n=map(int,input().split())\ntry:\n a=list(map(int,input().split()))\n \n \n a=sorted(a)\n ff=a[-1]-a[0]+1\n\n if x<a[0]:\n print(x)\n elif x>a[-1]:\n print(x)\n else:\n bb=list(range((a[0]-1),(a[-1])))\n b=list(range((a[0]-1),(a[-1])+ff))\n for n in range(n):\n b.remove(a[n])\n \n f=len(b)\n\n\n d=abs(x-int(b[0]))\n ans=b[0]\n\n for n in range(f):\n c=abs(x-int(b[n]))\n if d>c:\n ans=b[n]\n d=c\n \n print(ans)\n\n print(bb)\nexcept:\n print(x)\n', 'x,n=map(int,input().split())\ntry:\n a=list(map(int,input().split()))\n \n \n a=sorted(a)\n\n if x<a[0]:\n print(x)\n elif x>a[-1]:\n print(x)\n else:\n bb=list(range((a[0]-1),(a[-1]+1)))\n b=list(range((a[0]-1),(a[-1])))\n for n in range(n):\n b.remove(a[n])\n \n f=len(b)\n\n\n d=abs(x-int(b[0]))\n ans=b[0]\n\n for n in range(f):\n c=abs(x-int(b[n]))\n if d>c:\n ans=b[n]\n d=c\n \n print(ans)\n\n print(bb)\nexcept:\n print(x)\n\n', 'x,n=map(int,input().split())\ntry:\n a=list(map(int,input().split()))\n \n \n a=sorted(a)\n\n if x<a[0]:\n print(x)\n elif x>a[-1]:\n print(x)\n else:\n bb=list(range((a[0]-1),(a[-1]+1)))\n b=list(range((a[0]-1),(a[-1]+2)))\n for n in range(n):\n b.remove(a[n])\n \n f=len(b)\n\n\n d=abs(x-int(b[0]))\n ans=b[0]\n\n for n in range(f):\n c=abs(x-int(b[n]))\n if d>c:\n ans=b[n]\n d=c\n \n print(ans)\n\n print(bb)\nexcept:\n print(x)\n\n', 'x,n=map(int,input().split())\n\nif n==0:\n print(x)\n \nelse:\n a=list(map(int,input().split()))\n\n for i in range(100):\n if x-i not in a:\n ans=x-i\n break\n elif x+i not in a:\n ans=x+i\n break\n \n print(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s405913566', 's617431349', 's739997475', 's929177422', 's939315697']
[9252.0, 9252.0, 9124.0, 9240.0, 9016.0]
[22.0, 25.0, 24.0, 23.0, 30.0]
[469, 489, 471, 473, 231]
p02641
u517681577
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\nfor i in range(N):\n if not (X-i in p):\n print(X-i)\n elif not (X+i in p):\n print(X+i)', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nfor i in range(100):\n if X-i not in p:\n print(X-i)\n exit()\n elif X+i not in p:\n print(X+i)\n exit()']
['Wrong Answer', 'Accepted']
['s349590841', 's883594524']
[9080.0, 9176.0]
[30.0, 25.0]
[175, 202]
p02641
u519939795
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=sorted(list(map(int,input().split())))\nans=0\nfor i in range(102):\n if i not in l:\n if abs(x-i)<abs(x-ans):\n ans=i\nprint(i)', 'x,n=map(int,input().split())\nl=sorted(list(map(int,input().split())))\nans=0\nfor i in range(102):\n if abs(x-i)<abs(x-ans) and i not in l:\n ans=i\nprint(ans)']
['Wrong Answer', 'Accepted']
['s114885614', 's272730776']
[9168.0, 9108.0]
[27.0, 29.0]
[174, 164]
p02641
u521271655
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()))\ndic = {}\nlis = []\nfor i in range(0,102):\n if i not in p:\n dic[i] = abs(x-i)\n lis.append(i)\nprint(lis)\n\nmini = min(dic.values())\nfor j in lis:\n if mini == dic[j]:\n print(j)\n break', 'x,n = map(int,input().split())\np = list(map(int,input().split()))\ndic = {}\nlis = []\nfor i in range(0,102):\n if i not in p:\n dic[i] = abs(x-i)\n lis.append(i)\n\nmini = min(dic.values())\nfor j in lis:\n if mini == dic[j]:\n print(j)\n break']
['Wrong Answer', 'Accepted']
['s091819422', 's127594379']
[9004.0, 9180.0]
[32.0, 26.0]
[278, 267]
p02641
u521866787
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import bisect\n\nx ,n=map(int,input().split())\np=list(map(int,input().split()))\n\np.sort()\n\nindex = bisect.bisect_left(p,x)\n\nif n==0:\n print(x)\nelse:\n for i in range(n):\n print(index-i, index+i)\n if p[index-i] != x-i:\n print(x-i)\n break\n elif p[index+i] != x+i:\n print(x+i)\n break', 'import bisect\n\nx ,n=map(int,input().split())\np=list(map(int,input().split()))\n\np.sort()\n\nindex = bisect.bisect_left(p,x)\n\nif n==0:\n print(x)\nelse:\n p= p+[p[n-1]+2]\n for i in range(n):\n # print(index-i, index+i)\n if p[max(index-i,0)] != x-i:\n print(x-i)\n break\n elif p[min(index+i,n)] != x+i:\n print(x+i)\n break\n else:\n print(p[0]-1)\n']
['Runtime Error', 'Accepted']
['s607845994', 's673774561']
[9084.0, 9204.0]
[23.0, 23.0]
[348, 417]
p02641
u522937309
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.
['\nimport copy\nn = int(input())\nlist_a = list(map(int, input().split())) \n\nlist_a = list(set(list_a))\nlist_a.sort(reverse=True)\n# print(list_a)\n\ncount = 0\nif len(list_a) == 1:\n print(0)\nelse:\n for i in range(len(list_a)):\n ai = list_a[i] \n new_list = list_a[i+1:] \n# print(new_list)\n data2 = []\n booler = True\n for j in range(len(new_list)):\n aj = new_list[-j]\n# print(ai, aj, ai%aj)\n if ai % aj == 0:\n\n booler = False\n break\n if booler == True:\n count += 1\n\n\n print(count)', 'x, n =map(int, input().split()) \nlist_p = list(map(int, input().split())) \n\n\nif n == 0:\n print(x)\nelse:\n i = 0\n while True:\n if x - i not in list_p:\n print(x-i)\n break\n elif x + i not in list_p:\n print(x+i)\n break\n else:\n i += 1\n']
['Runtime Error', 'Accepted']
['s001883826', 's435101506']
[9284.0, 9168.0]
[25.0, 29.0]
[659, 351]
p02641
u524534026
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=list(map(int,input().split()))\ntmp=0\nif n==0:\n print(x)\n sys.exit()\nfor i in range(1,101):\n ans=x-i\n if not ans in p:\n print(ans)\n sys.exit()\n ', 'import sys\nimport numpy as np\n\nX,n=map(int,input().split())\np=list(map(int,input().split()))\nif n==0:\n print(X)\n sys,exit()\npp = list(map(lambda x: abs(x-X), p))\npp.sort()\nfor i in range(1,100):\n tmp=X-pp[0]-i\n if not tmp in p:\n print(tmp)\n sys.exit()\n tmpp=X-pp[0]+i\n if not tmpp in p:\n print(tmpp)\n sys.exit()\n']
['Wrong Answer', 'Accepted']
['s195805954', 's836105732']
[9176.0, 27180.0]
[23.0, 106.0]
[214, 358]
p02641
u528484796
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['n,x=map(int,input().split())\nl=list(map(int,input().split()))\np=0\nif x==0:\n print(n)\nelif n not in l:\n print(n)\nelse:\n for i in range(101):\n if abs(x-i)>abs(x-p) and i not in p:\n p=i\n print(p)', 'x,n=map(int,input().split())\nl=list(map(int,input().split()))\np=0\nif n==0:\n print(x)\nelif x not in l:\n print(x)\nelse:\n for i in range(101):\n if i not in l:\n if abs(x-i)>abs(x-p):\n p=i\n print(p)', 'x,n=map(int,input().split())\nl=list(map(int,input().split()))\nif x not in l:\n print(x)\nelif n==0:\n print(x)\nelse:\n a=101\n p1=0\n for i in range(102):\n if i not in l:\n if abs(x-i)<a:\n a=abs(x-i)\n p1=i\n\n print(p1)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s085449669', 's692754308', 's884958551']
[9212.0, 9192.0, 9184.0]
[22.0, 25.0, 21.0]
[204, 214, 277]
p02641
u529706830
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(list,int(input.split()))\ndirection = -1\ni = 0\nwhile True:\n dist = i * direction\n\n if not (dist + X in P):\n print(dist + X)\n break\n i += 1\n if direction < 0: direction = 1\n else : direction = -1', 'X,N = map(int, input().split())\nif N > 0: \n P = list(map(int,input().split()))\n direction = -1\n i = 1\n if not X in P:\n print(X)\n else:\n while True:\n dist = i * direction\n val = dist+X\n if not (val in P):\n print(val)\n break\n if direction < 0: direction = 1\n else : \n direction = -1\n i+=1\nelse: \n print(X)']
['Runtime Error', 'Accepted']
['s349726048', 's379708160']
[8816.0, 9136.0]
[27.0, 26.0]
[262, 450]
p02641
u532141811
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())\nif N == 0:\n print(X)\n sys.exit()\np = list(map(int, input().split()))\n\ncomp = 101\n\nfor i in range(1, 101):\n x = abs(X - i)\n if x == comp:\n sys.exit()\n if comp > x and i not in p and:\n comp = x\n result = i\n\nprint(result)', 'import sys\n\nX, N = map(int, input().split())\nif N == 0:\n print(X)\n sys.exit()\np = list(map(int, input().split()))\n\ncomp = 101\n\nfor i in range(1, 101):\n x = abs(X - i)\n if x == comp:\n break\n if comp > x and i not in p and:\n comp = x\n result = i\n\nprint(result)', 'import sys\n\nX, N = map(int, input().split())\np = list(map(int, input().split()))\n\nif N == 0:\n print(X)\n sys.exit()\n\ncomp = 101\nfor i in range(102):\n x = abs(X - i)\n if comp > x and i not in p:\n comp = x\n result = i\n\nprint(result)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s648944466', 's904938011', 's130556628']
[8984.0, 9048.0, 9156.0]
[19.0, 24.0, 25.0]
[299, 294, 256]
p02641
u532955973
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.
['#!/usr/bin/env python3\n# atcoder \n\n\nimport sys\n\niimr = lambda: map(int, sys.stdin.readline().rstrip().split())\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10 ** 8)\n\n\ndef 関数(x, n, p_liste):\n if n == 0:\n return x\n \n if x not in p_liste:\n return x\n chikai = x-1\n plus = x + 1\n\n for _ in range(n/2+4):\n #print(p_liste)\n if chikai not in p_liste:\n return chikai\n elif plus not in p_liste:\n return plus\n else: \n plus += 1\n chikai -= 1\n return "問題"\n\ndef çözmek():\n X,N = map(int,sys.stdin.readline().split())\n P_liste = list(map(int, sys.stdin.readline().split()))\n\n \n res = []\n res.append(関数(X,N,P_liste))\n print(*res, sep="\\n")\n\nif __name__ == "__main__":\n çözmek()\n', '#!/usr/bin/env python3\n# atcoder \n\n\nimport sys\n\niimr = lambda: map(int, sys.stdin.readline().rstrip().split())\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10 ** 8)\n\n\ndef 関数(x, n, p_liste):\n if n == 0:\n return x\n \n if x not in p_liste:\n return x\n chikai = x-1\n plus = x + 1\n\n for _ in range(n/2+1):\n #print(p_liste)\n if chikai not in p_liste:\n return chikai\n elif plus not in p_liste:\n return plus\n else: \n plus += 1\n chikai -= 1\n return "問題"\n\ndef çözmek():\n X,N = map(int,sys.stdin.readline().split())\n P_liste = list(map(int, sys.stdin.readline().split()))\n\n \n res = []\n res.append(関数(X,N,P_liste))\n print(*res, sep="\\n")\n\nif __name__ == "__main__":\n çözmek()\n', '#!/usr/bin/env python3\n# atcoder \n\n\nimport sys\n\niimr = lambda: map(int, sys.stdin.readline().rstrip().split())\nreadline = sys.stdin.readline\nsys.setrecursionlimit(10 ** 8)\n\n\ndef 関数(x, n, p_liste):\n if n == 0:\n return x\n \n if x not in p_liste:\n return x\n chikai = x-1\n plus = x + 1\n\n for _ in range(0,101):\n #print(p_liste)\n if chikai not in p_liste:\n return chikai\n elif plus not in p_liste:\n return plus\n else: \n plus += 1\n chikai -= 1\n return "問題"\n\ndef çözmek():\n X,N = map(int,sys.stdin.readline().split())\n P_liste = list(map(int, sys.stdin.readline().split()))\n\n \n res = []\n res.append(関数(X,N,P_liste))\n print(*res, sep="\\n")\n\nif __name__ == "__main__":\n çözmek()\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s385229547', 's815424390', 's888598985']
[9276.0, 9288.0, 9280.0]
[29.0, 27.0, 29.0]
[854, 854, 854]
p02641
u533084327
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 collections import deque\n\nX, N = map(int, input().split())\np = list(map(int, input().split()))\nans = X\nqueue = deque()\nqueue.append(X)\ndone_list = []\nans = []\nwhile queue:\n print(queue)\n var = queue.popleft()\n if var in p:\n done_list.append(var)\n if var - 1 not in done_list:\n queue.append(var-1)\n if var + 1 not in done_list:\n queue.append(var+1)\n continue\n else:\n ans = var\n break\nprint(ans)', 'from collections import deque\n\nX, N = map(int, input().split())\np = list(map(int, input().split()))\nans = X\nqueue = deque()\nqueue.append(X)\ndone_list = []\nans = []\nwhile queue:\n var = queue.popleft()\n if var in p:\n done_list.append(var)\n if var - 1 not in done_list:\n queue.append(var-1)\n if var + 1 not in done_list:\n queue.append(var+1)\n continue\n else:\n ans = var\n break\nprint(ans)']
['Wrong Answer', 'Accepted']
['s678810345', 's058665535']
[9444.0, 9464.0]
[27.0, 24.0]
[474, 457]
p02641
u534610124
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())\nlistp = list(set(map(int, input().split())))\n\n\ndef f(X, N, listp):\n\n if N == 0:\n return X\n if X not in listp:\n return X\n\n up_list = []\n down_list = []\n for p in listp:\n if p > X:\n up_list.append(p)\n if p < X:\n down_list.append(p)\n\n up_list = sorted(up_list)\n down_list = sorted(down_list, reverse=True)\n\n\n up_res = 10000\n for i, p in enumerate(up_list):\n if p != X+i+1:\n up_res = X+i+1\n break\n if up_res == 10000:\n up_res = X+1\n\n down_res = -10000\n for i, p in enumerate(down_list):\n if p != X-i-1:\n down_res = X-i-1\n break\n if down_res == -10000:\n down_res = X-1\n \n\n if abs(X - up_res) < abs(X - down_res):\n return up_res\n else:\n return down_res\n\n\nprint(f(X, N, listp)) ', 'X, N = map(int, input().split())\nlistp = list(map(int, input().split()))\n\n\ndef f(X, N, listp):\n\n if N == 0:\n return X\n if X not in listp:\n return X\n\n up_list = []\n down_list = []\n for p in listp:\n if p > X:\n up_list.append(p)\n if p < X:\n down_list.append(p)\n\n up_list = sorted(up_list)\n down_list = sorted(down_list, reverse=True)\n\n\n up_res = 10000\n for i, p in enumerate(up_list):\n if p != X+i+1:\n up_res = X+i+1\n break\n if up_res == 10000:\n up_res = X+1\n\n down_res = -10000\n for i, p in enumerate(down_list):\n if p != X-i-1:\n down_res = X-i-1\n break\n if down_res == -10000:\n down_res = X-1\n \n\n if abs(X - up_res) < abs(X - down_res):\n return up_res\n else:\n return down_res\n\n\nprint(f(X, N, listp)) ', 'X, N = map(int, input().split())\nlistp = list(set(map(int, input().split())))\n\n\ndef f(X, N, listp):\n if N == 0:\n return X\n if X not in listp:\n return X\n\n index = listp.index(X)\n \n downres = 1000\n for i,p in enumerate(listp):\n if index - i >= 0:\n if listp[index-i] != X-i:\n downres = X-i\n break\n if downres == 1000:\n downres = X - index -1\n\n upres = 1000\n l = len(listp)\n for i,p in enumerate(listp):\n\n if index + i < l:\n if listp[index+i] != X+i:\n upres = X+i\n break\n if upres == 1000:\n upres = X + l - index\n\n if abs(upres - X) < abs(downres - X):\n return upres\n else:\n return downres\n\n\nprint(f(X, N, listp))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s521808192', 's981588002', 's701977550']
[9248.0, 9244.0, 9248.0]
[23.0, 23.0, 24.0]
[892, 887, 786]
p02641
u536642030
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 p = list(map(int, input().split()))\n hoge = [i for i in range(x - n, x + n + 1)]', 'x,n = list(map(int, input().split()))\nif n == 0:\n print(x)\nelse:\n p = list(map(int, input().split()))\n hoge = [i for i in range(x - n, x + n + 1)]\n sabun = list(set(hoge) - set(p))\n min_ = 300\n index_ = 0\n for i, v in enumerate(sabun):\n if abs(x - v) < min_:\n min_ = abs(x - v)\n index_ = i\n print(sabun[index_])']
['Wrong Answer', 'Accepted']
['s400964847', 's909403126']
[9032.0, 9168.0]
[29.0, 29.0]
[149, 364]
p02641
u538909258
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['x, n = map(int, input().split())\np = list(map(int, input().split()))\np.sort()\n\ndef main():\n if len(p) == 0:\n print(x)\n return\n\n ans_l = list(range(x-10, x+10))\n print(ans_l)\n\n diff_l = list(set(p) ^ set(ans_l))\n print(diff_l)\n\n cnt = 100\n ans = 100\n for i in range(0, len(diff_l)):\n check = abs(diff_l[i]-x)\n # print(check)\n if check < cnt:\n cnt = check\n ans = diff_l[i]\n print(ans)\n return\n\nmain()', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\ndef main():\n if n == 0:\n print(x)\n return\n\n ans_l = list(range(-100, 201))\n\n diff_l = list(set(p) ^ set(ans_l))\n diff_l.sort()\n\n cnt = 100\n ans = 100\n for i in range(0, len(diff_l)):\n check = abs(diff_l[i]-x)\n if check < cnt:\n cnt = check\n ans = diff_l[i]\n print(ans)\n return\n\nmain()']
['Wrong Answer', 'Accepted']
['s060565616', 's064566583']
[9072.0, 9184.0]
[23.0, 21.0]
[485, 430]
p02641
u540698208
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 = (int(x) for x in input().split())\nif N != 0:\n p = [int(x) for x in input().split()]\nelse:\n print(X)\n sys.exit()\n\nans = X\nfor i in range(0, 101, -1):\n if X + i not in p:\n ans = X + i\n if X - i not in p:\n ans = X - i\nprint(ans)', 'import sys\n\nX, N = (int(x) for x in input().split())\nif N != 0:\n p = [int(x) for x in input().split()]\nelse:\n print(X)\n sys.exit()\ni = 0\nans = X\nflag = False\nwhile True:\n if X + i in p: continue\n ans = X + i\n flag = True\n if X - i in p: continue\n ans = X - i\n flag = True\n if flag: break\n i += 1\npritn(ans)', "def main():\n x, n = (int(x) for x in input().split())\n p = [int(x) for x in input().split()]\n\n if x not in p:\n print(x)\n else:\n for i in range(1, 200):\n if x - i not in p:\n print(x - i)\n break\n if x + i not in p:\n print(x + i)\n break\n\nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s039435192', 's403617962', 's945711675']
[9196.0, 9112.0, 9148.0]
[22.0, 2206.0, 28.0]
[267, 317, 380]
p02641
u542541293
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.
['try:\n p = list(map(int, input().split()))\nexcept:\n p = []\n\n\nl = [0]*100\n\nfor i in range(N):\n l[abs(p[i] - X)] += 1\n\n#print(p.index(9))\nif N == 0:\n print(X)\nelse:\n for i in range(N):\n if i == 0:\n if l[0] == 1:\n continue\n else:\n print(X)\n break\n else:\n if l[i] == 0:\n print(X-i)\n break\n elif l[i] == 1:\n try:\n p_index = p.index(X-i)\n print(X+i)\n except:\n print(X-i)\n break', 'X, N = map(int, input().split())\ntry:\n p = list(map(int, input().split()))\nexcept:\n p = []\n\n\nl = [0]*200\n\nfor i in range(N):\n l[abs(p[i] - X)] += 1\n\n#print(p.index(9))\n\nif N == 0:\n print(X)\nelse:\n for i in range(N+1):\n if i == 0:\n if l[0] == 1:\n continue\n else:\n print(X)\n break\n else:\n if l[i] == 0:\n print(X-i)\n break\n elif l[i] == 1:\n try:\n p_index = p.index(X-i)\n print(X+i)\n except:\n print(X-i)\n break']
['Runtime Error', 'Accepted']
['s544023027', 's315561252']
[9196.0, 9164.0]
[25.0, 23.0]
[484, 520]
p02641
u542739769
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())\n\nif N == 0:\n print(X)\n sys.exit()\n\narr = list(map(int, input().split()))\nmainasu = X \npurasu = X \n\ndef saiki():\n mainasu = mainasu - 1\n purasu = purasu + 1\n if X in arr:\n if mainasu in arr:\n if purasu in arr:\n saiki()\n else:\n print(purasu)\n else:\n print(mainasu)\n else:\n print(X)\n\nsaiki()', 'import sys\n\nX,N = map(int, input().split())\n\nif N == 0:\n print(X)\n sys.exit()\n\narr = list(map(int, input().split()))\n\ndef saiki():\n mainasu = X - 1\n purasu = X + 1\n if X in arr:\n if mainasu in arr:\n if purasu in arr:\n saiki()\n else:\n print(purasu)\n else:\n print(mainasu)\n else:\n print(X)\n\nsaiki()', 'import sys\n\nX,N = map(int, input().split())\n\nif N == 0:\n print(X)\n sys.exit()\n\narr = list(map(int, input().split()))\nmainasu = X \npurasu = X \n\ndef saiki():\n mainasu - 1\n purasu + 1\n if X in arr:\n if mainasu in arr:\n if purasu in arr:\n saiki()\n else:\n print(purasu)\n else:\n print(mainasu)\n else:\n print(X)\n\nsaiki()', "import sys\n\ndef saiki(l,r,lst):\n if (l - 1) not in lst:\n return (l - 1)\n \n if (r + 1) not in lst:\n return (r + 1)\n \n return saiki(l - 1, r + 1, lst)\n\ndef main():\n \n X,N = map(int, input().split())\n\n arr = list(map(int, input().split()))\n\n if N == 0:\n print(X)\n sys.exit()\n\n if X not in arr:\n print(X)\n sys.exit()\n\n print(saiki(X,X,arr))\n\nif __name__ == '__main__':\n main()"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s267837054', 's518131912', 's576920105', 's589955744']
[9192.0, 9664.0, 9664.0, 9212.0]
[22.0, 26.0, 23.0, 23.0]
[429, 393, 410, 461]
p02641
u543954314
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)))\n', 'x, n = map(int, input().split())\na = set(map(int, input().split()))\nprint(min(abs(i-x) for i in range(102) if i not in a))', '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)))\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s058736800', 's574811382', 's395410616']
[9036.0, 9164.0, 9132.0]
[24.0, 25.0, 22.0]
[139, 122, 141]
p02641
u546236742
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['a = input().split()\nif a[1] == "0":\n print(a[0])\nelse:\n number_list = input().split()\n n = 1\n number = int(a[0])\n while True:\n num = number + n\n num2 = number - n\n if str(num) not in number_list or str(num2) not in number_list:\n if str(num) in number_list:\n print(num2)\n else:\n print(num1)\n break\n n += 1\n ', 'a = input().split()\nif a[1] == "0":\n print(a[0])\nelse:\n number_list = input().split()\n n = 0\n number = int(a[0])\n while True:\n num = number + n\n num2 = number - n\n if str(num) not in number_list or str(num2) not in number_list:\n if str(num) not in number_list and str(num2) not in number_list:\n print(num2)\n break\n if str(num) in number_list:\n print(num2)\n else:\n print(num)\n break\n n += 1']
['Runtime Error', 'Accepted']
['s936982531', 's371291546']
[9192.0, 9208.0]
[24.0, 21.0]
[355, 454]
p02641
u548589319
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 a[1] == 0:\n print(a[0])\nelse:\n b = list(map(int, input().split()))\n ans = 1\n out = 0\n res = abs(a[0] - ans)\n while (ans <= max(b) or abs(a[0] - ans) != res):\n if ans not in b:\n if (abs(a[0] - ans) < res):\n res = abs(a[0] - ans)\n out = ans\n if (out > max(b)):\n break\n ans += 1\n print(out)', 'a = list(map(int, input().split()))\nif a[1] == 0:\n print(a[0])\nelse:\n b = list(map(int, input().split()))\n c = []\n out = 0\n res = 10000001\n for i in range(102):\n if i not in b:\n c.append(i)\n for j in c:\n if (abs(j - a[0]) < res):\n res = abs(j - a[0])\n out = j\n print(out)']
['Wrong Answer', 'Accepted']
['s134347739', 's715094477']
[9136.0, 9240.0]
[2205.0, 22.0]
[436, 342]
p02641
u550146922
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\ni = 0\nans = []\nflag = 0\nwhile True:\n if (x + i) not in p:\n ans += [x+i]\n print(ans)\n flag = 1\n if (x - i) not in p:\n ans += [x-i]\n print(ans)\n flag = 1\n if flag == 0:\n i += 1\n print(ans)\n else:\n break\n\nprint(min(ans))\n', 'x,n, = map(int,input().split())\np = list(map(int,input().split()))\n\ni = 0\nans = []\nflag = 0\nwhile True:\n if (x + i) not in p:\n ans += [x+i]\n flag = 1\n if (x - i) not in p:\n ans += [x-i]\n flag = 1\n if flag == 0:\n i += 1\n else:\n break\n\nprint(min(ans))\n']
['Wrong Answer', 'Accepted']
['s158589176', 's885114483']
[9116.0, 9124.0]
[24.0, 23.0]
[361, 304]
p02641
u551906883
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import math\ninput_a= input().split(" ")\nX=int(input_a[0])\nN=int(input_a[1])\ndis=X+3\nif N!=0:\n array= input().split(" ")\nelse:\n array=[0,0]\n\nnum=X\nnum2=-100\nfor i in range(101-X):\n\n \n if str(num) not in array:\n dis=abs(X-num)\n num2=X-dis\n num1=num\n if str(num2) not in array:\n \tnuma=min([num,num2])\n else:\n numa=num1\n break\n num=num+1\n \n\nnum=X\ni=0\nfor i in range(dis):\n \n if str(num) not in array:\n \n dis2=abs(X-num)\n num3=X+dis2\n #print(num,dis2,num3)\n if str(num3) not in array:\n \tnumb=min([num,num3])\n else:\n numb=num\n break\n num=num-1\n#print(numa,numb,dis,dis2)\nif dis<dis2:\n print(numa)\nelif dis==dis2:\n print(numb)\nelse:\n print(numb)', 'import math\ninput_a= input().split(" ")\nX=int(input_a[0])\nN=int(input_a[1])\ndis=X+3\nif N!=0:\n array= input().split(" ")\nelse:\n array=[0,0]\n\nnum=X\nnum2=-100\nfor i in range(N+1):\n\n \n if str(num) not in array:\n dis=abs(X-num)\n num2=X-dis\n num1=num\n if str(num2) not in array:\n \tnuma=min([num,num2])\n else:\n numa=num1\n break\n num=num+1\n \n\nnum=X\ni=0\nfor i in range(dis):\n \n if str(num) not in array:\n \n dis2=abs(X-num)\n num3=X+dis2\n\n if str(num3) not in array:\n \tnumb=min([num,num3])\n else:\n numb=num\n break\n num=num-1\n\nif dis<dis2:\n print(numa)\nelif dis==dis2:\n print(numb)\nelse:\n print(numb)', 'import math\ninput_a= input().split(" ")\nX=int(input_a[0])\nN=int(input_a[1])\ndis=X+3\ndis2=100\nif N!=0:\n array= input().split(" ")\nelse:\n array=[0,0]\n\nnum=X\nnum2=-100\nfor i in range(N+1):\n\n \n if str(num) not in array:\n dis=abs(X-num)\n num2=X-dis\n num1=num\n if str(num2) not in array:\n \tnuma=min([num,num2])\n else:\n numa=num1\n break\n num=num+1\n \n\nnum=X\ni=0\nfor i in range(dis):\n \n if str(num) not in array:\n \n dis2=abs(X-num)\n num3=X+dis2\n\n if str(num3) not in array:\n \tnumb=min([num,num3])\n else:\n numb=num\n break\n num=num-1\n\nif dis<dis2:\n print(numa)\nelif dis==dis2:\n print(numb)\nelse:\n print(numb)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s330346970', 's379152190', 's449433388']
[9208.0, 9264.0, 9172.0]
[23.0, 20.0, 24.0]
[709, 656, 665]
p02641
u552143188
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(p) for p in input().split()]\nA = X\nB = X\n\nwhile True:\n if B in P:\n B += 1\n else:\n break\n\nwhile True:\n if A in P:\n A -= 1\n else:\n break\n\n\nprint(min(A, B))', 'X, N = map(int, input().split())\nP = [int(p) for p in input().split()]\nA = X\nB = X\n\nwhile True:\n if B in P:\n B += 1\n else:\n break\n\nwhile True:\n if A in P:\n A -= 1\n else:\n break\na = abs(X - A)\nb = abs(X - B)\nif a < b:\n print(A)\nelif a > b:\n print(B)\nelse:\n print(min(A, B))\n\n']
['Wrong Answer', 'Accepted']
['s181311866', 's357545817']
[9180.0, 9192.0]
[20.0, 22.0]
[211, 293]
p02641
u554237650
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.
['str1 = input()\nstr2 = input()\n\nA = str1.split(" ")\nB = str2\n\nres = 0\n#print(A[1])\nif A[1] == "0":\n res = A[0]\nelse:\n# print("A[1]!=0")\n B = B.split(" ")\n intB = []\n for i in B:\n intB.append(int(i))\n intB.sort(reverse=True)\n\n X = int(A[0])\n N = int(A[1])\n\n res = 0\n diff = 999999\n\n \n l = list(range(-101, 102))\n\n \n for i in range(0, N):\n l.pop(intB[i]+101)\n\n print(l)\n for i in l:\n if 0 == abs(X - int(i)):\n diff = 0\n res = i\n break\n elif diff > abs(X - int(i)):\n diff = abs(X - int(i))\n res = i\n# print(diff, res)\n\n\nprint(res)', 'str1 = input()\nstr2 = input()\n\nA = str1.split(" ")\nB = str2\n\nres = 0\n#print(A[1])\nif A[1] == "0":\n res = A[0]\nelse:\n# print("A[1]!=0")\n B = B.split(" ")\n intB = []\n for i in B:\n intB.append(int(i))\n intB.sort(reverse=True)\n\n X = int(A[0])\n N = int(A[1])\n\n res = 0\n diff = 999999\n\n \n l = list(range(-101, 102))\n\n \n for i in range(0, N):\n l.pop(intB[i]+101)\n\n # print(l)\n for i in l:\n if 0 == abs(X - int(i)):\n diff = 0\n res = i\n break\n elif diff > abs(X - int(i)):\n diff = abs(X - int(i))\n res = i\n# print(diff, res)\n\n\nprint(res)']
['Wrong Answer', 'Accepted']
['s164337408', 's621563935']
[9096.0, 9244.0]
[24.0, 22.0]
[716, 717]
p02641
u555587832
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\n\nx,n = map(int,input().split())\np = list(map(int,input().split()))\n\na = numpy.abs(list(map(lambda z: z-x,p))).tolist()\nprint(a)\n\nif n==0 or 0 not in a:\n print(x)\nelse:\n for i in range(1,n,1):\n if a.count(i) == 2:\n continue\n elif a.count(i) == 1:\n if x+i not in p:\n print(x+i)\n break\n print(x-i)\n break', 'import numpy\n\nx,n = map(int,input().split())\ntry:\n p = list(map(int,input().split()))\nexcept EOFError:\n p =[]\n\na = numpy.abs(list(map(lambda z: z-x,p))).tolist()\nif 0 not in a:\n print(x)\nelse:\n i = 1\n while i <= n:\n if a.count(i) == 2:\n i += 1\n continue\n elif a.count(i) == 1:\n if x+i not in p:\n print(x+i)\n break\n if x > 0:\n print(x-i)\n else:\n print(x+i)\n break']
['Wrong Answer', 'Accepted']
['s226822031', 's899103858']
[27080.0, 27136.0]
[119.0, 116.0]
[400, 497]
p02641
u556326496
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()\nelse:\n ps = list(map(int, input().split()))\ncounters = [0 for _ in range(len(ps))]\ncounters[0] = 1\n\nfor i,p in enumerate(ps):\n distance = abs(x - p)\n if distance < len(ps):\n counters[distance] += 1\n\nprint(counters)\nfor i,counter in enumerate(counters):\n if counter == 0:\n print(x-i)\n break\n elif counter == 1:\n if x-i in ps:\n print(x+i)\n else:\n print(x-i)\n break', 'x, n = map(int, input().split())\nif n == 0:\n print(x)\n exit()\nelse:\n ps = list(map(int, input().split()))\ncounters = [0 for _ in range(len(ps)+1)]\ncounters[0] = 1\n\nfor i,p in enumerate(ps):\n distance = abs(x - p)\n if distance < len(ps):\n counters[distance] += 1\n\nfor i,counter in enumerate(counters):\n if counter == 0:\n print(x-i)\n break\n elif counter == 1:\n if x-i in ps:\n print(x+i)\n else:\n print(x-i)\n break']
['Wrong Answer', 'Accepted']
['s656062896', 's231905333']
[9216.0, 9224.0]
[23.0, 23.0]
[459, 445]
p02641
u559250296
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\n p.sort()\n gap = 10**1000\n ans =10**1000\n for i in p:\n if gap > abs(i-x) :\n ans = i\n gap =abs(i-x)\n\n\n\n print(ans)\nelse:\n print(x)', 'x, n = map(int,input().split())\nif n >0:\n p = list(map(int,input().split()))\n\n p.sort()\n gap = 10**1000\n ans =10**1000\n for i in range(0,1000):\n if not x-i in p:\n print(x-i)\n break\n elif not x+i in p:\n print(x+i)\n break\nelse:\n print(x)']
['Wrong Answer', 'Accepted']
['s677883950', 's006926911']
[9184.0, 9192.0]
[24.0, 24.0]
[257, 311]
p02641
u559367141
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())\nd = list(map(int, input().split()))\n\nfor n in range(X + 1):\n for m in [-1, 1]:\n l = X + n*m\n if d.count(l) == 0:\n print(l)\n break ', 'X, N = map(int, input().split())\nk = list(map(int, input().split()))\nfor d in range(X + 1):\n for s in [-1, +1]:\n a = X + s * d\n if k.count(a) == 0:\n print(a)\n exit(0)']
['Wrong Answer', 'Accepted']
['s885232157', 's879335656']
[9084.0, 9060.0]
[27.0, 29.0]
[202, 200]
p02641
u562015767
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 l = list(map(int,input().split()))\nelse:\n print(x)\n exit()\n\nif x not in l:\n print(x)\n exit()\n\ntmp = []\nfor i in range(x-50,x+50):\n tmp.append(i)\n\nans = []\nfor j in tmp:\n if j not in l:\n ans.append(j)\n\ntmp1 = 1\nfor k in ans:\n tmp2 = abs(x-k)\n if tmp2 != 0:\n if tmp1 >= tmp2:\n tmp1 = tmp2\n\nans2 = []\nfor m in ans:\n a = abs(m-x)\n if a == tmp1:\n ans2.append(m)\n\nprint(min(ans2))', 'import sys\n\nx,n = map(int,input().split())\nif n != 0:\n l = list(map(int,input().split()))\nelse:\n print(x)\n sys.exit()\n\nif x not in l:\n print(x)\n sys.exit()\n\ntmp = []\nfor i in range(x-60,x+60):\n tmp.append(i)\n\nans = []\nfor j in tmp:\n if j not in l:\n ans.append(j)\n\ntmp1 = 100\nfor k in ans:\n tmp2 = abs(x-k)\n if tmp2 != 0:\n if tmp1 >= tmp2:\n tmp1 = tmp2\n\nans2 = []\nfor m in ans:\n a = abs(m-x)\n if a == tmp1:\n ans2.append(m)\n\nprint(min(ans2))']
['Runtime Error', 'Accepted']
['s333263826', 's324262510']
[9228.0, 9228.0]
[22.0, 24.0]
[482, 504]
p02641
u563453679
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()\n\nif x == 1:\n print(0):\n sys.exit()\n\n\nif n == 100:\n if x <= 50:\n print(0)\n sys.exit()\n else:\n print(101)\n sys.exit()\n\n\nnun_list = list(map(int, input().split()))\nanswer = 0\n\nfor i in range(0, 210):\n if nun_list.__contains__(i):\n continue\n else :\n if abs(x - answer) >= abs(x - i):\n if abs(x - answer) == abs(x - i):\n if answer > i:\n answer = i\n else:\n answer = i\nif abs(x - answer) <= abs(x - 0):\n print(answer)\nelse :\n print(0)', 'import sys\nx, n = map(int, input().split())\nif n == 0:\n print(x)\n sys.exit()\n\nnun_list = list(map(int, input().split()))\nanswer = nun_list[0]\nfor i in nun_list:\n if abs(x - answer) >= abs(x - i):\n if abs(x - answer) == abs(x - i):\n if answer > i:\n answer = i\n else:\n answer = i\ntmp = 0\nfor i in range(0,1000):\n if not nun_list.__contains__(answer -i):\n tmp = answer -i\n break\n if not nun_list.__contains__(answer + i):\n # print(answer + i)\n tmp = answer + i\n break\nprint(tmp)\nif abs(x - tmp) <= abs(x - 0):\n print(tmp)\nelse :\n print(tmp)', 'import sys\nx, n = map(int, input().split())\nif n == 0:\n print(x)\n sys.exit()\nif x :\n print(x)\n sys.exit() \n\nnun_list = list(map(int, input().split()))\nanswer = nun_list[0]\nfor i in nun_list:\n if abs(x - answer) >= abs(x - i):\n if abs(x - answer) == abs(x - i):\n if answer > i:\n answer = i\n else:\n answer = i\nfor i in range(0,1000):\n if not nun_list.__contains__(answer -i):\n print(answer - i)\n sys.exit() \n if not nun_list.__contains__(answer + i):\n print(answer + i)\n sys.exit() \n', 'import sys\nx, n = map(int, input().split())\nif n == 0:\n print(x)\n sys.exit()\n\nif x == 1:\n print(0)\n sys.exit()\n\n\nif n == 100:\n if x <= 50:\n print(0)\n sys.exit()\n else:\n print(101)\n sys.exit()\n\n\nnun_list = list(map(int, input().split()))\nanswer = 0\n\nfor i in range(0, 210):\n if nun_list.__contains__(i):\n continue\n else :\n if abs(x - answer) >= abs(x - i):\n if abs(x - answer) == abs(x - i):\n if answer > i:\n answer = i\n else:\n answer = i\nif abs(x - answer) <= abs(x - 0):\n print(answer)\nelse :\n print(0)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s076655086', 's510954448', 's982765950', 's043412131']
[8996.0, 9236.0, 9156.0, 9204.0]
[24.0, 23.0, 25.0, 20.0]
[647, 644, 588, 646]
p02641
u563711100
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['n = input().split()\nn = [int(i) for i in n]\nm = input().split()\nm = [int(i) for i in m]\n \nans_1 = n[0]\nans_2 = n[0]\n \nans = []\nwhile True:\n \tif n[1] == 0:\n ans.append(0)\n \n ans_1 += 1\n ans_2 -= 1\n if not ans_1 in m:\n ans.append(ans_1)\n \n elif not ans_2 in m:\n ans.append(ans_2)\n \n if len(ans) > 0:\n break\n \nprint(min(ans))', 'n = input().split()\nn = [int(i) for i in n]\nm = input().split()\nm = [int(i) for i in m]\n\n\nans_1 = n[0]\nans_2 = n[0]\n\nans = []\nwhile True:\n \tif n[1] == 0:\n ans.append(0)\n \n ans_1 += 1\n ans_2 -= 1\n if not ans_1 in m:\n ans.append(ans_1)\n \n elif not ans_2 in m:\n ans.append(ans_2)\n \n if len(ans) > 0:\n break\n \nprint(min(ans))', 'n = input().split()\nn = [int(i) for i in n]\nif not n[1] == 0:\n\tm = input().split()\n\tm = [int(i) for i in m]\nelse:\n \tm =[0]\n\nans_1 = n[0]\nans_2 = n[0]\nans = []\nwhile True:\n if n[1] == 0:\n ans.append(n[0])\n if not n[0] in m:\n ans.append(n[0])\n if len(ans) > 0:\n break \n \n ans_1 += 1\n ans_2 -= 1\n if not ans_1 in m:\n ans.append(ans_1)\n if not ans_2 in m:\n ans.append(ans_2)\n \n \n \nprint(min(ans))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s105863121', 's472819965', 's484851540']
[8972.0, 8916.0, 9216.0]
[26.0, 25.0, 27.0]
[386, 385, 470]
p02641
u565751569
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 a=list(map(int,input().split()))\nelse:\n a=[]\nif not x in a:\n print(x)\nelse:\n a.sort()\n i=a.index(x)-1\n j=i+2\n d=1\n ans=0\n while(True):\n if(a[i]!=x-d):\n ans=a[i]\n break\n else:\n i-=1\n if(a[j]!=x+d):\n ans=a[j]\n break\n else:\n j+=1\n d+=1\n print(ans)\n', 'x,n=map(int,input().split())\na=list(map(int,input().split()))\nif not x in a:\n print(x)\nelse:\n a.sort()\n i=a.index(x)-1\n j=i+2\n d=1\n ans=0\n while(True):\n if(a[i]!=x-d):\n ans=a[i]\n break\n else:\n i-=1\n if(a[j]!=x+d):\n ans=a[j]\n break\n else:\n j+=1\n d+=1\n print(ans)', 'x,n=map(int,input().split())\nif(n!=0):\n a=list(map(int,input().split()))\nelse:\n a=[]\n\nif x not in a:\n print(x)\nelse:\n a.sort()\n idx=a.index(x)\n i=max(idx-1,0)\n j=min(idx+1,n-1)\n d=1\n ans=0\n while(True):\n if(a[i]!=x-d):\n ans=x-d\n break\n else:\n i=max(i-1,0)\n if(a[j]!=x+d):\n ans=x+d\n break\n else:\n j=min(j+1,n-1)\n d+=1\n print(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s201935514', 's467377796', 's258694076']
[9212.0, 9224.0, 9224.0]
[25.0, 24.0, 22.0]
[416, 386, 462]
p02641
u566574814
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\narr = []\nincc = []\nfor i in range(101):\n for j in range(n):\n incc.append(p[j])\n if i in incc:\n continue\n else:\n arr.append(i)\narr.pop(0)\n# print(arr)\n \nfor i in range(1,len(arr)):\n if n == 0:\n print(x)\n break\n elif x in arr:\n print(x)\n break\n elif x-i or x+i in arr:\n if not ((x-i) in arr):\n print(x-i)\n break\n elif not((x+i) in arr):\n print(x+i)\n break', 'x,n = map(int,input().split())\n# p = list(map(int,input().split()))\n\nif n==0:\n print(x)\n exit()\n\np = set([int(i) for i in input().split()])\n\nfor a in range(110):\n if not((x-a) in p):\n print(x-a)\n exit()\n if not((x+a) in p):\n print(x+a)\n exit()\n\n# arr = []\n# incc = []\n\n# for j in range(n):\n# incc.append(p[j])\n\n# continue\n# else:\n# arr.append(i)\n# arr.pop(0)\n# # print(arr)\n \n\n# if n == 0:\n# print(x)\n# break\n# elif x in arr:\n# print(x)\n# break\n# elif x-i or x+i in arr:\n\n# print(x-i)\n# break\n\n# print(x+i)\n# break']
['Wrong Answer', 'Accepted']
['s080734201', 's790610465']
[9220.0, 9188.0]
[23.0, 22.0]
[552, 805]
p02641
u569117803
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\n p = list(map(int, input().split(" ")))\n\n p_ = [abs(x - n) for n in p]\n\n m_p_ = p_.index(min(p_))\n\n start = p[m_p_]\n\n for v in range(100):\n a = start - v - 1\n if a not in p:\n ans = a\n b = start + v + 1\n if b not in p:\n if ans > b:\n ans = b\n break\n \nelse:\n ans = x\n \nprint(ans)', 'x, n = list(map(int, input().split(" ")))\nif n != 0:\n\n p = list(map(int, input().split(" ")))\n\n p_ = [abs(x - n) for n in p]\n\n m_p_ = p_.index(min(p_))\n\n start = p[m_p_]\n\n for v in range(100):\n a = start - v - 1\n b = start + v + 1\n if (a not in p) and (b in p):\n ans = a\n break\n\n elif (a in p) and (b not in p):\n ans = b\n break\n \n elif (a not in p) and (b not in p):\n if a > b:\n ans = b\n break\n else:\n ans = a\n break\n \nelse:\n ans = x\n \nprint(ans)']
['Runtime Error', 'Accepted']
['s842561019', 's352607166']
[9184.0, 9100.0]
[25.0, 22.0]
[438, 654]
p02641
u569776981
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\ny = []\nz = []\nfor i in range(n):\n if x - n[i] >= 0:\n y.append(x - n[i])\n else:\n z.append(n[i] - x)\n\n\n\ny = sorted(y)\nz = sorted(z)\n\nif y[0] == z[0]:\n print(y[0])\nelif y[0] > z[0]:\n print(z[0])\nelse:\n print(y[0])', 'x, n = map(int,input().split())\np = list(map(int,input().split()))\n\ny = []\nz = []\nfor i in range(n):\n if x - p[i] >= 0:\n y.append(x - p[i])\n else:\n z.append(p[i] - x)\n\n\n\ny = sorted(y)\nz = sorted(z)\n\nif y[0] == z[0]:\n print(y[0])\nelif y[0] > z[0]:\n print(z[0])\nelse:\n print(y[0])', 'x, n = map(int,input().split())\np = list(map(int,input().split()))\ny = 0\nz = 0\nwhile y == 0:\n a = x + z\n b = x - z\n if a in p and b in p:\n z += 1\n elif a not in p and b in p:\n print(a)\n y = 4\n elif b not in p:\n print(b)\n y = 5']
['Runtime Error', 'Runtime Error', 'Accepted']
['s037417287', 's529428970', 's841312160']
[9200.0, 9196.0, 8920.0]
[21.0, 28.0, 31.0]
[307, 307, 276]
p02641
u570155187
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 exit()\n\np = map(int,input().split())\n\nx1,x2 = x,x\nfor i in range(1000):\n x1 -= 1\n x2 += 1\n if x1 not in p:\n print(x1)\n exit()\n if x2 not in p:\n print(x2)\n exit()', 'x,n = map(int,input().split())\n\nif n == 0:\n print(x)\n exit()\n\np = map(int,input().split())\n\nx1,x2 = x,x\nfor i in range(1000):\n x1 -= 1\n x2 += 1\n if x1 not in p:\n print(x1)\n exit()\n if x2 not in p:\n print(x2)\n exit()', 'x,n = map(int,input().split())\n\nif n == 0:\n print(x)\n exit()\n\np = list(map(int,input().split()))\n\nif x not in p:\n print(x)\n exit()\n\nx1,x2 = x,x\nfor i in range(100):\n x1 -= 1\n x2 += 1\n if x1 not in p:\n print(x1)\n exit()\n if x2 not in p:\n print(x2)\n exit()']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s719085997', 's836168913', 's695994635']
[9132.0, 9128.0, 9124.0]
[31.0, 27.0, 28.0]
[233, 233, 274]
p02641
u571281863
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=[i-X for i in p]\n qs=set(q)\n print(q)\n\n for i in range(N):\n if -i not in qs:\n print(X-i)\n break\n elif i not in qs:\n print(X+i)\n break', 'X,N=map(int,input().split())\nif N==0:\n print(X)\nelse:\n p=set(map(int,input().split()))\n for i in range(N+1):\n if X-i not in p:\n print(X-i)\n break\n elif X+i not in p:\n print(X+i)\n break']
['Wrong Answer', 'Accepted']
['s032296227', 's552957142']
[9188.0, 9112.0]
[21.0, 25.0]
[256, 213]
p02641
u572122511
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()))\n\nmin_ = 100\nfor i in range(0, 102):\n print(i)\n cur = i \n if cur in P:\n continue\n diff = abs(X - cur)\n if diff < min_:\n min_ = diff\n\nfront = X - min_\nback = X + min_\nif front not in P:\n print(front)\nelse:\n print(back)', 'X, N = list(map(int, input().split()))\nP = list(map(int, input().split()))\n\nmin_ = 100\nfor i in range(0, 102):\n cur = i \n if cur in P:\n continue\n diff = abs(X - cur)\n if diff < min_:\n min_ = diff\n\nfront = X - min_\nback = X + min_\nif front not in P:\n print(front)\nelse:\n print(back)']
['Wrong Answer', 'Accepted']
['s911578402', 's823728634']
[8996.0, 9140.0]
[22.0, 20.0]
[326, 313]
p02641
u573332356
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['\nX, N = map(int, input().split())\nif(N != 0):\n p = set(list(map(int, input().split())))\nelse:\n print(X)\n exit()\n\nresult = []\n\nfor i in range(max(p)):\n result.append(i)\n\nans = set(result)-p\nans1 = 1000000000000\n\nprint(ans)\n\nfor count, i in enumerate(ans):\n if (ans1 > abs(i-X)):\n ans1 = abs(i-X)\n print(ans1, abs(i-X))\n index = count\n\nprint(list(ans)[index])\n', 'X, N = map(int, input().split())\nif(N != 0):\n p = set(list(map(int, input().split())))\nelse:\n print(X)\n exit()\n\nresult = []\n\nfor i in range(102):\n result.append(i)\n\nans = set(result)-p\nans1 = 1*10**50\n\n\nfor count, i in enumerate(ans):\n if (ans1 > abs(i-X)):\n ans1 = abs(i-X)\n index = count\n\nprint(list(ans)[index])\n']
['Wrong Answer', 'Accepted']
['s363434534', 's008386014']
[9212.0, 9196.0]
[20.0, 22.0]
[394, 344]
p02641
u580273604
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['import bisect\nX, N=map(int, input().split())\nif N==0:print(X);exit()\np=sorted(list(map(int, input().split())))\n#print(p)\nm=min(p)-1\nM=max(p)+1\n\n# p.append(i)\n\nm=X;i=0\nfor i in range(m,min(p)-2,-1):\n if i not in p:break\nM=X;j=0\nfor j in range(M,max(p)+2):\n if j not in p:break\n\nprint(min(i,j))\n', 'X, N=map(int, input().split())\nif N==0:print(X);exit()\np=sorted(list(map(int, input().split())))\n\nm=X;i=0\nfor i in range(m,min(p)-2,-1):\n if i not in p:break\nM=X;j=0\nfor j in range(M,max(p)+2):\n if j not in p:break\nif abs(i-X)==abs(j-X):print(min(i,j))\nelif abs(i-X)<abs(j-X):\n print(i)\nelse:print(j)']
['Wrong Answer', 'Accepted']
['s065431890', 's238489501']
[9128.0, 9216.0]
[27.0, 27.0]
[331, 303]
p02641
u581022379
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())\nline = list(map(int, input().split()))\nnotLine = [i for i in range(-100, 201) if i not in line]\nleft = -1\nright = len(notLine)\nwhile abs(right - left) > 1:\n middle = (right + left) // 2\n if notLine[middle] >= X:\n right = middle\n else:\n left = middle\nprint(notLine[left], notLine[right])\nif X - notLine[left] <= notLine[right] - X:\n print(notLine[left])\nelse:\n print(notLine[right])\n', 'X, N = map(int, input().split())\nline = list(map(int, input().split()))\nnotLine = [i for i in range(-100, 201) if i not in line]\nleft = -1\nright = len(notLine)\nwhile abs(right - left) > 1:\n middle = (right + left) // 2\n if notLine[middle] >= X:\n right = middle\n else:\n left = middle\n#print(notLine[left], notLine[right])\nif X - notLine[left] <= notLine[right] - X:\n print(notLine[left])\nelse:\n print(notLine[right])\n']
['Wrong Answer', 'Accepted']
['s455002344', 's373119974']
[9204.0, 9148.0]
[24.0, 28.0]
[444, 445]
p02641
u581603131
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X, N = map(int, input().split())\nif N == 0:\n print(X)\n exit()\n\np = list(map(int, input().split()))\npp = set(p)\nnumlist = [i for i in range(-1000, 1000)]\nnumlistt = set(numlist)\nnewlist = numlistt - pp\nnewlistt = list(newlist)\nabsn = 1000\nans = 1000\n \nfor i in newlistt:\n if absn > abs(X-i):\n ans = i\n absn = abs(X-i)\n elif absn == abs(X-i) and i < ans:\n ans = i\n absn = abs(X-i)\n\nprint(ans)\nprint(newlistt)', 'X, N = map(int, input().split())\nif N == 0:\n print(X)\n exit()\n\np = list(map(int, input().split()))\npp = set(p)\nnumlist = [i for i in range(-1000, 1000)]\nnumlistt = set(numlist)\nnewlist = numlistt - pp\nnewlistt = list(newlist)\nabsn = 1000\nans = 1000\n \nfor i in newlistt:\n if absn > abs(X-i):\n ans = i\n absn = abs(X-i)\n elif absn == abs(X-i) and i < ans:\n ans = i\n absn = abs(X-i)\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s510830492', 's544166075']
[9384.0, 9268.0]
[22.0, 24.0]
[446, 430]
p02641
u583507988
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 ans = []\n\n for i in range(n-2):\n if x-i not in p:\n ans.append(-i)\n break\n elif x+i not in p:\n ans.append(i)\n break\n else:\n ans.append(-3)\n print(x+ans[0])', 'x, n = map(int, input().split())\n\nif n == 0:\n print(x)\nelse:\n p = list(map(int, input().split()))\n for j in range(0, int(n/2)+ 2):\n #print(j)\n if x-j not in p:\n print(x-j)\n break\n else:\n if x+j not in p:\n print(x+j)\n break']
['Runtime Error', 'Accepted']
['s920329106', 's731738408']
[9200.0, 9128.0]
[22.0, 27.0]
[291, 263]
p02641
u591182368
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\ninput = sys.stdin.readline\n\ndef main():\n x, n = map(int, input().rstrip().split())\n if n == 0:\n print(x)\n sys.exit()\n else:\n p = list(map(int, input().rstrip().split()))\n\tif x > max(p):\n print(x)\n sys.exit()\n else:\n p_x = set(range(max(p)+1))\n p_temp = set(p)\n p_diff = p_x - p_temp\n p_temp = list(p_diff)\n p_dir = []\n\n for i in range(len(p_temp)):\n p_dir.append(abs(p_temp[i] - x))\n print(p_temp[p_dir.index(min(p_dir))])\n \nif __name__ == "__main__":\n main()', 'import sys\n\ninput = sys.stdin.readline\n\ndef main():\n x, n = map(int, input().rstrip().split())\n if n == 0:\n print(x)\n sys.exit()\n else:\n p = list(map(int, input().rstrip().split()))\n if x > max(p):\n print(x)\n sys.exit()\n else:\n p_x = set(range(min(p), max(p)+1))\n p_temp = set(p)\n p_diff = p_x - p_temp\n p_temp = list(p_diff).sort()\n p_dir = []\n\n for i in range(len(p_temp)):\n p_dir.append(abs(p_temp[i] - x))\n print(p_temp[p_dir.index(min(p_dir))])\n \nif __name__ == "__main__":\n main()', 'import sys\n\ninput = sys.stdin.readline\n\ndef main():\n x, n = map(int, input().rstrip().split())\n if n == 0:\n print(x)\n sys.exit()\n else:\n p = list(map(int, input().rstrip().split()))\n if x > max(p):\n print(x)\n sys.exit()\n else:\n p_x = set(range(102))\n p_temp = set(p)\n p_diff = p_x - p_temp\n p_temp = list(p_diff)\n p_temp = sorted(p_temp)\n p_dir = []\n\n for i in range(len(p_temp)):\n p_dir.append(abs(p_temp[i] - x))\n print(p_temp[p_dir.index(min(p_dir))])\n \nif __name__ == "__main__":\n main()']
['Runtime Error', 'Runtime Error', 'Accepted']
['s618983645', 's867728244', 's456826225']
[9036.0, 9192.0, 9236.0]
[23.0, 21.0, 22.0]
[540, 636, 652]
p02641
u591287669
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 collections import defaultdict\n\nx,n = map(int,input().split())\nif n==0:\n print(x)\nelse:\n dd = defaultdict(int)\n arr = list(map(int,input().split()))\n for i in range(len(arr)):\n dd[x-arr[i]]+=1\n \n print(dd)\n\n for i in range(101):\n if dd[i]==0:\n print(x-i)\n break\n elif dd[-i]==0:\n print(x+i)\n break\n\n\n', 'from collections import defaultdict\n\nx,n = map(int,input().split())\nif n==0:\n print(x)\nelse:\n dd = defaultdict(int)\n arr = list(map(int,input().split()))\n for i in range(len(arr)):\n dd[x-arr[i]]+=1\n\n for i in range(101):\n if dd[i]==0:\n print(x-i)\n break\n elif dd[-i]==0:\n print(x+i)\n break\n\n\n']
['Wrong Answer', 'Accepted']
['s116481741', 's906046090']
[9408.0, 9340.0]
[32.0, 32.0]
[391, 372]
p02641
u595833382
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()]\np = [int(x) for x in input().split()]\n\nif N != 0:\n if X in p:\n sorted_p = sorted(p)\n\n x = p.index(X)\n \n def checknum(d,loweridx,upperidx):\n upper = sorted_p[upperidx]\n lower = sorted_p[loweridx]\n if X-d == lower:\n if X+d == upper:\n if loweridx == 0:\n print(X-d-1)\n elif upperidx == N-1:\n a=1\n while(sorted_p[loweridx-a] == X-d):\n a += 1\n if sorted_p[loweridx-a] == X-d-1:\n print(X+d+1)\n else:\n print(X-d-1)\n else:\n checknum(d+1,loweridx-1,upperidx+1)\n elif X-d == lower and X+d != upper:\n print(X+d) \n else:\n return print(X-d)\n\n if x == 0:\n print(X-1)\n elif x == N-1:\n a=1\n while(sorted_p[x-a] == X):\n a += 1\n if sorted_p[x-a] != X-1:\n print(X-1)\n else:\n print(X+1)\n else:\n checknum(1,x-1,x+1)\n else:\n print(X)\nelse:\n print(X)', 'X,N = [int(x) for x in input().split()]\np = [int(x) for x in input().split()]\n\nif N != 0:\n sorted_p = sorted(p)\n flag = 0\n\n for x in range(N-1):\n diff = abs(X - sorted_p[x])\n if diff == 0:\n flag = 1\n break\n if diff <= abs(X-sorted_p[x+1]):\n break\n\n def checknum(d,loweridx,upperidx):\n upper = sorted_p[upperidx]\n lower = sorted_p[loweridx]\n if X-d == lower:\n if X+d == upper:\n if loweridx == 0:\n print(X-d-1)\n elif upperidx == N-1:\n print(X+d+1)\n else:\n checknum(d+1,loweridx-1,upperidx+1)\n elif X-d == lower and X+d != upper:\n print(X+d) \n else:\n return print(X-d)\n\n if not x in sorted_p:\n print(X)\n elif x == 0:\n print(X-1)\n elif x == N-1:\n a=1\n while(sorted_p[x-a] == X):\n a -= 1\n if sorted_p[x] != X-1:\n print(X-1)\n else:\n print(X+1)\n else:\n checknum(1,x-1,x+1)\nelse:\n print(X)', 'X,N = [int(x) for x in input().split()]\np = [int(x) for x in input().split()]\n\nif N != 0:\n sorted_p = sorted(p)\n\n for x in range(N-1):\n diff = abs(X - sorted_p[x])\n if diff < abs(X-sorted_p[x+1]):\n break\n elif x == N-2 and diff > abs(X-sorted_p[x+1]):\n x = N-1\n \n print(x)\n \n def checknum(d,loweridx,upperidx):\n upper = sorted_p[upperidx]\n lower = sorted_p[loweridx]\n if X-d == lower:\n if X+d == upper:\n if loweridx == 0:\n elif upperidx == N-1:\n else:\n checknum(d+1,loweridx-1,upperidx+1)\n elif X-d == lower and X+d != upper:\n print(X+d) \n else:\n return print(X-d)\n\n if x == 0:\n print(X-1)\n elif x == N-1:\n a=1\n while(sorted_p[x-a] == X):\n a += 1\n if sorted_p[x-a] != X-1:\n print(X-1)\n else:\n print(X+1)\n else:\n checknum(1,x-1,x+1)\nelif not(X in sorted_p):\n print(X)\nelse:\n print(X)', 'X,N = [int(x) for x in input().split()]\np = [int(x) for x in input().split()]\n\nif N != 0:\n if X in p:\n sorted_p = sorted(p)\n\n x = p.index(X)\n \n def checknum(d,loweridx,upperidx):\n upper = sorted_p[upperidx]\n lower = sorted_p[loweridx]\n if X-d == lower:\n if X+d == upper:\n if loweridx == 0:\n print(X-d-1)\n elif upperidx == N-1 and sorted_p[loweridx-1] == X-d-1:\n print(X+d+1)\n else:\n checknum(d+1,loweridx-1,upperidx+1)\n else:\n print(X+d) \n else:\n return print(X-d)\n\n if x == 0:\n print(X-1)\n elif x == N-1:\n if sorted_p[x-1] != X-1:\n print(X-1)\n else:\n print(X+1)\n else:\n checknum(1,x-1,x+1)\n else:\n print(X)\nelse:\n print(X)', 'X,N = [int(x) for x in input().split()]\np = [int(x) for x in input().split()]\n\nif N != 0:\n if X in p:\n sorted_p = sorted(p)\n\n x = sorted_p.index(X)\n \n def checknum(d,loweridx,upperidx):\n upper = sorted_p[upperidx]\n lower = sorted_p[loweridx]\n if X-d == lower:\n if X+d == upper:\n if loweridx == 0:\n print(X-d-1)\n elif upperidx == N-1 and sorted_p[loweridx-1] == X-d-1:\n print(X+d+1)\n else:\n checknum(d+1,loweridx-1,upperidx+1)\n else:\n print(X+d) \n else:\n return print(X-d)\n\n if x == 0:\n print(X-1)\n elif x == N-1:\n if sorted_p[x-1] != X-1:\n print(X-1)\n else:\n print(X+1)\n else:\n checknum(1,x-1,x+1)\n else:\n print(X)\nelse:\n print(X)']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s463135136', 's524611553', 's587778649', 's743796588', 's022036022']
[9220.0, 9276.0, 9012.0, 9244.0, 9192.0]
[29.0, 25.0, 27.0, 29.0, 29.0]
[1337, 1129, 1084, 1007, 1014]
p02641
u597455618
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 i in range(100):\n if x + i not in p:\n print(x+i)\n elif x - i not in p:\n print(x-i)', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\nfor i in range(n+1):\n c = 10**5\n t = 10**5\n y = 0\n if x + i not in p:\n c = x+i\n y += 1\n if x - i not in p:\n t = x-i\n y += 1\n if y:\n print(min(t,c))\n exit()']
['Wrong Answer', 'Accepted']
['s558734448', 's895634282']
[9172.0, 9196.0]
[25.0, 24.0]
[175, 284]
p02641
u600261652
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 resolve():\n X, N = map(int, input().split())\n P = []\n for i in range(N):\n p = int(input())\n P.append(p)\n plus = 1\n while True:\n if X in P:\n if plus%2 == 1:\n X -= plus\n plus +=1\n else:\n X += plus\n plus += 1\n else:\n print(X)\n exit()\nresolve()', 'def resolve():\n X, N = map(int, input().split())\n P = [int(input()) for _ in range(N)]\n if X in P:\n for j in range(N):\n if X+j in P:\n continue\n else:\n print(X+j)\n exit()\n if X-j in P:\n continue\n else:\n print(X-j)\n exit()\n else:\n print(X)\nresolve()', 'def resolve():\n X, N = map(int, input().split())\n if N != 0:\n P = list(map(int, input().split()))\n if X in P:\n for j in range(1, N):\n if X-j in P:\n continue\n else:\n print(X-j)\n exit()\n if X+j in P:\n continue\n else:\n print(X+j)\n exit()\n else:\n print(X)\n else:\n print(X)\nresolve()', 'def resolve():\n X, N = map(int, input().split())\n P = []\n for i in range(N):\n p = int(input())\n P.append(p)\n plus = 1\n while True:\n if X in P:\n if plus%2 == 1:\n X -= plus\n else:\n X += plus\n else:\n print(X)\n exit()\n plus += 1\nresolve()', 'def resolve():\n X, N = map(int, input().split())\n if N != 0:\n P = list(map(int, input().split()))\n S = []\n for _ in range(0, 102):\n if _ in P:\n continue\n else:\n S.append(_)\n if X in S:\n print(X)\n else:\n for i in range(1, 102):\n if X-i in S:\n print(X-i)\n exit()\n elif X+i in S:\n print(X+i)\n exit()\n else:\n print(X)\nresolve()']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s270811171', 's322458244', 's411585117', 's992287793', 's779425696']
[9132.0, 9184.0, 9144.0, 9192.0, 9212.0]
[22.0, 20.0, 24.0, 23.0, 23.0]
[391, 407, 511, 358, 554]
p02641
u602677143
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()))\np1 = [i for i in range(0,101)]\nfor i in p:\n if i in p1:\n p1.remove(i)\nans = 1000\n\nfor i in p1:\n if ans >= abs(i-x):\n ans = min(abs(i-x),ans)\n al.append(i)\n\nif len(al) == 0:\n if x < 50:\n print(0)\n else:\n print(101)\nelif abs(al[-1]-x) == abs(al[-2]-x):\n print(al[-2])\nelse:\n print(al[-1])', 'x,n = map(int,input().split())\np = list(map(int,input().split()))\np1 = [i for i in range(0,102)]\nfor i in p:\n if i in p1:\n p1.remove(i)\nans = 1000\nal = []\nfor i in p1:\n if ans >= abs(i-x):\n ans = min(abs(i-x),ans)\n al.append(i)\n\nif len(al) == 0:\n if x < 50:\n print(0)\n else:\n print(101)\nelif len(al) > 1:\n if abs(al[-1]-x) == abs(al[-2]-x):\n print(al[-2])\n else:\n print(al[-1])\nelse:\n print(al[-1])']
['Runtime Error', 'Accepted']
['s537991317', 's793061790']
[9216.0, 9108.0]
[25.0, 22.0]
[405, 468]
p02641
u602773379
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.
['\ndef input2():\n\treturn map(int,input().split())\nx,n=input2()\np=sorted(input_array())\nq=[0]*102\nresult=[10000,-1]\nfor i in range(n):\n\tq[p[i]]=1\nfor i in range(102):\n\tif q[i]==0:\n\t\tnum=abs(i-x)\n\t\tif num<result[0]:\n\t\t\tresult=[num,i]\nprint(result[1])', '\ndef input2():\n\treturn map(int,input().split())\n\n\ndef input_array():\n\treturn list(map(int,input().split()))\n \nx,n=input2()\np=sorted(input_array())\nq=[0]*102\nresult=[10000,-1]\nfor i in range(n):\n\tq[p[i]]=1\nfor i in range(102):\n\tif q[i]==0:\n\t\tnum=abs(i-x)\n\t\tif num<result[0]:\n\t\t\tresult=[num,i]\nprint(result[1])']
['Runtime Error', 'Accepted']
['s018778014', 's867130634']
[9060.0, 9200.0]
[25.0, 31.0]
[269, 371]
p02641
u605151360
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\nimport math\n\nX, N = map(int, input().split())\n\nif N==0:\n p = []\nelse:\n p = list(map(int, input().split()))\n\np = sorted(p)\n\nif X not in p:\n print(X)\nelse:\n ind = p.index(X)\n pre = p[:ind]\n pre = pre[::-1]\n pre += [100] * 100\n ans_p = math.inf\n for i, pp in enumerate(pre, start=1):\n if X!=(pp+i):\n ans_p = X-i\n break\n\n aft = p[ind+1:]\n aft += [-1] * 100\n ans_a = math.inf\n for i, pp in enumerate(aft, start=1):\n if X!=(pp-i):\n ans_a = X+i\n break\n\n print(min(ans_a, ans_p))\n', '# -*- coding: utf-8 -*-\n\nimport math\n\nX, N = map(int, input().split())\n\nif N==0:\n p = []\nelse:\n p = list(map(int, input().split()))\n\np = sorted(p)\n\nfor i in range(100):\n if X-i not in p:\n print(X-i)\n quit()\n\n if X+i not in p:\n print(X+i)\n quit()\n']
['Wrong Answer', 'Accepted']
['s269250600', 's005049581']
[9232.0, 9160.0]
[23.0, 22.0]
[597, 286]
p02641
u605161376
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()))\nsortP = sorted(P)\nif N==0:\n print(X)\nelif sortP[0]>X:\n print(sortP[0]-1)\nelif sortP[N-1]<X:\n print(sortP[N-1]+1)\nelse:\n for n in range(sortP[0],sortP[N-1]+2):\n if n in sortP:\n continue\n if n ==X:\n print(X)\n elif n>X:\n if X-a<=n-X:\n print(a)\n break\n else:\n print(n)\n break\n a = n', 'X,N = map(int, input().split())\nP = list(map(int, input().split()))\nsortP = sorted(P)\nif N==0:\n print(X)\nelif sortP[0]>X:\n print(X)\nelif sortP[N-1]<X:\n print(X)\nelse:\n for n in range(sortP[0]-2,sortP[N-1]+2):\n if n in sortP:\n continue\n if n ==X:\n print(X)\n break\n elif n>X:\n if X-a<=n-X:\n print(a)\n break\n else:\n print(n)\n break\n a = n']
['Runtime Error', 'Accepted']
['s176566532', 's064859640']
[9156.0, 9212.0]
[23.0, 25.0]
[490, 490]
p02641
u607180061
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\n\ndef getNearestValue(li, num):\n idx = np.abs(np.array(li) - num).argmin()\n return li[idx]\n\n\nx, n = map(int, input().split())\np = list(map(int, input().split()))\n\n\nans = 0\nprint(p)\ni = 0\nwhile True:\n mi = getNearestValue(p, x - i)\n ma = getNearestValue(p, x + i)\n if mi or ma:\n break\n i += 1\n\nprint(mi if mi < ma else ma)\n', 'x, n = map(int, input().split())\np = set(map(int, input().split()))\n\n\nans = 0\ni = 0\nwhile 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 i += 1\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s304217629', 's644881428']
[27212.0, 9176.0]
[109.0, 24.0]
[366, 239]
p02641
u608007704
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())\np=np.array(list(map(int,input().split())))\nans=np.array([X,X])\nwhile True:\n for x in ans:\n if x not in p:\n print(x)\n exit()\n ans+=[-1,1]\n \n', 'import numpy as np\nX,N=map(int,input().split())\np=np.array(list(map(int,input().split())))\nans=np.array([X,X])\nwhile True:\n for x in ans:\n if x not in p:\n print(x)\n exit()\n ans+=[-1,1]\n \n']
['Runtime Error', 'Accepted']
['s309295740', 's960726510']
[8800.0, 27340.0]
[25.0, 119.0]
[199, 205]
p02641
u608080019
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\np = list(map(int, input().split))\n\nabs_val_dict = {}\n\nif N == 0:\n print (X)\n\nfor i in range (X-N, X+N):\n if i not in p:\n abs_val_dict[i] = abs(i-X)\n \nprint(max(abs_val_dict, key = abs_val_dict.get()))', 'import operator\n\nX, N = map(int, input().split())\n\np = list(map(int, input().split()))\n\nabs_val_dict = {}\n\nif N == 0:\n print (X)\n\nfor i in range (X-N, X+N):\n if i not in p:\n abs_val_dict[i] = abs(i-X)\n\nif abs_val_dict != {}:\n print(min(abs_val_dict.items(), key=operator.itemgetter(1))[0])']
['Runtime Error', 'Accepted']
['s988816735', 's281172787']
[9104.0, 9096.0]
[19.0, 24.0]
[250, 305]
p02641
u608178601
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())\nans=0\nflag=0\nif N!=0:\n\n\tP=sorted(list(map(int, input().split())))\n\tpabs=[]\n\tfor p in P:\n\t\tpabs.append(abs(X-p))\n\t\n\tpabs.sort()\n\t\n\t\n\tcnt=0\n\ttemp=0\n\t\n\tprint(pabs)\n\tif 0 in pabs:\n\t\tfor i in range(1,max(pabs)+1):\n\t\t\tif i in pabs:\n\t\t\t\t\n\t\t\t\tif pabs.count(i)==1:\n\t\t\t\t\tif X-i not in P:\n\t\t\t\t\t\tans=X-i\n\t\t\t\t\t\tflag=1\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse:\n\t\t\t\t\t\tans=X+i\n\t\t\t\t\t\tflag=1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t\n\t\t\t\telse:\n\t\t\t\t\tcontinue\n\t\t\t\t\n\t\t\telse:\n\t\t\t\tans=X-1\n\t\t\t\tflag=1\n\t\t\t\tbreak\n\t\t\n\t\tprint(X-max(pabs)-1 if flag==0 else ans)\n\t\t\t\t\t\t\t\t\t\t\n\telse:\n\t\tprint(X)\n\t\t\nelse:\n\tprint(X)', 'X,N=map(int, input().split())\nans=0\nflag=0\n\nif N!=0:\n\tP=sorted(list(map(int, input().split())))\n\tpabs=[]\n\t\n\tfor p in P:\n\t\tpabs.append(abs(X-p))\n\tpabs.sort()\n\t\n\tif 0 in pabs:\n\t\tfor i in range(1,max(pabs)+1):\n\t\t\tif i in pabs:\n\t\t\t\t\n\t\t\t\tif pabs.count(i)==1:\n\t\t\t\t\tif X-i not in P:\n\t\t\t\t\t\tans=X-i\n\t\t\t\t\t\tflag=1\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse:\n\t\t\t\t\t\tans=X+i\n\t\t\t\t\t\tflag=1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t\n\t\t\t\telse:\n\t\t\t\t\tcontinue\n\t\t\t\t\n\t\t\telse:\n\t\t\t\tans=X-i\n\t\t\t\tflag=1\n\t\t\t\tbreak\n\t\t\n\t\tprint(X-max(pabs)-1 if flag==0 else ans)\n\t\t\t\t\t\t\t\t\t\t\n\telse:\n\t\tprint(X)\n\t\t\nelse:\n\tprint(X)']
['Wrong Answer', 'Accepted']
['s343950432', 's292925574']
[9180.0, 9232.0]
[21.0, 23.0]
[567, 535]
p02641
u609176437
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['n=int(input())\nli = list(map(int,input().split()))\ncount=0\n\nfor i in range(100):\n for j in range(n):\n if i == j:pass\n elif li[i]%li[j] == 0:break\n elif j == n-1:count +=1\n\nprint(count)', 'x,n = map(int,input().split())\nif n == 0:print(x)\nelse:\n li = list(map(int,input().split()))\n\n for i in range(100):\n plus = (x+i) in li\n minus = (x-i) in li\n \n if plus == 1 and minus == 1:\n pass \n elif plus == 1 and minus == 0:\n print(x-i)\n break\n elif plus == 0 and minus == 1:\n print(x+i)\n break\n else:\n print(x-i)\n break\n ']
['Runtime Error', 'Accepted']
['s779218463', 's849862653']
[9188.0, 9224.0]
[21.0, 21.0]
[194, 385]
p02641
u613350811
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 len(p) == 0:\n print(X)\n exit()\n\nif not X in p:\n print(X)\n exit()\n\nsmall = [i for i in range(-101, X)]\nbig = [i for i in range(X+1, 102)]\nsmall.reverse()\nprint(small)\nprint(big)\nprint(max(len(big),len(small)))\nfor i in range(max(len(big),len(small))):\n if not small[i] in p:\n print(small[i])\n exit()\n elif not big[i] in p:\n print(big[i])\n exit()', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nif len(p) == 0:\n print(X)\n exit()\n\nif not X in p:\n print(X)\n exit()\n\nsmall = [i for i in range(-1, X)]\nbig = [i for i in range(X+1, 101)]\nsmall.reverse()\nprint(small)\nprint(big)\nprint(max(len(big),len(small)))\nfor i in range(max(len(big),len(small))):\n if not small[i] in p:\n print(small[i])\n exit()\n elif not big[i] in p:\n print(big[i])\n exit()', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nif len(p) == 0:\n print(X)\n exit()\n\nif not X in p:\n print(X)\n exit()\n\nsmall = [i for i in range(-101, X)]\nbig = [i for i in range(X+1, 102)]\nsmall.reverse()\nfor i in range(max(len(big),len(small))):\n if not small[i] in p:\n print(small[i])\n exit()\n elif not big[i] in p:\n print(big[i])\n exit()']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s261480364', 's365199562', 's337487536']
[9232.0, 9236.0, 9220.0]
[21.0, 21.0, 22.0]
[463, 461, 407]
p02641
u618251217
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['X,N = map(int, input().split())\nif N == 0:\n print(X)\n exit()\nP = list(map(int, input().split()))\n\nP.sort(reverse=True)\nP += [-1000]\np_idx = 0\nmin_difference = 101\nans = 101\nfor num in range(101, -2, -1):\n if num == P[p_idx]:\n p_idx += 1\n else:\n if abs(X - num) <= min_difference:\n min_difference = abs(X - num)\n ans = num\nprint(num)', 'X,N = map(int, input().split())\nif N == 0:\n print(X)\n exit()\nP = list(map(int, input().split()))\nP.sort(reverse=True)\n\nfor i in range(105):\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']
['s828622408', 's163792223']
[9196.0, 9092.0]
[28.0, 29.0]
[380, 261]
p02641
u619819312
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())\ns=list(map(int,input().split()))\nfor i in range(101):\n if n-i not in s:\n print(n-i)\n break\n elif n+i not in s:\n print(n+i)\n break ', 'x,n=map(int,input().split())\ns=list(map(int,input().split()))\nfor i in range(101):\n if x-i not in s:\n print(x-i)\n break\n elif x+i not in s:\n print(x+i)\n break ']
['Wrong Answer', 'Accepted']
['s946009625', 's661868239']
[9176.0, 9128.0]
[24.0, 29.0]
[198, 198]
p02641
u629540524
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 = sorted(map(int, input().split()))\nif p == []:\n print(x)\nelse:\n a = p[-1]\n d =[]\n e = 0\n E = 0\n b = 1000\n c = 0\n for i in range(a):\n d += [e]\n e += 1\n for i in range(n):\n d.remove(p[E])\n E += 1\n for i in range(n):\n b = min((abs,x-d[c]),b)\n c += 1\n if (x-b) in d:\n print(x-b)\n else:\n print(x+b)', 'x,n = map(int, input().split())\np = set(map(int, input().split()))\nfor i in range(101):\n if x-i not in p:\n print(x-i)\n break\n if x+i not in p:\n print(x+i)\n break']
['Runtime Error', 'Accepted']
['s389715083', 's938680575']
[9256.0, 9176.0]
[24.0, 29.0]
[420, 195]
p02641
u632395989
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())\nlist = list(map(int, input().split()))\n\nintegers = [i for i in range(1, 101)]\nfor i in list:\n integers.remove(i)\n\nans = integers[0]\nminabs = abs(integers[0] - x)\nfor i in integers:\n if abs(i - x) < minabs:\n minabs = abs(i - x)\n ans = i\n break\n\nprint(ans)', 'x, n = map(int, input().split())\nlist = list(map(int, input().split()))\n\nans_list = [300]\nfor i in range(1, 101):\n if i not in list:\n if abs(x-i) < abs(x-ans_list[-1]):\n ans_list.append(i)\n\nprint(ans_list)\nans_list.sort(key=lambda y: abs(x-y))\nprint(ans_list[0])\n', 'x, n = map(int, input().split())\nlist = list(map(int, input().split()))\n\nans = 300\nfor i in range(-200, 201):\n if i not in list:\n if abs(x-i) < abs(x-ans):\n ans = i\n\nprint(ans)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s336146058', 's594106049', 's235413893']
[9136.0, 9184.0, 9176.0]
[22.0, 28.0, 23.0]
[314, 284, 198]
p02641
u638231966
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(100)\n sys.exit()\np = list(map(int, input()))\n\nn_ans = 1\nsa = 100\nfor k in range(1,100,1):\n if (k in p):\n continue\n if(abs(k-X) < sa):\n n_ans = k\n sa = abs(k-X)\n else:\n break\nprint(n_ans)', 'import sys\nX, N = map(int, input().split())\nif (N==0):\n print(X)\n sys.exit()\np = list(map(int, input().split()))\n\nn_ans = 0\nsa = 200\nfor k in range(0,102,1):\n if (k in p):\n continue\n if(abs(k-X) < sa):\n n_ans = k\n sa = abs(k-X)\n else:\n break\nprint(n_ans)']
['Runtime Error', 'Accepted']
['s417931177', 's907757767']
[9200.0, 9200.0]
[25.0, 22.0]
[291, 297]
p02641
u643679148
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())\nps = list(map(int, input().split()))\npss = [i for i in range(1, 100+1)]\nps = list(set(pss)-set(ps))\nans = x\n\nfor i, p in enumerate(ps):\n temp = abs(x-p)\n ans = p\n if i == 0:\n mins = temp\n ans = p\n else:\n if mins > temp:\n mins = temp\n ans = p\n\nprint(ans)', '# -*- coding: utf-8 -*-\nx, n = map(int, input().split())\nps = list(map(int, input().split()))\n\nfor i in range(0, x):\n for j in [-1, 1]:\n temp = x + (i*j)\n if ps.count(temp) == 0:\n ans = temp\n break\n\n\nprint(ans)\n', '# -*- coding: utf-8 -*-\nx, n = map(int, input().split())\nps = list(map(int, input().split()))\n\nfor i in range(0, x+100):\n for j in [-1, 1]:\n temp = x + (i*j)\n if ps.count(temp) == 0:\n ans = temp\n break\n else:\n continue\n break\n\n\nprint(ans)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s353654525', 's791290914', 's925019339']
[9108.0, 9156.0, 9056.0]
[28.0, 30.0, 28.0]
[341, 250, 291]
p02641
u646661668
2,000
1,048,576
Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.
['XN = input().split()\nX = int(XN[0])\nN = int(XN[1])\nif N == 0:\n print(X)\nelse:\n p = input().split()\n A = [None]*N\n for i in range(N):\n A[i] = abs(int(p[i])-X)\n print(A)\n if 0 not in A:\n print(X)\n else:\n j = 1\n while A.count(j) == 2:\n j += 1\n if A.count(j) == 0:\n print(X-j)\n else:\n if str(X-j) in p:\n print(X+j)\n else:\n print(X-j)', 'XN = input().split()\nX = int(XN[0])\nN = int(XN[1])\nif N == 0:\n print(X)\nelse:\n p = input.split()\n A = [None]*N\n for i in range(N):\n A[i] = abs(int(p[i])-X)\n j = 0\n while j in A:\n j += 1\n if j == 1:\n print(X-j)\n else:\n if A.count(j-1) == 2:\n print(X-j)\n else:\n if str(X-(j-1)) in p:\n print(X+(j-1))\n else:\n print(X-(j-1))', 'XN = input().split()\nX = int(XN[0])\nN = int(XN[1])\nif N == 0:\n print(X)\nelse:\n p = input().split()\n A = [None]*N\n for i in range(N):\n A[i] = abs(int(p[i])-X)\n print(A)\n j = 0\n while j in A:\n j += 1\n if j == 0:\n print(X)\n elif j == 1:\n print(X-j)\n else:\n if A.count(j-1) == 2:\n print(X-j)\n else:\n if str(X-(j-1)) in p:\n print(X+(j-1))\n else:\n print(X-(j-1))', 'XN = input().split()\nX = int(XN[0])\nN = int(XN[1])\nif N == 0:\n print(X)\nelse:\n p = input().split()\n A = [None]*N\n for i in range(N):\n A[i] = abs(int(p[i])-X)\n if 0 not in A:\n print(X)\n else:\n j = 1\n while A.count(j) == 2:\n j += 1\n if A.count(j) == 0:\n print(X-j)\n else:\n if str(X-j) in p:\n print(X+j)\n else:\n print(X-j)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s191931375', 's596436376', 's871875081', 's182948281']
[9224.0, 9220.0, 9228.0, 9224.0]
[23.0, 19.0, 22.0, 22.0]
[466, 442, 491, 453]
p02641
u647087591
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()))\nmin_abs = 51\nans = 0\nfor i in range(max(X, N)+2):\n if i in l:\n continue\n if abs(i - X) < min_abs:\n min_abs = abs(i - X)\n ans = i\nprint(ans)', 'X, N = map(int, input().split())\nl = list(map(int, input().split()))\nmin_abs = 51\nans = 0\nfor i in range(102):\n if i in l:\n continue\n if abs(i - X) < min_abs:\n min_abs = abs(i - X)\n ans = i\nprint(ans)']
['Wrong Answer', 'Accepted']
['s807935380', 's519580967']
[9192.0, 9184.0]
[22.0, 23.0]
[235, 227]
p02641
u655048024
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\nans = 0\nwhile True:\n if(x-1 in p):\n if(x+1 in p):\n None\n else:\n ans = x+1\n break\n else:\n ans = x-1\n break\n i += 1\nprint(ans)\n \n ', 'x,n = map(int,input())\np = list(map(int,input.split()))\ni = 0\nans = 0\nwhile True:\n if(x-1 in p):\n if(x+1 in p):\n None\n else:\n ans = x+1\n break\n else:\n ans = x-1\n break\n i += 1\nprint(ans)\n \n ', 'x,n = map(int,input().split())\np = list(map(int,input().split()))\ni = 0\nans = 0\nwhile True:\n if(x-i in p):\n if(x+i in p):\n None\n else:\n ans = x+i\n break\n else:\n ans = x-i\n break\n i += 1\nprint(ans)\n\n ']
['Runtime Error', 'Runtime Error', 'Accepted']
['s408978025', 's583145965', 's718342169']
[9172.0, 9176.0, 9172.0]
[23.0, 22.0, 23.0]
[236, 228, 234]
p02641
u658627575
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 = []\np.sort()\n\ndiff_1 = abs(X-p[-1])\ndiff_2 = abs(X-p[1])\ndiff = max(diff_1,diff_2)\n\nfor x in range(1,diff+1):\n\tif X+x not in p:\n\t\tans.append(X+x)\n\t\t\n\tif X-x not in p:\n\t\tans.append(X-x)\n\nans.sort()\nprint(ans[1])', 'X,N = map(int,input().split())\nif N == 0:\n\tprint(X)\nelse:\n\tp = list(map(int,input().split()))\n\tp.sort()\n\n\tdiff_1 = abs(X-p[-1])\n\tdiff_2 = abs(X-p[0])\n\tdiff = max(diff_1,diff_2)\n\n\tfor x in range(0,diff+1):\n\t\tif X-x not in p\n\t\t\tprint(X-x)\n\t\t\tbreak\n\t\tif X+x not in p\n\t\t\tprint(X+x)\n\t\t\tbreak', 'X,N = map(int,input().split())\nif N == 0:\n\tprint(X)\nelse:\n\tp = list(map(int,input().split()))\n\tp.sort()\n\n\tdiff_1 = abs(X-p[-1])\n\tdiff_2 = abs(X-p[0])\n\tdiff = max(diff_1,diff_2)\n\n\n\tfor x in range(diff+2):\n\t\tif X-x not in p:\n\t\t\tprint(X-x)\n\t\t\tbreak\n\t\tif X+x not in p:\n\t\t\tprint(X+x)\n\t\t\tbreak\n\t\t']
['Runtime Error', 'Runtime Error', 'Accepted']
['s390141191', 's762804345', 's907595305']
[9192.0, 9048.0, 9196.0]
[21.0, 20.0, 23.0]
[281, 286, 290]
p02641
u663404111
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()))\ninteger = [i for i in range(101)]\nfor i in range(N):\n integer.remove(p[i])\nl = len(integer)\nans = -200\nfor i in range(l):\n if abs(ans) > abs(integer[i]-X):\n ans = integer[i]\nprint(ans)', '\n\nX, N = list(map(int, input().split()))\np = list(map(int, input().split()))\ninteger = [i+1 for i in range(100)]\nfor i in range(N):\n integer.remove(p[i])\nl = len(integer)\nans = -200\nfor i in range(l):\n if abs(ans) > abs(integer[i]-X):\n ans = integer[i]\nprint(ans)', 'X, N = list(map(int, input().split()))\np = list(map(int, input().split()))\ninteger = [i for i in range(102)]\nfor i in range(N):\n integer.remove(p[i])\nl = len(integer)\nans = -200\nfor i in range(l):\n if abs(ans) > abs(integer[i]-X):\n ans = integer[i] - X\nprint(ans + X)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s690021490', 's765757246', 's017162155']
[9128.0, 9048.0, 9076.0]
[24.0, 25.0, 26.0]
[268, 272, 276]
p02641
u663438907
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()))\nl = []\nif len(l) == 0:\n if X != N:\n print(X)\n else:\n print(X-1)\n exit()\nfor i in range(-100, max(p)):\n if not i in p:\n l.append(i)\nprint(l)\n\nans_n = 100\nans = 0\nfor i in range(len(l)):\n if ans_n > abs(X-l[i]):\n ans_n = abs(X-l[i])\n ans = l[i]\n\nprint(ans)', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\nl = []\nif len(p) == 0:\n print(X)\n exit()\nfor i in range(-1000, 1000):\n if not i in p:\n l.append(i)\n\nans_n = 1000\nans = 0\nfor i in range(-1000, 1000):\n if ans_n > abs(X-l[i]):\n ans_n = abs(X-l[i])\n ans = l[i]\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s157541465', 's047837909']
[9216.0, 9216.0]
[23.0, 25.0]
[373, 321]