problem_id
stringlengths 6
6
| user_id
stringlengths 10
10
| time_limit
float64 1k
8k
| memory_limit
float64 262k
1.05M
| problem_description
stringlengths 48
1.55k
| codes
stringlengths 35
98.9k
| status
stringlengths 28
1.7k
| submission_ids
stringlengths 28
1.41k
| memories
stringlengths 13
808
| cpu_times
stringlengths 11
610
| code_sizes
stringlengths 7
505
|
---|---|---|---|---|---|---|---|---|---|---|
p02641 | u853728588 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['x,n = map(int,input().split())\nP = list(map(int,input().split()))\n\nfor i in range(101):\n xl = x - 1\n xr = x + 1\n if xl not in P:\n print(xl)\n break\n if xr not in P:\n print(xr)\n break\n ', 'x,n = map(int,input().split())\nP = list(map(int,input().split()))\n\nfor i in range(101):\n xl = x - i\n xr = x + i\n if xl not in P:\n print(xl)\n break\n if xr not in P:\n print(xr)\n break'] | ['Wrong Answer', 'Accepted'] | ['s023252613', 's150260836'] | [9168.0, 9000.0] | [28.0, 29.0] | [200, 197] |
p02641 | u854405453 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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(lambda t : int(t)-x, input().split()))\np = [0] + sorted(map(abs,l))\nfor i in range(n//2):\n if ( n == 2 * i +1 ) or ( not ( p[2*i+1] == i )):\n if -i in l:\n print(x+i)\n else:\n print(x-i)\n break\n', 'import functools as ft\nx,n = map(int, input().split())\nl = map(lambda t : int(t)-x, input().split())\np = sorted(map(abs,l))\nfor i in range((n//2)+1):\n if not ( p[i] == p[i+1] ==i ):\n if -i in l:\n print(x+i)\n else:\n print(x-i)', 'import functools as ft\nx,n = map(int, input().split())\nl = map(lambda t : int(t)-x, input().split())\np = sorted(map(abs,l))\nfor i in range(n/2):\n if not ( p[i] == p[i+1] ==i ):\n if -i in l:\n print(x+i)\n else:\n print(x-i)', 'x,n = map(int, input().split())\nl = map(lambda t : int(t)-x, input().split())\np = [0]\np.extend( sorted(map(abs,l)))\nfor i in range(n//2+1):\n if not ( p[2*i] == p[2*i+1] == i ):\n if i in l:\n print(x+i)\n else:\n print(x-i)\n break', 'x,n = map(int, input().split())\nif n == 0:\n print(x)\nelse:\n l = list(map(lambda t : int(t)-x, input().split()))\n p = [0] + sorted(map(abs,l))\n for i in range(n//2):\n if ( n == 2 * i +1 ) or ( not ( p[2*i+1] == i )):\n if -i in l:\n print(x+i)\n else:\n print(x-i)\n break', 'x,n = map(int, input().split())\nl = map(lambda t : int(t)-x, input().split())\np = sorted(map(abs,l))\nfor i in range(n//2+1):\n if not ( p[i] == p[i+1] ==i ):\n if -i in l:\n print(x+i)\n else:\n print(x-i)', 'x,n,*p=map(int,open(0).read().split())\nprint(min({*range(999)}-{*p},key=lambda y:abs(y-x)))'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s060877011', 's370464413', 's481731572', 's612578695', 's791852215', 's937361597', 's378310888'] | [9184.0, 9568.0, 9572.0, 9196.0, 9208.0, 9120.0, 9232.0] | [20.0, 23.0, 21.0, 21.0, 23.0, 19.0, 22.0] | [257, 264, 259, 246, 302, 239, 91] |
p02641 | u854962015 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['import sys\nX,N=map(int,input().split())\nif N==0:\n print(X)\n sys.exit()\nelse:\n P=list(map(int,input().split()))\nL=[]\nA=[]\nA_1=[]\nfor i in range(-100,200):\n L.append(i)\nfor i in P:\n L[i+100]=200\nfor i in L:\n A.append(abs(X-i))\nA_1=sorted(A)\na=A_1[0]\nfor i in L:\n if i==X-a:\n print(i)\n sys.exit()\n elif i==X+a:\n print(X+a)\n break\nprint(a)', 'import sys\nX,N=map(int,input().split())\nif N==0:\n print(X)\n sys.exit()\nelse:\n P=list(map(int,input().split()))\nL=[]\nA=[]\nA_1=[]\nfor i in range(-100,200):\n L.append(i)\nfor i in P:\n L[i+100]=200\nfor i in L:\n A.append(abs(X-i))\nA_1=sorted(A)\na=A_1[0]\nfor i in L:\n if i==X-a:\n print(i)\n sys.exit()\n elif i==X+a:\n print(X+a)\n break'] | ['Wrong Answer', 'Accepted'] | ['s014519987', 's984145274'] | [9212.0, 8964.0] | [27.0, 29.0] | [355, 346] |
p02641 | u855967722 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 exit()\nlist = []\nlist2 = []\nfor i in range(-5,max(P)+50):\n if i not in P and i != X:\n res = abs(X - i)\n list.append(res)\n list2.append(i)\n \nmaxres = list.index(min(list))\nif maxres != 0:\n print(list2[maxres])\nelse:\n print(-1)\nprint(maxres)\n\n', 'X, N = map(int, input().split())\nif N != 0:\n P = list(map(int, input().split()))\nelse:\n print(X)\n exit()\n\nfor i in range(101):\n if X-i not in P:\n print(X-i)\n exit()\n elif X+i not in P:\n print(X+i)\n exit()'] | ['Wrong Answer', 'Accepted'] | ['s803375332', 's710349903'] | [9140.0, 9188.0] | [24.0, 23.0] | [357, 221] |
p02641 | u856819253 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ["import sys\nimport bisect\n\ndef I(): return int(sys.stdin.readline().rstrip())\ndef LI():return list(map(int,sys.stdin.readline().rstrip().split()))\ndef LS():return list(sys.stdin.readline().rstrip().split())\n\n\ndef main():\n X,N = LI()[:]\n P = LI()\n P.sort()\n print(X,N)\n print(P)\n\n if N==0:\n print(X)\n exit()\n \n index = bisect.bisect_left(P, X)\n \n l = index\n r = index\n for i in range(0,100):\n up = X + i\n down = X - i\n \n if l < 0:\n print(down)\n break\n \n if r > N:\n print(up)\n break\n \n \n if P[l] != down:\n print(down)\n break\n \n if P[r] != up:\n print(up)\n break\n \n l -= 1\n r += 1\n \nif __name__ == '__main__':\n\tmain()\n", 'import sys\nimport bisect\n\ndef I(): return int(sys.stdin.readline().rstrip())\ndef LI():return list(map(int,sys.stdin.readline().rstrip().split()))\ndef LS():return list(sys.stdin.readline().rstrip().split())\n\n\ndef main():\n X,N = LI()[:]\n if N > 0:\n P = LI()\n P.sort()\n else:\n print(X)\n exit()\n \n #print(X,N)\n #print(P)\n \n index = bisect.bisect_left(P, X)\n #print("index=",index)\n if index >= N :\n print(X)\n exit()\n \n l = index\n r = index\n for i in range(0,200):\n up = X + i\n down = X - i\n \n #print("l=",l,"r=",r)\n \n \n if l < 0 or P[l] != down:\n print(down)\n break\n\n if r >= N or P[r] != up:\n print(up)\n break\n \n l -= 1\n r += 1\n \nif __name__ == \'__main__\':\n\tmain()\n'] | ['Runtime Error', 'Accepted'] | ['s095848955', 's998949666'] | [9240.0, 9236.0] | [25.0, 22.0] | [732, 765] |
p02641 | u857547702 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['P=list(map(int,input().split()))\nP=sorted(P)\nx=bisect_left(P,X)\nif x>=len(P):\n print(X)\n sys.exit()\nif P[x]!=X:\n print(X)\n sys.exit()\nA=X\nB=X\nwhile True:\n A-=1\n B+=1\n x1=bisect_left(P,A)\n x2=bisect_left(P,B)\n\n if x1<len(P) and P[x1]!=A:\n print(A)\n break\n \n if x2<len(P) and P[x2]!=B:\n print(B)\n break', 'import sys\nX,N=list(map(int,input().split()))\nP=list(map(int,input().split()))\nif not X in P:\n print(X)\n sys.exit()\nA=X\nB=X\nwhile True:\n A-=1\n B+=1\n if not A in P:\n print(A)\n sys.exit()\n if not B in P:\n print(B)\n sys.exit()'] | ['Runtime Error', 'Accepted'] | ['s322234301', 's818143574'] | [9240.0, 9196.0] | [24.0, 20.0] | [365, 269] |
p02641 | u861886710 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X, N = list(map(int, input().split()))\np = list(map(int, input().split()))\np_max = max(p)\ndiff = [0]\n\nfor i in range(1, 101):\n if X - i not in P:\n print(X -1)\n break\n if X + i not in P:\n print(X + i)\n break', 'import numpy as np\n\n\ndef getNearestValue(list, num):\n\n \n idx = np.abs(np.asarray(list) - num).argmin()\n return list[idx]\n\n\nif __name__ == "__main__":\n\n X, N = list(map(int, input().split()))\n p = list(map(int, input().split()))\n print(np.sort(p))\n print(getNearestValue(p, X-1))\n for i in range(np.sort(p)):', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nfor i in range(200):\n if X - i not in p:\n print(X - i)\n break\n if X + i not in p:\n print(X + i)\n break'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s118634146', 's437371040', 's612077977'] | [9184.0, 8952.0, 9168.0] | [24.0, 21.0, 29.0] | [283, 420, 206] |
p02641 | u863370423 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ["#input from user X and N\n#input from user p\n#print the number that is nearest to X but not included in p\n#if N = 0, p doesn't have to be taken, only X will be printed\n#time complexity O(n)\n\nX,N = [int(x) for x in input().split()]\np = [int(x) for x in input().split()[:N]]\n\n\na = X + 1\nb = X - 1\nif a < b :\n if a not in p:\n print(a)\n\nelif b < a:\n if b not in p:\n print(b)\n\n \n", '# inpute integer (x) along with integer sequence (n)\n# finding the integer nearest to x within the given range 100\n# no time i have to submit\nx, n = map(int, input().split()) # take input from the user\nP = list(map(int, input().split()))\n\nfor i in range(101): # loop through the range\n length = x - i\n result = x + i\n if length not in P:\n print(length)\n break\n elif result not in P:\n print(result)\n break\n\n'] | ['Wrong Answer', 'Accepted'] | ['s214376815', 's959893215'] | [9168.0, 9120.0] | [30.0, 26.0] | [404, 448] |
p02641 | u863397945 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()))\nn_l = sorted(l)\n\nfor i in range(N-2):\n if n_l[i]<= X < n_l[i+1]:\n print(n_l[i])\n else:\n print(n_l[N-1])\n break', 'X,N = map(int,input().split())\nl = list(map(int,input().split()))\nn_l = sorted(l)\n\nfor i in range(N-2):\n if n_l[i]<= X < n_l[i+1]:\n print(n_l[i])\n else:\n print(n_l[N-1])\n break', 'X,N = map(int,input().split())\nl = list(map(int,input().split()))\nn_l = sorted(l)\n\nfor i in range(100):\n if not X-i in n_l:\n print(X-i)\n break\n elif not X+i in n_l:\n print(X+i)\n break\n pass'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s092261035', 's778332143', 's624362226'] | [9060.0, 9020.0, 9036.0] | [25.0, 28.0, 27.0] | [187, 187, 212] |
p02641 | u868884408 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['kazulist = []\nfor i in range(100):\n kazulist.append(i+1)\n\na = list(input().split(" "))\ntarget = int(a[0])\nsyokyo = int(a[1])\n\nb = list(input().split(" "))\nfor i in b:\n kazulist.pop(int(i))\n\nsaisyosa = 100\nkotae = 0\nfor i in kazulist:\n sa = target - int(i)\n if sa < 0:\n sa *= -1\n if sa < saisyosa:\n saisyosa = 0\n kotae = i\n\nprint(i)\n', 'kazulist = []\nfor i in range(100):\n kazulist.append(i+1)\n \na = list(input().split(" "))\ntarget = int(a[0])\nsyokyo = int(a[1])\n \nb = list(input().split(" "))\nfor i in b:\n kazulist.pop(int(i))\n \nsaisyosa = 100\nkotae = 0\nfor i in kazulist:\n sa = target - int(i)\n if sa < 0:\n sa *= -1\n if sa < saisyosa:\n saisyosa = 0\n kotae = i\n \nprint(kotae)', 'kazulist = []\nfor i in range(-100,200):\n kazulist.append(i)\n \na = list(input().split(" "))\ntarget = int(a[0])\nsyokyo = int(a[1])\n\nif syokyo != 0:\n b = list(input().split(" "))\n for i in b:\n kazulist.remove(int(i))\n \nsaisyosa = 100\nkotae = 0\nfor i in kazulist:\n sa = target - int(i)\n #print(sa)\n if sa < 0:\n sa *= -1\n if sa < saisyosa:\n saisyosa = sa\n kotae = i\n \nprint(kotae)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s202288667', 's478674864', 's264578326'] | [9200.0, 9208.0, 9208.0] | [22.0, 24.0, 25.0] | [368, 375, 424] |
p02641 | u869265610 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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=list(map(int,input().split()))\nL=list(map(int,input().split()))\nif N not in L:\n print(N)\n exit()\nc=N\nd=N\nwhile True:\n if c not in L:\n break\n else:\n c-=1\nwhile True:\n if d not in L:\n break\n else:\n d+=1\nif abs(d-M)>=abs(c-M):\n print(c)\nelse:\n print(d)\n \n \n \n ', 'N,M = list(map(int,input().split()))\nA = list(map(int,input().split()))\n \nfor i in range(100):\n if N-i not in A:\n print(N-i)\n exit()\n elif N+i in A and N+i!=N-i:\n print(N+i)\n exit()', 'N,M=list(map(int,input().split()))\nL=list(map(int,input().split()))\nif N not in L:\n print(N)\n exit()\nc=N\nd=N\nwhile True:\n if c not in L:\n break\n else:\n c-=1\nwhile True:\n if d not in L:\n break\n else:\n d+=1\nif abs(d-N)>=abs(c-N):\n print(c)\nelse:\n print(d)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s148899829', 's179429450', 's491380149'] | [9176.0, 8940.0, 9108.0] | [25.0, 27.0, 28.0] | [291, 196, 273] |
p02641 | u876616721 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ["x,n = list(map(int,input().split()))\nif n >0 :\n p = list(map(int,input().split()))\n#print(x,n)\n#print(p)\n#print(max(p))\ny = 100\nans = n\nif n == 0:\n print(x)\nelse:\n for i in range(100):\n if p.count(i) == 0:\n print('i=',i,abs(x-i))\n if abs(x-i) < y:\n ans = i\n y = abs(x-i)\n print(ans)", '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\n#if not x-s in p:\n# print(x - s)\n#else:\n# print(x + s)\n', "x,n = list(map(int,input().split()))\nif n >0 :\n p = list(map(int,input().split()))\n#print(x,n)\n#print(p)\n#print(max(p))\ny = 100\nans = n\nif n == 0:\n print(x)\nelse:\n for i in range(0,101):\n if i != x:\n if p.count(i) == 0:\n print('i=',i,abs(x-i))\n if abs(x-i) < y:\n ans = i\n y = abs(x-i)\n print(ans)", "x,n = list(map(int,input().split()))\nif n >0 :\n p = list(map(int,input().split()))\ny = 101\n\nif n == 0:\n print(x)\nelse:\n for i in range(0,101):\n \n if p.count(i) == 0:\n print('i=',i,abs(x-i))\n if abs(x-i) < y:\n ans = i\n y = abs(x-i)\n print('i=',i,'abs=',abs(x-i),'ans=',ans)\n print(ans)", "x,n = list(map(int,input().split()))\nif n >0 :\n p = list(map(int,input().split()))\n#print(x,n)\n#print(p)\n#print(max(p))\ny = 100\nans = n\nif n == 0:\n print(x)\nelse:\n for i in range(max(p)+1):\n if p.count(i) == 0:\n for j in range(i,100):\n #print('i=',i,abs(x-j))\n if abs(x-j) < y:\n ans = j\n y = abs(x-j)\n print(ans)", "x,n = list(map(int,input().split()))\nif n >0 :\n p = list(map(int,input().split()))\ny = 101\n\nif n == 0:\n print(x)\nelse:\n for i in range(0,102):\n \n if p.count(i) == 0:\n #print('i=',i,abs(x-i))\n if abs(x-i) < y:\n ans = i\n y = abs(x-i)\n #print('i=',i,'abs=',abs(x-i),'ans=',ans)\n print(ans)"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s495147391', 's634921794', 's807430252', 's824066083', 's906860575', 's925152804'] | [9144.0, 9120.0, 9208.0, 9228.0, 9224.0, 9132.0] | [22.0, 22.0, 22.0, 31.0, 20.0, 29.0] | [313, 278, 340, 356, 356, 358] |
p02641 | u882179152 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['x, n = list(map(int, input().split()))\n\nif n == 0:\n print(x)\n exit(0)\nelse:\n arr = list(map(int, input().split()))\n\narr.sort()\nprint(arr)\ni = arr.index(x)\n\nif not i and i != 0:\n print(x)\n exit(0)\n\nj = 1\nfor _ in range(n):\n row = i - j\n high = i + j\n if row >= 0 and arr[row] != x - j:\n print(x - j)\n exit(0)\n elif high <= n-1 and arr[high] != x + j:\n print(x + j)\n exit(0)\n j += 1\n\nprint(x-1)\n\n', 'x, n = list(map(int, input().split()))\n\nif n == 0:\n print(x)\n exit(0)\nelse:\n arr = list(map(int, input().split()))\n\narr.sort()\nif x in arr:\n i = arr.index(x)\nelse:\n print(x)\n exit(0)\n\nif not i and i != 0:\n print(x)\n exit(0)\n\nj = 1\nfor _ in range(n):\n row = i - j\n high = i + j\n if x - j not in arr:\n print(x - j)\n exit(0)\n elif x + j not in arr:\n print(x + j)\n exit(0)\n j += 1\n\nprint(x-1)\n'] | ['Runtime Error', 'Accepted'] | ['s830904207', 's017776483'] | [9064.0, 9216.0] | [30.0, 28.0] | [416, 414] |
p02641 | u882616665 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 = list(map(int, input().split()))\n if N==0: return\n \n P = list(map(int, input().split()))\n #allowed elements\n Q = set([i for i in range(1,100+1)])\n for p in P:\n Q.remove(p)\n Q = sorted(Q)\n # distance from X\n D = [abs(q-X) for q in Q]\n \n minD = min(D)\n for d,q in zip(D,Q):\n if d==min(D):\n break\n return q\n \nmain()', "def main():\n X,N = list(map(int, input().split()))\n P = list(map(int, input().split()))\n #allowed elements\n Q = set([i for i in range(0,101+1)])\n for p in P:\n Q.remove(p)\n Q = sorted(Q)\n # distance from X\n D = [abs(q-X) for q in Q]\n \n minD = min(D)\n for d,q in zip(D,Q):\n if d==minD:\n break\n print(q)\n \nif __name__=='__main__':\n main()\n"] | ['Runtime Error', 'Accepted'] | ['s788816975', 's376267448'] | [9100.0, 8992.0] | [27.0, 29.0] | [402, 388] |
p02641 | u887080361 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['xn=input().split()\nx=int(xn[0])\nn=int(xn[1])\n\ndata=input().split()\nfor i in range(100):\n for d in data:\n if int(d) == x-i:\n print(int(d))\n break\n elif int(d) == x+i:\n print(int(d))\n break\n else:\n continue\n break', 'xn=input().split()\nx=int(xn[0])\nn=int(xn[1])\n\ndata=input().split()\nfor i in range(100):\n for d in data:\n if d == x-i:\n print(d)\n break\n elif d == x+i:\n print(d)\n break', 'xn=input().split()\nx=int(xn[0])\n\ndata=input().split()\nfor i in range(100):\n for d in data:\n if int(d) == x-i:\n break\n else:\n print(x-i)\n break\n \n for d in data:\n if int(d) != x+i:\n break\n else:\n print(x+i)\n break\n ', 'xn=input().split()\nx=int(xn[0])\nn=int(xn[1])\n\ndata=input().split()\nfor i in range(100):\n for d in data:\n if int(d) == x-i:\n print(d)\n break\n elif int(d) == x+i:\n print(d)\n break\n break', 'xn=input().split()\nx=int(xn[0])\nn=int(xn[1])\n\ndata=input().split()\nfor i in range(100):\n for d in data:\n if d == x-i:\n print(d)\n break\n elif d == x+i:\n print(d)\n break\n break', 'xn=input().split()\nx=int(xn[0])\nn=int(xn[1])\n\ndata=input().split()\nfor i in range(100):\n for d in data:\n if int(d) != x-i:\n print(int(d))\n break\n elif int(d) != x+i:\n print(int(d))\n break\n else:\n continue\n break', 'xn=input().split()\nx=int(xn[0])\nn=int(xn[1])\n\ndata=input().split()\nfor i in range(100):\n for d in data:\n if int(d) == x-i:\n print(int(d))\n break\n elif int(d) == x+i:\n print(int(d))\n break\n else:\n continue\n break', 'xn=input().split()\nx=int(xn[0])\n\ndata=input().split()\nfor i in range(100):\n for d in data:\n if int(d) == x-i:\n break\n else:\n print(x-i)\n break\n \n for d in data:\n if int(d) == x+i:\n break\n else:\n print(x+i)\n break\n '] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s026633249', 's039294693', 's231268042', 's255054836', 's388117205', 's394884344', 's819116740', 's426375744'] | [9168.0, 9180.0, 9052.0, 9076.0, 9064.0, 9092.0, 9064.0, 9020.0] | [26.0, 30.0, 31.0, 28.0, 27.0, 29.0, 31.0, 27.0] | [285, 228, 296, 248, 238, 285, 285, 296] |
p02641 | u887152994 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X,N=map(int,input().split())\nList=[int(i) for i in input().split()]\nA=X\nB=X\nif X in List == True: \n p=True\n q=True\n while p==True:\n A=A-1\n p= A in List\n while q==True:\n B=B+1\n q= B in List\n if X-A <= B-X:\n print (A)\n else:\n print (B)\nelse:\n print(X)', 'X,N=map(int,input().split())\nList=[int(i) for i in input().split()]\nA=X\nB=X\nC=X in List\nif C == True: \n p=True\n q=True\n while p==True:\n A=A-1\n p= A in List\n while q==True:\n B=B+1\n q= B in List\n if X-A <= B-X:\n print (A)\n else:\n print (B)\nelse:\n print(X)'] | ['Wrong Answer', 'Accepted'] | ['s411498472', 's148564070'] | [9200.0, 9180.0] | [21.0, 23.0] | [315, 319] |
p02641 | u888260487 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X,N=map(int,input().split())\nif N>0:\n p=list(map(int,input().split()))\n d=abs(X-p[0])\nif N>0:\n for i in range(N):\n d=min(abs(X-p[i]),d)\n print(p[i])\nelse:\n print(X)', 'X,N=map(int,input().split())\nl=[]\nfor i in range(100):\n l.append(i+1)\nif N>0:\n p=list(map(int,input().split()))\n l1=[x for x in l if x not in p]\n d=abs(X-l1[0])\nif N>0:\n for i in range(N):\n d=min(abs(X-l1[i]),d)\n print(l1[i])\nelse:\n print(X)', 'x, n = map(int, input().split())\na = [int(x) for x in input().split()]\nb = [i for i in range(0,102) if i not in a] \nb_tmp = list(map(lambda s:abs(s-x), b)) \naddress = b_tmp.index(min(b_tmp))\nprint(b[address])'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s003483451', 's439807875', 's319116012'] | [9196.0, 9200.0, 9048.0] | [22.0, 22.0, 22.0] | [172, 251, 258] |
p02641 | u890488173 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\nif (x == 1 and y == 2) or (x == 1 and y == 4):\n print('Yes')\n quit()\n\nfor i in range(-101,201):\n if i * 2 + (x - i) * 4 == y:\n print('Yes')\n quit()\nprint('No')", 'x, y = map(int, input().split())\nli = list(map(int, input().split()))\n\nif y == 0:\n print(x)\n quit()\n\nans=[]\nfor i in range(-101,201):\n if not i in li:\n ans.append(abs(i - x))\n\nif not x - min(ans) in li:\n print(x-min(ans))\nelif not min(ans) + x in li:\n print(min(ans) + x)'] | ['Wrong Answer', 'Accepted'] | ['s253805409', 's660585569'] | [9184.0, 9200.0] | [23.0, 21.0] | [216, 293] |
p02641 | u893661063 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['x, n = map(int, input().split())\np = list(map(int, input().split()))\nprint (p)\n\nfor i in range(100):\n if not((x - i) in p):\n print (x - i)\n exit ()\n if not((x + i) in p):\n print (x + i)\n exit()\n', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nfor i in range(100):\n if not((x - i) in p):\n print (x - i)\n exit ()\n elif not((x + i) in p):\n print (x + i)\n exit()'] | ['Wrong Answer', 'Accepted'] | ['s519279192', 's620072670'] | [8984.0, 9188.0] | [31.0, 30.0] | [228, 219] |
p02641 | u894858952 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X,N = map(int,input().split())\np = list(map(int, input().split()))\n\ni = 0\n\nif X not in p:\n print(X)\n\nelse:\n while True:\n i += 1\n if X - i not in p:\n print(X-i)\n if X+i not in p:\n print(X+i)', 'X,N = map(int,input().split())\np = list(map(int, input().split()))\n\ni = 0\n\nif X not in p:\n print(X)\n\nelse:\n while True:\n i += 1\n if X - i not in p:\n print(X-i)\n break\n if X+i not in p:\n print(X+i)\n break\n'] | ['Time Limit Exceeded', 'Accepted'] | ['s271295096', 's339719172'] | [47856.0, 9092.0] | [2251.0, 28.0] | [210, 235] |
p02641 | u894939163 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['class int(int): \n def times(self, callback):\n for times in range(0,self):\n callback()\n\nclass list(list):\n def maps(self, callback):\n return list(map(callback, self))\n\n def each(self, callback):\n list(map(callback, self))\n return self\n\n # index will sent to the function as a second parameter.\n def each_with_index(self,callback):\n list(map(callback, self, range(0,len(self))))\n return self\n\n# Make sure you initialize object with class name.\n# Ex: int(10).times, array = list([1,2,3,4,5])\n\ntarget, length = input().split()\ntarget = int(target)\nlength = int(length)\nnums = list(input().split())\n\ndef convert(arg):\n return int(arg)\nnums = nums.maps(convert)\n\nfor i in range(0,101):\n a = target - i\n if a not in nums:\n print(a)\n exit()\n\n a = target + u\n if b not in nums:\n print(b)\n exit()', 'class int(int): \n def times(self, callback):\n for times in range(0,self):\n callback()\n\nclass list(list):\n def maps(self, callback):\n return list(map(callback, self))\n\n def each(self, callback):\n list(map(callback, self))\n return self\n\n # index will sent to the function as a second parameter.\n def each_with_index(self,callback):\n list(map(callback, self, range(0,len(self))))\n return self\n\n# Make sure you initialize object with class name.\n# Ex: int(10).times, array = list([1,2,3,4,5])\n\ntarget, length = input().split()\ntarget = int(target)\nlength = int(length)\no_nums = list(input().split())\n\nif length == 0:\n def convert(arg):\n return int(arg)\n\n o_nums = o_nums.maps(convert)\n diffs = list()\n nums = list()\n for exclude_num in range(min(o_nums), max(o_nums)+1):\n if exclude_num in o_nums:\n continue\n else:\n nums.append(exclude_num)\n\n for num in nums:\n diffs.append(target - num)\n\n def absm(arg):\n return abs(arg)\n\n diffs_abs = diffs.maps(absm)\n smallest_diff_index = diffs_abs.index(min(diffs_abs)) \n\n if -(diffs_abs[smallest_diff_index]) in diffs: \n index = diffs.index(-(diffs_abs[smallest_diff_index]))\n print(nums[index])\n else:\n print(nums[smallest_diff_index])\n\nelif length == 1:\n print(o_nums[0])\n\nelse:\n print(target)', 'class int(int): \n def times(self, callback):\n for times in range(0,self):\n callback()\n\nclass list(list):\n def maps(self, callback):\n return list(map(callback, self))\n\n def each(self, callback):\n list(map(callback, self))\n return self\n\n # index will sent to the function as a second parameter.\n def each_with_index(self,callback):\n list(map(callback, self, range(0,len(self))))\n return self\n\n# Make sure you initialize object with class name.\n# Ex: int(10).times, array = list([1,2,3,4,5])\n\ntarget, length = input().split()\ntarget = int(target)\nlength = int(length)\nnums = list(input().split())\n\ndef convert(arg):\n return int(arg)\nnums = nums.maps(convert)\n\nfor i in range(0,101):\n \n a = target - i \n if a not in num:\n print(a)\n exit()\n\n b = target + i \n if b not in nums:\n print(b)\n exit()\n \n', 'class int(int): \n def times(self, callback):\n for times in range(0,self):\n callback()\n\nclass list(list):\n def maps(self, callback):\n return list(map(callback, self))\n\n def each(self, callback):\n list(map(callback, self))\n return self\n\n # index will sent to the function as a second parameter.\n def each_with_index(self,callback):\n list(map(callback, self, range(0,len(self))))\n return self\n\n# Make sure you initialize object with class name.\n# Ex: int(10).times, array = list([1,2,3,4,5])\n\ntarget, length = input().split()\ntarget = int(target)\nlength = int(length)\nnums = list(input().split())\n\ndef convert(arg):\n return int(arg)\nnums = nums.maps(convert)\n\nfor i in range(0,101):\n \n a = target - i \n if a not in nums:\n print(a)\n exit()\n\n b = target + i \n if b not in nums:\n print(b)\n exit()\n \n\n\n\n\n\n\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s014211160', 's846344576', 's949733504', 's036310633'] | [9136.0, 9288.0, 9240.0, 9176.0] | [27.0, 25.0, 27.0, 29.0] | [834, 1414, 1195, 1202] |
p02641 | u895536501 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['if n != 0:\n p = list(map(int, input().split()))\n \nresult = x\nif n != 0:\n for i in range(0, 1000):\n if not (x - i) in p:\n print(x - i)\n break\n if not (x + i) in p:\n print(x + i)\n break\nelse:\n print(x)\n ', 'X,N= map(int,input().split())\np = list(map(int,input().split()))\nfor i in range(100):\n if X-i not in p:\n print(X-i)\n exit()\n if X+i not in p:\n print(X+i)\n exit()'] | ['Runtime Error', 'Accepted'] | ['s137563661', 's470901810'] | [9020.0, 9188.0] | [24.0, 19.0] | [271, 175] |
p02641 | u910362203 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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, inpot().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)', '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)'] | ['Runtime Error', 'Accepted'] | ['s081189144', 's159668242'] | [9172.0, 9124.0] | [26.0, 26.0] | [205, 205] |
p02641 | u910536093 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 = list(map(int, input().split()))\np = list(map(int, input().split()))\n\nif (n == 0):\n print(x)\n sys.exit()\n\na = [i for i in range(-110,210)]\n\nfor j in p:\n d = a.index(j)\n a.pop(d)\n\na.append(x)\na = set(a.sort())\n\nidx_x = a.index(x)\n\nif (idx_x == 0):\n print(a[idx_x+1])\n sys.exit()\nif (idx_x == len(a)-1):\n print(a[-2])\n sys.exit()\n\nlesser = a[idx_x-1]\ngreater = a[idx_x+1]\n\ndl = abs(x - lesser)\ndg = abs(greater - x)\n\nif (dl <= dg):\n print(lesser)\nelse:\n print(greater)\n', 'import sys\nx, n = list(map(int, input().split()))\np = list(map(int, input().split()))\n\nif (n == 0):\n print(x)\n sys.exit()\n\ni = 0\nwhile True:\n if (not (x-i) in p):\n print(x-i)\n break\n if (not (x+i) in p):\n print(x+i)\n break\n i += 1\n'] | ['Runtime Error', 'Accepted'] | ['s421747690', 's637334324'] | [9120.0, 9128.0] | [22.0, 24.0] | [514, 274] |
p02641 | u916242112 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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())\nN = list(map(int,input().split()))\nS =[]\nkey = 9999\nfor i in range(b):\n\tc = [N[i]-a]\n\tS.extend(c)\nfor i in range(b):\n\tif key > abs(S[i]):\n\t\tkey= abs(S[i])\nif key ==0:\n\tprint(a)\nelse:\n\tif a - key in S:\n\t\tprint(a-key)\n\telse:\n\t\tprint(a+key)', 'a,b= map(int,input().split())\nN = list(map(int,input().split()))\nS =[]\nkey = 0\nwhile(1):\n\tif a-key in N:\n\t\tif a +key in N:\n\t\t\tkey +=1\n\t\telse:\n\t\t\tprint(a+key)\n\t\t\tbreak\n\t\t\n\telse:\n\t\tprint(a-key)\n\t\tbreak'] | ['Wrong Answer', 'Accepted'] | ['s250653619', 's644612386'] | [9144.0, 9172.0] | [23.0, 26.0] | [267, 199] |
p02641 | u916662650 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['x,n = (int(x) for x in input().split())\np = [int(x) for x in input().split()]\n\nresult = 100\n\nl = list(range(0,6))\n\n\n\nif len(p) == 0:\n kotae = x\nelse:\n for i in range(len(p)):\n\n l[p[i]] = 200\n\n\n for i in reversed(range(len(l))):\n \n \n\n if l[i] != 200:\n\n if result >= abs(l[i] - x):\n result = abs(l[i] - x)\n \n kotae = l[i]\n \n \n\n\n\nprint(kotae)', 'x,n = (int(x) for x in input().split())\np = [int(x) for x in input().split()]\n\nresult = 100\n\nl = list(range(0,102))\n\n\n\nif len(p) == 0:\n kotae = x\nelse:\n for i in range(len(p)):\n\n l[p[i]] = ""\n\n\n\n for i in reversed(range(len(l))):\n \n if l[i] != "":\n\n if result >= abs(l[i] - x):\n result = abs(l[i] - x)\n \n kotae = l[i] \n \nprint(kotae)\n'] | ['Runtime Error', 'Accepted'] | ['s240812596', 's752485499'] | [9212.0, 9096.0] | [21.0, 27.0] | [442, 436] |
p02641 | u921729430 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 x in p:\n print(x)\nelse:\n for i in range(100):\n if x-i in p:\n print(x-i)\n break\n if x+i in p:\n print(x+i)\n break', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nif not(x in p):\n print(x)\nelse:\n for i in range(100):\n if not(x-i in p):\n print(x-i)\n break\n if not(x+i in p):\n print(x+i)\n break'] | ['Wrong Answer', 'Accepted'] | ['s400044532', 's439348438'] | [9176.0, 9184.0] | [23.0, 19.0] | [212, 227] |
p02641 | u923172145 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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#print(p)\n#A.sort()\ndis = p[0] - X\nans = p[0]\nfor pi in p :\n if abs(pi-X) < abs(dis):\n ans = pi\n dis = pi - X\n #print("if")\n elif pi-X == -abs(dis):\n ans = pi\n dis = pi - X\n \nprint(ans)', 'X, N = map(int,input().split())\nif N > 0:\n p = list(map(int, input().split()))\nelse:\n p=[]\n#print(p)\np.sort()\n#dis = p[0] - X\nans_1 = X\nans_2 = X\nfor i in range(N) :\n pi = p[i]\n if pi == ans_1:\n ans_1 += 1\n\np.reverse()\nfor i in range(N) :\n pi = p[i]\n if pi == ans_2:\n ans_2 -= 1\n\nans = X\nif abs(ans_1 - X) < abs(ans_2 - X):\n ans = ans_1\nelif ans_1 - X == -abs(ans_2 - X):\n ans = ans_1\nelse:\n ans = ans_2\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s589899221', 's518966120'] | [9192.0, 9216.0] | [23.0, 20.0] | [308, 429] |
p02641 | u924828749 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()]\nif n == 0:\n print(x)\nelse:\n p = [int(x) for x in input().split()]\n p.sort()\n ans = []\n for i in range(1,101):\n if i in p:\n continue\n b = abs(x - i)\n ans.append((i,b))\n ans = sorted(ans,key = lambda x: x[1])\n print(ans)\n print(ans[0][0])', 'x,n = [int(x) for x in input().split()]\nif n == 0:\n print(x)\nelse:\n p = [int(x) for x in input().split()]\n p.sort()\n a = 1000\n for i in range(n):\n b = abs(x - p[i])\n if b < a:\n a = i\n print(a)', '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)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s380491448', 's928625058', 's615556581'] | [9204.0, 9184.0, 9092.0] | [29.0, 31.0, 31.0] | [298, 209, 183] |
p02641 | u924852499 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['from sys import stdin\n \ninput_num = stdin.readline().strip().split(" ")\n\nX = int(input_num[0])\nN = int(input_num[1])\nnum_list = []\nif N != 0:\n num_list = [int(x) for x in stdin.readline().strip().split(" ")]\n\ndec_num = X\ninc_num = X\nif N == 0:\n print(X)\nelif X not in num_list:\n print(X)\nelse:\n while True:\n dec_num += -1\n inc_num += 1\n if dec_num not in num_list:\n print(dec_num)\n break\n if inc_num not in num_list:\n print(dec_num)\n break', 'from sys import stdin\n \ninput_num = stdin.readline().strip().split(" ")\n\nX = int(input_num[0])\nN = int(input_num[1])\nnum_list = [int(x) for x in stdin.readline().strip().split(" ")]\n\nminv = 10000\nnum = 0\n\nif N == 0:\n print(X)\nelse:\n for i in range(len(num_list)):\n if minv > abs(X - num_list[i]):\n minv = abs(X - num_list[i])\n num = i\n print(num)', 'from sys import stdin\n \ninput_num = stdin.readline().strip().split(" ")\n\nX = int(input_num[0])\nN = int(input_num[1])\nnum_list = [int(x) for x in stdin.readline().strip().split(" ")]\n\nminv = 10000\nnum = 0\n\nif N == 0:\n print(X)\nelse:\n for i in range(len(num_list)):\n if minv > abs(X - num_list[i]):\n minv = abs(X - num_list[i])\n num = i\n print(num_list[num])', 'from sys import stdin\n \ninput_num = stdin.readline().strip().split(" ")\n\nX = int(input_num[0])\nN = int(input_num[1])\nnum_list = stdin.readline().strip().split(" ")\n\nminv = 10000\nnum = 0\n\nif N == 0:\n print(X)\nelse:\n for i in range(len(num_list)):\n if minv > abs(X - num_list[i]):\n minv = abs(X - num_list[i])\n num = i\n print(num)\n\n \n \n ', 'from sys import stdin\n \ninput_num = stdin.readline().strip().split(" ")\n\nX = int(input_num[0])\nN = int(input_num[1])\nnum_list = []\nif N != 0:\n num_list = [int(x) for x in stdin.readline().strip().split(" ")]\n\n\ndec_num = X\ninc_num = X\nif N == 0:\n print(X)\nelif X not in num_list:\n print(X)\nelse:\n while True:\n dec_num += -1\n inc_num += 1\n if dec_num not in num_list:\n print(dec_num)\n break\n if inc_num not in num_list:\n print(inc_num)\n break'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s290586728', 's335684027', 's903358398', 's982646632', 's618318222'] | [8868.0, 8944.0, 9200.0, 9132.0, 9200.0] | [27.0, 26.0, 26.0, 24.0, 28.0] | [523, 362, 372, 360, 524] |
p02641 | u926266624 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 P.len == 0:\n print(X)\nelse:\n for i in range(X,1):\n if P.index(X-i) == 0:\n print(X-i)\n break\n elif P.index(X+1) == 0:\n print(X+1)\n break\n else:\n continue', 'X,N = map(int, input().split())\nP = list(map(int, input().split()))\n\nif P.len == 0:\n print(X)\nelse:\n for i in range(X,1):\n if P.count(X-i) == 0:\n print(X-i)\n break\n elif P.count(X+1) == 0:\n print(X+1)\n break\n else:\n continue', 'X,N = map(int, input().split())\nP = list(map(int, input().split()))\n\nif len(P) == 0:\n print(X)\nelse:\n for i in range(1,100):\n if P.count(X-i) == 0:\n print(X-i)\n break\n elif P.count(X+1) == 0:\n print(X+1)\n break\n else:\n continue\n', 'X,N = map(int, input().split())\nP = list(map(int, input().split()))\n\nif P.len == 0:\n print(X)\nelse:\n for i in range(1,100):\n if P.count(X-i) == 0:\n print(X-i)\n break\n elif P.count(X+1) == 0:\n print(X+1)\n break\n else:\n continue', 'X,N = map(int, input().split())\nP = list(map(int, input().split()))\n\nif len(P) == 0:\n print(X)\nelse:\n for i in range(0,10000):\n if P.count(X-i) == 0:\n print(X-i)\n break\n elif P.count(X+i) == 0:\n print(X+i)\n break\n else:\n continue'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s104593814', 's286849868', 's309622494', 's955552486', 's267839336'] | [9148.0, 9204.0, 9176.0, 9188.0, 9184.0] | [28.0, 30.0, 27.0, 23.0, 33.0] | [260, 260, 264, 262, 265] |
p02641 | u931889893 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\nif N == 1:\n if not (X - 1) in P:\n print(X - 1)\n exit()\n if not (X + 1) in P:\n print(X + 1)\n exit()\n\nfor n in range(1, (N // 2) + 1):\n print(X - n)\n print(X + n)\n if not (X - n) in P:\n print(X - n)\n exit()\n if not (X + n) in P:\n print(X + n)\n exit()\nif min(P) - 1 < 0:\n print(max(P) + 1)\n exit()\nprint(min(P) - 1)', 'X, N = map(int, input().split())\nif N == 0:\n print(X)\n exit()\nP = list(map(int, input(). split()))\nif X not in P:\n print(X)\n exit()\n\nfor n in range(1, N + 1): \n if not (X - n) in P:\n print(X - n)\n exit()\n if not (X + n) in P:\n print(X + n)\n exit()\nprint(min(P) - 1)'] | ['Wrong Answer', 'Accepted'] | ['s484454082', 's557453294'] | [9168.0, 9144.0] | [22.0, 19.0] | [498, 314] |
p02641 | u933129390 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 for i in range(100)]\nfor i in p:\n table[i-1] = 1\n\nmx = 10000\nans = mx\ndis = mx\nfor i in range(len(table)):\n idx = 99-i\n if (table[idx] == 0) and (dis >= abs(idx+1-x)):\n ans = idx+1\n dis = abs(idx+1-x)\nif ans == mx:\n if 50 >= x\n print(0)\n else:\n print(101)\nelse:\n print(ans)\n', 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\ntable = [0 for i in range(102)]\nfor i in p:\n table[i] = 1\n\nmx = 10000\nans = mx\ndis = mx\nfor i in range(len(table)):\n idx = 101-i\n if (table[idx] == 0) and (dis >= abs(idx-x)):\n ans = idx\n dis = abs(idx-x)\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s066014948', 's069873060'] | [9072.0, 9196.0] | [20.0, 20.0] | [401, 309] |
p02641 | u934119021 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()))\na = 1\nans = ''\np.sort()\nprint(p)\nwhile ans == '':\n if len(p) == 0:\n ans = x\n elif x - a not in p:\n ans = x - a\n elif x + a not in p:\n ans = x + a\n else:\n a += 1\nprint(ans)", "x, n = map(int, input().split())\np = list(map(int, input().split()))\na = 0\nans = ''\nwhile ans == '':\n if len(p) == 0:\n ans = x\n elif x - a not in p:\n ans = x - a\n elif x + a not in p:\n ans = x + a\n else:\n a += 1\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s563850193', 's605683177'] | [9200.0, 9200.0] | [25.0, 22.0] | [256, 238] |
p02641 | u938933689 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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())\nanswer = 0\nif N != 0:\n mapped_list = map(int,input().split())\n list = list(mapped_list)\n print(list)\n for i in range (N):\n if (X-i in list) == False:\n answer = X-i\n break\n elif (X+i in list) == False:\n answer = X+i\n break\nelse:\n answer = X \n \nprint(answer)', 'X, N = map(int,input().split())\nanswer = 0\nif N != 0:\n mapped_list = map(int,input().split())\n list = list(mapped_list)\n for i in range (N):\n if (X-i in list) == False:\n answer = X-i\n break\n elif (X+i in list) == False:\n answer = X+i\n break\nelse:\n answer =X\n\nprint(answer)\n '] | ['Wrong Answer', 'Accepted'] | ['s577030353', 's621839605'] | [9100.0, 9076.0] | [28.0, 28.0] | [320, 305] |
p02641 | u939581910 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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())\nr=[i-x for i in map(int,input())]\ni=1\nwhile True:\n if not -i in r:\n print(x-i)\n break\n elif not i in r:\n print(x+i)\n else:\n i+=1', 'x,n=map(int,input().split())\nr=[i-x for i in map(int,input().split())]\ni=1\nwhile True:\n if not -i in r:\n print(x-i)\n break\n elif not i in r:\n print(x+i)\n else:\n i+=1\n', 'x,n=map(int,input().split())\nr=[i-x for i in map(int,input().split())]\nfor i in range(100):\n if not -i in r:\n print(x-i)\n elif not i in r:\n print(x+i)\n', 'x,n=map(int,input().split())\nr=[i-x for i in map(int,input())]\nfor i in range(100):\n if not -i in r:\n print(x-i)\n elif not i in r:\n print(x+i)', 'x,n=map(int,input().split())\nr=[i-x for i in map(int,input())]\nfor i in range(100):\n if not -(i+1) in r:\n print(x-i-1)\n break\n elif not i+1 in r:\n print(x+i+1)\n break', 'x,n=map(int,input().split())\nr=[i-x for i in map(int,input())]\nfor i in range(100):\n if not -(i+1) in r:\n print(x-i)\n elif not (i+1) in r:\n print(x+i)\n', 'x,n=map(int,input().split())\nr=[i-x for i in map(int,input().split())]\nfor i in range(n+1):\n if not -(i) in r:\n print(x-i)\n break\n elif not i in r:\n print(x+i)\n break\n'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s221096301', 's282746875', 's317668651', 's401308138', 's786935826', 's975763897', 's018652322'] | [9096.0, 27384.0, 9172.0, 9132.0, 9184.0, 9128.0, 9168.0] | [27.0, 2237.0, 24.0, 26.0, 25.0, 26.0, 24.0] | [172, 181, 159, 150, 180, 159, 181] |
p02641 | u940533000 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['import numpy as np\nX,N = map(int, input().split())\nif N != 0:\n p = list(map(int, input().split()))\n min_val = 0\n max_val = 101\n not_p = [i for i in range(min_val,max_val+1,1)]\n \n for i in range(N):\n not_p.remove(p[i])\n print(not_p)\n\n min_val = 999\n out_num = 101\n for i in range(len(not_p)):\n if abs(X-not_p[i]) < min_val:\n min_val = abs(X-not_p[i])\n out_num = not_p[i]\n print(out_num)\nelse:\n out_num = 0\n', 'import numpy as np\nX,N = map(int, input().split())\nif N != 0:\n p = list(map(int, input().split()))\n min_val = 0\n max_val = 101\n not_p = [i for i in range(min_val,max_val+1,1)]\n print(not_p)\n for i in range(N):\n not_p.remove(p[i])\n\n min_val = 999\n out_num = 101\n for i in range(len(not_p)):\n if abs(X-not_p[i]) < min_val:\n min_val = abs(X-not_p[i])\n out_num = not_p[i]\nelse:\n out_num = 0\nprint(out_num)\n', 'import numpy as np\nX,N = map(int, input().split())\nif N != 0:\n p = list(map(int, input().split()))\n min_val = 0\n max_val = 101\n not_p = [i for i in range(min_val,max_val+1,1)]\n \n for i in range(N):\n not_p.remove(p[i])\n print(not_p)\n\n min_val = 999\n out_num = 101\n for i in range(len(not_p)):\n if abs(X-not_p[i]) < min_val:\n min_val = abs(X-not_p[i])\n out_num = not_p[i]\n print(out_num)\nelse:\n print(0)\n', 'import numpy as np\nX,N = map(int, input().split())\n\n\nif N == 0:\n print(X)\nelse:\n ans_v = 102\n ans_idx = 0\n candidate = list(np.arange(0,102))\n p = list(map(int, input().split()))\n for i in range(N):\n candidate.remove(p[i])\n for i in range(len(candidate)):\n if ans_v > abs(X-candidate[i]):\n ans_v = abs(X-candidate[i])\n ans_idx = i\n print(candidate[ans_idx])\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s126297320', 's709241111', 's800015165', 's527335931'] | [27184.0, 27176.0, 27148.0, 26940.0] | [109.0, 111.0, 99.0, 116.0] | [433, 428, 430, 382] |
p02641 | u941438707 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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,*a=map(int,open(0).read().split())\nb=[1]*101\nfor i in a:\n b[i]=0\nc=1000 \nans=n\nfor i in range(102):\n if b[i] and c>abs(x-i):\n c=abs(x-i)\n ans=i\nprint(ans)', 'x,n,*a=map(int,open(0).read().split())\nb=[1]*103\nfor i in a:\n b[i]=0\nc=1000 \nans=n\nfor i in range(102):\n if b[i] and c>abs(x-i):\n c=abs(x-i)\n ans=i\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s308823317', 's019753298'] | [9220.0, 9192.0] | [25.0, 23.0] | [178, 178] |
p02641 | u944886577 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['c=[]\nd=0\ne=[]\n\na,b=map(int,input().split())\nc=int(input().split())\nif c!=null:\n for i in range(c):\n d=a-c\n e.append(abs(d))\nprint(min(e)) ', 'x,n=map(int,input().split())\ns=list(map(int,input().split()))\n\ndist=0\nfor i in range(0,100):\n if abs(x-i)>=0:\n for j in s:\n if s[j]==i:\n else:\n print(i)', 's=[]\nx,n=map(int,input().split())\ns=list(map(int,input().split()))\nslist=sorted(s)\n\nif n==0:\n print(x)\n exit()\nfor i in range(0,100):\n for j in range(n+1):\n if slist[j]==x-i:\n flag=1\n if slist[j]==x+i:\n flag=2\n \n if flag==2:\n flag=0\n elif flag==1:\n print(x+i)\n exit()\n elif flag==0:\n print(x-i)\n exit()', 's=[]\nx,n=map(int,input().split())\nif n==0:\n print(x)\n exit()\n \ns=list(map(int,input().split()))\nslist=sorted(s)\n \nfor i in range(0,1000):\n for j in range(n):\n if slist[j]==x-i:\n flaga=1\n if slist[j]==x+i:\n flagb=1\n \n if flaga=1 and flagb=1:\n flaga=0\n flagb=0\n elif flagb==0:\n print(x-i)\n exit()\n elif flaga==0:\n print(x+i)\n exit()', 's=[]\nx,n=map(int,input().split())\nif n==0:\n print(x)\n exit()\n \ns=list(map(int,input().split()))\nslist=sorted(s)\nout=0\nfor i in range(0,1000):\n out=0\n for j in range(n):\n if slist[j]==x-i:\n out=1\n if out !=1:\n print(x-i)\n exit()\n out=0\n for k in range(n):\n if slist[k]==x+i:\n out=1\n if out !=1:\n print(x+i)\n exit()'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s309667514', 's579423593', 's589744947', 's778549185', 's088327617'] | [9184.0, 8976.0, 9196.0, 9028.0, 9152.0] | [29.0, 30.0, 26.0, 23.0, 26.0] | [140, 164, 354, 387, 348] |
p02641 | u950052018 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()))\nb = list(map(int,input().split()))\nb.sort()\n\nP = a[1] - 1 \n\nlist = list(map(lambda x: x+1, list(range(b[P]))))\n\nif a[1] == 0:\n print(a[0])\n exit()\n\nfor i in range(a[1]):\n list.remove(b[i])\n\nnum = 0\n\nresult = []\n\nfor i in range(a[1]):\n x = a[0] - b[num]\n result.append(abs(x))\n num += 1\n\nprint(min(result))', 'X,N = map(int,input().split())\n\nif N == 0:\n print(X)\n exit()\nelse:\n P = list(map(int,input().split()))\n\n for i in range(100):\n if (X-i) not in P:\n print(X-i)\n break\n elif (X+i) not in P:\n print(X+i)\n break'] | ['Runtime Error', 'Accepted'] | ['s220104617', 's350522082'] | [9224.0, 9056.0] | [24.0, 23.0] | [346, 235] |
p02641 | u952170648 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['print(101)', 'print(0)', 'import sys\nx,n = map(int,input().split())\n \np,f = x-1,x+1\nbans = set(map(int,input().split()))\n\nif n == 0 or x not in bans:\n print(x)\n sys.exit()\n\nwhile True:\n if p not in bans:\n print(p)\n break \n p -= 1\n \n if f not in bans:\n print(f)\n break \n f += 1'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s606414177', 's734178385', 's959172560'] | [9080.0, 9076.0, 9196.0] | [20.0, 21.0, 23.0] | [10, 8, 302] |
p02641 | u957198490 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()', '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()'] | ['Runtime Error', 'Accepted'] | ['s304122189', 's250998751'] | [8976.0, 9052.0] | [22.0, 23.0] | [206, 206] |
p02641 | u957799665 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['m, n = map(int, input().split())\np = list(map(int, input().split()))\n\nif n == 0:\n print(m)\n exit()\nelse:\n pp = list(range(0, max(p)+1))\n ppp = list(filter(lambda x: x not in p, pp))\n print(ppp)\n pppp = list(map(lambda x: abs(x-m), ppp))\n print(ppp[pppp.index(min(pppp))])\n', 'm, n = map(int, input().split())\np = list(map(int, input().split()))\n\nfor d in range(m+1):\n for i in [-1,1]:\n a = m + i*d\n if p.count(a==0):\n print(a)\n exit()', 'm, n = map(int, input().split())\np = list(map(int, input().split()))\na=0\n\nwhile True:\n if m-a not in p:\n print(m-a)\n break\n elif m+a not in p:\n print(m+a)\n break\n a+=1'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s324621532', 's584463547', 's907383958'] | [9140.0, 9124.0, 9048.0] | [28.0, 26.0, 27.0] | [293, 197, 204] |
p02641 | u962423738 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\nfrom bisect import insort\n\nX,N=list(map(int,input().split()))\nif N != 0:\n\tp=list(map(int,input().split()))\n\n\tnot_list=[]\n\tfor i in range(1,101):\n\t\tif i not in p:\n\t\t\tnot_list.append(i)\n\n\t\ta=bisect(not_list,X)\n\t\tinsort(not_list,X)\n\n\t\tans1=not_list[a]-not_list[a-1]\n\t\tans2=not_list[a+1]-not_list[a]\n\n\t\tif ans1 < ans2:\n\t\t\tprint(not_list[a-1])\n\t\telif ans1 == ans2:\n\t\t\tprint(not_list[a-1])\n\t\telse:\n\t\t\tprint(not_list[a+1])\n \nelse:\n\tprint(X)', 'from bisect import bisect\nfrom bisect import insort\n\nX,N=list(map(int,input().split()))\nif N != 0:\n\tp=list(map(int,input().split()))\n\n\tnot_list=[]\n\tfor i in range(1,101):\n\t\tif i not in p:\n\t\t\tnot_list.append(i)\n\n\t\ta=bisect(not_list,X)\n\t\tinsort(not_list,X)\n\n\t\tans1=not_list[a]-not_list[a-1]\n\t\tans2=not_list[a+1]-not_list[a]\n\n\t\tif ans1 < ans2:\n\t\t\tprint(not_list[a-1])\n\t\telif ans1 == ans2:\n\t\t\tprint(not_list[a-1])\n\t\telse:\n\t\t\tprint(not_list[a+1])\n \nelse:\n\tprint(X)', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\np = set(p)\nfor i in range(200):\n if X - i not in p:\n print(X - i)\n break\n if X + i not in p:\n print(X + i)\n break'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s257591152', 's318354369', 's137743053'] | [9224.0, 9220.0, 9168.0] | [28.0, 29.0, 27.0] | [470, 470, 217] |
p02641 | u963747475 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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()))\na=set(a)\nfor i in range(101):\n \n if x-i not in a:\n print(x-i)\n exit()\n elif x+i not in a:\n print(x+i)\n exit()', 'x,y=map(int,input().split())\na=list(map(int,input().split()))\na=set(a)\nfor i in range(101):\n \n if x-i not in a:\n print(x-i)\n exit()\n elif x+i not in a:\n print(x+i)\n exit()\n'] | ['Runtime Error', 'Accepted'] | ['s683357868', 's071578159'] | [8936.0, 9164.0] | [22.0, 25.0] | [204, 199] |
p02641 | u963944915 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['import sys\nx,n=map(int,input().split())\np=list(map(int,input().split()))\nc=0\nif n==0:\n print(x)\n sys.exit()\nfor i in range(x,-200,-1):\n \n if not i in p:\n print(i)\n sys.exit()\n if not (x+c) in p:\n print(x+c)\n sys.exit()\n\u3000c+=1', 'import sys\nx,n=map(int,input().split())\np=list(map(int,input().split()))\nc=0\nif n==0:\n print(x)\n sys.exit()\nfor i in range(x,-200,-1):\n \n if not i in p:\n print(i)\n sys.exit()\n if not (x+c) in p:\n print(x+c)\n sys.exit()\n c+=1\n'] | ['Runtime Error', 'Accepted'] | ['s178167802', 's452049122'] | [9060.0, 9192.0] | [19.0, 25.0] | [243, 243] |
p02641 | u964521959 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X,N = map(int, input().split())\nif(N == 0):\n print(X)\n exit()\nelse:\n p_list = list(map(int, input().split()))\n\ni = X\nans_small = X\nans_big = X\n\nwhile(True):\n i = i + 1\n #print("1",i)\n if((i in p_list)==True):\n pass\n else:\n ans_big = i\n break\n \ni = X\nwhile(True):\n i = i - 1\n #print("2",i)\n if((i in p_list)==True):\n pass\n else:\n ans_small = i\n break\n\nprint(ans_big,ans_small)\nif(abs(X-ans_small)>abs(X-ans_big)):\n print(ans_big)\nelse:\n print(ans_small)', 'X,N = map(int, input().split())\nif(N == 0):\n print(X)\n exit()\nelse:\n p_list = list(map(int, input().split()))\n\ni = X\nans_big = X\n\nwhile(True):\n #print("1",i)\n if((i in p_list)==True):\n pass\n else:\n ans_big = i\n break\n i = i + 1\n \ni = X\nans_small = X\nwhile(True):\n #print("2",i)\n if((i in p_list)==True):\n pass\n else:\n ans_small = i\n break\n i = i - 1\n\n#print(ans_big,ans_small)\nif(abs(X-ans_small)>abs(X-ans_big)):\n print(ans_big)\nelse:\n print(ans_small)'] | ['Wrong Answer', 'Accepted'] | ['s608890255', 's779789123'] | [9224.0, 9220.0] | [23.0, 22.0] | [486, 487] |
p02641 | u966207392 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nif N == 0:\n print(X)\n \nelse:\n for i in range(100):\n if (X-(i+1)) and (X+i+1) and X in p:\n continue\n \n elif (X-i-1) not in p:\n print(X-i-1)\n break\n \n elif (X+i+1) not in p:\n print(X+i+1)\n break', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nif N == 0:\n print(X)\n\n\nfor i in range(100):\n if (X-i+1) in p:\n print(X-i+1)\n break\n elif (X+i+1) in p:\n print(X+i+1)\n break\n ', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nif N == 0:\n print(X)\n break\n \nelse:\n for i in range(100):\n if (X-(i+1)) and (X+i+1) in p:\n continue\n \n elif (X-i-1) not in p:\n print(X-i-1)\n break\n \n elif (X+i+1) not in p:\n print(X+i+1)\n break\n', 'X, N = map(int, input().split())\np = list(map(int, input().split()))\n\nif N == 0:\n print(X)\n\nelif X not in p:\n print(X)\n \nelse:\n for i in range(110):\n if (X-(i+1)) in p and (X+i+1) in p:\n continue\n \n else:\n if(X-(i+1)) not in p:\n print(X-(i+1))\n break\n \n elif (X+i+1) not in p:\n print(X+i+1)\n break'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s070100160', 's277228854', 's791613643', 's555624817'] | [9200.0, 9180.0, 9048.0, 9068.0] | [23.0, 24.0, 21.0, 21.0] | [353, 239, 326, 422] |
p02641 | u970267139 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ["x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nif n == 0:\n print(x)\n exit()\n\np.sort()\nprint(p)\nfor i in range(n):\n if p[i] == x:\n index = i\n break\n\nright = x + 1\nfor i in p[index + 1:]:\n print(i)\n if i != right:\n print('aaaa')\n print(right)\n break\n right += 1\n\nleft = x - 1\nfor i in reversed(p[:index]):\n print(i)\n if i != left:\n print('bbbb')\n print(left)\n break\n left -= 1\n\nif x - left <= right - x:\n print(left)\nelse:\n print(right)", 'x, n = map(int, input().split())\np = list(map(int, input().split()))\n\nif n == 0:\n print(x)\n exit()\n\np.sort()\n\nif x not in p:\n print(x)\n exit()\n \nfor i in range(len(p)):\n #print(p[i])\n if p[i] == x:\n index = i\n break\n\nright = x + 1\nfor i in p[index + 1:]:\n if i != right:\n break\n right += 1\n\nleft = x - 1\nfor i in reversed(p[:index]):\n if i != left:\n break\n left -= 1\n\nif x - left <= right - x:\n print(left)\nelse:\n print(right)'] | ['Runtime Error', 'Accepted'] | ['s547652063', 's115814229'] | [9264.0, 9224.0] | [23.0, 21.0] | [546, 493] |
p02641 | u970497613 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X,N = list(map(int,input().split()))\np = list(map(int,input().split()))\n\ndef f(p):\n global X\n return p - X\n\np2 = list(map(f,p))\n\np3 = list(map(abs,p2))\n\nOK = 2\nj = 0\nprint(p2,p3)\n\nif min(p3) ==0:\n while(OK==2):\n j+=1\n \n OK = p3.count(min(p3)+j)\n\n print(X-p2[p3.index(min(p3)+j)])\n \nelse:\n print(X)', 'X,N = list(map(int,input().split()))\nif N != 0:\n p = list(map(int,input().split()))\nelse:\n p = [X+1]\ndef f(p):\n global X\n return p - X\n\np2 = list(map(f,p))\n\np3 = list(map(abs,p2))\n\nOK = 2\nj = 0\n\n\nif min(p3) ==0:\n while(OK==2):\n j+=1\n OK = p3.count(min(p3)+j)\n if OK == 1:\n print(X-p2[p3.index(min(p3)+j)])\n else:\n print(X-j)\nelse:\n print(X)'] | ['Runtime Error', 'Accepted'] | ['s594087427', 's540788695'] | [9216.0, 9228.0] | [23.0, 24.0] | [316, 360] |
p02641 | u971124021 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['x,n = list(map(int,input().split()))\nif n == 0:\n print(x)\n exit()\n\np = list(map(int,input().split()))\n\nimport bisect\np.sort()\ni = bisect.bisect_left(p,x)\nprint(p)\nfor h in range(1, p[-1]-p[0]+2):\n if p[i-h] != x-h:\n print(x-h)\n exit()\n elif p[i+h] != x+h:\n print(x+h)\n exit() \n', 'x,n = list(map(int,input().split()))\nif n == 0:\n print(x)\n exit()\n\np = list(map(int,input().split()))\np = [-1] + p + [101]\nimport bisect\np.sort()\ni = bisect.bisect_left(p,x)', 'x,n = list(map(int,input().split()))\nif n == 0:\n print(x)\n exit()\n\np = list(map(int,input().split()))\np = [-1] + p + [102]\nimport bisect\np.sort()\ni = bisect.bisect_left(p,x)\nif p[i] != x:\n print(x)\n exit()\n\nfor h in range(102):\n if p[i-h] != x-h:\n print(x-h)\n exit()\n elif p[i+h] != x+h:\n print(x+h)\n exit() \n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s264455092', 's873375489', 's596723606'] | [9144.0, 9128.0, 9160.0] | [30.0, 28.0, 26.0] | [296, 175, 334] |
p02641 | u974918235 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 exit()\np = list(map(int, input().split()))\n\nmax_num = max(p)\nlst = []\nfor i in range(max_num+2):\n if i not in p:\n lst.append(i)\ntmp = float("inf")\nprint(lst)\nfor j in lst:\n if tmp > abs(X-j):\n tmp = abs(X-j)\n ans = j\nprint(ans)', 'X, N = map(int, input().split())\nif N == 0:\n print(X)\n exit()\np = list(map(int, input().split()))\n\nmax_num = max(p)\nlst = []\nfor i in range(max_num+2):\n if i not in p:\n lst.append(i)\ntmp = float("inf")\nfor j in lst:\n if tmp > abs(X-j):\n tmp = abs(X-j)\n ans = j\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s109565739', 's683321286'] | [9148.0, 9176.0] | [27.0, 26.0] | [284, 284] |
p02641 | u975485663 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 if N == 0:\n return X\n \n P = list(map(int, input().split()))\n \n if X < min(P) or X > max(P):\n return X\n \n delta = []\n for n in range(min(P), max(P) + 1):\n if n in P:\n delta.append(float('inf'))\n else:\n delta.append(abs(X - n))\n print(list(range(min(P), max(P) + 1)))\n \n print(delta)\n \n minD = min(delta)\n for i, d in enumerate(delta):\n if d == minD:\n return min(P) + i\n \n\nprint(main())", "def main():\n X, N = map(int, input().split())\n if N == 0:\n return X\n \n P = list(map(int, input().split()))\n \n delta = []\n for n in range(-1, 102):\n if n in P:\n delta.append(float('inf'))\n else:\n delta.append(abs(X - n))\n \n minD = min(delta)\n for i, d in enumerate(delta):\n if d == minD:\n return i + 1\n\n\nprint(main())", "def main():\n X, N = map(int, input().split())\n if N == 0:\n return X\n \n P = list(map(int, input().split()))\n \n delta = []\n for n in range(-1, 102):\n if n in P:\n delta.append(float('inf'))\n else:\n delta.append(abs(X - n))\n \n minD = min(delta)\n for i, d in enumerate(delta):\n if d == minD:\n return i - 1\n\n\nprint(main())"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s128330716', 's653467123', 's735051145'] | [9228.0, 9200.0, 9184.0] | [22.0, 25.0, 23.0] | [477, 357, 357] |
p02641 | u978531093 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ["import sys\n\n\ndef main():\n x, n = map(int, input().split())\n P = list(map(int, input().split()))\n\n if not (x in P):\n print(x)\n sys.exit()\n\n for i in range(101):\n x1 = max(0, x - (i + 1))\n x2 = min(101, x + (i + 1))\n\n print(x1, x2)\n if x1 == 0:\n print(0)\n sys.exit()\n \n if not (x1 in P):\n print(x1)\n sys.exit()\n\n if x2 == 101:\n print(101)\n sys.exit()\n \n if not (x2 in P):\n print(x2)\n sys.exit()\n\n\nif __name__ == '__main__':\n main()\n", "import sys\n\n\ndef main():\n x, n = map(int, input().split())\n P = list(map(int, input().split()))\n\n if not (x in P):\n print(x)\n sys.exit()\n\n for i in range(n):\n x1 = max(0, x - (i + 1))\n x2 = min(101, x + (i + 1))\n\n print(x1, x2)\n if x1 == 0:\n print(0)\n sys.exit()\n \n if not (x1 in P):\n print(x1)\n sys.exit()\n\n if x2 == 101:\n print(101)\n sys.exit()\n \n if not (x2 in P):\n print(x2)\n sys.exit()\n\n\nif __name__ == '__main__':\n main()\n", "import sys\n\n\ndef main():\n x, n = map(int, input().split())\n P = list(map(int, input().split()))\n\n if not (x in P):\n print(x)\n sys.exit()\n\n for i in range(101):\n x1 = max(0, x - (i + 1))\n x2 = min(101, x + (i + 1))\n\n if x1 == 0:\n print(0)\n sys.exit()\n \n if not (x1 in P):\n print(x1)\n sys.exit()\n\n if x2 == 101:\n print(101)\n sys.exit()\n \n if not (x2 in P):\n print(x2)\n sys.exit()\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s682217302', 's954357205', 's734707812'] | [9212.0, 9216.0, 9212.0] | [23.0, 20.0, 23.0] | [618, 616, 596] |
p02641 | u981938462 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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 -*-\nnum, i = map(int, input().split())\nif(i != 0):\n s = set(map(int, input().split()))\nelse:\n s = set()\nm = set(range(101))\no = list(m-s)\no2 = list(map(lambda x: abs(x - num), o))\nprint(o2.index(min(o2)))', '# -*- coding: utf-8 -*-\nnum, i = map(int, input().split())\nif(i != 0):\n s = set(map(int, input().split()))\nelse:\n s = set()\nm = set(range(102))\no = list(m-s)\no2 = list(map(lambda x: abs(x - num), o))\nprint(o[o2.index(min(o2))])'] | ['Wrong Answer', 'Accepted'] | ['s023149608', 's597313861'] | [9192.0, 9200.0] | [24.0, 22.0] | [226, 229] |
p02641 | u985418994 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['x,n = list(map(int,input().split()))\np= list(map(int,input().split()))\n \nfor i in range(x+1):\n for s in [-1,+1]:\n a=x+s*i\n if a not in p:\n print(a)', 'x,n = list(map(int,input().split()))\np= list(map(int,input().split()))\n\nfor i in range(x+1):\n for s in [-1,+1]:\n a=X+s*d\n if a not in p:\n print(a)\n\n\n', 'x,n = list(map(int,input().split()))\np= list(map(int,input().split()))\n \nfor i in range(x+1):\n for s in [-1,+1]:\n a=x+s*d\n if a not in p:\n print(a)', 'x,n = list(map(int,input().split()))\np= list(map(int,input().split()))\n \nfor i in range(x+1):\n for s in [-1,+1]:\n a=x+s*i\n if a not in p:\n print(a)\n exit(0)'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s006823617', 's268704412', 's331916764', 's262964643'] | [9024.0, 9072.0, 9176.0, 9100.0] | [31.0, 23.0, 25.0, 30.0] | [155, 157, 155, 168] |
p02641 | u993435350 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['X,N = map(int,input().split())\nP = list(map(int,input().split()))\n\nnum = sorted([[abs(X - i),i] for i in range(-100,101) if i not in P],key = lambda x: x[0])\n\nprint(num)', 'X,N = map(int,input().split())\nP = list(map(int,input().split()))\nnum = sorted([[abs(X - i),i] for i in range(-200,200) if i not in P],key = lambda x: x[0])\n\ninf = 10 ** 3\ninf2 = 10 ** 3 * -1\n\nfor i in range(X,inf):\n if i in P:\n continue\n plus = abs(X - i)\n break\n\nfor j in range(X,inf * -1,-1):\n if j in P:\n continue\n minus = abs(X - j)\n break\n\nif plus < minus:\n print(i)\n\nelse:\n print(j)'] | ['Wrong Answer', 'Accepted'] | ['s467708153', 's971241672'] | [9188.0, 9228.0] | [22.0, 24.0] | [169, 403] |
p02641 | u994400382 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, 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\nP_sub_abs = [abs(i - X) for i in P]\nif(P_sub_abs.count(0) == 0):\n print(X)\n exit()\nfor i in range(1, 100):\n if(P_sub_abs.count(i) == 1):\n list = [X - i, X + i]\n list.remove(P[P_sub_abs.index(i)])\n print(list[0])\n exit()\n elif(P_sub_abs.count(i) == 0):\n print(X - i)\n exit()\n', 'X, N= [int(x) for x in input().split()]\nP = [int(x) for x in input().split()]\n\nP_sub_abs = [abs(i - X) for i in P]\nif(P_sub_abs.count(0) == 0):\n print(X)\n exit()\nfor i in range(1, 100):\n if(P_sub_abs.count(i) == 1):\n list = [X - i, X + i]\n list.remove(P[P_sub_abs.index(i)])\n print(list[0])\n exit()\n elif(P_sub_abs.count(i) == 0):\n print(X - i)\n exit()\n'] | ['Runtime Error', 'Accepted'] | ['s356324177', 's178693359'] | [9212.0, 9204.0] | [22.0, 24.0] | [390, 407] |
p02641 | u995163736 | 2,000 | 1,048,576 | Given are an integer X and an integer sequence of length N: p_1, \ldots, p_N. Among the integers not contained in the sequence p_1, \ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer. | ['x, n = map(int, input().split())\nif n == 0:\n print(x)\nelse:\n p = list(map(int, input().split()))\n p.sort()\n p1 = {i for i in range(p[-1])}\n p = set(p)\n p2 = p1 - p\n p2 = list(p2)\n absv = x\n for i in range(len(p2)):\n if absv > abs(x - p2[i]):\n absv = abs(x - p2[i])\n print(x - absv)', 'x, n = map(int, input().split())\nif n == 0:\n print(x)\nelse:\n p = list(map(int, input().split()))\n absv = x\n value = x\n for i in range(-1, 102):\n if i in p:\n pass\n else:\n if absv > abs(x - i):\n absv = abs(x - i)\n value = x - i\n print(x - value)\n '] | ['Wrong Answer', 'Accepted'] | ['s813117350', 's053603979'] | [9152.0, 9124.0] | [22.0, 24.0] | [299, 284] |
p02642 | u000037600 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n=int(input())\nb=list(map(int,input().split()))\nans=0\nw=max(b)\na=[0]*w\nfor i in b:\n x=i\n while x<w:\n a[x]=1\n x+=i\nfor i in b:\n if a[i]==0:\n ans+=1', 'a=int(input())\nb=list(map(int,input().split()))\nans=0\nfor i in b:\n if len([j for j in b if not i%j==0])==a:\n break\n else:\n ans+=1\nprint(ans)', 'n=int(input())\nb=list(map(int,input().split()))\nans=0\nw=max(b)\na=[0]*(w+1)\nfor i in b:\n x=i\n while x<=w:\n a[x]+=1\n x+=i\nfor i in b:\n if a[i]==1:\n ans+=1\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s338563869', 's896346564', 's763823716'] | [32040.0, 32236.0, 32032.0] | [491.0, 2206.0, 540.0] | [158, 148, 175] |
p02642 | u013864607 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nAs = list(map(int, input().split()))\n\nbool_array = []\n\n\nfor i in range(len(As)):\n tmp = [True if i!=j else False for j in range(len(As))]\n bool_array.append(tmp)\n\ncount = 0\nfor i, A in enumerate(As):\n is_exist = True\n for j, tf in enumerate(bool_array[i]):\n if i!=j and not tf:\n is_exist = False\n break\n elif i!=j:\n current_tf = A%As[j]\n current_tf = [current_tf==0][0]\n if current_tf and A!=As[j]:\n is_exist = False\n bool_array[i][j] = False\n #bool_array[j][i] = False\n break\n if not is_exist:\n count+=1\nprint(count)\n', 'N = int(input())\nAs = list(sorted(list(map(int, input().split()))))\n\nmax_num = max(As)\ntfs = [0 for _ in range(max_num+1)]\n\nfor A in As:\n if tfs[A] != 0:\n tfs[A] = 2\n continue\n for j in range(A, max_num+1, A):\n tfs[j]+=1\n\nresult = 0\nfor A in As:\n if tfs[A] == 1:\n result+=1\nprint(result)\n'] | ['Wrong Answer', 'Accepted'] | ['s138027221', 's453210474'] | [369320.0, 32236.0] | [2214.0, 486.0] | [707, 325] |
p02642 | u016881126 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import sys\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nread = sys.stdin.buffer.read\nsys.setrecursionlimit(10 ** 7)\nINF = float(\'inf\')\n\nimport collections\nN = int(input())\nA = list(map(int, input().split()))\ncA = collections.Counter(A)\n\nLIM = 10 ** 6 + 10\n# LIM = 25\n\nA.sort()\ndp = [1] * LIM\n\nfor i in set(A):\n s = i * 2\n while s <= LIM:\n dp[s] = 0\n s += i\n\nans = 0\n# print(dp)\nfor a in A:\n # print("{} {}".format(dp[a], cA[a]))\n if dp[a] and cA[a] == 1:\n # print(a)\n ans += 1\nprint(ans)', 'import sys\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nread = sys.stdin.buffer.read\nsys.setrecursionlimit(10 ** 7)\nINF = float(\'inf\')\n\nimport collections\nN = int(input())\nA = list(map(int, input().split()))\ncA = collections.Counter(A)\n\nLIM = 10 ** 6 + 1\n# LIM = 25\n\nA.sort()\ndp = [1] * LIM\n\nfor i in set(A):\n s = i * 2\n while s <= LIM:\n dp[s] = 0\n s += i\n\nans = 0\n# print(dp)\nfor a in A:\n # print("{} {}".format(dp[a], cA[a]))\n if dp[a] and cA[a] == 1:\n print(a)\n ans += 1\nprint(ans)', 'import sys\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nread = sys.stdin.buffer.read\nsys.setrecursionlimit(10 ** 7)\nINF = float(\'inf\')\n\nimport collections\nN = int(input())\nA = list(map(int, input().split()))\ncA = collections.Counter(A)\n\nLIM = 10 ** 6 + 1\n# LIM = 25\n\nA.sort()\ndp = [1] * LIM\n\nfor i in set(A):\n s = i * 2\n while s <= LIM:\n dp[s] = 0\n s += i\n\nans = 0\n# print(dp)\nfor a in A:\n # print("{} {}".format(dp[a], cA[a]))\n if dp[a] and cA[a] == 1:\n print(a)\n ans += 1\nprint(ans)', 'import sys\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nread = sys.stdin.buffer.read\nsys.setrecursionlimit(10 ** 7)\nINF = float(\'inf\')\n\nimport collections\nN = int(input())\nA = list(map(int, input().split()))\ncA = collections.Counter(A)\n\nLIM = 10 ** 6 + 1\n# LIM = 25\n\nA.sort()\ndp = [1] * LIM\n\nfor i in set(A):\n s = i * 2\n while s < LIM:\n dp[s] = 0\n s += i\n\nans = 0\n# print(dp)\nfor a in A:\n # print("{} {}".format(dp[a], cA[a]))\n if dp[a] and cA[a] == 1:\n # print(a)\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s320358809', 's510558980', 's806198439', 's733408267'] | [53072.0, 52844.0, 52836.0, 52960.0] | [435.0, 552.0, 524.0, 1792.0] | [558, 555, 555, 556] |
p02642 | u021217230 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N=int(input())\nA=list(map(int,input().split()))\nA.sort()\nma=A[-1]\ndp=[1]*(ma+1)\nans=0\n\nfor i in range(len(A)-1):\n p=A[i]\n if dp[i]==1:\n for q in range(ma//p+1):\n dp[p*q]=0\n if dp[i]!=dp[i+1]:\n ans+=1\nif dp[ma]==1:\n ans+=1\nprint(ans)\n', 'N=int(input())\nA=list(map(int,input().split()))\nA.sort()\nma=A[-1]\ndp=[1]*(ma+1)\nans=0\n\nfor i in range(N-1):\n p=dp[i]\n if dp[i]==1:\n for q in range(ma//p+1):\n dp[p*q]=0\n if dp[i]!=dp[i+1]:\n ans+=1\nif dp[ma]==1:\n ans+=1\nprint(ans)', 'N = int(input())\nA = list(map(int, input().split()))\nA.sort() \nAmax = A[-1]\ndp = [1]*(Amax+1) \nans = 0\nfor i in range(len(A)-1):\n p = A[i]\n if dp[p] == 1: \n for q in range(Amax//p+1):\n dp[p*q] = 0 \n if A[i] != A[i+1]: \n ans += 1 \nif dp[Amax] == 1: \n ans += 1\nprint(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s046992221', 's935477039', 's478307244'] | [32232.0, 32376.0, 32292.0] | [427.0, 260.0, 420.0] | [252, 247, 709] |
p02642 | u023229441 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n=int(input())\nA=list(map(int,input().split()))\n\nA.sort()\nB=[1]*n\n\nfrom math import sqrt\ndef eratosu():\n # if not isinstance(n,int):\n \n # if n<2:\n \n primec = 0\n \n data = A #2,3,4,...,n\n while len(data)>0:\n p = data[0]\n \n \n if len(data)>0:\n if data[1]==p:\n primec-=1\n primec+=1 \n data = [e for e in data if e % p != 0]\n return primec \n\n\n# if i>0:\n# if A[i]==A[i-1]: B[i]=0 ; B[i-1]=0 ; continue\n # if B[i]==1:\n # for j in range(i+1,n):\n # if A[j]%A[i]==0:\n # B[j]=0\nprint(eratosu())\n\n\n', 'n=int(input())\nA=sorted(list(map(int,input().split())))\nB=[0]*(1+A[-1])\nfor i in A:\n B[i]+=1\n if B[i]==1:\n for j in range(2*i,A[-1]+1,i):\n B[j]+=1\n else:\n continue\nans=0\nfor i in A:\n if B[i]==1: ans+=1\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s721672963', 's733177314'] | [33032.0, 32380.0] | [2206.0, 420.0] | [779, 248] |
p02642 | u027903950 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N =input()\nA = list(map(int, input().split()))\nN=int(N)\ns=0\nA2 = [-1] \nLS =[-1]\nfor i in range(0,N):\n k=1\n P =A[i]\n if P in A2:\n pass\n else:\n while P*k<=10^6:\n LS.append(P)\n k+=1\n A2.append(P)\nfor j in range(0,N):\n if A[j] in A2:\n pass\n else:\n if LS.count(A[j]) ==1:\n s+=1\n \nprint(s)\n ', 'N =input()\nA = list(map(int, input().split()))\nN=int(N)\ns=0\nA1 =A\nA2 = [-1]\nB = [-1]\nLS =[]\nfor i in range(0,N):\n k=1\n P =A1[i]\n if P in A2:\n if P in B:\n pass\n else:\n B.append(P)\n else:\n while P*k<=2*10^5:\n LS.append(P)\n k+=1\n A2.append(P)\nfor j in range(0,N):\n if A[j] in B:\n pass\n else:\n if LS.count(A[j]) ==1:\n s+=1\n \nprint(s)\n ', 'sucl =[]\nfor i in range(0,int(N)):\n T=True\n for j in range(0,int(N)):\n if T== False:\n break\n if A[i]<A[j]:\n break\n if A[i] % A[j]==0:\n if i==j:\n pass\n else:\n T=False\n \n if T==True:\n sucl.append(i)\nprint(len(sucl))\n ', 'N=input()\nA = list(map(int, input().split()))\nT=True\nsucl =[]\nfor i in range(0,int(N)):\n T=True\n for j in range(0,int(N)):\n if T== False:\n break\n if A[i]<A[j]:\n break\n if A[i] % A[j]==0:\n if i==j:\n pass\n else:\n T=False\n \n if T==True:\n sucl.append(i)\nprint(len(sucl))\n ', 'N =input()\nA = list(map(int, input().split()))\nN=int(N)\ns=0\nA2 = [-1] \nLS =[-1]\nfor i in range(0,N):\n k=1\n P =A[i]\n if P in A2:\n pass\n else:\n while P*k<=10^6:\n LS.append(P*k)\n k+=1\n A2.append(P)\nfor j in range(0,N):\n if A[j] in A2:\n pass\n else:\n if LS.count(A[j]) ==1:\n s+=1\n \nprint(s)\n \n', 'N = input()\nA = list(map(int, input().split()))\nN = int(N)\nMA = max(A)\ns=0\nLS = [0 for i in range(0,MA)]\nfor i in range(0,N):\n k=1\n while A[i]*k<=MA:\n LS[A[i]*k-1] +=1\n k +=1\nfor j in range(0,N):\n if LS[A[j]-1]==1:\n s+=1\nprint(s)'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s059819070', 's172919342', 's367346260', 's755648677', 's945634850', 's546412289'] | [32248.0, 32252.0, 9108.0, 32196.0, 32240.0, 32308.0] | [2206.0, 2206.0, 25.0, 1148.0, 2206.0, 1050.0] | [336, 388, 274, 327, 339, 241] |
p02642 | u050584166 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na_lst = list(map(int, input().split()))\nindex_lst = [0]*(a_max + 1)\n\nfor ai in a_lst:\n for multi in range(ai, a_max+1, ai):\n index_lst[multi] += 1\n\nans = 0\nfor ai in a_lst:\n if index_lst[ai] == 1:\n ans += 1\nprint(ans)', 'n = int(input())\na_lst = list(map(int, input().split()))\n\na_max = max(a_lst)\nindex_lst = [0]*(a_max + 1)\n\nfor ai in a_lst:\n for multi in range(ai, a_max+1, ai):\n index_lst[multi] += 1\n\nans = 0\nfor ai in a_lst:\n if index_lst[ai] == 1:\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s099388671', 's840583182'] | [32112.0, 32060.0] | [69.0, 468.0] | [254, 274] |
p02642 | u057415180 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["def LI(): return list(map(int, input().split()))\ndef I(): return map(int, input().split())\n \ndef main():\n m = int(input())\n a = LI()\n ans = 0\n n = max(a)\n num = [True]*(n+1)\n num[0] = False\n a.sort()\n for i in range(m):\n if (i != m-1 and a[i]==a[i+1]) or (i != 0 and a[i]== a[i-1]): num[a[i]] = False\n for j in range(a[i]*2, n+1, a[i]):\n num[j] = False\n print(num)\n for aa in a:\n if num[aa]:\n ans += 1\n print(ans)\n\nif __name__ == '__main__':\n main()", "def LI(): return list(map(int, input().split()))\ndef I(): return map(int, input().split())\n \ndef main():\n m = int(input())\n a = LI()\n ans = 0\n if a.count(1) == 1:\n print(1)\n exit()\n n = max(a)\n num = [True]*(n+1)\n num[0] = num[1] = False\n a.sort()\n for i in range(m):\n if (i != m-1 and a[i]==a[i+1]) or (i != 0 and a[i]== a[i-1]): num[a[i]] = False\n for j in range(a[i]*2, n+1, a[i]):\n num[j] = False\n for aa in a:\n if num[aa]:\n ans += 1\n print(ans)\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s709380537', 's416917514'] | [39520.0, 32420.0] | [358.0, 378.0] | [481, 523] |
p02642 | u067983636 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import bisect\nimport copy\nimport heapq\nimport sys\nimport itertools\nimport math\nimport queue\nfrom functools import lru_cache\ninput = sys.stdin.readline\nsys.setrecursionlimit(1000000)\nmod = 10 ** 9 + 7 \n\ndef read_values(): return map(int, input().split())\ndef read_index(): return map(lambda x: int(x) - 1, input().split())\ndef read_list(): return list(read_values())\ndef read_lists(N): return [read_list() for n in range(N)]\n\n\ndef main():\n N = int(input())\n A = read_list()\n A.sort()\n\n F = [True] * (A[-1] + 1)\n for i in range(N - 1):\n if A[i] == A[i + 1]:\n F[A[i]] = False\n\n res = 0\n for a in A:\n if not F[a]:\n continue\n \n res += 1\n for b in range(a, len(F), a):\n print(a, b)\n F[b] = False\n\n print(res)\n\n\nif __name__ == "__main__":\n main()\n\n', 'import bisect\nimport copy\nimport heapq\nimport sys\nimport itertools\nimport math\nimport queue\nfrom functools import lru_cache\ninput = sys.stdin.readline\nsys.setrecursionlimit(1000000)\nmod = 10 ** 9 + 7 \n\ndef read_values(): return map(int, input().split())\ndef read_index(): return map(lambda x: int(x) - 1, input().split())\ndef read_list(): return list(read_values())\ndef read_lists(N): return [read_list() for n in range(N)]\n\n\ndef main():\n N = int(input())\n A = read_list()\n A.sort()\n\n F = [True] * (A[-1] + 1)\n for i in range(N - 1):\n if A[i] == A[i + 1]:\n F[A[i]] = False\n\n res = 0\n for a in A:\n if F[a]:\n res += 1\n for b in range(a, len(F), a):\n F[b] = False\n\n print(res)\n\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s623794303', 's078140442'] | [45060.0, 34572.0] | [1585.0, 349.0] | [847, 791] |
p02642 | u068862829 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["import math\nN = int(input())\nA = list(map(int, input().split()))\n\nAs = sorted(A)\n\ndellist = []\n\ni = 0\nMAX = int(math.sqrt(As[N-1]))+2\nwhile(i < len(As)):\n if As[i] < MAX:\n break\n# print('i:{}'.format(i))\n# print('As:{}'.format(As))\n \n j = i+1\n poplist = []\n while(j < len(As)):\n\n# print('As[i]:{}'.format(As[i]))\n# print('As[j]:{}'.format(As[j]))\n if As[j]%As[i] == 0: \n \n poplist.append(j)\n \n \n if As[i] == As[j]:\n dellist.append(A[i])\n \n j += 1\n \n \n \n # https://gammasoft.jp/blog/remove-multiple-elements-from-python-list/\n for k in sorted(poplist, reverse=True):\n As.pop(k)\n \n \n i += 1\n\n\n\ndellist = list(set(dellist))\n \nfor i in dellist:\n As.remove(i)\n\n# print(As)\nprint(len(As))\n", 'N = int(input())\nA = list(map(int, input().split()))\n\nD = [0]*(10**6+1)\nfor i in A:\n \n D[i] += 1\n\nU = []\nfor i in range(10**6+1):\n \n if D[i] == 1:\n U.append(i)\n\nA = list(set(A))\n\nT = [0]*(max(A)+1)\nfor i in A:\n \n for j in range(2*i, 10**6+1, i):\n T[j] = 1\n\n\nans = 0\nfor i in U:\n if T[i] == 0:\n ans += 1\n\nprint(ans)', "import math\nN = int(input())\nA = list(map(int, input().split()))\n\nAs = sorted(A)\n\ndellist = []\n\ni = 0\nMAX = int(math.sqrt(As[N-1]))+2\nwhile(i < len(As) or As[i] < MAX):\n# print('i:{}'.format(i))\n# print('As:{}'.format(As))\n \n j = i+1\n poplist = []\n while(j < len(As)):\n\n# print('As[i]:{}'.format(As[i]))\n# print('As[j]:{}'.format(As[j]))\n if As[j]%As[i] == 0: \n \n poplist.append(j)\n \n \n if As[i] == As[j]:\n dellist.append(A[i])\n \n j += 1\n \n \n \n # https://gammasoft.jp/blog/remove-multiple-elements-from-python-list/\n for k in sorted(poplist, reverse=True):\n As.pop(k)\n \n \n i += 1\n\n\n\ndellist = list(set(dellist))\n \nfor i in dellist:\n As.remove(i)\n\n# print(As)\nprint(len(As))\n", 'N = int(input())\nA = sorted(list(map(int, input().split())))\n\n\nrm = 0\nfor i in A:\n if A.count(i) != 1:\n rm += 1\n\n\nT = [0]*(10**6+1)\nfor i in A:\n j = 1\n while(i*j <= 10**6):\n T[i*j] += 1\n j += 1\n\nans = -len(rmlst)\nfor i in A:\n if T[i] == 1:\n ans += 1\n\nprint(ans)', 'N = int(input())\nA = list(map(int, input().split()))\n\nD = [0]*(10**6+1)\nfor i in A:\n \n D[i] += 1\n\nU = []\nfor i in range(10**6+1):\n \n if D[i] == 1:\n U.append(i)\n\nA = list(set(A))\n\nT = [0]*(10**6+1)\nfor i in A:\n \n for j in range(2*i, 10**6+1, i):\n T[j] = 1\n\n\nans = 0\nfor i in U:\n if T[i] == 0:\n ans += 1\n\nprint(ans)'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s276384863', 's630249704', 's762499081', 's888527472', 's650596304'] | [33348.0, 46168.0, 33344.0, 32228.0, 45992.0] | [2206.0, 297.0, 2206.0, 2206.0, 1546.0] | [1671, 493, 1652, 356, 492] |
p02642 | u072218780 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['# -*- coding: utf-8 -*-\n\nn = int(input())\nnum_list = list(map(int, input().split()))\n\nnew_num_list = list(set(num_list))\nnew_num_list.sort()\n\nif len(new_num_list) = 1:\n ans = 0\nelse:\n ans = 1\n\ncount = 0\n\nfor index_1, num_1 in enumerate(num_list):\n for index_2, num_2 in enumerate(num_list):\n if index_1 > index_2:\n if num_1 % num_2 != 0:\n count += 1\n \n if count == index_1:\n ans += 1\n\n count = 0\n\nprint(ans)', 'import collections\n \nn=int(input())\narr=list(map(int,input().split()))\narr=sorted(arr)\ns=set()\ncnt=collections.Counter(arr)\n \nfor i in range(n):\n if arr[i] in s:\n continue\n if cnt[arr[i]]>=2:\n s.add(arr[i])\n for j in range(2,10**6//arr[i]+1):\n s.add(arr[i]*j)\nans=0\nfor i in range(n):\n if arr[i] in s:\n continue\n ans+=1\n \nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s877161157', 's992165826'] | [9024.0, 103036.0] | [24.0, 796.0] | [431, 340] |
p02642 | u075303794 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import numpy as np\nfrom numba import njit\n\n\nn = int(input())\na = np.array(list(map(int, input().split())))\nans = 0\n\n@njit\ndef check(ans):\n for i in range(n):\n temp = a[i]\n count = np.count_nonzero(temp%a==0)\n if count == 1:\n ans += 1\n return ans\n\nans = check(ans)\nprint(ans)', 'import sys\nimport numpy as np\nfrom numba as njit\n\n\n@njit\ndef solve(A):\n count = np.zeros(10**6+10, np.int32)\n for x in A:\n if count[x] > 1:\n continue\n else:\n count[::x] += 1\n ret = 0\n for x in A:\n if count[x] == 1:\n rep += 1\n return ret\n\n\nA = np.array(read().split(),np.int32)\nprint(solve(A))', 'import sys\nimport numpy as np\nfrom numba import njit\n \nread = sys.stdin.buffer.read\n \n@njit\ndef solve(A):\n count = np.zeros(10**6+10, np.int32)\n for x in A:\n if count[x] > 1:\n continue\n else:\n count[::x] += 1\n ret = 0\n for x in A:\n if count[x] == 1:\n ret += 1\n return ret\n \n \nA = np.array(read().split(),np.int32)[1:]\nprint(solve(A))'] | ['Time Limit Exceeded', 'Runtime Error', 'Accepted'] | ['s661715484', 's945194216', 's610009872'] | [150048.0, 8968.0, 122428.0] | [2209.0, 24.0, 733.0] | [290, 321, 362] |
p02642 | u075304271 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import math\nimport collections\nimport fractions\nimport itertools\n\ndef solve():\n n = int(input())\n arr = list(map(int, input().split()))\n arr.sort()\n s = set()\n cnt = collections.Counter(arr)\n for i in ragne(n):\n if arr[i] in s:\n continue\n elif cnt[arr[i]] >= 2:\n s.add(arr[i])\n for j in range(2, 10**6//arr[i]+1):\n s.add(arr[i]*j)\n ans = 0\n for i in arr:\n if i in s == False:\n ans += 1\n print(ans)\n return 0\n\nif __name__ == "__main__":\n solve()', 'import math\nimport collections\nimport fractions\nimport itertools\n\ndef solve():\n n = int(input())\n arr = list(map(int, input().split()))\n arr.sort()\n s = set()\n cnt = collections.Counter(arr)\n for i in range(n):\n if arr[i] in s:\n continue\n elif cnt[arr[i]] >= 2:\n s.add(arr[i])\n for j in range(2, 10**6//arr[i]+1):\n s.add(arr[i]*j)\n ans = 0\n for i in arr:\n if i in s:\n continue\n ans += 1\n print(ans)\n return 0\n\nif __name__ == "__main__":\n solve()\n'] | ['Runtime Error', 'Accepted'] | ['s378741861', 's996678982'] | [36648.0, 104780.0] | [142.0, 669.0] | [549, 558] |
p02642 | u077291787 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['# D - Not Divisible\ndef main():\n N, *A = map(int, open(0).read().split())\n lim = max(A) + 1\n dp = [-1] * lim\n for a in A:\n dp[a] += 1\n if dp[a]:\n continue\n for i in range(a * 2, lim, a):\n dp[i] = 0\n print(sum(dp[a] == 0 for a in A))\n\n\nif __name__ == "__main__":\n main()\n', '# D - Not Divisible\ndef main():\n N, *A = map(int, open(0).read().split())\n lim = max(A) + 1\n sieve = [0] * lim\n for a in A:\n sieve[a] += 1\n if sieve[a] > 1:\n continue\n for i in range(a * 2, lim, a):\n sieve[i] = 2\n print(sum(sieve[a] == 1 for a in A))\n\n\nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s505982454', 's536233678'] | [32976.0, 33144.0] | [214.0, 197.0] | [331, 349] |
p02642 | u087731474 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['from collections import Counter\nmax_=10**6+1\nans=0\n\nn=int(input())\ndata=list(map(int,input().split()))\n\nb=[True]*(max_+1)\ndata.sort()\nc=Counter(data)\nprint(c)\n\nfor d in data:\n if b[d]:\n for j in range(d,max_,d):\n b[j]=False\n if c[d]==1:\n ans+=1\nprint(ans)\n', 'def factorization(n):\n arr = []\n temp = n\n for i in range(2, int(-(-n**0.5//1))+1):\n if temp%i==0:\n cnt=0\n while temp%i==0:\n cnt+=1\n temp //= i\n arr.append([i, cnt])\n\n if temp!=1:\n arr.append([temp, 1])\n\n if arr==[]:\n arr.append([n, 1])\n\n return arr\n#print(factorization(7),len(factorization(5)))\n\nn = int(input())\na = list(input().split())\na = [int(i) for i in a]\nif len(set(a)) == 1:\n print(0)\n exit()\n\nans=0\nfor i in range(len(a)):\n print(i,a[i])\n x=a[i]\n if len(factorization(x)) == 1 and factorization(x)[0][1] == 1:\n ans+=1\n #print("so")\n continue\n l=[a[j] for j in range(len(a)) if int(x/2) >= a[j] or (j != i and a[j] == x)]\n s=0\n print(l)\n for ii in l:\n #print("check:", ii)\n if x % ii == 0:\n break\n else:\n s+=1\n if s == len(l):\n ans+=1\n #print("ans",ans)\n\nprint(ans)\n\n \n \n', 'from collections import Counter\nmax_=10**6+1\nans=0\n\nn=int(input())\ndata=list(map(int,input().split()))\n\nb=[True]*(max_+1)\ndata.sort()\nc=Counter(data)\nprint(c)\n\nfor d in data:\n if b[d]:\n for j in range(d,max_,d):\n b[j]=False\n if c[d]==1:\n ans+=1\nprint(ans)\n', 'from collections import Counter\nmax_=10**6+1\nans=0\n\nn=int(input())\ndata=list(map(int,input().split()))\n\nb=[True]*(max_+1)\ndata.sort()\nc=Counter(data)\n#print(c)\n\nfor d in data:\n if b[d]:\n for j in range(d,max_,d):\n b[j]=False\n if c[d]==1:\n ans+=1\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s224138636', 's299842906', 's479352292', 's494347372'] | [64908.0, 32404.0, 64896.0, 43756.0] | [434.0, 2266.0, 418.0, 361.0] | [295, 936, 314, 315] |
p02642 | u092387689 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\n\nl = [int(x) for x in input().split()]\nmp = [1]*n\n\n\nfor i in range(n):\n for j in range(i+1,n):\n if(mp[j]==0):\n continue\n if(l[j]==l[i]):\n mp[i] = 0\n mp[j] = 0\n continue\n if(l[j]%l[i]==0):\n mp[j] = 0\n continue\n\nprint(sum(mp))', 'n = int(input())\nl = [int(x) for x in input().split()]\nD = set() #Duplication\nS = set() #all\nfor x in l:\n if x in S:\n D.add(x)\n else:\n S.add(x)\n\nM = max(S)\nlimit = M+1\nmp = [0]*(limit)\n\ncnt = 0\nS = sorted(S)\nfor x in S:\n for y in range(x,limit,x):\n mp[y] += 1\n if(x in D):\n continue\n if(mp[x]==1):\n cnt += 1\n \nprint(cnt)\n\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s460741322', 's343166912'] | [32016.0, 36200.0] | [2206.0, 482.0] | [331, 381] |
p02642 | u094999522 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n,*a=map(int,open(0).read().split())\ni = 0\nwhile a:\n if a.count(a[0]) == 1:\n i+=1\n a = list(filter(lambda x: x%a[0] >0,a))\nprint(i)', 'n,*a=map(int,open(0).read().split())\ni = 0\nwhile a:\n if a.count(a[0]) == 1:\n i+=1\n a = list(filter(lambda x: x%a[i] >0,a))\nprint(i)', 'import numpy as np\nn,*a=map(int,open(0).read().split())\na=np.array(sorted(a))\ni = 0\nwhile len(a):\n if a[0] != a[1]:\n i+=1\n a = a[a%a[0] != 0]\nprint(i)', '_, *a = map(int, open("/Users/rikuo/Downloads/03-LargeRandom-23 (1)").read().split())\na.sort()\nm = -~a[-1]\nc = [0] * m\nfor i in a:\n c[i] += 1\n if c[i] > 1:\n continue\n for j in range(i * 2, m, i):\n c[j] = 2\nprint(sum(c[i]for i in a))', '_,*a = map(int, open(0).read().split())\na.sort()\nm = -~a[-1]\nc = [0]*m\nfor i in a:\n c[i] += 1\n if c[i] > 1:\n continue\n for j in range(i * 2, m, i):\n c[j] = 2\nprint(sum(c[i]==1for i in a))'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s128519502', 's201499305', 's288614035', 's785610615', 's990881595'] | [33260.0, 33208.0, 50180.0, 9068.0, 33344.0] | [2206.0, 2206.0, 2206.0, 26.0, 298.0] | [144, 144, 163, 255, 210] |
p02642 | u095094246 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n=int(input())\na=list(map(int,input().split()))\na.sort()\nok=[0]*(a[-1]+1)\nfor i in range(n):\n ok[a[i]]+=1\nfor i in range(n):\n if ok[a[i]]>1:\n ok[a[i]]=0\n elif ok[a[i]]:\n for j in range(2,a[-1]//a[i]):\n ok[a[i]*j]=0\n \nprint(sum(ok))', 'n=int(input())\na=list(map(int,input().split()))\na.sort()\nok=[0]*(a[-1]+1)\nfor i in range(n):\n ok[a[i]]+=1\nfor i in range(n):\n if ok[a[i]]>1:\n ok[a[i]]=0\n elif ok[a[i]]==0:\n continue\n j=a[i]\n while 1:\n j += a[i]\n if j > a[-1]:\n break\n ok[j]=0\n \nprint(sum(ok))\n'] | ['Wrong Answer', 'Accepted'] | ['s691788942', 's696942183'] | [32240.0, 32376.0] | [544.0, 584.0] | [248, 287] |
p02642 | u098012509 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['import collections\n\nN = int(input())\nA = [int(x) for x in input().split()]\n\nc = collections.Counter(A)\n\nA = list(set(A))\nA.sort()\n\ntotal = 10 ** 6 + 1\n\nX = [0] * total\n\nfor a in A:\n for aa in range(a + a, total, a):\n X[aa] = 1\n\nans = 0\nfor i in range(1, total):\n if X[i] == 0 and c[i] == 1:\n ans += 1\n\nprint(X)\nprint(ans)\n', 'import collections\n\nN = int(input())\nA = [int(x) for x in input().split()]\n\nc = collections.Counter(A)\n\nA = list(set(A))\nA.sort()\n\ntotal = 10 ** 6 + 1\n\nX = [0] * total\n\nfor a in A:\n for aa in range(a + a, total, a):\n X[aa] = 1\n\nans = 0\nfor i in range(1, total):\n if X[i] == 0 and c[i] == 1:\n ans += 1\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s160412199', 's107694670'] | [45296.0, 45080.0] | [1502.0, 1297.0] | [342, 333] |
p02642 | u099150084 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = list(map(int, input().split()))\na.sort()\n\nb = [True for i in range(n)]\n\ns = 0\nwhile s < n-1:\n if b[s]:\n for k in range(s+1, n):\n if b[k]:\n b[k] = bool(a[k] % a[s])\n b[s] = a[s+1] != a[s]\n s += 1\n\nprint(b)\nprint(b.count(True))\n', 'n = int(input())\na = list(map(int, input().split()))\na.sort()\n\nb = [True for i in range(a[-1]+1)]\n\nans = 0\n\nfor i, j in enumerate(a):\n if b[j]:\n t = 1\n while j*t < len(b):\n b[j*t] = False\n t += 1\n \n if i == n-1:\n ans += 1\n elif j != a[i+1]:\n ans += 1\n \nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s168782301', 's892199910'] | [33204.0, 32240.0] | [2206.0, 852.0] | [293, 353] |
p02642 | u100927237 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = sorted((map(int,input().split())))\nA_Max = A[-1]\nB = [True]*A_Max\n\nfor i in range(N):\n if B[A[i]]:\n for j in range(0, A_Max):\n if j < 2:\n continue\n elif A[i]*j > A_Max:\n break\n B[A[i] * j] = False\n\nans = 0\nfor i in range(N):\n if B[A[i]]:\n B[A[i]] = False\n ans += 1\n\nprint(ans)\n\n', 'N = int(input())\nA = sorted((map(int,input().split())))\nA_Max = A[-1]\nB = [True]*A_Max\n\nfor i in range(N):\n if B[A[i]]:\n for j in range(2, A_Max):\n if A[i]*j > A_Max:\n break\n B[A[i] * j] = False\n\nans = 0\nfor i in range(N-1):\n if B[A[i]]:\n if A[i] == A[i+1]:\n B[A[i]] = False\n else:\n ans += 1\n\nprint(ans)\n\n', 'N = int(input())\nA = sorted((map(int,input().split())))\nA_Max = A[-1]\nB = [True]*A_Max\n\nfor i in range(N):\n if B[A[i]]:\n for j in range(2, A_Max // A[i]+1):\n B[A[i]*j] = False\n\nans = 0\nfor i in range(N-1):\n if B[A[i]]:\n if A[i] == A[i+1]:\n B[A[i]] = False\n else:\n ans += 1\n\nprint(ans)\n\n', 'N = int(input())\nA = sorted((map(int,input().split())))\nA_Max = A[-1]\nB = [True]*A_Max\n\nfor i in range(N):\n if B[A[i]]:\n for j in range(2, A_Max):\n if A[i]*j > A_Max:\n break\n B[A[i] * j] = False\n\nans = 0\nfor i in range(N-1):\n if B[A[i]]:\n if A[i] == A[i+1]:\n B[A[i]] = False\n else:\n ans += 1\n\nprint(ans)\n\n', 'N = int(input())\nA = sorted((map(int,input().split())))\nA_Max = A[-1]\nB = [True]*A_Max+1\n\nfor i in range(N):\n if B[A[i]]:\n for j in range(2,A_Max):\n if A[i] * j > A_Max:\n break\n B[A[i] * j] = False\n\nans = 0\nfor i in range(N):\n if B[A[i]]:\n B[A[i]] = False\n ans += 1\n\nprint(ans)\n\n', 'N = int(input())\nA = sorted((map(int,input().split())))\nA_Max = A[-1]\nB = [True]*A_Max\n\nfor i in range(N):\n if B[A[i]]:\n for j in range(2, A_Max):\n if A[i]*j > A_Max:\n break\n B[A[i] * j] = False\n\nans = 0\nfor i in range(N):\n if B[A[i]]:\n B[A[i]] = False\n ans += 1\n \nprint(ans)\n\n', 'N = int(input())\nA = sorted((map(int,input().split())))\nA_Max = A[-1]\nB = [True]*A_Max\n\nfor i in range(N):\n if B[A[i]]:\n for j in range(2, A_Max//A[i]+1):\n B[A[i]*j] = False\n\nans = 0\nfor i in range(N-1):\n if B[A[i]]:\n if A[i] == A[i+1]:\n B[A[i]] = False\n else:\n ans += 1\n\nprint(ans)\n\n', 'N = int(input())\nA = sorted((map(int,input().split())))\na_Max = A[-1]\nB = [0]*a_Max\nans =0\nfor a in A:\n if B[a-1] == 0:\n B[a-1] = 1\n ans += 1\n for j in range(a*2-1,a_Max,a):\n B[j] = 2\n elif B[a-1] == 1:\n B[a-1] = 2\n ans -= 1\nprint(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s337334755', 's364571486', 's521018019', 's688279776', 's804012172', 's891911562', 's896756464', 's283665517'] | [32372.0, 32272.0, 32184.0, 32248.0, 32240.0, 32180.0, 32272.0, 32176.0] | [902.0, 817.0, 426.0, 795.0, 106.0, 797.0, 510.0, 309.0] | [397, 391, 346, 391, 351, 356, 344, 288] |
p02642 | u102367647 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['def main():\n\tn = I()\n\tA = np.array(LI())\n\tA.sort()\n\tcount = 0\n\ta_max = A[-1]\n\tdp = [1]*a_max\n\tfor a in A:\n\t\tpoint = dp[a-1]\n\t\tif point == 1:\n\t\t\tdp[a-1] = 2\n\t\t\tcount += 1\n\t\t\tfor i in range(2,a_max):\n\t\t\t\tif a*i > a_max:\n\t\t\t\t\tbreak\n\t\t\t\tdp[a*i-1] = 0\n\t\telif point == 2:\n\t\t\tcount -= 1\n\t\t\tdp[a-1] = 0\n\tprint(count)', "import sys\nimport numpy as np\nimport random\nfrom decimal import Decimal\nimport itertools\nimport re\nimport bisect\nfrom collections import deque, Counter\nfrom functools import lru_cache\n\nsys.setrecursionlimit(10**9)\nINF = 10**13\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)]\ndef SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')\ndef GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]\ndef GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]\nMOD = 1000000007\n\ndef main():\n\tn = I()\n\tA = np.array(LI())\n\tA.sort()\n\tcount = 0\n\ta_max = A[-1]\n\tdp = [1]*a_max\n\tfor a in A:\n\t\tpoint = dp[a-1]\n\t\tif point == 1:\n\t\t\tdp[a-1] = 2\n\t\t\tcount += 1\n\t\t\tfor ai in range(a*2,a_max+1,a):\n\t\t\t\tdp[ai-1] = 0\n\t\telif point == 2:\n\t\t\tcount -= 1\n\t\t\tdp[a-1] = 0\n\tprint(count)\n\n\n\n\n\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s894393915', 's663156160'] | [9052.0, 45936.0] | [23.0, 442.0] | [308, 1415] |
p02642 | u106311097 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ["#!python3.8\n# -*- coding: utf-8 -*-\n# abc170/abc170_d\nimport sys\nfrom collections import Counter\n\ni2s = sys.stdin.readline().rstrip\n\ndef main():\n N = int(i2s())\n A = sorted(map(int, i2s().split(' ')))\n B = Counter(A)\n for a in A:\n if B[a] == 0:\n continue\n if B[a] > 1:\n B[a] = 0\n for i in range(2, A[-1] // a + 1):\n if B[a * i]:\n B[a * i] = 0\n print(sum(B.values()))\n return\n\nmain()\n", "#!python3.8\n# -*- coding: utf-8 -*-\n# abc170/abc170_d\nimport sys\n\ns2nn = lambda s: [int(c) for c in s.split(' ')]\nss2nn = lambda ss: [int(s) for s in list(ss)]\nss2nnn = lambda ss: [s2nn(s) for s in list(ss)]\ni2s = lambda: sys.stdin.readline().rstrip()\ni2n = lambda: int(i2s())\ni2nn = lambda: s2nn(i2s())\nii2ss = lambda n: [i2s() for _ in range(n)]\nii2nn = lambda n: ss2nn(ii2ss(n))\nii2nnn = lambda n: ss2nnn(ii2ss(n))\n\ndef main():\n N = i2n()\n A = sorted(int(c) for c in i2s().split(' '))\n max_ = A[-1]\n B = {}\n if N == 1:\n print(1)\n return\n if A[0] == A[1]:\n B[A[i]] = 2\n else:\n B[A[i]] = 1\n for i in range(1, N - 1):\n if A[i-1] == A[i] or A[i+1] == A[i]:\n B[A[i]] = 2\n else:\n B[A[i]] = 1\n if A[-2] == A[-1]:\n B[A[i]] = 2\n else:\n B[A[i]] = 1\n for b in B:\n if B[b] == 0:\n continue\n if B[b] == 2:\n B[b] = 0\n for i in range(2, max_ // b + 1):\n if b * i in B:\n B[b * i] = 0\n res = 0\n for v in B.values():\n if v:\n res += 1\n print(res)\n return\n\nmain()\n", "#!python3.8\n# -*- coding: utf-8 -*-\n# abc170/abc170_d\nfrom collections import Counter\n\ndef main():\n N = input()\n A = sorted(map(int, input().split(' ')))\n B = Counter(A)\n r = 0\n for a in A:\n if B[a] == 0:\n continue\n if B[a] == 1:\n r += 1\n for i in range(2, A[-1] // a + 1):\n B[a * i] = 0\n print(r)\n return\n\nmain()\n"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s091550262', 's407577590', 's054306086'] | [9392.0, 32424.0, 96764.0] | [26.0, 114.0, 935.0] | [470, 1156, 389] |
p02642 | u107601154 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\narray = list(map(int, input().strip().split()))\narray.sort()\nans = 0\na = [True] * array{N}\ni = 0\nbefore = 0\nfor i in array:\n j = 2*i\n if i == before:\n array[i] == False\n while j < array[N]:\n array[j] == False\n j += i\n before = i\nfor i in array:\n if array[i] == True:\n ans += 1\nprint(ans)', 'N = int(input())\narray = list(map(int, input().strip().split()))\narray.sort()\nans = 0\na = [True] * array[N-1]\ni = 0\nbefore = 0\nfor i in array:\n j = 2*i\n if i == before:\n array[i] == False\n while j < array[N-1]:\n array[j] == False\n j += i\n before = i\nfor i in array:\n if array[i] == True:\n ans += 1\nprint(ans)', 'N = int(input())\narray = list(map(int, input().strip().split()))\narray.sort()\nans = 0\na = [True] * (10**6 + 1)\ni = 0\nbefore = 0\nfor i in array:\n if a[i] == True:\n j = 2*i\n if i == before:\n a[i] = False\n while j <= array[N-1]:\n a[j] = False\n j += i\n before = i\nfor i in array:\n if a[i] == True:\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s552616803', 's878330499', 's912506160'] | [9028.0, 32176.0, 33096.0] | [23.0, 589.0, 652.0] | [347, 351, 388] |
p02642 | u111473084 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['def main():\n import sys\n sys.setrecursionlimit(10**9)\n input = sys.stdin.readline\n from collections import Counter\n\n N = int(input())\n A = tuple(map(int, input().split()))\n counter_A = Counter(A)\n \n count = 0\n for i in counter_A.keys():\n if counter_A[i] > 1:\n continue\n flag = True\n j = 2\n while j*j <= i:\n if i % j != 0 :\n j += 1\n continue\n if j in counter_A :\n flag = False\n break\n j += 1\n\n if flag:\n count += 1\n\n print(count)\n\nmain()', 'def main():\n import sys\n sys.setrecursionlimit(10**9)\n input = sys.stdin.readline\n from collections import Counter\n\n N = int(input())\n A = list(map(int, input().split()))\n counter_A = Counter(A)\n flag = [True] * 1000001\n\n count = 0\n for i in sorted(counter_A.keys()):\n if counter_A[i] == 1 and flag[i]:\n count += 1\n multiple = i\n while multiple < 1000001:\n flag[multiple] = False\n multiple += i\n\n print(count)\n\n\nmain()'] | ['Wrong Answer', 'Accepted'] | ['s314999901', 's043339732'] | [37064.0, 40204.0] | [2206.0, 1150.0] | [619, 505] |
p02642 | u113255362 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nList = list(map(int, input().split()))\nres = 0\nNew_List = sorted(List)\nFlag = [1]*N\n\ndef checkf(x, List):\n for j in range(N):\n if x < j:\n break\n else:\n if x == List[j]:\n return True\n return False\nfor i in range(2, N-1):\n for j in range(i+1,N):\n if New_List[i] == New_List[j]:\n Flag[i] = 0\n Flag[j] = 0\nA = New_List[N-1]\nfor i in range(2,A):\n if checkf(i, New_List):\n for j in range(N):\n if New_List[j] == i :\n pass\n elif New_List[j] % i == 0:\n Flag[j] = 0\n if i > New_List[N-1]**0.5:\n break\nres = Flag.count(1)\nprint(Flag,res)', 'N = int(input())\nList = list(map(int, input().split()))\nres = 0\nNew_List = sorted(List)\nFlag = [1]*N\nfor i in range(1,N):\n print(Flag)\n if Flag[i] ==1:\n for j in range(i):\n if New_List[i] == New_List[j]:\n Flag[i] = 0\n Flag[j] = 0\n if Flag[j] == 1:\n if New_List[i] % New_List[j] == 0:\n Flag[i] = 0\n else:\n pass\n elif Flag[j] == 0:\n pass\n else:\n pass\nres = Flag.count(1)\nprint(res)', 'N = int(input())\nList = list(map(int, input().split()))\nres = 0\nList.sort()\nK = List[N-1]+1\nFlag = [1]*K\nfor i in range(N):\n if Flag[List[i]] ==1:\n res +=1\n for j in range(List[i],K,List[i]):\n Flag[j] = 0\n if i != N-1 and List[i] == List[i+1]:\n res += -1\nprint(res)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s299573464', 's707382161', 's540443172'] | [33284.0, 127980.0, 33124.0] | [2206.0, 2418.0, 348.0] | [615, 456, 285] |
p02642 | u114641312 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['from collections import deque,Counter\n\nN = int(input())\nA = list(map(int,input().split()))\n\nmemo = [0] * (10**6+10)\ncnt = Counter(A)\nfor k,v in cnt.items():\n if memo[k] > 1:\n continue\n for j in range(k,10**6+1,k):\n memo[j] += v \n\nans = 0\nfor num in cnt:\n ans += (memo[num] == 0)\n\nprint(ans)\n', '# from math import factorial,sqrt,ceil #,gcd\n# from itertools import permutations,combinations,combinations_with_replacement\n# from collections import deque,Counter\n# from bisect import bisect_left\n# from heapq import heappush,heappop\nfrom numba import njit,jit\n\n# from fractions import gcd\n\n# from decimal import Decimal, getcontext\n\n# # eps = Decimal(10) ** (-100)\n\nimport numpy as np # numpy.lcm()\n# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson\n# from scipy.sparse import csr_matrix\n\n# import networkx as nx\n# G = Graph()\n\n\nN = int(input())\nlisA = list(map(int,input().split()))\n\n@jit\ndef solve(lisA):\n lisA.sort()\n arrA = np.array(lisA)\n needcheck = np.array([])\n i = 0\n while len(arrA)>0:\n needcheck = np.append(needcheck,arrA[i])\n filter = (arrA % arrA[i] != 0)\n arrA = arrA[filter]\n\n ans = len(needcheck)\n if lisA[0] in lisA[1:]:\n ans -= 1\n return ans\n \nprint(solve(lisA))\n# for row in board:\n\n# print("{:.10f}".format(ans))\n# print("{:0=10d}".format(ans))\n', 'from collections import deque,Counter\n\nN = int(input())\nA = list(map(int,input().split()))\n\nmemo = [0] * (10**6+10)\ncnt = Counter(A)\nfor k,v in cnt.items():\n if memo[k] > 1:\n continue\n for j in range(k,10**6+1,k):\n memo[j] += v \n\n# print(memo[:max(A)+1])\n\nans = 0\nfor num in cnt:\n ans += (memo[num] == 1)\n\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s624117516', 's790832663', 's389044289'] | [52928.0, 136676.0, 52656.0] | [847.0, 2210.0, 921.0] | [314, 1347, 340] |
p02642 | u116038906 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['\nimport numpy as np \nimport sys\ninput = sys.stdin.readline\nN = int(input())\nA = list(map(int, input().split()))\nA.sort()\nA_np =np.array(A,dtype=np.int64)\nA_set =set(A)\ncount =set()\nfor i in range(N):\n if np.count_nonzero(A[i] %A_np[:i] ==0) >=1:\n count.add(A[i])\nans =len(A_set - count)\nprint(ans)\n"""', '\ndef make_divisors(n): をリストで返す\n divisors = set()\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.add(i)\n if i != n // i:\n divisors.add(n//i)\n return divisors\n\n\nfrom collections import Counter\nimport sys\ninput = sys.stdin.readline\nN = int(input())\nA = list(map(int, input().split()))\nA.sort()\nA_set =set(A)\ncount =set()\ncouter =Counter(A)\nfor a in A:\n if couter[a] >=2:\n count.add(a)\n else:\n divi_set =make_divisors(a)\n intersection =divi_set & A_set\n if len(intersection) >=2:\n count.add(a)\nans =len(A_set - count)\nprint(ans)', '\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n\n\t\n\nfrom collections import Counter\nimport bisect\nN = int(input())\nA = list(map(int,input().split()))\ncnt = Counter(A)\nA.sort()\nans = 0\nMX = 10**6\nP = [0] * (MX+1)\nfor a in A:\n if P[a]==0:\n for i in range(MX+1):\n x = a*i\n if x > MX:\n break\n P[x] = 1\n if cnt[a]==1:\n ans+=1\nprint (ans)'] | ['Runtime Error', 'Time Limit Exceeded', 'Accepted'] | ['s662697900', 's811374478', 's523342868'] | [8900.0, 54116.0, 39068.0] | [25.0, 2207.0, 659.0] | [329, 678, 407] |
p02642 | u125348436 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N=int(input())\n\nA=list(map(int,input().split()))\n\nrcnt=0\nlength=len(A)\ndef length(n,*A):\n \n for i in range(length):\n if A[i]==A[i+1]:\n cnt+=1\n if cnt==N:\n print(0)\n return\n\n for i in range(length):\n cnt=0\n for j in range(length):\n if A[i]%A[j]!=0 and A[i]!=A[j]:\n cnt+=1\n if cnt==N-1:\n rcnt+=1\n print(rcnt)\nlength(*A)', '\n\nfrom collections import Counter\nn = int(input())\na = list(map(int, input().split()))\n\n\nc = Counter(a)\n\n\np = [True] * (10 ** 6 + 1)\n\n\ns = list(set(a))\n\n\nfor x in s:\n t = x * 2\n \n \n while t <= 10 ** 6:\n p[t] = False\n t += x\nans = 0\n\nfor x in a:\n \n if c[x] == 1 and p[x] == True:\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s479120255', 's442439721'] | [32264.0, 52468.0] | [71.0, 1889.0] | [434, 773] |
p02642 | u127499732 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['def main():\n n, *a = map(int, open(0).read().split())\n if n == 1:\n print(1)\n return\n\n m = max(a) + 1\n l = [0] * m\n for i in a:\n for j in range(i, m, i):\n l[j] += 2\n l[i] -= 1\n\n ans = sum(l[i] == -1 for i in a)\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', 'def main():\n n, *a = map(int, open(0).read().split())\n if n == 1:\n print(1)\n return\n\n m = max(a) + 1\n l = [0] * m\n for i in a:\n for j in range(i, m, i):\n l[j] += 2\n l[i] -= 1\n\n ans = sum(a[i] == -1 for i in a)\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n', "def main():\n from collections import Counter\n n, *a = map(int, open(0).read().split())\n x = Counter(a)\n\n y = [k for k, v in x.items() if v == 1]\n if len(y) == 0:\n print(0)\n exit()\n\n z = sorted(y)\n\n if x.get(1) > 1:\n print(0)\n exit()\n if x.get(1) == 1:\n print(1)\n exit()\n\n l = z[-1]\n m = [0] * (l + 1)\n for i in z:\n if m[i] == 0:\n m[i] = 1\n j = l // i\n for k in range(2, j + 1):\n m[i * k] = -1\n\n ans = m.count(1)\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", 'def main():\n n, *a = map(int, open(0).read().split())\n if n == 1:\n print(1)\n return\n\n m = max(a) + 1\n l = [0] * m\n for i in a:\n for j in range(i, m, i):\n l[j] += 2\n l[i] -= 1\n\n ans = sum(l[i] == 1 for i in a)\n print(ans)\n\n\nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s245280021', 's613106359', 's766216025', 's190718386'] | [33144.0, 33216.0, 38244.0, 33132.0] | [352.0, 406.0, 150.0, 387.0] | [322, 322, 588, 321] |
p02642 | u127873832 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['from collections import Counter\n\ndef undivisible(A):\n m = max(A)\n dp = [True] * (m+1)\n A.sort()\n for a in A:\n if dp[a]:\n k = a * 2\n while k <= m:\n dp[k] = False\n k += a\n cnt = Counter(A)\n ans = 0\n for a in A:\n if dp[a] and cnt[a] == 1:\n ans += 1\n return ans\n\nn = int(input())\nA = list(map(int, input().split()))\nundivisible(A)\n\n', 'from collections import Counter\n\ndef undivisible(A):\n m = max(A)\n dp = [True] * (m+1)\n A.sort()\n for a in A:\n if dp[a]:\n k = a * 2\n while k <= m:\n dp[k] = False\n k += a\n cnt = Counter(A)\n ans = 0\n for a in A:\n if dp[a] and cnt[a] == 1:\n ans += 1\n return ans\n\nA = list(map(int, input().split()))\nundivisible(A)\n', 'from collections import Counter\n\ndef undivisible(A):\n m = max(A)\n dp = [True] * (m+1)\n A.sort()\n for a in A:\n if dp[a]:\n k = a * 2\n while k <= m:\n dp[k] = False\n k += a\n cnt = Counter(A)\n ans = 0\n for a in A:\n if dp[a] and cnt[a] == 1:\n ans += 1\n return ans\n\nn = int(input())\nA = list(map(int, input().split()))\nprint(undivisible(A))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s754332728', 's908886916', 's756694485'] | [43380.0, 10700.0, 43532.0] | [268.0, 32.0, 281.0] | [429, 411, 434] |
p02642 | u129749062 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\na = list(map(int,input().split()))\nA = sorted(a, reverse=True)\ncount = 0\nfor i in range(N-1):\n flag = False\n for j in range(i+1,N):\n if i != j:\n if A[i] % A[j] == 0:\n flag = True\n break\n if flag == False:\n count += 1\nprint(count)\n', 'N = int(input())\na = list(map(int,input().split()))\nA = sorted(a, reverse=True)\ncount = 0\nprint(A)\nif A[N-1] % A[N-2] != 0:\n count += 1\nfor i in range(N-1):\n flag = False\n for j in range(i+1,N):\n if i != j:\n if A[i] % A[j] == 0:\n flag = True\n break\n if flag == False:\n count += 1\nprint(count)\n', 'N = int(input())\nA = list(map(int,input().split()))\nA.sort()\ncnt = 0\ndp = [True]*(A[-1]+1)\n\nfor i in range(N-1):\n if dp[A[i]] == True:\n for j in range(A[i], A[-1]+1,A[i]):\n dp[j] = False\n if A[i] != A[i+1]:\n cnt+=1\nif dp[A[-1]] == True:\n cnt+=1\nprint(cnt)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s554913266', 's735962431', 's990424463'] | [32308.0, 32252.0, 32300.0] | [2206.0, 2206.0, 315.0] | [275, 322, 273] |
p02642 | u131638468 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n,*a=map(int,open(0).read().split())\na.sort()\nnum=[True for i in range(a[-1]+1)]\nfor i in range(n):\n if num[a[i]]:\n for j in range(a[-1]//a[i]):\n if j<2:\n continue\n num[a[i]*j]=False\n if i==n-1:\n pass\n elif a[i]==a[i+1]:\n num[a[i]]=False\n else:\n pass\n else:\n continue\nans=0\nfor i in range(n):\n if num[a[i]]:\n ans+=1\nprint(ans)', 'n,*a=map(int,open(0).read().split())\nans=[]\na.sort()\nfor i in range(1,n):\n for x in a[:i]:\n if a[i]%x==0:\n ans.append(x)\n break\nprint(len(ans))', 'n,*a=map(int,open(0).read().split())\na.sort()\nnum=[True for i in range(a[-1]+1)]\nfor i in range(n):\n if num[i]:\n for j in range(a[-1]//a[i]):\n if j<2:\n continue\n num[a[i]*j]=False\n if i!=n-1 and a[i]==a[i+1]:\n num[a[i]]=False\n else:\n pass\nans=0\nfor i in range(n):\n if num[a[i]]:\n ans+=1\nprint(ans)', 'n,*a=map(int,open(0).read().split())\na.sort()\nnum=[True for i in range(a[-1]+1)]\nfor i in range(n):\n if num[a[i]]:\n for j in range(a[-1]//a[i]+1):\n if j<2:\n continue\n num[a[i]*j]=False\n if i==n-1:\n pass\n elif a[i]==a[i+1]:\n num[a[i]]=False\n else:\n pass\n else:\n continue\nans=0\nfor i in range(n):\n if num[a[i]]:\n ans+=1\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s008281981', 's377469097', 's874213303', 's213161454'] | [33220.0, 32980.0, 33024.0, 33024.0] | [532.0, 2206.0, 451.0, 566.0] | [379, 157, 334, 381] |
p02642 | u131881594 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na=list(map(int,input().split()))\na.sort()\ndp = [True for _ in range(a[n-1])]\nfor val in set(a):\n for i in range(2,a[n-1]+1,val):\n dp[i-1]=False\nans = 0\nfor val in a:\n if dp[val-1] and a.count(val)==1:\n ans+=1\nprint(ans)', 'n = int(input())\na=list(map(int,input().split()))\na.sort()\ndp = [True for _ in range(a[n-1])]\nfor val in set(a):\n for i in range(2,a[n-1],i):\n dp[i-1]=False\nans = 0\nfor val in a:\n if dp[val-1] and a.count(val)==1:\n ans+=1\nprint(ans)', 'n = int(input())\na=list(map(int,input().split()))\na.sort()\ndp = [True for _ in range(a[n-1])]\nfor val in set(a):\n temp=2\n for temp in range(2,a[n-1]//val):\n dp[val*temp-1]=False\nans = 0\nfor val in a:\n if dp[val-1] and a.count(val)==1:\n ans+=1\nprint(ans)', 'n=int(input())\na=list(map(int,input().split()))\na.sort()\ndp=[True]*a[-1]\ndef hantei(i):\n ans = True\n if i!=n-1:\n if a[i]==a[i+1]: ans = False\n if i!=0:\n if a[i]==a[i-1]: ans=False\n return ans\nfor val in set(a):\n for i in range(2*val,a[-1]+1,val): dp[i-1]=False\nans=0\nfor i in range(n):\n if dp[a[i]-1] and hantei(i)==1: ans+=1\nprint(ans)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s489772895', 's582335409', 's828285891', 's275483349'] | [39420.0, 39644.0, 39400.0, 38520.0] | [2206.0, 161.0, 2206.0, 431.0] | [256, 252, 276, 368] |
p02642 | u137646745 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['length=int(input())\nlist=list(map(int,input().split()))\nmax=max(list)\ndp=[True]*(max+1)\nret=0\nfor num in list:\n if dp[num]:\n for i in range(max//num+1):\n dp[num*i]=False\n if list.count(num)==1:\n ret=ret+1\nprint(ret)\n', 'import numpy as np\nfrom collections import Counter\n\nlength=int(input())\nlist=list(map(int,input().split()))\nlist.sort()\n\nmax=list[-1]\ndp=[0]*(max+1)\ndp=np.array(dp,int)\n\nfor num in list:\n dp[num]=1\n\nfor num in list:\n if dp[num]==1:\n dp[2*num::num]=0\n\ncount=Counter(list)\n\nfor num,cnt in count.items():\n if cnt>1:\n dp[num]=0\n\nprint(dp.sum())\n'] | ['Wrong Answer', 'Accepted'] | ['s915396425', 's586956344'] | [32312.0, 63328.0] | [2206.0, 502.0] | [255, 364] |
p02642 | u141786930 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['# D - Not Divisible\nimport numpy as np\nfrom collections import Counter\n\nN = int(input())\nA = list(int(a) for a in input().split())\nc = Counter(A)\ndbl = len([i[0] for i in c.items() if i[1] >= 2])\n\nA.sort()\nA = np.array(A)\nans = 0\nfor i in range(N):\n if A[i] == 0:\n continue\n else:\n ans += 1\n B = A % A[i]\n B = B.astype(np.bool)\n A = A * B\n\nprint(ans-dbl)', '# D - Not Divisible\nimport numpy as np\nfrom collections import Counter\n\nN = int(input())\nA = list(int(a) for a in input().split())\nc = Counter(A)\ndbl = set([i[0] for i in c.items() if i[1] >= 2])\n\nA.sort()\nA = np.array(A)\nans = 0\nfor i in range(N):\n if A[i] == 0:\n continue\n elif A[i] not in dbl:\n ans += 1\n B = A % A[i]\n B = B.astype(np.bool)\n A = A * B\n\nprint(ans)', '# D - Not Divisible\n\nN = int(input())\nA = list(int(a) for a in input().split())\nA.sort()\n\nM = max(A)\nis_D = [0] * (M+1)\nfor i, a in enumerate(A):\n if is_D[a]:\n is_D[a] = 2\n continue\n for j in range(2*a, M+1, a):\n is_D[j] += 1\n\nans = 0\nfor a in A:\n if is_D[a] == 1:\n ans += 1\nprint(ans)', '# D - Not Divisible\n\nN = int(input())\nA = list(int(a) for a in input().split())\nA.sort()\n\nM = max(A)\nis_D = [0] * (M+1)\nfor i, a in enumerate(A):\n if is_D[a]:\n is_D[a] = 2\n continue\n for j in range(a, M+1, a):\n is_D[j] += 1\n\nans = 0\nfor a in A:\n if is_D[a] == 1:\n ans += 1\nprint(ans)'] | ['Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s368527457', 's711350191', 's813813147', 's086080937'] | [52936.0, 53004.0, 32232.0, 32296.0] | [2207.0, 2207.0, 464.0, 379.0] | [395, 395, 322, 320] |
p02642 | u145145077 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n=int(input())\na=list(map(int, input().split()))\na_set=set(a)\na_uni=list(a_set)\n\nkazu=[0]*(10*6+1)\nfor i in a_uni:\n for j in range(1,len(a_uni), i):\n kazu[j] += 1\n\ncount = 0\nfor i in a_uni:\n if kazu[i] == 1:\n count += 1\nprint(count)', 'n=int(input())\na=list(map(int, input().split()))\nkazu=[0]*(10**6+1)\nfor i in a:\n for j in range(i,10**6+1, i):\n if j > 10**6+1:\n break\n if kazu[i] >= 2:\n break\n kazu[j] += 1\n\ncount = 0\nfor i in a:\n if kazu[i] == 1:\n count += 1\nprint(count)'] | ['Runtime Error', 'Accepted'] | ['s674793432', 's506399800'] | [32232.0, 32160.0] | [186.0, 913.0] | [240, 263] |
p02642 | u146597538 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = list(map(int, input().split()))\n\na_sorted = sorted(a)\ndivisible_list = [0] * 2 * 100010\n\nfor i in range(len(a)):\n \n if divisible_list[a[i]] > 2:\n continue\n for j in range(0, len(divisible_list), a[i]):\n divisible_list[j] += 1\n\nans = 0\nfor i in range(a):\n if divisible_list[a[i]] == 1:\n ans+=1\nprint(ans)', 'n = int(input())\na = list(map(int, input().split()))\n\na_sorted = sorted(a)\ndivisible_list = [0] * (max(a)+1)\n\nfor i in range(len(a)):\n \n if divisible_list[a[i]] > 2:\n continue\n for j in range(0, len(divisible_list), a[i]):\n divisible_list[j] += 1\n\nans = 0\nfor i in range(len(a)):\n if divisible_list[a[i]] == 1:\n ans+=1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s777172711', 's084912196'] | [32348.0, 32232.0] | [322.0, 527.0] | [425, 430] |
p02642 | u149991748 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\na = list(map(int, input().split()))\na.sort(reverse=True)\nans = 0\n#print(a)\n\nfor i in range(n-1):\n for j in range(i+1, n):\n if a[i]%a[j] == 0 and a[i]!=a[j]:\n ans += 1\n break\n\nprint(ans)', 'n = int(input())\na = list(map(int, input().split()))\na.sort()\naMax = a[-1]\nans = 0\ndp = [1] * (aMax+1)\n\nfor i in range(n-1):\n p = a[i]\n if dp[p] == 1:\n for j in range(aMax//p+1):\n dp[p*j] = 0\n if a[i] != a[i+1]:\n ans += 1\nif dp[aMax] == 1:\n ans += 1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s080419633', 's554027896'] | [32232.0, 32164.0] | [2206.0, 445.0] | [234, 305] |
p02642 | u151285327 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['N = int(input())\nA = list(map(int, input().split()))\nn = max(A)\ndp = [True for i in range(n+1)]\np = 2\nwhile (p * p <= n): \n # If prime[p] is not changed, then it is a prime \n if (prime[p] == True): \n # Update all multiples of p \n for i in range(p * p, n+1, p): \n prime[i] = False\n p += 1\nans = 0\nfor num in A:\n if dp[num]:\n ans += 1\nprint(ans)', 'from collections import Counter\ndef D():\n N = int(input())\n A = list(map(int, input().split()))\n nums = Counter(A)\n if 1 in nums:\n if nums[1] > 1:\n print(0)\n return\n else:\n print(1)\n return\n n = max(A)\n dp = [True for i in range(n+1)]\n p = 2\n while (p <= n): \n if (p in nums and dp[p] == True): \n for i in range(p*2, n+1, p): \n # print(i)\n dp[i] = False\n p += 1\n ans = 0\n for num in nums:\n if nums[num] == 1 and dp[num]:\n # print(num)\n ans += 1\n print(ans)\n\nD()'] | ['Runtime Error', 'Accepted'] | ['s225303441', 's739265405'] | [32164.0, 43032.0] | [101.0, 432.0] | [365, 636] |
p02642 | u152614052 | 2,000 | 1,048,576 | Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: * For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. | ['n = int(input())\nli = list(map(int,input().split()))\nli2 = li[:]\nli2.sort(reverse=True)\nans = 0\n\nif len(set(li)) == 1:\n ans = 0\nelse:\n for i,num in enumerate(li2,1):\n temp = 0\n j_list = li2[i:]\n for j in j_list:\n if num % j == 0:\n break\n else:\n temp += 1\n if temp == n - i and n != i:\n ans += 1\nprint(ans)', 'n = int(input())\nli = list(map(int,input().split()))\nli.sort()\ncnt = 0\n\n\ncnt_li = [0] * (10 ** 6 +1)\n\nfor i in li:\n cnt_li[i-1] += 1\n if cnt_li[i-1] == 1:\n for j in range(2*i,10**6+1,i):\n cnt_li[j-1] += 1\n\nfor k in li:\n if cnt_li[k-1] == 1:\n cnt += 1\n\nprint(cnt)'] | ['Wrong Answer', 'Accepted'] | ['s160056814', 's924853805'] | [33956.0, 32128.0] | [2206.0, 489.0] | [402, 296] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.