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
|
---|---|---|---|---|---|---|---|---|---|---|
p02640 | u994865749 | 2,000 | 1,048,576 | There are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs. Takahashi says: "there are X animals in total in the garden, and they have Y legs in total." Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct. | ["x, y = map(int, input().split())\nif y % 2 == 0 and y >= 2*x and y <= 4*x:\n print('yes')\nelse:\n print('no')", "x, y = map(int, input().split())\nif y % 2 == 0 and y >= 2*x and y <= 4*x:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s183108258', 's668043697'] | [9108.0, 9104.0] | [27.0, 29.0] | [108, 108] |
p02641 | u000037600 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['x,y=map(int,input().split())\na=list(map(int,input().split()))\nwhile True:\n if x not in a:\n break\n else:\n x-=1\nprint(x)', 'x,y=map(int,input().split())\na=list(map(int,input().split()))\ndif=1\nif x not in a:\n print(x)\nelse:\n while True:\n if x-dif not in a:\n dif*=-1\n break\n elif x+dif not in a:\n break\n else:\n dif+=1\n print(x+dif)'] | ['Wrong Answer', 'Accepted'] | ['s144690728', 's956005642'] | [8936.0, 9192.0] | [30.0, 26.0] | [126, 237] |
p02641 | u000298463 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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())\nY = list(map(int, input().split()))\nx = int(X)\nprint(x)\nfor i in range(100):\n if x - i in Y:\n print(x + i)\n break\n elif x + i in Y:\n print(x - i)\n break\n', 'X, N = map(int, input().split())\nif int(N) == 0:\n print(X)\nelse:\n Y = list(map(int, input().split()))\n x = int(X)\n for i in range(100):\n if x - i in Y:\n print(x + i)\n break\n elif x + i in Y:\n print(x - i)\n break\n', 'X, N = map(int, input().split())\nif int(N) == 0:\n print(X)\nelse:\n Y = list(map(int, input().split()))\n x = int(X)\n for i in range(100):\n if x - i not in Y:\n print(x + i)\n break\n elif x + i not in Y:\n print(x - i)\n break\n', 'X, N = map(int, input().split())\nif int(N) == 0:\n print(X)\nelse:\n Y = list(map(int, input().split()))\n x = int(X)\n for i in range(100):\n if x - i not in Y:\n print(x - i)\n break\n elif x + i not in Y:\n print(x + i)\n break\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s267819977', 's325109693', 's621649736', 's744274335'] | [9072.0, 9036.0, 9176.0, 9124.0] | [33.0, 26.0, 26.0, 30.0] | [220, 282, 290, 290] |
p02641 | u000623733 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['from bisect import bisect_left\n\nX, N = map(int, input().split())\nplist = list(map(int, input().split()))\n\n\nif N == 0:\n print(X)\n\nelse:\n plist.sort()\n not_plist = [x for x in range(plist[0]-1, plist[-1]+2, 1) if x not in plist]\n\n print(not_plist)\n\n idx = bisect_left(not_plist, X)\n\n if idx == 0:\n print(X)\n\n elif idx == len(not_plist):\n print(X)\n\n else:\n left = X - not_plist[idx-1]\n right = not_plist[idx] - X\n if left <= right:\n print(not_plist[idx-1])\n else:\n print(not_plist[idx])\n', 'from bisect import bisect_left\n\nX, N = map(int, input().split())\nplist = list(map(int, input().split()))\n\n\nif N == 0:\n print(X)\n\nelse:\n plist.sort()\n not_plist = [x for x in range(plist[0]-1, plist[-1]+2, 1) if x not in plist]\n idx = bisect_left(not_plist, X)\n\n if idx == 0:\n print(X)\n\n elif idx == len(not_plist):\n print(X)\n\n else:\n left = X - not_plist[idx-1]\n right = not_plist[idx] - X\n if left <= right:\n print(not_plist[idx-1])\n else:\n print(not_plist[idx])\n'] | ['Wrong Answer', 'Accepted'] | ['s305938036', 's856280950'] | [9156.0, 9156.0] | [31.0, 29.0] | [573, 550] |
p02641 | u000875186 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['l=input()\nls=l.split(" ")\nX=int(ls[0])\nN=int(ls[1])\nlstr=input()\nlst=lstr.split(" ")\nfl=[];\nif(fl!=[]):\n for a in lst:\n fl.append(int(a))\nelse:\n print(X)\nfor a in range(len(fl)):\n if(X-a not in fl):\n print(X-a)\n break\n if(X+a not in fl):\n print(X+a)\n break\n', 'l=input()\nls=l.split(" ")\nX=int(ls[0])\nN=int(ls[1])\nlstr=input()\nlst=lstr.split(" ")\nfl=[]\nif(N!=0):\n for a in lst:\n fl.append(int(a))\nfor a in range(101):\n if(X-a not in fl):\n print(X-a)\n break\n if(X+a not in fl):\n print(X+a)\n break'] | ['Wrong Answer', 'Accepted'] | ['s908264614', 's164455700'] | [8816.0, 9072.0] | [29.0, 27.0] | [309, 282] |
p02641 | u002663801 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['s = input().split()\n\nx = int(s[0])\nn = int(s[1])\n\ns = {i for i in range(-100,101)}\n\np1 = input().split()\n\np = set()\n\nfor i in p1:\n p.add(int(i))\n\nt = s - p\n\nanswer = 150\n\nfor i in t:\n if (abs(x - abs(int(i))) < abs(x - abs(answer))) or (abs(x - abs(int(i))) == abs(x - abs(answer))) and i < answer:\n answer = int(i)\n\nprint(answer)', 's = input().split()\n\nx = int(s[0])\nn = int(s[1])\n\ns = {i for i in range(-1,102)}\n\np1 = input().split()\n\np = set()\n\nfor i in p1:\n p.add(int(i))\n\nt = s - p\n\nanswer = 20000\n\nfor i in t:\n if (x - abs(int(i)) < x - abs(answer)) or (x - abs(int(i)) == x - abs(answer)) and i < answer:\n answer = int(i)\n\nprint(answer)', 's = input().split()\n\nx = int(s[0])\nn = int(s[1])\n\ns = {i for i in range(-1,102)}\n\np1 = input().split()\n\np = set()\n\nfor i in p1:\n p.add(int(i))\n\nt = s - p\n\nanswer = 20000\n\nfor i in t:\n if (abs(x - int(i)) < abs(x - answer)) or (abs(x - int(i)) == abs(x - answer)) and i < answer:\n answer = int(i)\n\nprint(answer)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s221149823', 's257456436', 's251227153'] | [9224.0, 9216.0, 9208.0] | [23.0, 23.0, 23.0] | [343, 323, 323] |
p02641 | u003142309 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ["X, N = [int(i) for i in input().split()]\nif N == 0:\n print(X)\nelse:\n Ps = set([int(i) for i in input().split()])\n if not X in Ps:\n print(X)\n\n print(f'{X} {sorted(Ps)}')\n diff = 0\n while True:\n if not X - diff in Ps:\n print(X - diff)\n break\n if not X + diff in Ps:\n print(X + diff)\n break\n diff += 1", 'X, N = [int(i) for i in input().split()]\nif N == 0:\n print(X)\nelse:\n Ps = set([int(i) for i in input().split()])\n\n \n if X not in Ps:\n print(X)\n exit(0)\n\n \n diff = 0\n while True:\n a = X - diff\n if a not in Ps:\n print(a)\n break\n a = X + diff\n if a not in Ps:\n print(a)\n break\n diff += 1'] | ['Wrong Answer', 'Accepted'] | ['s452560629', 's734814090'] | [9200.0, 9088.0] | [22.0, 23.0] | [388, 458] |
p02641 | u003475507 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\nsys.setrecursionlimit(10000000)\n\nx,n = map(int,input().split())\n\np = list(map(int,input().split()))\n\n\nif n == 0:print(x);exit()\n\nl=[0] * 101\n\nfor i in p:\n l[i] =1\n\ndiff=1000\nans=0\nfor i in range(1,101):\n if l[i] == 0 and diff > abs(x-1):\n diff= abs(x-1)\n ans=i\n\nprint(ans)\n', 'import sys\nsys.setrecursionlimit(10000000)\n\nx,n = map(int,input().split())\n\np = list(map(int,input().split()))\n\n\nif n == 0:print(x);exit()\n\nl=[0] * 100\n\nfor i in p:\n l[i-1] =1\n\nprint(l)\n\ndiff=min(101-x,x)\nans=0 if x < 51 else 101\nfor i in range(100):\n if l[i] == 0 and diff > abs(x-(i+1)):\n diff= abs(x-(i+1))\n ans=i+1\n\nprint(ans)\n', 'import sys\nsys.setrecursionlimit(10000000)\n\nx,n = map(int,input().split())\n\np = list(map(int,input().split()))\n\n\nif n == 0:print(x);exit()\n\nl=[0] * 102\n\nfor i in p:\n l[i] =1\n\ndiff=1000\nans=0\nfor i in range(0,102):\n if l[i] == 0 and diff > abs(x-i):\n diff= abs(x-i)\n ans=i\n\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s211139257', 's620411598', 's680483703'] | [9108.0, 9124.0, 9112.0] | [21.0, 23.0, 22.0] | [304, 351, 304] |
p02641 | u005569385 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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())\na = list(map(int,input().split()))\nif x in a:\n s = 0; t = 0\n for i in range(x+1,100):\n if i not in a:\n s = i\n sys.exit()\n for j in reversed(range(x-1,-100)):\n if i not in a:\n t = j\n sys.exit()\n if abs(x-s) < abs(x-t):\n print(s)\n elif abs(x-s) > abs(x-t):\n print(t)\nelse:\n print(x)', 'x,m = map(int,input().split())\na = list(map(int,input().split()))\nfor i in range(x+1):\n for s in [-1,1]:\n b = x+i*s\n if a.count(b) == 0:\n print(b)\n exit()'] | ['Wrong Answer', 'Accepted'] | ['s773709711', 's698508002'] | [9220.0, 9068.0] | [20.0, 27.0] | [412, 193] |
p02641 | u017624958 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['import math\n\nX, N = list(map(int, input().split()))\np = list(map(int, input().split()))\n# print(X, N, p)\n\nif N == 0:\n print(X)\n exit()\n\n# p.sort()\n\n\n\n\n# if X < minimum or maximum < X:\n# print(X)\n# exit()\n\n\n\n\n# answer = min(minimum - 1, maximum + 1)\n# else:\n\n\nfor candidate in range(0, 100 + 2):\n if candidate in p : continue\n\n diff_candidate = abs(X - candidate)\n diff_answer = abs(X - answer)\n\n if diff_candidate == diff_answer:\n answer = min(candidate, answer)\n elif diff_candidate < diff_answer:\n answer = candidate\n\nprint(answer)\n', 'import math\n\nX, N = list(map(int, input().split()))\np = list(map(int, input().split()))\n# print(X, N, p)\n\nif N == 0:\n print(X)\n exit()\n\np.sort()\n\nminimum = p[0]\nmaximum = p[len(p) - 1]\n# print(minimum, maximum)\n\nanswer = 101\nfor candidate in range(minimum + 1, maximum):\n diff = abs(X - candidate)\n answer = candidate if diff < answer else answer\n\nprint(answer)\n', 'import math\n\nX, N = list(map(int, input().split()))\np = list(map(int, input().split()))\n# print(X, N, p)\n\nif N == 0:\n print(X)\n exit()\n\np.sort()\n\nminimum = p[0]\nmaximum = p[len(p) - 1]\n# print(minimum, maximum)\n\nif X < minimum or maximum < X:\n print(0)\n exit()\n\n\nfor candidate in range(minimum, maximum):\n if candidate in p: continue\n\n diff_answer = abs(X - answer)\n diff_candidate = abs(X - candidate)\n # print(candidate, diff, answer)\n answer = candidate if diff_candidate < diff_answer else answer\n\nprint(answer)\n', 'import math\n\nX, N = list(map(int, input().split()))\np = list(map(int, input().split()))\n# print(X, N, p)\n\nif N == 0:\n print(X)\n exit()\n\nif X < minimum or maximum < X:\n print(X)\n exit()\n\nanswer = 1\nfor candidate in range(1, 100 + 1):\n if candidate in p : continue\n\n diff_candidate = abs(X - candidate)\n diff_answer = abs(X - answer)\n\n if diff_candidate == diff_answer:\n answer = min(candidate, answer)\n elif diff_candidate < diff_answer:\n answer = candidate\n\nprint(answer)\n', 'import math\n\nX, N = list(map(int, input().split()))\np = list(map(int, input().split()))\n# print(X, N, p)\n\nif N == 0:\n print(X)\n exit()\n\np.sort()\n\nminimum = p[0]\nmaximum = p[len(p) - 1]\n\nif X < minimum or maximum < X:\n print(X)\n exit()\n\ndiff_min = abs(X - minimum - 1)\ndiff_max = abs(X - maximum + 1)\nif diff_min == diff_max:\n answer = min(minimum - 1, maximum + 1)\nelse:\n answer = minimum - 1 if diff_min < diff_max else maximum + 1\n\nfor candidate in range(0, 100 + 2):\n if candidate in p : continue\n\n diff_candidate = abs(X - candidate)\n diff_answer = abs(X - answer)\n\n if diff_candidate == diff_answer:\n answer = min(candidate, answer)\n elif diff_candidate < diff_answer:\n answer = candidate\n\nprint(answer)\n'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s404945327', 's616216070', 's711709296', 's763881564', 's748365875'] | [9184.0, 9188.0, 9196.0, 9208.0, 9236.0] | [21.0, 22.0, 25.0, 24.0, 22.0] | [780, 374, 601, 513, 756] |
p02641 | u018679195 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 find_smallest_num(lst):\n\tX=lst[0]\n\tfor i in range(len(lst)):\n\t\tif lst[i]<X: X=lst[i]\n\treturn X', '#input x,n and p as intergers. p acts as an array\nx,n=int(input()).split()\np=int([]).split()\nlength=len(p)\n\n#define the closest number\ndef closestnum(p,length):\n return p[min(range(length))]\n#print when x is not it p\nfor x not in p:\n print(round(closestnum(p,length)))\n \n \n', 'import math\n\nif __name__ == "__main__":\n x, n = map(int, input().split())\n a = set(map(int, input().split()))\n p = q = x\n while True:\n if p not in a and q not in a:\n print(min(p, q))\n quit(0)\n if p not in a:\n print(p)\n quit(0)\n elif q not in a:\n print(q)\n quit(0)\n else:\n p -= 1\n q += 1\n\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s230947438', 's912600905', 's105316545'] | [9020.0, 8960.0, 9092.0] | [27.0, 24.0, 29.0] | [98, 285, 416] |
p02641 | u018776180 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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(s) for s in input().split(" ")]\nif n == 0:\n print(x)\nelse:\n plist = [int(s) for s in input().split(" ")]\n\n dlist = {}\n for p in plist:\n d = abs(p - x)\n if d in dlist or d == 0:\n dlist[d] = (True, None)\n else:\n dlist[d] = (False, p - x)\n\n sorted_d = sorted(dlist.items(), key=lambda x:x[0])\n\n ans = 0\n prevk = 0\n flag = False\n for k, v in sorted_d:\n if not flag and prevk == 0 and k >= 1:\n ans = 0\n break\n elif k - prevk > 1:\n ans = -(prevk + 1)\n break\n elif not v[0]:\n ans = v[1]\n break\n flag = True\n prevk = k\n print(x + ans)', 'x, n = [int(s) for s in input().split(" ")]\nif n == 0:\n print(x)\nelse:\n plist = [int(s) for s in input().split(" ")]\n\n dlist = {}\n for p in plist:\n d = abs(p - x)\n if d in dlist or d == 0:\n dlist[d] = (True, None)\n else:\n dlist[d] = (False, p - x)\n\n sorted_d = sorted(dlist.items(), key=lambda x:x[0])\n\n ans = 0\n prevk = 0\n flag = False\n for k, v in sorted_d:\n if not flag and prevk == 0 and k >= 1:\n ans = 0\n break\n elif v[0] and k - prevk > 1:\n ans = -(prevk + 1)\n break\n elif not v[0]:\n ans = min(-v[1], v[1])\n break\n flag = True\n prevk = k\n ans = -(k + 1)\n print(x + ans)', 'x, n = [int(s) for s in input().split(" ")]\nif n == 0:\n print(x)\nelse:\n plist = [int(s) for s in input().split(" ")]\n\n dlist = {}\n for p in plist:\n d = abs(p - x)\n if d in dlist or d == 0:\n dlist[d] = (True, None)\n else:\n dlist[d] = (False, p - x)\n\n sorted_d = sorted(dlist.items(), key=lambda x:x[0])\n\n ans = 0\n prevk = 0\n flag = False\n for k, v in sorted_d:\n if not flag and prevk == 0 and k >= 1:\n ans = 0\n break\n elif k - prevk > 1:\n ans = -(prevk + 1)\n break\n elif not v[0]:\n ans = -v[1]\n break\n flag = True\n prevk = k\n ans = -(k + 1)\n print(x + ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s078912652', 's319093505', 's176856957'] | [9244.0, 9252.0, 9192.0] | [25.0, 26.0, 23.0] | [612, 652, 632] |
p02641 | u018846452 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['x, n = map(int, input().split())\nif n:\n\tp = list(map(int, input().split()))\n\n\tfor i in range(n+1):\n\t\tif x - i in p:\n\t\t\tprint(x-1)\n\t\t\tbreak\n\t\tif x + i in p:\n\t\t\tprint(x+1)\n\t\t\tbreak\nelse:\n\tprint(x)', 'x, n = map(int, input().split())\nif n:\n\tp = list(map(int, input().split()))\n\tfor i in range(n+1):\n\t\tif not x - i in p:\n\t\t\tprint(x-i)\n\t\t\tbreak\n\t\tif not x + i in p:\n\t\t\tprint(x+i)\n\t\t\tbreak\nelse:\n\tprint(x)'] | ['Wrong Answer', 'Accepted'] | ['s375615596', 's603639404'] | [9196.0, 9168.0] | [27.0, 28.0] | [194, 201] |
p02641 | u021114240 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\nimport time\nfrom collections import defaultdict, deque\nfrom sys import stdin, stdout\nfrom bisect import bisect_left, bisect_right\nx,n=map(int,stdin.readline().split())\na=set(map(int,stdin.readline().split()))\nif(x not in a):\n print(x)\nelse:\n diff=1\n while(True):\n if(x-diff not in a):\n print(x-diff)\n break\n elif(x+diff not in a):\n print(diff)\n break\n diff+=1', 'import math\nimport time\nfrom collections import defaultdict, deque\nfrom sys import stdin, stdout\nfrom bisect import bisect_left, bisect_right\nx,n=map(int,stdin.readline().split())\na=set(map(int,stdin.readline().split()))\nif(x not in a):\n print(x)\nelse:\n diff=1\n while(True):\n if(x-diff not in a):\n print(x-diff)\n break\n elif(x+diff not in a):\n print(x+diff)\n break\n diff+=1'] | ['Wrong Answer', 'Accepted'] | ['s072052484', 's995336842'] | [9260.0, 9412.0] | [28.0, 29.0] | [445, 447] |
p02641 | u021763820 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 -*-\nx, n = map(int, input().split())\naa = 0\nif n == 0:\n aa = 1\nif aa == 0:\n p = list(map(int, input().split()))\n p.sort()\n i = 0\n flg = 0\n dis = []\n while flg == 0:\n if i > 100:\n flg = 1\n if i in p:\n dis.append(5000)\n else:\n dis.append(abs(x-i))\n i += 1\n for i in dis:\n if dis[i] == min(dis):\n print(i)\n break\nelse:\n print(x)', '# -*- coding: utf-8 -*-\nx, n = map(int, input().split())\naa = 0\nif n == 0:\n aa = 1\nif aa == 0:\n p = list(map(int, input().split()))\n p.sort()\n i = 0\n flg = 0\n dis = []\n while flg == 0:\n if i > 100:\n flg = 1\n if i in p:\n dis.append(5000)\n else:\n dis.append(abs(x-i))\n i += 1\n for i in range(len(dis)):\n if dis[i] == min(dis):\n print(i)\n break\nelse:\n print(x)'] | ['Runtime Error', 'Accepted'] | ['s785056270', 's629801437'] | [9148.0, 9212.0] | [23.0, 19.0] | [460, 473] |
p02641 | u021849254 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()\na=a.split()\nx=int(a[0])\np=input()\np=p.split()\n\ni=0\np_1=p+[]\n\n\n\nfor y in p_1:\n p_1[i]=abs(int(p_1[i])-x)\n i=i+1\n\np_1.sort()\nif p_1[0]==0:\n del p_1[0]\n\nq=p_1[0]\nif str(x-q) in p:\n print(x-q)\nelse:\n print(x+q)\n\n\n\n\n', 'x,n=map(int, input().split())\na=list(map(int, input().split()))\n\nfor y in range(x+1):\n for b in[-1,1]:\n c=x+y*b\n if a.count(c)==0:\n print(c)\n exit(0)\n'] | ['Runtime Error', 'Accepted'] | ['s799356880', 's110057631'] | [9180.0, 9088.0] | [25.0, 28.0] | [226, 167] |
p02641 | u023229441 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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())\nQ=list(map(int,input().split()))\n\nif n==0:\n print(x);exit()\n \nif x in Q:\n print(x) ; exit()\n\nA=[]\nfor i in range(1,250):\n A.append(-i)\n A.append(i)\n \nfor i in A:\n if not x+i in Q:\n print(x+i)\n exit()\n', 'x,n=map(int,input().split())\nQ=list(map(int,input().split()))\n\nif n==0:\n print(x);exit()\n\nA=[]\nfor i in range(1,107):\n A.append(-i)\n A.append(i)\nfor i in A:\n if not i in Q:\n print(i)\n exit()', 'x,n=map(int,input().split())\nQ=list(map(int,input().split()))\n\nif n==0:\n print(x);exit()\n \nif not x in Q:\n print(x) ; exit()\n\nA=[]\nfor i in range(1,250):\n A.append(-i)\n A.append(i)\n \nfor i in A:\n if not x+i in Q:\n print(x+i)\n exit()\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s300447865', 's833469951', 's568105881'] | [9176.0, 9184.0, 9040.0] | [27.0, 26.0, 32.0] | [242, 200, 246] |
p02641 | u025236579 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 \n X, N = map(int, input().split())\n P = list(map(int, input().split()))\n \n min_abs = list()\n \n if N == 0:\n return X\n # X + i\n i = 1\n while True:\n if X + i in P:\n i += 1\n else:\n min_abs.append(X + i)\n break\n # X - i\n i = -1\n while True:\n if X + i in P:\n i -= 1\n else:\n min_abs.append(X + i)\n break\n \n return min(min_abs)\n\nresult = forbidden_list()\nprint(result)', 'def forbidden_list():\n \n X, N = map(int, input().split())\n P = list(map(int, input().split()))\n \n min_abs_list = list()\n \n if N == 0:\n return X\n # X + i\n i = 0\n while True:\n if X + i in P:\n i += 1\n else:\n min_abs_list.append(X + i)\n break\n # X - i\n i = 0\n while True:\n if X + i in P:\n i -= 1\n else:\n min_abs_list.append(X + i)\n break\n \n if abs(X - min_abs_list[0]) > abs(X - min_abs_list[1]):\n return min_abs_list[1]\n elif abs(X - min_abs_list[0]) == abs(X - min_abs_list[1]):\n return min(min_abs_list)\n elif abs(X - min_abs_list[0]) < abs(X - min_abs_list[1]):\n return min_abs_list[0]\n\nresult = forbidden_list()\nprint(result)'] | ['Wrong Answer', 'Accepted'] | ['s158755131', 's972582048'] | [9080.0, 9208.0] | [27.0, 27.0] | [606, 875] |
p02641 | u027977105 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X, N = map(int, input().split())\ni = list(map(int, input().split()))\nif X not in i:\n print(X)\nelse:\n n = 1\n while n <=N+1:\n if X - n not in i:\n print(X - n)\n break\n else:\n if X+n not in i:\n print(X+n)\n break', 'X, N = map(int, input().split())\ni = list(map(int, input().split()))\nif X not in i:\n print(X)\nelse:\n n = 1\n while n <=N+1:\n if X - n not in i:\n print(X - n)\n break\n else:\n if X+n not in i:\n print(X+n)\n break\n n +=1'] | ['Time Limit Exceeded', 'Accepted'] | ['s396545935', 's551553024'] | [9120.0, 9192.0] | [2206.0, 22.0] | [293, 307] |
p02641 | u033287260 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 = input().split(' ')\np =[int(i) for i in p]\nif X not in p:\n print(X)\n exit()\n\nnum_list = [int(i-99) for i in range(200)]\n[num_list.remove(p[i]) for i in range(N)]\ntmp = [0] * int(len(num_list))\n\n\nfor i in range(len(num_list)):\n tmp[i] = max(num_list[i], X) - min(num_list[i], X)\n\nans = [i for i,x in enumerate(tmp) if x == min(tmp)]\n# print(num_list)\n# print(tmp)\n# print(ans)\nif len(ans) == 2:\n print(min(num_list[ans[0]],num_list[ans[1]]))\nelse:\n print(num_list[ans])\n", "X, N = map(int,input().split(' '))\nif N == 0:\n print(X)\n exit()\n\np = input().split(' ')\np =[int(i) for i in p]\nif X not in p:\n print(X)\n exit()\n\nnum_list = [int(i-99) for i in range(200)]\n[num_list.remove(p[i]) for i in range(N)]\ntmp = [0] * int(len(num_list))\n\n\nfor i in range(len(num_list)):\n tmp[i] = max(num_list[i], X) - min(num_list[i], X)\n\nans = [i for i,x in enumerate(tmp) if x == min(tmp)]\n# print(num_list)\n# print(tmp)\nprint(ans)\nif len(ans) == 2:\n print(min(num_list[ans[0]],num_list[ans[1]]))\nelse:\n print(num_list[ans[0]])\n", "X, N = map(int,input().split(' '))\nif N == 0:\n print(X)\n exit()\n\np = input().split(' ')\np =[int(i) for i in p]\nif X not in p:\n print(X)\n exit()\n\nnum_list = [int(i) for i in range(102)]\n[num_list.remove(p[i]) for i in range(N)]\ntmp = [0] * int(len(num_list))\n\n\nfor i in range(len(num_list)):\n tmp[i] = abs(num_list[i] - X)\n\nans = tmp.index(min[tmp])\n\nprint(num_list[ans])\n", "X, N = map(int,input().split(' '))\nif N == 0:\n print(X)\n exit()\n\np = input().split(' ')\np =[int(i) for i in p]\nif X not in p:\n print(X)\n exit()\n\nnum_list = [int(i) for i in range(102)]\n[num_list.remove(p[i]) for i in range(N)]\ntmp = [0] * int(len(num_list))\n\n\nfor i in range(len(num_list)):\n tmp[i] = abs(num_list[i] - X)\n\nans = tmp.index(min(tmp))\n\nprint(num_list[ans])\n"] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s462028773', 's565999121', 's631133861', 's139309320'] | [9248.0, 9184.0, 9220.0, 9208.0] | [22.0, 21.0, 20.0, 20.0] | [558, 559, 386, 386] |
p02641 | u033642300 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['def main():\n import copy\n\n num, quantity = map(int, input().split())\n nums = list(map(int, input().split()))\n nums.sort()\n \n if quantity == 0:\n print(num)\n return\n \n i = 0\n\n minus_num = copy.copy(num)\n plus_num = copy.copy(num)\n\n while i = 1\n if num not in nums:\n print(num)\n return\n \n if minus_num not in nums:\n print(minus_num)\n return\n \n if plus_num not in nums:\n print(plus_num)\n return\n \n minus_num = minus_num - 1\n plus_num = plus_num + 1\n\n\n\nmain()', 'def main():\n import copy\n\n num, quantity = map(int, input().split())\n nums = list(map(int, input().split()))\n nums.sort()\n \n if quantity == 0:\n print(num)\n return\n \n i = 0\n\n minus_num = copy.copy(num)\n plus_num = copy.copy(num)\n\n while i < len(nums)\n if num not in nums:\n print(num)\n return\n \n if minus_num not in nums:\n print(minus_num)\n return\n \n if plus_num not in nums:\n print(plus_num)\n return\n \n minus_num = minus_num - 1\n plus_num = plus_num + 1\n i = i + 1\n\nmain()', 'def main():\n import copy\n\n num, quantity = map(int, input().split())\n nums = list(map(int, input().split()))\n nums.sort()\n \n if quantity == 0:\n print(num)\n return\n \n i = 0\n\n minus_num = copy.copy(num)\n plus_num = copy.copy(num)\n\n while i < len(nums):\n if num not in nums:\n print(num)\n return\n \n if minus_num not in nums:\n print(minus_num)\n return\n \n if plus_num not in nums:\n print(plus_num)\n return\n \n minus_num = minus_num - 1\n plus_num = plus_num + 1\n\nmain()'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s608139637', 's837867714', 's221692244'] | [9040.0, 8900.0, 9192.0] | [26.0, 23.0, 25.0] | [623, 647, 630] |
p02641 | u035210736 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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(0)\np = list(map(int, input().split()))\na = [i for i in range(1,101)]\nb = list(set(a) - set(p))\nfor i in range(len(b)):\n if x < b[i]:\n if abs(b[i-1]-x) <= abs(b[i]-x):\n print(b[i-1])\n break\n else:\n print(b[i])\n break\nprint(x-b[-1])', 'x, n = map(int, input().split())\nif n == 0:\n print(x)\n exit(0)\np = list(map(int, input().split()))\na = [i for i in range(101)]\nb = sorted(list(set(a) - set(p)))\nprint(b)\nmin_v = 1000\nmin_id = 0\nfor i in range(len(b)):\n if abs(x - b[i]) < min_v:\n min_v = abs(x - b[i])\n min_id = i\nprint(b[min_id])', 'x, n = map(int, input().split())\nif n == 0:\n print(x)\n exit(0)\np = list(map(int, input().split()))\na = [i for i in range(201)]\nb = sorted(list(set(a) - set(p)))\nmin_v = 1000\nmin_id = 0\nfor i in range(len(b)):\n if abs(x - b[i]) < min_v:\n min_v = abs(x - b[i])\n min_id = i\nprint(b[min_id])'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s745240656', 's892792970', 's060784195'] | [9128.0, 9036.0, 9128.0] | [29.0, 27.0, 31.0] | [319, 305, 296] |
p02641 | u039065404 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()))\nS = []\n\nfor i in range(101):\n if i in p:\n continue\n else:\n S.append(abs(i-X))\n\nprint(min(S))', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\nS = []\n\nfor i in range(110):\n if i in p:\n S.append(100)\n else:\n S.append(abs(i-X))\n \nprint(S.index(min(S)))'] | ['Wrong Answer', 'Accepted'] | ['s697078852', 's454925648'] | [9168.0, 9172.0] | [31.0, 29.0] | [169, 184] |
p02641 | u048735692 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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())\npList = list(map(int, input().split()))\n\nnmap = [i for i in range(0, 102)]\n\nfor (i, v) in enumerate(nmap):\n nmap[i] = abs(v-x)\n\nprint(nmap)\n\nfor (i, v) in enumerate(pList):\n nmap[v] = 102\n\nprint(nmap)\n\nans = numpy.argmin(nmap)\nprint(ans)\n', 'import numpy\n\nx, n = map(int, input().split())\npList = list(map(int, input().split()))\n\nnmap = [i for i in range(0, 102)]\n\nfor (i, v) in enumerate(nmap):\n nmap[i] = abs(v-x)\n\nfor (i, v) in enumerate(pList):\n nmap[v] = 102\n\nans = numpy.argmin(nmap)\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s794565382', 's124896001'] | [27076.0, 27000.0] | [115.0, 118.0] | [287, 261] |
p02641 | u050706842 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['ans = None\nfor r in range(100):\n for i in [-r, r]:\n if (X + i) not in p:\n ans = X+i\n break\n\n if ans is not None:\n break\n\n\nprint(ans)', 'X, N = list(map(int, input().split()))\np = list(map(int, input().split()))\n\nans = None\nfor r in range(100):\n for i in [-r, r]:\n if (X + i) not in p:\n ans = X+i\n break\n\n if ans is not None:\n break\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s769790162', 's368770959'] | [9092.0, 9188.0] | [25.0, 19.0] | [174, 249] |
p02641 | u052244548 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ["X,Y=map(int,input().split())\n\n\nfor i in range(0,100+1):\n \n for j in range(0,100+1):\n if i + j > X:\n break\n if (i*2 + j*4) == Y and (i+j) == X:\n print('Yes')\n exit()\n\nprint('No')\n", 'X,N=map(int,input().split())\nif N == 0:\n print(X)\n exit()\n\nP=list(map(int,input().split()))\n\nif X in P:\n for i in range(1,100):\n\n if not X - i in P:\n print(X - i)\n exit()\n if not X + i in P:\n print(X + i)\n exit()\nelse:\n print(X)'] | ['Wrong Answer', 'Accepted'] | ['s724075785', 's970952323'] | [9168.0, 9144.0] | [24.0, 23.0] | [231, 306] |
p02641 | u054662964 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()\nb = int(a[0])\nc = int(a[1])\nd = [int(i) for i in input().split()]\ne = sorted(d)\n\n\nf = int(e[0]-1)\ng = int(e[-1]+1)\n\n\nh = int(g-f)\n\nX = []\nfor I in range(int(h+1)):\n J = int(f+I)\n if e.count(J) == 0:\n X.append(J)\n\nY = len(X)\nH = []\nfor S in range(Y):\n Q = X[S]\n if Q>=b:\n g = Q-b\n H.append(g)\n else:\n g = b-Q\n H.append(g)\nP = sorted(H)\nF = P[0]\nO = H.index(F)\n\n\nprint(X[O])\nprint(X)\nprint(H)\nprint(O)', 'a = input().split()\nb = int(a[0])\nc = int(a[1])\nif c == 0:\n print(b)\n \nelse:\n d = [int(i) for i in input().split()]\n e = sorted(d)\n\n\n f = int(e[0]-1)\n g = int(e[-1]+1)\n\n\n h = int(g-f)\n\n X = []\n for I in range(int(h+1)):\n J = int(f+I)\n if e.count(J) == 0:\n X.append(J)\n\n Y = len(X)\n H = []\n for S in range(Y):\n Q = X[S]\n if Q>=b:\n g = Q-b\n H.append(g)\n elif Q<=b:\n g = b-Q\n H.append(g)\n \n P = sorted(H)\n F = P[0]\n O = H.index(F)\n\n\n print(X[O])'] | ['Runtime Error', 'Accepted'] | ['s094565778', 's911104304'] | [9160.0, 9200.0] | [22.0, 21.0] | [469, 583] |
p02641 | u054798759 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['x,n = input().split()\nx,n = int(x),int(n)\n\na = input().split()\nfor i in range(len(a)):\n a[i] = int(a[i])\n\nif x not in a:\n print(x)\nelse:\n sa = 1\n while True:\n if x-sa not in a:\n print(x-sa)\n break\n if x+sa not in a:\n print(x+sa)\n break', 'x,n = input().split()\nx,n = int(x),int(n)\n\na = input().split()\nfor i in range(len(a)):\n a[i] = int(a[i])\n\nif x not in a:\n print(x)\nelse:\n sa = 1\n while True:\n if x-sa not in a:\n print(x-sa)\n break\n if x+sa not in a:\n print(x+sa)\n break\n sa += 1\n'] | ['Time Limit Exceeded', 'Accepted'] | ['s462682532', 's511257840'] | [9204.0, 9188.0] | [2206.0, 22.0] | [265, 278] |
p02641 | u054825571 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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=[]\nif N>0:\n p=list(map(int,input().split()))\n L=[abs(X-i) for i in P]\n l=min(L)\n if X-l in P:\n print(X-l)\n else:\n print(X+l)\nelse:\n print(X)', 'X,N=map(int,input().split())\nif N>0:\n P=list(map(int,input().split()))\n L=[abs(X-i) for i in P]\n l=min(L)\n if X-l in P:\n print(X-l)\n else:\n print(X+l)\nelse:\n print(X)', 'X,N=map(int,input().split())\nif N>0:\n P=list(map(int,input().split()))\n for i in range(N+1):\n if X-i not in P:\n print(X-i)\n break\n elif X+i not in P:\n print(X+i)\n break\nelse:\n print(X)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s106424812', 's764870843', 's080139997'] | [9096.0, 9120.0, 9116.0] | [26.0, 33.0, 28.0] | [183, 178, 213] |
p02641 | u055044516 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\nX, N = map(int,input().split())\nP = list(map(int,input().split()))\n\nP_set = list(set(P))\n#print(P_set)\n#print(P_set[1])\n\nans_chk = 0\n\nif ( X < P[0] or X > P[N-1] ):\n print(X)\n ans_chk = 1\n\nif ( ans_chk==0 ):\n for i in range(len(P)):\n if ( P_set[i] == X ):\n X_i = i\n break\n elif ( P_set[i] > X ):\n print(X)\n ans_chk = 1\n break\n\nif ( ans_chk==0 ):\n \n if ( X_i >= N-(X_i+1) ):\n M = N-(X_i+1)\n temp_ans = X + N-(X_i+1) +1\n else:\n M = X_i\n temp_ans = X - X_i -1\n \n for i in range(1,M+1):\n if ( P_set[ X_i -i ] != X-i ):\n print(X-i)\n ans_chk = 1\n break\n elif ( P_set[ X_i +i ] != X+i ):\n print(X+i)\n ans_chk = 1\n break\n\nif ( ans_chk==0 ):\n print(temp_ans)', '# -*- coding: utf-8 -*-\n\nX, N = map(int,input().split())\nP = list(map(int,input().split()))\n\nP_set = list(set(P))\n#print(P_set)\n#print(P_set[1])\n\nans_chk = 0\n\nif ( X < P_set[0] or X > P_set[N-1] ):\n print(X)\n ans_chk = 1\n\nif ( ans_chk==0 ):\n for i in range(len(P)):\n if ( P_set[i] == X ):\n X_i = i\n break\n elif ( P_set[i] > X ):\n print(X)\n ans_chk = 1\n break\n\nif ( ans_chk==0 ):\n \n if ( X_i >= N-(X_i+1) ): \n M = N-(X_i+1)\n temp_ans = X + N-(X_i+1) +1\n \n \n for i in range(1,M+1):\n print(i)\n if ( P_set[ X_i -i ] != X-i ):\n print(X-i)\n ans_chk = 1\n break\n elif ( P_set[ X_i +i ] != X+i ):\n print(X+i)\n ans_chk = 1\n break\n \n if ( ans_chk==0 ):\n if ( P_set[ X_i -(M+1) ] != X-(M+1) ):\n print( X-(M+1) )\n ans_chk = 1\n\n\n else: \n M = X_i\n temp_ans = X - X_i -1\n \n \n for i in range(1,M+1):\n print(i)\n if ( P_set[ X_i -i ] != X-i ):\n print(X-i)\n ans_chk = 1\n break\n elif ( P_set[ X_i +i ] != X+i ):\n print(X+i)\n ans_chk = 1\n break\n\nif ( ans_chk==0 ):\n print(temp_ans)', '# -*- coding: utf-8 -*-\n\nX, N = map(int,input().split())\n\nif( N == 0 ):\n #print("N=0")\n print(X)\n\nelse:\n P = list(map(int,input().split()))\n P_set = list(set(P))\n \n \n ans_chk = 0\n \n if ( X < P_set[0] or X > P_set[N-1] ):\n #print("X < P_set[0] or X > P_set[N-1]")\n print(X)\n ans_chk = 1\n \n if ( ans_chk==0 ):\n for i in range(N):\n if ( P_set[i] == X ):\n X_i = i\n break\n elif ( P_set[i] > X ):\n #print("P_set[i] > X")\n print(X)\n ans_chk = 1\n break\n \n if ( ans_chk==0 ):\n \n if ( X_i > N-(X_i+1) ): \n M = N-(X_i+1)\n temp_ans = X + N-(X_i+1) +1\n \n \n for i in range(1,M+1):\n if ( P_set[ X_i -i ] != X-i ):\n print(X-i)\n ans_chk = 1\n break\n elif ( P_set[ X_i +i ] != X+i ):\n print(X+i)\n ans_chk = 1\n break\n \n if ( ans_chk==0 ):\n if ( P_set[ X_i -(M+1) ] != X-(M+1) ):\n print( X-(M+1) )\n ans_chk = 1\n \n \n else: \n M = X_i\n temp_ans = X - X_i -1\n \n \n for i in range(1,M+1):\n if ( P_set[ X_i -i ] != X-i ):\n print(X-i)\n ans_chk = 1\n break\n elif ( P_set[ X_i +i ] != X+i ):\n print(X+i)\n ans_chk = 1\n break\n \n if ( ans_chk==0 ):\n print(temp_ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s544736265', 's740125044', 's491679051'] | [9272.0, 9268.0, 9324.0] | [24.0, 22.0, 22.0] | [762, 1312, 1498] |
p02641 | u055981695 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\na = list(map(int,input().split()))\n\nx = a[0]\nn = a[1]\nd = list(map(int,input().split()))\n\nif (n == 0):\n print(x)\nelse:\n min_int = d[np.argmin(d)]\n max_int = d[np.argmax(d)]SSS\n if (x < min_int or max_int < x):\n print(x)\n else:\n p = []\n for var in range(min_int,max_int):\n if var not in d:\n p.append(var)\n else:\n continue\n ans = []\n for pp in p:\n ans.append(np.abs(pp - x))\n ans = np.array(ans)\n print(p[np.argmin(ans)])\n', 'import numpy as np\na = list(map(int,input().split()))\n\nx = a[0]\nn = a[1]\n\nif (n == 0):\n print(x)\nelse:\n d = list(map(int,input().split()))\n min_int = d[np.argmin(d)]\n max_int = d[np.argmax(d)]\n if (x < min_int or max_int < x):\n print(x)\n else:\n p = []\n for var in range(min_int - 10,max_int + 10):\n if var not in d:\n p.append(var)\n else:\n continue\n ans = []\n for pp in p:\n ans.append(np.abs(pp - x))\n ans = np.array(ans)\n print(p[np.argmin(ans)])\n'] | ['Runtime Error', 'Accepted'] | ['s754856960', 's270311856'] | [9044.0, 27092.0] | [24.0, 111.0] | [566, 577] |
p02641 | u057942294 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 = set(list(map(int, input().split())))\n\nfor diff in range(1000):\n if X - diff not in P:\n print(X - diff)\n elif X + diff not in P:\n print(X + diff)\n', 'X, N = map(int, input().split())\nP = set(map(int, input().split()))\n\nfor diff in range(1000):\n if X - diff not in P:\n print(X - diff)\n break\n elif X + diff not in P:\n print(X + diff)\n break\n '] | ['Wrong Answer', 'Accepted'] | ['s465428523', 's092350965'] | [9224.0, 9172.0] | [24.0, 20.0] | [190, 208] |
p02641 | u058496530 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['import sys\ndef my_index(l, x, default=False):\n if x in l:\n return l.index(x)\n else:\n return default\nlist_n = [0, -1, 1]\nfor i in range(2, 50):\n list_n.append(-i)\n list_n.append(i)\nX, N = map(int, input().split())\nif N == 0:\n print(X)\n sys.exit()\np = list(map(int, input().split()))\nx = [0] * N\nfor i in range(0, N):\n x[i] = p[i] - X\nfor i in list_n:\n if my_index(x, i) == False:\n print(X+i)\n break', 'import sys\ndef my_index(l, x, default=-1):\n if x in l:\n return l.index(x)\n else:\n return default\nlist_n = [0, -1, 1]\nfor i in range(2, 101):\n list_n.append(-i)\n list_n.append(i)\nX, N = map(int, input().split())\nif N == 0:\n print(X)\n sys.exit()\np = list(map(int, input().split()))\nx = [0] * N\nfor i in range(0, N):\n x[i] = p[i] - X\nfor i in list_n:\n if my_index(x, i) == -1:\n print(X+i)\n break'] | ['Wrong Answer', 'Accepted'] | ['s115735566', 's753362841'] | [9128.0, 9224.0] | [23.0, 23.0] | [445, 440] |
p02641 | u059973060 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 = input().split()\ny = input().split()\n\nif len(y) == 0:\n print(x[0])\n sys.exit()\na=[]\nb=[]\nfor n in range(-1,102):\n b.append(n)\n \nfor nn in range(len(y)):\n \n b.remove(int(y[nn]))\nfor m in range(len(b)): \n d = b[m] - int(x[0])\n if d < 0:\n c = d*(-1)\n if d >= 0:\n c = d\n a.append(c)\nmm = min(a)\nif (int(x[0]) - mm) in y:\n print(int(x[0]) + mm)\nelse:\n print(int(x[0]) - mm)', 'import sys\nx = input().split()\ny = input().split()\n\nif len(y) == 0:\n print(x[0])\n sys.exit()\na=[]\nb=[]\nfor n in range(-1,102):\n b.append(n)\n \nfor nn in range(len(y)):\n \n b.remove(int(y[nn]))\nfor m in range(len(b)): \n d = b[m] - int(x[0])\n if d < 0:\n c = d*(-1)\n if d >= 0:\n c = d\n a.append(c)\nmm = min(a)\nif str((int(x[0]) - mm)) in y:\n print(int(x[0]) + mm)\nelse:\n print(int(x[0]) - mm)'] | ['Wrong Answer', 'Accepted'] | ['s888518339', 's242485857'] | [9236.0, 9236.0] | [23.0, 23.0] | [432, 437] |
p02641 | u062754605 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()))\n A = [0] * N\n for i in range(N):\n A[i] = abs(l[i] - X)\n S = A.count(0)\n if S == 0:\n print(X)\n else:\n for i in range(1, N):\n S = A.count(N)\n if S == 1:\n if l.count(X - 1) == 0:\n print(X - 1)\n break\n else:\n print(X + 1)\n break\n else:\n pass\nelse:\n print(X)\n', 'X, N = map(int, input().split())\nif N > 0:\n l = list(map(int, input().split()))\n A = [0] * N\n\n for i in range(N):\n A[i] = abs(l[i] - X)\n\n S = A.count(0)\n if S == 0:\n print(X)\n ok = 1\n\n if ok != 1:\n for i in range(1, 101):\n S = A.count(i)\n if S == 0:\n print(X - 1)\n break\n if S == 1:\n if l.count(X - i) == 0:\n print(X - i)\n break\n else:\n print(X + i)\n break\n else:\n pass\n\nelse:\n print(X)\n', 'X, N = map(int, input().split())\nif N > 0:\n l = list(map(int, input().split()))\n A = [0] * N\n for i in range(N):\n A[i] = abs(l[i] - X)\n S = A.count(0)\n if S == 0:\n print(X)\n else:\n for i in range(1, N):\n S = A.count(N)\n if S == 1:\n if l.count(X + 1) == 1 or l.count(X - 1) == 0:\n print(X - 1)\n break\n else:\n print(X + 1)\n break\n else:\n pass\nelse:\n print(X)\n', 'X, N = map(int, input().split())\nif N > 0:\n l = list(map(int, input().split()))\n A = [0] * N\n\n for i in range(N):\n A[i] = abs(l[i] - X)\n\n S = A.count(0)\n if S == 0:\n print(X)\n\n for i in range(1, N + 1):\n S = A.count(i)\n if S == 0:\n print(X-1)\n if S == 1:\n if l.count(X - i) == 0:\n print(X - i)\n break\n else:\n print(X + i)\n break\n else:\n pass\n\nelse:\n print(X)\nprint(A)\n', 'X, N = map(int, input().split())\nif N > 0:\n l = list(map(int, input().split()))\n A = [0] * N\n ok == 0\n\n for i in range(N):\n A[i] = abs(l[i] - X)\n\n S = A.count(0)\n if S == 0:\n print(X)\n ok = 1\n\n if ok == 0:\n for i in range(1, 101):\n S = A.count(i)\n if S == 0:\n print(X - 1)\n break\n if S == 1:\n if l.count(X - i) == 0:\n print(X - i)\n break\n else:\n print(X + i)\n break\n else:\n pass\n\nelse:\n print(X)\n', 'X, N, *d = map(int, open(0).read().split())\nif N == 0:\n print(X)\nelse:\n ans = -100\n for i in range(102):\n if i not in d and abs(i - X) < abs(ans - X):\n ans = i\n\n print(ans)\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s279491049', 's381442571', 's550700756', 's639091664', 's651430033', 's099199965'] | [9180.0, 9216.0, 9204.0, 9212.0, 9216.0, 9124.0] | [32.0, 23.0, 32.0, 22.0, 23.0, 23.0] | [590, 631, 613, 535, 643, 203] |
p02641 | u066551652 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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(101):\n a = int(x - i)\n b = int(x + i)\n if a not in p:\n print(a)\n exit()\n elif b not in p:\n print(b)\n exit()', 'x, n = map(int,input().split())\np = list(map(int, input().split()))\n\nfor i in range(101):\n a = int(x - i)\n b = int(x + i)\n if a not in p:\n print(a)\n exit()\n elif b not in p:\n print(b)\n exit()'] | ['Wrong Answer', 'Accepted'] | ['s073930829', 's645898350'] | [9184.0, 9188.0] | [23.0, 21.0] | [226, 231] |
p02641 | u070630744 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 iput(): return int(input())\ndef mput(): return map(int, input().split())\ndef lput(): return list(map(int, input().split()))\n\ndef solve():\n x, n = mput()\n p = lput()\n ans = []\n for i in range(x, x-n-1, -1):\n boo = i in p\n if boo != True:\n ans.append(i)\n break\n for i in range(x, x+n+1):\n boo = i in p\n if boo != True:\n ans.append(i)\n break\n print(min(abs(x-ans[0]),abs(x-ans[1])))\n return 0\n\nif __name__ == "__main__":\n solve()', 'def iput(): return int(input())\ndef mput(): return map(int, input().split())\ndef lput(): return list(map(int, input().split()))\n\ndef solve():\n x, n = mput()\n p = lput()\n ans = []\n for i in range(x, x-n-1, -1):\n boo = i in p\n if boo != True:\n ans.append(i)\n break\n for i in range(x, x+n+1):\n boo = i in p\n if boo != True:\n ans.append(i)\n break\n print(min(ans))\n return 0\n\nif __name__ == "__main__":\n solve()', 'def iput(): return int(input())\ndef mput(): return map(int, input().split())\ndef lput(): return list(map(int, input().split()))\n\ndef solve():\n x, n = mput()\n p = lput()\n ans = []\n for i in range(x, x-n-1, -1):\n boo = i in p\n if boo != True:\n ans.append(i)\n break\n for i in range(x, x+n+1):\n boo = i in p\n if boo != True:\n ans.append(i)\n break\n print(min(abs(x-ans[0]),abs(x-ans[1])))\n return 0\n\nif __name__ == "__main__":\n solve()', '\ndef iput(): return int(input())\ndef mput(): return map(int, input().split())\ndef lput(): return list(map(int, input().split()))\n\ndef solve():\n x, n = mput()\n p = lput()\n ans = []\n for i in range(x, x-n-1, -1):\n boo = i in p\n if boo != True:\n ans.append(i)\n break\n for i in range(x, x+n+1):\n boo = i in p\n if boo != True:\n ans.append(i)\n break\n if abs(x-ans[0]) <= abs(x-ans[1]):\n print(ans[0])\n else:\n print(ans[1])\n return 0\n\nif __name__ == "__main__":\n solve()'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s250410251', 's478540874', 's635319943', 's240212198'] | [9220.0, 9084.0, 9220.0, 9180.0] | [20.0, 25.0, 22.0, 22.0] | [526, 502, 526, 576] |
p02641 | u080419397 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['for i in range(100):\n plus_abs=X+i\n minus_abs=X-i\n\n for j in range(N):\n if plus_abs == int(list2[j]):\n plus_abs=1000\n\n\n for k in range(N):\n if minus_abs == int(list2[k]):\n minus_abs=1000\n\n if plus_abs !=1000 or minus_abs!=1000:\n if plus_abs >= minus_abs:\n result = minus_abs\n else:\n result = plus_abs\n\n print(result)\n break', 'list1= input().split(" ")\nlist2= input().split(" ")\nX=int(list1[0])\nN=int(list1[1])\nplus_abs =1000\nminus_abs=1000\nresult=0\n\nfor i in range(100):\n plus_abs=X+i\n minus_abs=X-i\n\n for j in range(N):\n if plus_abs == int(list2[j]):\n plus_abs=1000\n\n\n for k in range(N):\n if minus_abs == int(list2[k]):\n minus_abs=1000\n\n if plus_abs !=1000 or minus_abs!=1000:\n if plus_abs >= minus_abs:\n result = minus_abs\n else:\n result = plus_abs\n\n print(result)\n break\n'] | ['Runtime Error', 'Accepted'] | ['s369319840', 's638292803'] | [9056.0, 9212.0] | [24.0, 24.0] | [423, 548] |
p02641 | u085530099 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['z = list(map(int, input().split()))\nx = z[0]\nif z[1] == 0:\n print(z[0])\nelse:\n p = list(map(int, input().split()))\n count = 0\n l = []\n for i in range(1, 101):\n l.append(i)\n for i in p:\n l.remove(i)\n print(l)\n t = 200\n for i in l:\n e = abs(x-i)\n if e >= t:\n break\n t = e\n ans = i\n print(ans)', 'z = list(map(int, input().split()))\nx = z[0]\nif z[1] == 0:\n print(x)\nelse:\n p = list(map(int, input().split()))\n l = []\n for i in range(-1, 102):\n l.append(i)\n for i in p:\n l.remove(i)\n t = 200\n for i in l:\n e = abs(x-i)\n if e >= t:\n break\n t = e\n ans = i\n print(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s253992542', 's255550059'] | [9232.0, 9196.0] | [24.0, 23.0] | [323, 299] |
p02641 | u088553842 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\nif n == 0:\n print(x)\n sys.exit()\nx, n = map(int, input().split())\nlst = list(map(int, input().split()))\nfor i in range(250):\n if x - i not in lst:\n print(x + i)\n sys.exit()\n if x + i not in lst:\n print(x + i)\n sys.exit()', 'import sys\nx, n = map(int, input().split())\nlst = list(map(int, input().split()))\nfor i in range(250):\n if x - i not in lst:\n print(x + i)\n sys.exit()\n if x + i not in lst:\n print(x + i)\n sys.exit()', 'import sys\nx, n = map(int, input().split())\nif n == 0:\n print(x)\n sys.exit()\nlst = list(map(int, input().split()))\nfor i in range(250):\n if x - i not in lst:\n print(x - i)\n sys.exit()\n if x + i not in lst:\n print(x + i)\n sys.exit()'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s563930167', 's857775615', 's011068017'] | [9056.0, 9020.0, 9124.0] | [30.0, 28.0, 31.0] | [247, 218, 247] |
p02641 | u089230684 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['#the program is to find the nearest number which is not included in N, and if more than 1 number, it will take the smallest one\n\n#we will declare the x and n integer\nx, n = map(int, input().split())\n\n#declare the pi\np = list(map(int, input().split()))\n\n\nfor a in range(x + 1):\nfor b in [-1, +1]:\nresult = X + b * a\nif p.count(result) == 0:\nprint(result)\n', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\ncheck = 1000000\nans = 0\n\nN = list(range(102))\n\nfor i in range(1, 101):\n if i in p:\n N.remove(i)\n\nfor i in range(len(N)):\n if check > abs(N[i]-x):\n check = abs(N[i]-x)\n ans = N[i]\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s923172037', 's329729071'] | [8988.0, 9100.0] | [25.0, 26.0] | [354, 287] |
p02641 | u091307273 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['def main():\n x, n = (int(i) for i in input().split())\n if n > 0:\n p = [int(i) for i in input().split()]\n else:\n p = []\n\n mask = [0] * 101 \n for pe in p:\n mask[pe] = 1\n\n b, e = x, x\n\n while True:\n if b >= 1 and mask[b] == 0:\n break\n b -= 1\n if e <= 100 and mask[e] == 0:\n break\n e += 1\n\n if mask[b] == 0:\n print(b)\n else:\n print(e)\n\nmain()', 'def main():\n # x in [1, 100]\n # n in [0, 100]\n \n x, n = (int(i) for i in input().split())\n if n > 0:\n p = set(int(i) for i in input().split())\n else:\n p = set() \n\n b, e = x, x\n while b not in p and e not in p:\n b -= 1\n e += 1\n\n if b in p:\n print(b)\n else:\n print(e)\n\n\nmain()\n', 'def main():\n # x in [1, 100]\n # n in [0, 100]\n \n x, n = (int(i) for i in input().split())\n if n > 0:\n p = set(int(i) for i in input().split())\n else:\n p = set() \n\n b, e = x, x\n while b in p and e in p:\n b -= 1\n e += 1\n\n if b not in p:\n print(b)\n else:\n print(e)\n\n\nmain()\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s594469939', 's811237391', 's892205703'] | [9188.0, 9044.0, 9164.0] | [2205.0, 2205.0, 32.0] | [450, 365, 361] |
p02641 | u092650292 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 math import gcd\n\nfrom math import factorial as f\n\nfrom math import ceil,floor,sqrt\nimport math\n\nimport bisect\nimport re\nimport heapq\n\n\nfrom copy import deepcopy\nimport itertools\nfrom itertools import permutations\n\nfrom sys import exit\n\nii = lambda : int(input())\nmi = lambda : map(int,input().split())\nli = lambda : list(map(int,input().split()))\n\n\nyes = "Yes"\nno = "No"\n\n\ndef main():\n \n\n\nmain()\n\n\n', 'from math import gcd\n\nfrom math import factorial as f\n\nfrom math import ceil,floor,sqrt\nimport math\n\nimport bisect\nimport re\nimport heapq\n\n\nfrom copy import deepcopy\nimport itertools\nfrom itertools import permutations\n\nfrom sys import exit\n\nii = lambda : int(input())\nmi = lambda : map(int,input().split())\nli = lambda : list(map(int,input().split()))\n\n\nyes = "Yes"\nno = "No"\n\n\ndef main():\n x,n = mi()\n p = li()\n\n for 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()\n\n\n\nmain()\n\n\n'] | ['Runtime Error', 'Accepted'] | ['s702242909', 's364209268'] | [8964.0, 9976.0] | [26.0, 40.0] | [406, 592] |
p02641 | u094999522 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()\nq = input().split()\np = sorted(abs(int(i)-x) for i in q)\nfor i in range(n):\n if i != p[i]:\n if x - i not in q:\n print(x - i)\n else:\n print(x + i)\n exit()', 'x,n,*p = map(int,open(0).read().split())\nfor i in range(101):\n if x - i not in p:\n print(x - i)\n exit()\n elif x + i not in p:\n print(x + i)\n exit()'] | ['Wrong Answer', 'Accepted'] | ['s576896157', 's851074750'] | [9184.0, 9172.0] | [21.0, 24.0] | [260, 181] |
p02641 | u097065307 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()))\na = 0\nab = 0\nfor i in range(100):\n if x - i not in l:\n ans = x - i\n a = i + 1\n print(ans)\n break\nfor i in range(100):\n if x + i not in l:\n ansb = x + i\n ab = i + 1\n print(ansb)\n break\nif a > ab:\n print(ansb)\nelse:\n print(ans)\n', 'x, n = map(int,input().split())\nl = list(map(int,input().split()))\na = 0\nab = 0\nfor i in range(100):\n if x - i not in l:\n ans = x - i\n a = i + 1\n break\nfor i in range(100):\n if x + i not in l:\n ansb = x + i\n ab = i + 1\n break\nif a > ab:\n print(ansb)\nelse:\n print(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s775956499', 's132707057'] | [9140.0, 9000.0] | [29.0, 29.0] | [361, 322] |
p02641 | u098436028 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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==100):\n print(X)\n\nelse:\n p = list(map(int,input().split() ))\n\n p.sort()\n q=list(range(1,max(p)+1))\n\n for i in p:\n q.remove(i)\n\n Z=1000\n ans=-1\n for i in q:\n if( abs(X-i)<Z):\n Z=abs(X-i)\n ans=i\n \n print(ans)', 'X,N=map(int,input().split() )\nif( (N==0)):\n print(X)\n\nelse:\n p = list(map(int,input().split() ))\n\n p.sort()\n q=list(range(-5,102))\n\n for i in p:\n q.remove(i)\n\n Z=1000\n for i in q:\n if( abs(X-i)<Z):\n Z=abs(X-i)\n ans=i\n \n print(ans)'] | ['Runtime Error', 'Accepted'] | ['s951159178', 's262696831'] | [9020.0, 9136.0] | [23.0, 20.0] | [275, 255] |
p02641 | u099150084 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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)\nelse:\n l = list(map(int, input().split()))\n l.sort()\n small = x\n large = x\n while small in l and large in l:\n small -= 1\n large += 1\n if x - small > large - x:\n print(large)\n else:\n print(small)\n', 'x, n = map(int, input().split())\n\nif n == 0:\n input()\n print(x)\nelse:\n l = list(map(int, input().split()))\n l.sort()\n small = x\n large = x\n while small in l and large in l:\n small -= 1\n large += 1\n if x - small > large - x:\n print(large)\n else:\n print(small)\n', 'x, n = map(int, input().split())\n\nif n == 0:\n # input()\n print(x)\nelse:\n l = list(map(int, input().split()))\n l.sort()\n small = x\n large = x\n while small in l and large in l:\n small -= 1\n large += 1\n if x - small > large - x:\n print(large)\n else:\n print(small)\n', 'x, n = map(int, input().split())\n\nif n == 0:\n # input()\n print(x)\nelse:\n l = list(map(int, input().split()))\n l.sort()\n small = x\n large = x\n while small in l and large in l:\n small -= 1\n large += 1\n if small in l:\n print(large)\n elif large in l:\n print(small)\n elif x - small > large - x:\n print(large)\n else:\n print(small)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s420895154', 's473061084', 's862954121', 's384480758'] | [9176.0, 9184.0, 9188.0, 9192.0] | [24.0, 23.0, 23.0, 21.0] | [302, 314, 316, 400] |
p02641 | u103520789 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X, N = map(int, input().split())\nP = list(map(int, input().split()))\nif N == 0:\n print(100)\n\nelse:\n min_abs = 100\n min_abs = min([abs(X-i) for i in range(100) if not i in P])\n min_abs\n\n\n ans_candi = [i+X for i in range(-min_abs, min_abs+1) if not i in P]\n ans = min(ans_candi)\n print(ans)', 'X, N = map(int, input().split())\nP = list(map(int, input().split()))\n\ndelta, notP = [], []\nfor i in range(0, 102):\n if not i in P:\n delta.append(abs(X-i))\n notP.append(i)\n\ni = delta.index(min(delta))\nprint(notP[i])'] | ['Wrong Answer', 'Accepted'] | ['s625578915', 's941348232'] | [9204.0, 9144.0] | [21.0, 22.0] | [309, 231] |
p02641 | u107494228 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['k,n=map(int,input().split())\nif(n==0):\n print(k)\nelse:\n l=sorted(list(map(int,input().split())))\n a=[]\n a.append(k)\n for i in range(1,n):\n a.append(k-i)\n a.append(k+i)\n if(n%2==0):\n a.pop(-1)\n for i in range(n):\n if(l[i] in a):\n continue\n else:\n if(i!=n-1):\n print(min(a[i],a[i+1]))\n break\n else:\n print(a[i])\n break', 'k,n=map(int,input().split())\nif(n==0):\n print(k)\nelse:\n l=list(map(int,input().split()))\n c=0\n d=0\n while(d==0):\n if(k-c not in l):\n print(k-c)\n break\n if(k+c not in l):\n print(k+c)\n break\n c=c+1\n '] | ['Wrong Answer', 'Accepted'] | ['s299247773', 's675983236'] | [9084.0, 9140.0] | [26.0, 28.0] | [411, 274] |
p02641 | u107799502 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 = set([int(i) for i in input().split()])\nset_all = set(np.arange(-100, 101))\nex_list = set_all-p_list\nex_list = list(ex_list)\ndiff_list = [np.abs(i-X) for i in ex_list]\nmin_index = np.argmin(diff_list)\nprint(ex_list[min_index])', 'X, N = map(int, input().split())\np_list = set([int(i) for i in input().split()])\nset_all = set(np.arange(0, 101))\nex_list = set_all-p_list\nex_list = list(ex_list)\ndiff_list = [np.abs(i-X) for i in ex_list]\nmin_index = np.argmin(diff_list)\nprint(ex_list[min_index])', 'import numpy as np\nX, N = map(int, input().split())\np_list = set([int(i) for i in input().split()])\nset_all = set(np.arange(-201, 201))\nex_list = set_all-p_list\nex_list = list(ex_list)\ndiff_list = [np.abs(i-X) for i in ex_list]\nmin_index = np.argmin(diff_list)\nprint(ex_list[min_index])'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s140495740', 's422562499', 's022844882'] | [9132.0, 9220.0, 27188.0] | [25.0, 24.0, 104.0] | [267, 264, 286] |
p02641 | u110650988 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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())\nlis = list(map(int,input().split()))\nlis.sort()\np = 0\ncounter = n\nfor i in range(n):\n if i>0 and lis[i] == lis[i-1]:\n counter -=1\n elif i>0 and lis[i]<lis[0]*2:\n p += 1\n else:\n for j in range(n):\n if i != j and lis[i]%lis[j] ==0:\n counter -=1\n break\nprint(counter)\n', 'x, n = map(int,input().split())\nlis = list(map(int,input().split()))\nlis.sort()\nif n == 0:\n print(x)\nelse:\n for i in range(lis[n-1]+2):\n \n if i < x and i not in lis:\n a = i\n if i >= x and i not in lis:\n b = i\n if abs(a-x) <= abs(b-x):\n print(a)\n else:\n print(b)\n break\n\n'] | ['Runtime Error', 'Accepted'] | ['s848605133', 's789498355'] | [9132.0, 9192.0] | [29.0, 21.0] | [353, 382] |
p02641 | u113569368 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 = list(map(int, input().split()))\n\nif XN[1] == 0:\n print(XN[0])\nelse:\n p = list(map(int, input().split()))\n for d in range(1, XN[1] + 1):\n if not XN[0] + d in p:\n print(XN[0] + d)\n', 'XN = list(map(int, input().split()))\n \nif XN[1] == 0:\n print(XN[0])\nelse:\n p = list(map(int, input().split()))\n for d in range(XN[1] + 1):\n if not XN[0] - d in p:\n print(XN[0] - d)\n if not XN[0] + d in p:\n print(XN[0] + d)', 'XN = list(map(int, input().split()))\n \nif XN[1] == 0:\n print(XN[0])\nelse:\n p = list(map(int, input().split()))\n for d in range(XN[1] + 1):\n if not XN[0] - d in p:\n print(XN[0] - d)\n elif not XN[0] + d in p:\n print(XN[0] + d)', 'XN = list(map(int, input().split()))\n \nif XN[1] == 0:\n print(XN[0])\nelse:\n p = list(map(int, input().split()))\n for d in range(1, XN[1] + 1):\n if not XN[0] - d in p:\n print(XN[0] - d)\n if not XN[0] + d in p:\n print(XN[0] + d)', 'XN = list(map(int, input().split()))\n \nif XN[1] == 0:\n print(XN[0])\nelse:\n p = list(map(int, input().split()))\n for d in range(XN[1] + 1):\n if not XN[0] - d in p:\n print(XN[0] - d)\n break\n if not XN[0] + d in p:\n print(XN[0] + d)\n break'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s193836784', 's257557492', 's752334193', 's782493940', 's187947948'] | [9116.0, 9192.0, 9200.0, 9088.0, 9132.0] | [24.0, 22.0, 23.0, 26.0, 21.0] | [194, 241, 243, 244, 265] |
p02641 | u115110170 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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())\nls = list(map(int,input().split()))\n\nls = sorted(ls)\nd = 10**3\nans = 0\nfor p in ls:\n if abs(x-p)<d:\n d = abs(x-p)\n ans = p\nprint(ans)', 'x,n = map(int,input().split())\nif n==0:\n print(x)\n exit()\nls = list(map(int,input().split()))\n\nls = sorted(ls)\nd = 10**3\nans = 0\nfor i in range(ls[0]-1,ls[-1]+2):\n if i in ls:\n continue\n if d>abs(i-x):\n d = abs(i-x)\n ans = i\nprint(ans)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s190959577', 's303414406'] | [9208.0, 9192.0] | [20.0, 24.0] | [171, 250] |
p02641 | u115877451 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\na,b=map(int,input().split())\nc=list(map(int,input().split()))\n\nif a not in c:\n print(a)\n exit()\n\nn=[i for i in range(-1,101)]\n\nm=sorted(list(set(n)^set(c)))\nbisect.insort_right(m,a)\n\nm=sorted(list(set(m)))\nif len(m)=<3:\n print(m[m.index(a)-1])\n\nelif b==0:\n print(a)\n\nelif a==100:\n print(m[m.index(a)+1])\n\nelif abs(a-m[m.index(a)-1])<abs(a-m[m.index(a)+1]):\n print(m[m.index(a)-1])\n\nelif abs(a-m[m.index(a)-1])==abs(a-m[m.index(a)+1]):\n print(m[m.index(a)-1])\n\nelse:\n print(m[m.index(a)+1])', 'a,b=map(int,input().split())\nc=list(map(int,input().split()))\nans=0\nfor i in range(100):\n if a-i not in c:\n ans=a-i\n break\n elif a+i not in c:\n ans=a+i\n break\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s358107703', 's209879915'] | [9056.0, 9208.0] | [21.0, 21.0] | [527, 203] |
p02641 | u116038906 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 sys\ninput = sys.stdin.readline\nX,N = (int(i) for i in input().split())\nif N !=0:\n p = list(map(int, input().split()))\nelif N ==0:\n p=[-1]\np.sort()\np_100 =[i for i in range(1,101)]\np =p_100\n#\nans =[]\nfor i in range(-1,101):\n if i not in p:\n ans.append((abs(i-X),i))\nans.sort()\nif len(ans) >=2:\n print(ans[0][1])', '\nimport sys\ninput = sys.stdin.readline\nX,N = (int(i) for i in input().split())\nif N !=0:\n p = list(map(int, input().split()))\nelif N ==0:\n p=[-1]\np.sort()\np_100 =[i for i in range(1,101)]\n\n#\nans =[]\nfor i in range(1,101):\n if i not in p:\n ans.append((abs(i-X),i))\nans.sort()\nif len(ans) >=2:\n print(min(ans[0][1],ans[1][1]))\nelif len(ans) ==0:\n print(0)\nelse:\n print(ans[0][1])', '\nimport sys\ninput = sys.stdin.readline\nX,N = (int(i) for i in input().split())\nif N !=0:\n p = list(map(int, input().split()))\nelif N ==0:\n p=[-1]\np.sort()\n#\nans =[]\nfor i in range(-1,102):\n if i not in p:\n ans.append((abs(i-X),i))\nans.sort()\nprint(ans[0][1])'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s241172401', 's397383971', 's099868026'] | [9156.0, 9128.0, 9204.0] | [23.0, 21.0, 22.0] | [351, 416, 288] |
p02641 | u117078923 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X,N = map(int,input().split())\nP = list(map(int,input().split()))\n\n\nall_l = [i for i in range(0,101)]\n\n\nfor p in P:\n all_l.remove(p)\n \n\nkouho = x\nfor i in range(200):\n kouho1 = x-i\n kouho2 = x+i\n if kouho1 not in P:\n print(x-i)\n break\n elif kouho2 not in P:', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n \nans = 0\nfor i in range(1, 102):\n if abs(X - i) < abs(X - ans) and i not in p:\n ans = i\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s479098081', 's959659936'] | [9056.0, 9140.0] | [21.0, 19.0] | [338, 178] |
p02641 | u119982001 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\nlis = [1] * 100\nprint(lis)\nfor p in P: lis[p-1] -= 1\nprint(lis)\n\nfor i in range(50):\n up = X+i\n down = X-i\n if lis[down-1] == 1:\n print(down)\n exit()\n elif lis[up-1] == 1:\n print(up)\n exit()\n', 'X, N = map(int, input().split())\nP = list(map(int, input().split()))\n\nlis = [1] * (201)\nfor p in P: lis[p+99] -= 1\n\nfor i in range(100+1):\n up = X+i\n down = X-i\n if lis[100+down-1] == 1:\n print(down)\n exit()\n elif lis[100+up-1] == 1:\n print(up)\n exit()\n'] | ['Runtime Error', 'Accepted'] | ['s683167194', 's746320603'] | [9196.0, 9188.0] | [23.0, 25.0] | [301, 293] |
p02641 | u121799456 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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)\n\texit()\np = list(map(int, input().split()))\nmind = abs(x - p[0])\npos = [p[0]]\ns = set(p)\np = []\nfor x1 in range(-100, 200):\n\tif x1 in s:\n\t\tcontinue\n\telse:\n\t\tp.append(x1)\nfor q in p:\n\tif abs(x - q) < mind:\n\t\tmind = abs(x - q)\n\t\tpos = [q]\n\telif abs(x - q) == mind:\n\t\tpos.append(q)\npos.sort()\nprint(pos[0])', 'x, n = map(int, input().split())\nif n == 0:\n\tprint(x)\n\texit()\np = list(map(int, input().split()))\n\ns = set(p)\np = []\nfor x1 in range(-100, 200):\n\tif x1 in s:\n\t\tcontinue\n\telse:\n\t\tp.append(x1)\nmind = abs(x - p[0])\npos = [p[0]]\nfor q in p:\n\tif abs(x - q) < mind:\n\t\t#print(q)\n\t\tmind = abs(x - q)\n\t\tpos = [q]\n\telif abs(x - q) == mind:\n\t\tpos.append(q)\npos.sort()\nprint(pos[0])'] | ['Wrong Answer', 'Accepted'] | ['s783958488', 's553587095'] | [9216.0, 9220.0] | [24.0, 22.0] | [357, 370] |
p02641 | u124212130 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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())\nMylist = input().split()\nMylist = [int(s) for s in Mylist]\n\nfor i in range(X):\n if not (X - i) in Mylist:\n print(X-i)\n elif not (X + i) in Mylist:\n print(X+i) ', 'X, N = map(int, input().split())\nMylist = input().split()\nMylist = [int(s) for s in Mylist]\n\nfor i in range(X):\n if (X - i) in Mylist:\n print(X-i)\n elif (X + i) in Mylist:\n print(X+i) ', 'import sys\nX, N = map(int, input().split())\nMylist = input().split()\nMylist = [int(s) for s in Mylist]\n\nfor i in range(100):\n if not (X - i) in Mylist:\n print(X-i)\n sys.exit()\n elif not (X + i) in Mylist:\n print(X+i) \n sys.exit()'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s908432652', 's975405994', 's972447484'] | [9120.0, 9176.0, 9184.0] | [24.0, 22.0, 21.0] | [212, 204, 263] |
p02641 | u127025777 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['a = list(map(int,input().split()))\nx = a[0]\nif a[1] == 0 :\n print(x)\nelse :\n b = list(map(int,input().split()))\n retu = []\n for i in range(1,101) :\n retu.append(i)\n for i in b :\n if i in retu :\n retu.remove(i)\n print(retu)\n k = 1000\n ans = i\n for i in retu :\n y = abs(i - x)\n if y < k :\n k = y\n ans = i\n\n print(ans)', 'a = list(map(int,input().split()))\nx = a[0]\nif a[1] == 0 :\n print(x)\nelse :\n b = list(map(int,input().split()))\n retu = []\n for i in range(0,102) :\n retu.append(i)\n for i in b :\n if i in retu :\n retu.remove(i)\n k = 1000\n ans = 0\n for i in retu :\n y = abs(i - x)\n if y < k :\n k = y\n ans = i\n print(ans)'] | ['Wrong Answer', 'Accepted'] | ['s860346186', 's305308436'] | [9208.0, 9088.0] | [26.0, 24.0] | [406, 389] |
p02641 | u127873832 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['x, n = map(int, input().split())\nP = list(map(int, input().split()))\nif not P:\n print(x)\nexit(0)\nfor i in range(x, 102):\n if i not in P:\n upper = i\n break\n else:\n upper = 102\nfor i in range(x, -1, -1):\n if i not in P:\n lower = i\n break\n else:\n lower = 0\nprint(lower if x-lower <= upper - x else upper)', 'x, n = map(int, input().split())\nP = list(map(int, input().split()))\nif not P:\n print(x)\n\texit(0)\nfor i in range(x, 102):\n if i not in P:\n upper = i\n break\n else:\n upper = 102\nfor i in range(x, -1, -1):\n if i not in P:\n lower = i\n break\n else:\n lower = 0\nprint(lower if x-lower <= upper - x else upper)', 'x, n = map(int, input().split())\nP = list(map(int, input().split()))\nif not P:\n print(x)\n exit(0)\nfor i in range(x, 102):\n if i not in P:\n upper = i\n break\n else:\n upper = 102\nfor i in range(x, -1, -1):\n if i not in P:\n lower = i\n break\n else:\n lower = 0\nprint(lower if x-lower <= upper - x else upper)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s026640541', 's981526280', 's400923321'] | [9084.0, 8940.0, 9100.0] | [29.0, 24.0, 25.0] | [358, 359, 362] |
p02641 | u132266749 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['a, b= map(int, input().split())\nlista= [int (x) for x in input().split()]\n\nfor i in range(200):\n if a-i not in lista:\n print(a-1)\n exit()\n elif a+i not in lista:\n print(a+1)\n exit()', 'a, b= map(int, input().split())\nlista= [int (x) for x in input().split()]\n\nfor i in range(102):\n if a-i not in lista:\n print(a-i)\n break\n elif a+i not in lista:\n print(a+i)\n break'] | ['Wrong Answer', 'Accepted'] | ['s829937458', 's821395664'] | [9020.0, 9164.0] | [29.0, 32.0] | [215, 213] |
p02641 | u135389999 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\nelse:\n p = list(map(int, input().split()))\n cnt = 0\n if x in p:\n print(x)\n else:\n while True:\n cnt += 1\n if x - cnt not in p:\n print(x - cnt)\n break\n if x + cnt not in p:\n print(x + cnt)\n break', 'x, n = map(int, input().split())\nif n == 0:\n print(x)\n\nelse:\n p = list(map(int, input().split()))\n cnt = 0\n if x not in p:\n print(x)\n else:\n while True:\n cnt += 1\n if x - cnt not in p:\n print(x - cnt)\n break\n if x + cnt not in p:\n print(x + cnt)\n break'] | ['Wrong Answer', 'Accepted'] | ['s381454479', 's250599097'] | [9180.0, 9128.0] | [33.0, 33.0] | [370, 374] |
p02641 | u139216357 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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_d = [x-int(i) for i in input().split()]\np_sorted = sorted(p_d,key= lambda x: (-x-0.1, x)[x > 0])\n\nl = [x-k for k in range(1,101)]\nl_sorted = sorted(l,key= lambda x: (-x-0.1, x)[x > 0])\n\nfor i in range(n):\n ans = l_sorted[i]\n if p_sorted[i] != ans:\n print(x+ans)\n break\nif n == 0:\n print(x)\n', 'x,n = map(int,input().split())\nif n == 0:\n print(x)\nelse:\n l = [k for k in range(102)]\n for p in input().split():\n p = int(p)\n l[p] = 1000\n l_d = [x-k for k in l]\n l_sorted = sorted(l_d,key= lambda x: (-x+0.1, x)[x > 0])\n print(x-l_sorted[0])'] | ['Wrong Answer', 'Accepted'] | ['s574591248', 's995620123'] | [9204.0, 9204.0] | [22.0, 24.0] | [347, 274] |
p02641 | u139441419 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 a=list(map(int,input().split()))\n\n flag=0\n i=0\n while flag==0:\n continueflag=0\n for j in a:\n if j==x-i:\n continueflag=1\n break\n if continueflag==0:\n print(x-i)\n break\n \n for j in a:\n if j==x+i:\n continueflag=1\n break\n if continueflag==0:\n print(x+i)\n break\n i=i+1\n \n', 'x,n=map(int,input().split())\na=list(map(int,input().split()))\n\ndtmp = 100\nfor i in range(n):\n d=abs(x-a[i])\n if d<dtmp:\n dtmp=d\n ans=x\n elif d==dtmp:\n ans=x\nprint(ans)', 'x,n=map(int,input().split())\nif n==0:\n print(x)\nelse:\n a=list(map(int,input().split()))\n flag=0\n i=0\n while flag==0:\n continueflag=0\n for j in range(n):\n if a[j]==x-i:\n continueflag=1\n break\n if continueflag==0:\n print(x-i)\n break\n \n continueflag=0\n for j in range(n):\n if a[j]==x+i:\n continueflag=1\n break\n if continueflag==0:\n print(x+i)\n break\n i=i+1\n'] | ['Time Limit Exceeded', 'Runtime Error', 'Accepted'] | ['s241429788', 's441448392', 's881067541'] | [9108.0, 9180.0, 9204.0] | [2205.0, 21.0, 26.0] | [408, 179, 443] |
p02641 | u143322814 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['def main():\n x, n = map(int, input().split())\n p = set(map(int, input().split()))\n if not x in p:\n print(x)\n else:\n a = [abs(i-x) if not i in p else 1000 for i in range(-1, 102)]\n print(a.index(min(a))+1)\n\nif __name__ == "__main__":\n main()', 'def main():\n x, n = map(int, input().split())\n p = set(map(int, input().split()))\n if not x in p:\n print(x)\n else:\n a = [abs(i-x) if not i in p else 1000 for i in range(11, 102)]\n print(a.index(min(a))+1)\n\nif __name__ == "__main__":\n main()', 'def main():\n x, n = map(int, input().split())\n p = set(map(int, input().split()))\n if not x in p:\n print(x)\n else:\n a = [abs(x-i) if not i in p else 1000 for i in range(-1, 102)]\n print(a)\n print(a.index(min(a))-1)\n\nif __name__ == "__main__":\n main()', 'def main():\n x, n = map(int, input().split())\n p = set(map(int, input().split()))\n if not x in p:\n print(x)\n else:\n a = [abs(x-i) if not i in p else 1000 for i in range(-1, 102)]\n print(a.index(min(a))-1)\n \nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s001330876', 's450068751', 's609506772', 's679998653'] | [9084.0, 9104.0, 9224.0, 9080.0] | [27.0, 27.0, 25.0, 28.0] | [276, 276, 293, 277] |
p02641 | u145145077 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()))\nall=set(range(1,101))\ns_p=set(p)\n\nmin_dis=100\nfor i in all-s_p:\n dis=abs(i-x)\n if min_dis > dis:\n min_i=i\n min_dis=dis\nprint(min_dis, min_i)', 'x,n=map(int, input().split())\nif n == 0:\n print(x)\n exit()\np=list(map(int, input().split()))\nall=set(range(0,102))\ns_p=set(p)\nkouho=sorted(all-s_p)\n\nmin_dis=201\nfor i in kouho:\n dis=abs(i-x)\n if min_dis > dis:\n min_i=i\n min_dis=dis\nprint(min_i)\n'] | ['Runtime Error', 'Accepted'] | ['s182157271', 's569286965'] | [9196.0, 9084.0] | [22.0, 25.0] | [243, 255] |
p02641 | u146575240 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['\nX,N= map(int,input().split())\np= list(map(int,input().split()))\nA= list(range(1,X+1))\nfor i in range(N):\n A.remove(p[i])\n\nD = 101\nans = 0\nfor j in range(len(A)):\n if D >= abs(X - A[j]):\n D = abs(X - A[j])\n ans = A[j]\n else:\n pass\nprint(ans)', '"""#D - Not Divisible\nN= map(int,input().split())\nA= list(map(int,input().split()))"""\n\n\n\nX,N= map(int,input().split())\np= list(map(int,input().split()))\nA= list(range(-200,200))\n#print(A)\nfor i in range(N):\n A.remove(p[i])\n\nD = 201\nans = -100\nfor j in range(len(A)):\n if D > abs(X - A[j]):\n D = abs(X - A[j])\n ans = A[j]\n\n else:\n pass\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s704410256', 's598669930'] | [9200.0, 9208.0] | [22.0, 21.0] | [290, 396] |
p02641 | u146597538 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()))\nif len(p) == 0:\n print(x)\n exit(0)\nfor abs in range(n+1):\n print(f'{x} {abs}')\n if (x - abs) not in p:\n print(x-abs)\n exit(0)\n elif (x + abs) not in p:\n print(x+abs)\n exit(0)", 'x, n = map(int, input().split())\n\np = list(map(int, input().split()))\nif len(p) == 0:\n print(x)\n exit(0)\nfor abs in range(n+1):\n if (x - abs) not in p:\n print(x-abs)\n exit(0)\n elif (x + abs) not in p:\n print(x+abs)\n exit(0)'] | ['Wrong Answer', 'Accepted'] | ['s623506101', 's591427468'] | [9220.0, 9192.0] | [21.0, 24.0] | [287, 263] |
p02641 | u159144188 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 not N == 0:\n p_l = list(map(int, input().split()))\nif N == 0:\n print(X)\n exit()\na = b = X\nwhile True:\n if a in p_l and b in p_l:\n continue\n if not a in p_l:\n if not b in p_l:\n if a > b:\n print(b)\n exit()\n else:\n print(a)\n exit()\n print(a)\n exit()\n elif not b in p_l:\n if not a in p_l:\n if a > b:\n print(b)\n exit()\n else:\n print(a)\n exit()\n print(b)\n a += 1\n b -= 1', 'X, N = map(int, input().split())\nif not N == 0:\n p_l = list(map(int, input().split()))\nif N == 0:\n print(X)\n exit()\na = b = X\nif not a in p_l:\n if not b in p_l:\n if a > b:\n print(b)\n exit()\n else:\n print(a)\n exit()\n print(a)\n exit()\nelif not b in p_l:\n if not a in p_l:\n if a > b:\n print(b)\n exit()\n else:\n print(a)\n exit()\n print(b)\nwhile True:\n a += 1\n if b > 0:\n b -= 1\n if a in p_l and b in p_l:\n continue\n if not a in p_l:\n if not b in p_l:\n if a > b:\n print(b)\n# print("A")\n exit()\n else:\n# print("B")\n print(a)\n exit()\n# print("C")\n print(a)\n exit()\n elif not b in p_l:\n if not a in p_l:\n if a > b:\n print(b)\n# print("D")\n exit()\n else:\n print(a)\n# print("E")\n exit()\n# print("F")\n print(b)\n exit()'] | ['Time Limit Exceeded', 'Accepted'] | ['s073925418', 's218975422'] | [9112.0, 9264.0] | [2206.0, 30.0] | [502, 904] |
p02641 | u160224209 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 = 9999999999\nlists = []\nif n == 0:\n print(x)\n exit()\nfor i in range(101):\n if i not in p:\n print(i)\n lists.append(i)\nfor i in lists:\n if ans > abs(x - i):\n ans = abs(x-i)\n m = i\n\nprint(m)\n', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\nans = 9999999999\nlists = []\nif n == 0:\n print(x)\n exit()\nfor i in range(1, 101):\n if not i in p:\n print(i)\n lists.append(i)\nfor i in lists:\n if ans > abs(x - i):\n ans = abs(x-i)\n m = i\n\nprint(m)\n', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\nans = 9999999999\nlists = []\nif n == 0:\n print(x)\n exit()\nfor i in range(-1000, 1000):\n if not i in p:\n lists.append(i)\nfor i in lists:\n if ans > abs(x - i):\n ans = abs(x-i)\n m = i\n\nprint(m)\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s122800309', 's475506383', 's424638933'] | [9100.0, 9172.0, 9056.0] | [27.0, 31.0, 35.0] | [301, 304, 292] |
p02641 | u161411695 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X, N = map(int, input().split())\np = list(map(int, input().split()))\nfor d in range(X + 1):\n for s in [-1, +1]: a=X+s*d\n if p.count(a) == 0:\n print(a)\n exit(0)', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\nfor d in range(X + 1):\n for s in [-1, +1]: a=X+s*d\n if p.count(a) == 0:\n print(a)\n exit(0)\n', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\nfor d in range(X + 1):\n for s in [-1, +1]: \n a=X+s*d\n if p.count(a) == 0:\n print(a)\n exit(0)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s560666390', 's630949381', 's361637421'] | [9028.0, 9024.0, 9104.0] | [26.0, 25.0, 26.0] | [173, 174, 179] |
p02641 | u165318982 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\ntable = [0] * 102\nans = X\ndist = 102\n\nfor p in range(P):\n table[p] = 1\n\nfor i in range(102):\n if abs(i - X) < dist:\n ans = i\n dist = abs(i - X)\n elif abs(i - X) == dist:\n ans = min(i, ans)\n\nprint(str(ans))', 'X,N = map(int, input().split())\nP = list(map(int, input().split()))\n\ntable = [0] * 102\nans = X\ndist = 102\n\nfor p in range(P):\n table[p] = 1\n\nfor i in range(102):\n if table[i] == 1:\n continue\n if abs(i - X) < dist:\n ans = i\n dist = abs(i - X)\n elif abs(i - X) == dist:\n ans = min(i, ans)', 'X,N = map(int, input().split())\nP = list(map(int, input().split()))\n\ntable = [0] * 102\nans = X\ndist = 102\n\nfor p in P:\n table[p] = 1\n\nfor i in range(102):\n if table[i] != 0:\n continue\n if abs(i - X) < dist:\n ans = i\n dist = abs(i - X)\n elif abs(i - X) == dist:\n ans = min(i, ans)\n\nprint(str(ans))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s769638682', 's827301263', 's113731311'] | [9184.0, 8980.0, 9128.0] | [25.0, 26.0, 29.0] | [286, 302, 312] |
p02641 | u167908302 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\nx, n = map(int, input().split())\np = list(map(int, input().split()))\n\n\nif n == 0:\n print(x)\nelse:\n ps = sorted(p)\n tmp = list(range(-201, 200))\n ans_list = list(set(tmp) ^ set(ps))\n ans_list = sorted(ans_list)\n # print(tmp, ans_list)\n diff = []\n\n for i in ans_list:\n diff.append(abs(i - x))\n\n print(ans_list)\n print(diff)\n print(min(diff))\n print(ans_list[diff.index(min(diff))])\n', '# coding:utf-8\nx, n = map(int, input().split())\np = list(map(int, input().split()))\n\n\nif n == 0:\n print(x)\nelse:\n ps = sorted(p)\n tmp = list(range(-201, 200))\n ans_list = list(set(tmp) ^ set(ps))\n ans_list = sorted(ans_list)\n # print(tmp, ans_list)\n diff = []\n\n for i in ans_list:\n diff.append(abs(i - x))\n\n print(ans_list[diff.index(min(diff))])\n'] | ['Wrong Answer', 'Accepted'] | ['s074795256', 's377273442'] | [9260.0, 9140.0] | [22.0, 25.0] | [438, 381] |
p02641 | u173644182 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['def main():\n x, n = map(int, input().split())\n p = list(map(int, input().split()))\n _near = 0\n for i in range(101):\n if i in p:\n continue\n if abs(abs(_near)) - x > abs(abs(i)-x):\n _near = i\n print(_near)\n\n\nif __name__ == "__main__":\n main()\n', 'def main():\n x, n = map(int, input().split())\n p = list(map(int, input().split()))\n _near = 0\n for i in range(101):\n if i in p:\n continue\n if abs(_near - x) > abs(i - x):\n if _near > i:\n _near = i\n print(_near)\n\n\nif __name__ == "__main__":\n main()\n', 'def main():\n x, n = map(int, input().split())\n p = list(map(int, input().split()))\n _near = -1\n for i in range(-1, 102):\n if i in p:\n continue\n if abs(_near - x) > abs(i - x):\n _near = i\n print(_near)\n\n\nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s327364003', 's521412330', 's880987000'] | [9200.0, 9180.0, 9180.0] | [24.0, 22.0, 23.0] | [295, 317, 296] |
p02641 | u174831560 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 readInts():\n return list(map(int, input().split()))\n\ndef main():\n a = input()\n a =a.split(" ")\n p = readInts()\n x = int(a[0])\n n = int(a[1])\n i= x -1\n j = x + 1\n \n while i not in p:\n i -=1\n \n while j not in p:\n j += 1\n \n if abs(x-i) <= abs(x-j):\n print(i)\n else:\n print(j)\n \n \nif __name__ == "__main__":\n main()', 'def readInts():\n return list(map(int, input().split()))\n\ndef main():\n a = input()\n a =a.split(" ")\n p = readInts()\n x = int(a[0])\n n = int(a[1])\n i= x -1\n j = x + 1\n \n while i not in p:\n i -=1\n \n while j not in p:\n j += 1\n \n if abs(x-i) <= abs(x-j):\n print(i)\n else:\n print(j)\n \n \nif __name__ == "__main__":\n main()', 'def readInts():\n return list(map(int, input().split()))\n\ndef main():\n a = input()\n a =a.split(" ")\n x = int(a[0])\n n = int(a[1])\n if n == 0:\n print(x)\n return\n \n p = readInts()\n i= x \n j = x + 1\n \n while i in p:\n i -=1\n \n while j in p:\n j += 1\n \n if abs(x-i) <= abs(x-j):\n print(i)\n else:\n print(j)\n \n \nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s373989426', 's737473339', 's695198327'] | [9196.0, 9200.0, 9200.0] | [2205.0, 2205.0, 22.0] | [346, 346, 379] |
p02641 | u175217658 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()))\ndif = 1\n\nif(X not in p):\n print(X)\nelse:\n while True:\n if(X-dif not in p):\n dif = dif*(-1)\n break\n elif(X+dif not in p):\n break\n else:\n dif=dif+1\n print(X+dif)', 'X,N = map(int, input().split())\np = list(map(int, input().split()))\ndif = 1\n\nif(X not in p):\n print(X)\nelse:\n while True:\n if(X-dif not in p):\n dif = dif*(-1)\n break\n elif(X+dif not in p):\n break\n else:\n dif=dif+1\n print(X+dif)'] | ['Runtime Error', 'Accepted'] | ['s774362354', 's718862978'] | [8808.0, 9172.0] | [23.0, 28.0] | [303, 301] |
p02641 | u175590965 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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(101):\n if x-i not in p:\n print(x-i)\n exit()\n elif x+i not in p:\n print(x+i)\n exit()\n', 'x,n = map(int,input()split())\np = lsit(map(int,input().split()))\nfor i in range(101):\n if x-i not in p:\n print(x-i)\n exit()\n elif x+i not in p:\n print(x+i)\n exit()\n', 'x,n = map(int,input().split())\np = list(map(int,input().split()))\nfor i in range(101):\n if x-i not in p:\n print(x-i)\n exit()\n elif x+i not in p:\n print(x+i)\n exit()\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s449960147', 's914298236', 's781392126'] | [9008.0, 8948.0, 9172.0] | [26.0, 23.0, 27.0] | [194, 194, 199] |
p02641 | u179376941 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['n, m = map(int, input().split())\nif m == 0:\n lst = []\nelse:\n lst = [int(i) for i in k.split()]\n\nnums = []\nmin_num = 1000\nfor i in range(1, 101):\n if i in lst:\n continue\n l = abs(i - n)\n if l < min_num:\n min_num = l\n nums.append(i)\n elif l > min_num:\n break\nprint(nums[-1])', 'n, m = map(int, input().split())\nif m == 0:\n lst = []\nelse:\n lst = [int(i) for i in input().split()]\n\nnums = []\nmin_l = 1000\nfor i in range(103):\n if i in lst:\n continue\n l = abs(i - n)\n if l < min_l:\n min_l = l\n min_num = i\n elif l >= min_l:\n break\nprint(min_num)'] | ['Runtime Error', 'Accepted'] | ['s933581994', 's266483301'] | [9116.0, 9052.0] | [29.0, 26.0] | [290, 282] |
p02641 | u180172332 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\ninput()\n\ndef no_Divisible(num,num_list):\n for row in set(num_list):\n if num%row==0:\n return 0\n return 1\n\ninput_list = np.array(sorted(list(map(lambda x:int(x),input().split(" "))),reverse=True))\ncount = 0\nprev_num = 0\nfor i,num in enumerate(input_list):\n if num == prev_num:\n continue\n #print(num)\n #print(input_list[i+1:]%num)\n #if sum(input_list[i+1:]%num==0):\n if no_Divisible(num,input_list[i+1:]):\n count += 1\n prev_num = num\nprint(count)\n\n', 'x,y = map(lambda x:int(x),input().split(" "))\nif y==0:\n print(x)\nelse:\n input_list = list(map(lambda x:int(x),input().split(" ")))\n for i in range(y+2):\n if x-i not in input_list:\n print(x-i)\n break\n elif x+i not in input_list:\n print(x+i)\n break\n '] | ['Runtime Error', 'Accepted'] | ['s738754816', 's904496923'] | [27148.0, 9196.0] | [119.0, 23.0] | [520, 326] |
p02641 | u181159654 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nif N == 0:\n print(X)\nelse:\n p = sorted(p)\n for i in range(0, 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()))\n\nif N == 0:\n print(X)\nelse:\n p = sorted(p)\n for i in range(0, 100):\n if X-i not in p:\n print(X-i)\n break\n elif X+i not in p:\n print(X+i)\n break'] | ['Wrong Answer', 'Accepted'] | ['s360318237', 's016908782'] | [9184.0, 9188.0] | [18.0, 23.0] | [243, 279] |
p02641 | u181644161 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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=101\nif x in p:\n for i in range(102):\n if i in p:\n continue\n ans=min(ans,abs(p[i]-x))\n if x+ans in p:\n ans*=-1\nelse:\n ans=0\nprint(x+ans)\n', 'x,N=map(int,input().split())\np=list(map(int,input().split()))\nans=101\nif x in p:\n for i in range(102):\n if i in p:\n continue\n ans=min(ans,abs(i-x))\n if x-ans in p:\n ans*=-1\nelse:\n ans=0\nprint(x-ans)\n'] | ['Runtime Error', 'Accepted'] | ['s137167495', 's470781468'] | [9192.0, 9184.0] | [20.0, 25.0] | [243, 240] |
p02641 | u183840468 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 = [int(i) for i in input().split()]\nl = {int(i) for i in input().split()}\n\nxl = {int(i) for i in range(x+2)}\n\nans_list = list(xl - l)\n\nans = bisect.bisect_right(ans_list,x)\n\nprint(ans_list[ans-1] if ans != 0 else ans[1])\n\n\n\n', 'x,n = [int(i) for i in input().split()]\nl = [int(i) for i in input().split()]\n\nfor i in range(x+1):\n for j in [-1,1]:\n y = x + j * i\n if y in l:\n pass\n else:\n print(y)\n exit()'] | ['Wrong Answer', 'Accepted'] | ['s380423451', 's905180505'] | [9120.0, 9188.0] | [31.0, 27.0] | [242, 232] |
p02641 | u184661160 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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())\nls=inp()\nls.sort()\nif n==0:\n print(x)\n exit(0)\nelse:\n a=x-1\n b=x+1\n flag=False\n while(not flag):\n if a not in ls:\n print(a)\n exit(0)\n else:\n a-=1\n if b not in ls:\n print(b)\n exit(0)\n else:\n b+=1', "def inp():\n ls=set(map(int,input().split()))\n return ls\nx,n=map(int,input().split())\nif n==0:\n print(x)\n exit(0)\nls=inp()\nls.sort()\nans=0\nd=float('inf')\nfor i in range(1, 102):\n if i in ls:\n continue\n tmp = abs(x - i)\n if tmp < d:\n d = tmp\n ans = i\nprint(ans)", "def inp():\n ls=list(map(int,input().split()))\n return ls\nx,n=map(int,input().split())\nls=inp()\nans=0\nd=float('inf')\nfor i in range(102):\n if i in ls:\n continue\n tmp = abs(x - i)\n if tmp < d:\n d = tmp\n ans = i\nprint(ans)"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s969731226', 's974723920', 's911895881'] | [9196.0, 9208.0, 9192.0] | [27.0, 22.0, 22.0] | [335, 301, 255] |
p02641 | u185350737 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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=x\njudge=True\nif(n!=0):\n p=list(map(int, input().split()))\nelse:\n ans=x\n judge=False\n\nif(judge):\n check=True\n s_list=[]\n l_list=[]\n for i in range(n):\n for j in range(n):\n if(x-i==p[j]):\n check=False\n if(check):\n s_list.append(x-i)\n check=True\n\n for i in range(n):\n for j in range(n):\n if(x+i==p[j]):\n check=False\n if(check):\n l_list.append(x+i)\n check=True\n if(l_list == [] and s_list == []):\n ans = x-1\n else:\n if(abs(x-min(l_list)) > abs(x-max(s_list))):\n ans = max(s_list)\n elif(abs(x-min(l_list))==abs(x-max(s_list))):\n ans=max(s_list)\n else:\n ans=min(l_list) \n\nprint(ans)', 'x,n=map(int, input().split())\nans=x\njudge=True\nif(n!=0):\n p=list(map(int, input().split()))\nelse:\n ans=x\n judge=False\n\nif(judge):\n check=True\n s_list=[]\n l_list=[]\n for i in range(n):\n for j in range(n):\n if(x-i==p[j]):\n check=False\n if(check):\n s_list.append(x-i)\n check=True\n\n for i in range(n):\n for j in range(n):\n if(x+i==p[j]):\n check=False\n if(check):\n l_list.append(x+i)\n check=True\n if(l_list != []):\n if(abs(x-min(l_list)) > abs(x-max(s_list))):\n ans = max(s_list)\n elif(abs(x-min(l_list))==abs(x-max(s_list))):\n ans=max(s_list)\n else:\n ans=min(l_list) \n\nprint(ans)', 'x,n=map(int, input().split())\nans=x\njudge=True\nif(n!=0):\n p=list(map(int, input().split()))\nelse:\n ans=x\n judge=False\n\nif(judge):\n check=True\n s_list=[]\n l_list=[]\n for i in range(n):\n for j in range(n):\n if(x-i-1==p[j]):\n check=False\n if(check):\n s_list.append(x-i)\n check=True\n for i in range(n):\n for j in range(n):\n if(x+i+1==p[j]):\n check=False\n if(check):\n l_list.append(x+i)\n check=True\n if(abs(x-min(l_list)) > abs(x-max(s_list))):\n ans = max(s_list)\n elif(abs(x-min(l_list))==abs(x-max(s_list))):\n ans=max(s_list)\n else:\n ans=min(l_list)\n\nprint(ans)', 'x,n=map(int, input().split())\nans=x\njudge=True\nif(n!=0):\n p=list(map(int, input().split()))\nelse:\n ans=x\n judge=False\n\nif(judge):\n check=True\n s_list=[]\n l_list=[]\n for i in range(n):\n for j in range(n):\n if(x-i==p[j]):\n check=False\n if(check):\n s_list.append(x-i)\n check=True\n\n for i in range(n):\n for j in range(n):\n if(x+i==p[j]):\n check=False\n if(check):\n l_list.append(x+i)\n check=True\n if(l_list == [] and s_list == []):\n ans = x-1\n elif(l_list == []):\n ans = max(s_list)\n elif(s_list == []):\n ans = min(l_list)\n else:\n if(abs(x-min(l_list)) > abs(x-max(s_list))):\n ans = max(s_list)\n elif(abs(x-min(l_list))==abs(x-max(s_list))):\n ans=max(s_list)\n else:\n ans=min(l_list) \n\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s334888190', 's435513251', 's680491436', 's739311951'] | [9188.0, 9212.0, 9228.0, 9256.0] | [122.0, 117.0, 34.0, 136.0] | [732, 689, 630, 828] |
p02641 | u187462782 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()]\n\nif n = 0:\n print(x)\n exit()\n\nP = [int(x) for x in input().split()]\n\nbefore = x\nafter = x\nwhile True:\n if before not in P:\n print(before)\n break\n elif after not in P:\n print(after)\n break\n before -= 1\n after += 1\n', 'x, n = [int(x) for x in input().split()]\n\nif n == 0:\n print(x)\n exit()\n\nP = [int(x) for x in input().split()]\n\nbefore = x\nafter = x\nwhile True:\n if before not in P:\n print(before)\n break\n elif after not in P:\n print(after)\n break\n before -= 1\n after += 1\n'] | ['Runtime Error', 'Accepted'] | ['s188180167', 's424680350'] | [9008.0, 9180.0] | [20.0, 21.0] | [300, 301] |
p02641 | u188305619 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X, N = map(int, input().split())\np = list(map(int, input().split()))\nprint(X,N,p)\n\nnot_in_p = list(range(1,101))\nfor pn in p:\n if pn in not_in_p:\n not_in_p.remove(pn)\nprint(not_in_p)\n\ndiff_p = []\nfor not_in_pn in not_in_p:\n diff_p.append(abs(not_in_pn - X))\nmin_value_index = [j for j, value in enumerate(diff_p) if value == min(diff_p)]\n\nanswer = 0\nfor index in min_value_index:\n if answer == 0:\n answer = not_in_p[index]\n elif answer > not_in_p[index]:\n answer = not_in_p[index]\n\nprint(answer)', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nnot_in_p = list(range(-101,102))\nfor pn in p:\n if pn in not_in_p:\n not_in_p.remove(pn)\n\ndiff_p = []\nfor not_in_pn in not_in_p:\n diff_p.append(abs(not_in_pn - X))\nanswer = not_in_p[diff_p.index(min(diff_p))]\n\nprint(answer)'] | ['Wrong Answer', 'Accepted'] | ['s303944292', 's247276199'] | [9216.0, 9192.0] | [23.0, 20.0] | [529, 304] |
p02641 | u188827677 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\na = 0\nfor i in range(x-1, -1, -1):\n if i not in p:\n a = i\n exit()\nb = 0\nfor i in range(x, 101):\n if i not in p:\n b = i\n break\n\nif abs(x-a) <= abs(x-b):\n print(a)\nelse:\n print(b)', 'x,n = map(int, input().split())\np = list(map(int, input().split()))\n\nfor i in range(102):\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'] | ['s402021664', 's576122128'] | [9204.0, 9084.0] | [21.0, 22.0] | [293, 177] |
p02641 | u190178779 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['import sys\n\nX,N = map(int,input().split())\nP = list(map(int,input().split()))\nif X < 1 or 100 < X:\n sys.exit()\nif N < 0 or 100 < N:\n sys.exit()\n\nP_number = len(P)\nif P_number < 1 or 100 < P_number:\n sys.exit()\n\nres = [100,100]\ni = 0\nwhile i < N:\n if res[0] > abs(X - P[i]) and res[1] > P[i]:\n res[0] = abs(X - P[i])\n res[1] = P[i]\n i += 1\nprint(res[1])', 'import sys\n\nX,N = map(int,input().split())\nP = list(map(int,input().split()))\nif X < 1 or 100 < X:\n sys.exit()\nif N < 0 or 100 < N:\n sys.exit()\nP_number = count(P)\nif P_number < 1 or 100 < P_number:\n sys.exit()\n\nres = 100\ncount = 0\nwhile i < N:\n if res > abs(X - P[i]):\n res = X - P[i] \nprint(res)', 'import sys\n\nX,N = map(int,input().split())\nP = list(map(int,input().split()))\nif X < 1 or 100 < X:\n sys.exit()\nif N < 0 or 100 < N:\n sys.exit()\n\nP_number = len(P)\nif P_number < 1 or 100 < P_number:\n sys.exit()\n\nres = [100,100]\ni = 0\nwhile i < N:\n if res[0] > abs(X - P[i]) and res[1] > P[i]:\n res[0] = abs(X - P[i])\n res[1] = P[i]\n i += 1\nprint(res[1])', 'import sys\n\nX,N = map(int,input().split())\nP = list(map(int,input().split()))\nif X < 1 or 100 < X:\n sys.exit()\nif N < 0 or 100 < N:\n sys.exit()\nif N == 0:\n print(X)\n sys.exit()\n\nP_number = len(P)\nif P_number < 1 or 100 < P_number:\n sys.exit()\n\nres1 = 100\nres2 = 100\nres0 = 0\ni = 0\nwhile i < N:\n if !((X - i) in P):\n res1 = (X - i)\n i += 1\nwhile j < N:\n if !((X + j) in P):\n res2 = (X + j)\n j += 1\nif res2 > res1:\n res0 = res1\nelse if res1 > res2:\n res0 = res2\nelse if res2 == res1:\n res0 = res1\nprint(res0)\n', 'import sys\n\nX,N = map(int,input().split())\nP = list(map(int,input().split()))\nif X < 1 or 100 < X:\n sys.exit()\nif N < 0 or 100 < N:\n sys.exit()\nif N == 0:\n print(X)\n sys.exit()\n\nP_number = len(P)\nif P_number < 1 or 100 < P_number:\n sys.exit()\n\nres1 = 100\nres2 = 100\nres0 = 0\ni = 0\nj = 0\nwhile i <= N:\n if (X - i) not in P:\n res1 = (X - i)\n break\n i += 1\nwhile j <= N:\n if (X + j) not in P:\n res2 = (X + j)\n break\n j += 1\nif i > j:\n res0 = res2\nelif j > i:\n res0 = res1\nelif i == j:\n res0 = res1\nprint(res0)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s194885312', 's750408217', 's798677951', 's907066252', 's844962419'] | [9212.0, 9140.0, 9212.0, 9056.0, 9108.0] | [24.0, 27.0, 26.0, 24.0, 29.0] | [381, 316, 381, 557, 570] |
p02641 | u190850294 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 _typeshed import ReadableBuffer\nimport sys\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\ndef I(): return int(sys.stdin.buffer.readline())\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef LSR(n): return [LS() for i in range(n)]\ndef SRL(n): return [list(S()) for i in range(n)]\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\nmod = 10 ** 9 + 7\n\nX, N = LI()\nP = LI().sort()\n\n\n\nif N == 0:\n print(X)\n sys.exit()\n\nelif (X not in P) and (N != 0):\n print(X)\n sys.exit()\n\nelse:\n while X in P:\n X = X - 1\n print(X)\n sys.exit()", "import sys\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\ndef I(): return int(sys.stdin.buffer.readline())\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef LSR(n): return [LS() for i in range(n)]\ndef SRL(n): return [list(S()) for i in range(n)]\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\nmod = 10 ** 9 + 7\n\nX, N = LI()\nP = LI()\n\n# d = X\n\n\nif N == 0:\n print(X)\n sys.exit()\n\nelif (N != 0) and (X not in P):\n print(X)\n sys.exit()\n\nQ = [q for q in range(-1, 102) if q not in P] \nans = min(Q, key=lambda x: (abs(x - X), x)) \n\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s049885782', 's673225465'] | [9160.0, 9264.0] | [28.0, 33.0] | [916, 1197] |
p02641 | u192433528 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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(input()) for i in range(N)]\n\nL = sorted([abs(X-p) for p in P])\nif 0 not in L :\n print(X)\n exit()\n\nDL = list(set([x for x in L if L.count(x) > 1]))\n\nans_abs = 1\nfor i,x in enumerate(DL) :\n if x == i+1 :\n ans_abs += 1\n else :\n break\n\nif X-ans_abs in P :\n print(X+ans_abs)\nelse :\n print(X-ans_abs)\n', 'import itertools\nX,N = map(int,input().split())\n\nif N == 0 :\n print(X)\n exit()\n\nP = list(map(int,input().split()))\n\nL = sorted([abs(X-p) for p in P])\nif 0 not in L :\n print(X)\n exit()\n\nDL = list(set([x for x in L if L.count(x) > 1]))\n\nans_abs = 1\nfor i,x in enumerate(DL) :\n if x == i+1 :\n ans_abs += 1\n else :\n break\n\nif X-ans_abs in P :\n print(X+ans_abs)\nelse :\n print(X-ans_abs)'] | ['Runtime Error', 'Accepted'] | ['s410139356', 's873418779'] | [9184.0, 9220.0] | [26.0, 28.0] | [367, 419] |
p02641 | u197968862 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['x, n = map(int,input().split())\nif n != 0:\n p = list(map(int,input().split()))\nelse:\n print(x)\n quit()\n\np.sort()\nd = 10 ** 9\nfor i in range(-1000,1000):\n if d > abs(i-x) and i not in p:\n d = abs(i-x)\n ans = i\n print(i)\nprint(ans)', 'x, n = map(int,input().split())\nif n != 0:\n p = list(map(int,input().split()))\nelse:\n print(x)\n quit()\n\np.sort()\nd = 10 ** 9\nfor i in range(-1000,1000):\n if d > abs(i-x) and i not in p:\n d = abs(i-x)\n ans = i\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s767224592', 's997104073'] | [9168.0, 9192.0] | [25.0, 24.0] | [262, 245] |
p02641 | u201986772 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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=sorted(list(map(int,input().split())))\nif n==0:\n print(x)\n exit()\nelse:\n for i in range(100):\n aa=x-i\n if aa not in a:\n print(aa)\n exit()\n bb=x+i\n if bb not in a:\n print(bb)\n exit()\n \n ', 'x,n=map(int,input().split())\na=sorted(list(map(int,input().split())))\nif n==0:\n print(x)\n exit()\nelse:\n for i in range(100):\n aa=x-i\n if aa not in a:\n print(aa)\n exit()\n bb=x+i\n if bb not in a:\n print(bb)\n exit()'] | ['Runtime Error', 'Accepted'] | ['s626242711', 's078815948'] | [8820.0, 9136.0] | [26.0, 24.0] | [258, 247] |
p02641 | u203383537 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 = [int(input()) for i in range(n)]\ns = 1000000000\n\nfor i in range(1,101):\n if i in p:\n continue\n s = min(abs(x-i),s)\n \n\nif not x-s in p:\n print(x - s)\nelse:\n print(x + s)', 'x,n = map(int,input().split())\n\nif n != 0:\n p = list(map(int,input().split()))\nelse:\n print(x)\n exit()\n\ns = 1000000000\n\nfor i in range(-100,102):\n if i in p:\n continue\n s = min(abs(x-i),s)\n \n\nif not x-s in p:\n print(x - s)\nelse:\n print(x + s)'] | ['Runtime Error', 'Accepted'] | ['s002893067', 's464777655'] | [9188.0, 9196.0] | [21.0, 23.0] | [226, 273] |
p02641 | u214209871 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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())\nplist = list(map(int, input().split()))\n\nlist = []\n\na = x\nwhile True:\n if not a in plist:\n list.append(a)\n break\n a += 1\n\nb = x-1\nwhile True:\n if not b in plist:\n list.append(b)\n break\n b -= 1\n\nprint(min(list))\n', 'x, n = map(int, input().split())\nplist = list(map(int, input().split()))\n\na = x\nwhile True:\n if not a in plist:\n big = a\n break\n a += 1\n\nb = x-1\nwhile True:\n if not b in plist:\n small = b\n break\n b -= 1\n\nif abs(big-x) < abs(small-x):\n ans = big\nelse:\n ans = small\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s447355890', 's474661320'] | [9140.0, 9168.0] | [28.0, 25.0] | [284, 322] |
p02641 | u218108604 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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# from collections import deque\n# from collections import Counter\n# from math import sqrt\n# from math import log\n# from math import ceil\n\n\n# \tif(a==0):\n# \t\treturn b \n\n\n\n\n# \tp=2\n# \twhile(p*p<=n): \n\n\n\n# \t\tp+=1\n\n\n# \ts=set()\n\n\n# \t\ts.add(i)\n\n\n# alpha=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\n# mod=10**9+7\n\nfast_reader=sys.stdin.readline\nfast_writer=sys.stdout.write\n\ndef input():\n\treturn fast_reader().strip()\n\ndef print(*argv):\n\tfast_writer(' '.join((str(i)) for i in argv))\n\tfast_writer('\\n')\n\ndef list_input():\n\treturn list(map(int, input().split()))\n\ndef sep_input():\n\treturn map(int, input().split())\n\n#_______________________________________________________________________________________________________________________________________\n\nx,n=sep_input()\nl=list_input()\ns=set(l)\ni=0\nwhile(True):\n\tif(x-i not in s):\n\t\tprint(x+i)\n\t\tbreak\n\telif(x+i not in s):\n\t\tprint(x-i)\n\t\tbreak\n\telse:\n\t\ti+=1", "import sys\n# from collections import deque\n# from collections import Counter\n# from math import sqrt\n# from math import log\n# from math import ceil\n\n\n# \tif(a==0):\n# \t\treturn b \n\n\n\n\n# \tp=2\n# \twhile(p*p<=n): \n\n\n\n# \t\tp+=1\n\n\n# \ts=set()\n\n\n# \t\ts.add(i)\n\n\n# alpha=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\n# mod=10**9+7\n\nfast_reader=sys.stdin.readline\nfast_writer=sys.stdout.write\n\ndef input():\n\treturn fast_reader().strip()\n\ndef print(*argv):\n\tfast_writer(' '.join((str(i)) for i in argv))\n\tfast_writer('\\n')\n\ndef list_input():\n\treturn list(map(int, input().split()))\n\ndef sep_input():\n\treturn map(int, input().split())\n\n#_______________________________________________________________________________________________________________________________________\n\nx,n=sep_input()\nl=list_input()\ns=set(l)\ni=0\nwhile(True):\n\tif(x+i in s):\n\t\tprint(x+i)\n\t\tbreak\n\telif(x-i in s):\n\t\tprint(x-i)\n\t\tbreak\n\telse:\n\t\ti+=1", "import sys\n# from collections import deque\n# from collections import Counter\n# from math import sqrt\n# from math import log\n# from math import ceil\n\n\n# \tif(a==0):\n# \t\treturn b \n\n\n\n\n# \tp=2\n# \twhile(p*p<=n): \n\n\n\n# \t\tp+=1\n\n\n# \ts=set()\n\n\n# \t\ts.add(i)\n\n\n# alpha=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\n# mod=10**9+7\n\nfast_reader=sys.stdin.readline\nfast_writer=sys.stdout.write\n\ndef input():\n\treturn fast_reader().strip()\n\ndef print(*argv):\n\tfast_writer(' '.join((str(i)) for i in argv))\n\tfast_writer('\\n')\n\ndef list_input():\n\treturn list(map(int, input().split()))\n\ndef sep_input():\n\treturn map(int, input().split())\n\n#_______________________________________________________________________________________________________________________________________\n\nx,n=sep_input()\nl=list_input()\ns=set(l)\ni=0\nwhile(True):\n\tif(x-i not in s):\n\t\tprint(x-i)\n\t\tbreak\n\telif(x+i not in s):\n\t\tprint(x+i)\n\t\tbreak\n\telse:\n\t\ti+=1"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s006759815', 's200447445', 's276781631'] | [9108.0, 9136.0, 9216.0] | [24.0, 2206.0, 20.0] | [1251, 1243, 1251] |
p02641 | u221272125 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()))\n for i in range(100):\n x = X - i\n y = X - i\n if x not in A:\n print(x)\n quit()\n if y not in A:\n print(y)\n quit()\nelse:\n print(N)\n', 'X,N = map(int,input())\nif N > 0:\n A = list(map(int,input()))\n for i in range(100):\n x = X - i\n y = X - i\n if x not in A:\n print(x)\n quit()\n if y not in A:\n print(y)\n quit()\nelse:\n print(N)', 'X,N = map(int,input().split())\nif N > 0:\n A = list(map(int,input().split()))\n d = {}\n for i in range(102):\n d[i] = 0\n for a in A:\n d[a] = 1\n for i in range(0,100):\n x = X - i\n y = X + i\n if d[x] == 0:\n print(x)\n quit()\n if d[y] == 0:\n print(y)\n quit()\nelse:\n print(X)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s558921485', 's658152602', 's518530482'] | [9144.0, 9180.0, 9144.0] | [22.0, 22.0, 23.0] | [254, 245, 371] |
p02641 | u221998589 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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#from numba import njit\n\ndef getVar():\n return map(int, input().split())\ndef getArray():\n return np.array(list(map(int, input().split())))\n\n(X,N) = getVar()\np = getArray()\n\nif (len(p) == 0):\n print(X)\nelse:\n subp = p - X\n i = 0\n while (True):\n if (not i in subp):\n break\n print(X - i)', 'import numpy as np\n#from numba import njit\n\ndef getVar():\n return map(int, input().split())\ndef getArray():\n return np.array(list(map(int, input().split())))\n\n(X,N) = getVar()\np = getArray()\n\nif (len(p) == 0):\n print(X)\nelse:\n subp = p - X\n i = 0\n while (True):\n if (not i in subp):\n break\n i += 1\n print(X - i)', 'import numpy as np\n#from numba import njit\n\ndef getVar():\n return map(int, input().split())\ndef getArray():\n return np.array(list(map(int, input().split())))\n\n(X,N) = getVar()\np = getArray()\n\nif (len(p) == 0):\n print(X)\nelse:\n subp = p - X\n i = 0\n while (True):\n if (not -i in subp):\n print(X - i)\n break\n if (not i in subp):\n print(X + i)\n break\n i += 1'] | ['Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s329798834', 's393323420', 's624592702'] | [26860.0, 27192.0, 27224.0] | [2206.0, 119.0, 122.0] | [322, 333, 393] |
p02641 | u223215060 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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_str = input().split()\nlist = []\nfor i in p_str :\n p = int(i)\n list.append(p)\n\nif not x in list :\n print(x)\nelse :\n for i in range(101):\n y = x - i\n if not y in list :\n print(y)\n break\n z = x + i\n if not z in list :\n print(z)\n break\n', 'x , n = map(int,input().split())\np_str = []\nif n != 0 :\n p_str = input().split()\n \nlist = []\n\nfor i in p_str :\n p = int(i)\n list.append(p)\n\nif not x in list :\n print(x)\nelse :\n for i in range(101):\n y = x - i\n if not y in list :\n print(y)\n break\n z = x + i\n if not z in list :\n print(z)\n break'] | ['Runtime Error', 'Accepted'] | ['s587280009', 's971263143'] | [9220.0, 9144.0] | [25.0, 23.0] | [366, 394] |
p02641 | u228636605 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 = []\nif N == 0:\n print(X)\nelif X not in p:\n print(X)\nelse:\n p = sorted(p)\n p2 = [abs(i-X) for i in p]\n\n for i in range(p[p2.index(min(p2))],101):\n if i not in p:\n ans.append(i)\n break\n for i in range(p[p2.index(min(p2))], -100, -1):\n if i not in p:\n ans.append(i)\n break\n \n ans = sorted(ans)\n ans2 = [abs(i-X) for i in ans]\n \n print(min(ans))\n # print(ans[ans2.index(min(ans2))])\n # print(min(ans))', 'X , N = map(int, input().split())\np = list(map(int,input().split()))\nans = []\nif N == 0:\n print(X)\nelif X not in p:\n print(X)\nelse:\n p = sorted(p)\n p2 = [abs(i-X) for i in p]\n\n for i in range(p[p2.index(min(p2))],101):\n if i not in p:\n ans.append(i)\n break\n for i in range(p[p2.index(min(p2))], -1, -1):\n if i not in p:\n ans.append(i)\n break\n \n ans = sorted(ans)\n ans2 = [abs(i-X) for i in ans]\n ans2 = sorted(ans2)\n print(ans[ans2.index(min(ans2))])\n # print(min(ans))\n', 'X , N = map(int, input().split())\np = list(map(int,input().split()))\nans = []\nif N == 0:\n print(X)\nelif X not in p:\n print(X)\nelse:\n p = sorted(p)\n p2 = [abs(i-X) for i in p]\n\n for i in range(p[p2.index(min(p2))],102):\n if i not in p:\n ans.append(i)\n break\n for i in range(p[p2.index(min(p2))], -1, -1):\n if i not in p:\n ans.append(i)\n break\n \n ans = sorted(ans)\n ans2 = [abs(i-X) for i in ans]\n ans2 = sorted(ans2)\n print(ans[ans2.index(min(ans2))])\n # print(min(ans))\n', 'X , N = map(int, input().split())\np = list(map(int,input().split()))\nans = []\nif N == 0:\n print(X)\nelif X not in p:\n print(X)\nelse:\n p = sorted(p)\n p2 = [abs(i-X) for i in p]\n\n for i in range(p[p2.index(min(p2))],102):\n if i not in p:\n ans.append(i)\n break\n for i in range(p[p2.index(min(p2))], -100, -1):\n if i not in p:\n ans.append(i)\n break\n \n ans = sorted(ans)\n ans2 = [abs(i-X) for i in ans]\n print(ans[ans2.index(min(ans2))])\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s049938068', 's459508305', 's615502867', 's580946795'] | [9228.0, 9100.0, 9220.0, 9224.0] | [27.0, 21.0, 23.0, 23.0] | [587, 564, 564, 521] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.