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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02718 | u938718404 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['n,m=map(int,input().split())\nai=list(map(int,input().split()))\nbi=[i for i in ai if i>=sum(ai)/(4*m)]\nif len(ai)==len(bi):\n print("Yes")\nelse:\n print("No")', 'n,m=map(int,input().split())\nai=list(map(int,input().split()))\nbi=[i for i in ai if i>=sum(ai)/(4*m)]\nif len(bi)>=m:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s720070068', 's657351539'] | [9196.0, 9188.0] | [24.0, 23.0] | [161, 155] |
p02718 | u939198091 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['import math\n\ndef solve(n,m,lst):\n min_vote = math.ceil(sum(lst)/4/m) - 1\n print(min_vote)\n print(sum(lst))\n return lst[m-1] > min_vote\n\nif __name__ == "__main__":\n _n, _m = map(int, input().split())\n a_list = [int(i) for i in input().split()]\n a_list = sorted(a_list,reverse=True)\n if solve(_n,_m,a_list):\n print(\'Yes\')\n else:\n print(\'No\')\n', 'import math\n\ndef solve(n,m,lst):\n min_vote = math.ceil(sum(lst)/4/m) - 1\n return lst[m-1] > min_vote\n\nif __name__ == "__main__":\n _n, _m = map(int, input().split())\n a_list = [int(i) for i in input().split()]\n a_list = sorted(a_list,reverse=True)\n if solve(_n,_m,a_list):\n print(\'Yes\')\n else:\n print(\'No\')\n'] | ['Wrong Answer', 'Accepted'] | ['s059049459', 's719712702'] | [3060.0, 3060.0] | [18.0, 18.0] | [355, 319] |
p02718 | u942767171 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ["n,m = map(int,input().split())\na = []\na = list(map(int,input().split()))\n\nb = sum(a)/(4.0*m)\nc = 0\nfor i in range(n) :\n if a[i]>=b :\n c += 1\n\nif c>=m :\n print('YES')\nelse :\n print('NO')", "n,m = map(int,input().split())\na = []\na = list(map(int,input().split()))\n\nb = sum(a)/(4.0*m)\nc = 0\nfor i in range(n) :\n if a[i]>=b :\n c += 1\n\nif c>=m :\n print('Yes')\nelse :\n print('No')\n"] | ['Wrong Answer', 'Accepted'] | ['s406767763', 's033084099'] | [3060.0, 3060.0] | [17.0, 18.0] | [201, 202] |
p02718 | u944325914 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['n,m = map(int,input().split())\na=list(map(int,input().split()))\na_sum=sum(a)\na_sort=sorted(a)\nfor i in range(m):\n if a_sort[i]<(a_sum)/4/m:\n print("No")\n break\nelse:\n print("Yes")', 'n,m = map(int,input().split())\na=list(map(int,input().split()))\na_sum=sum(a)\na_sort=sorted(a,reverse=True)\nfor i in range(m):\n if a_sort[i]<(a_sum)/4/m:\n print("No")\n break\nelse:\n print("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s699824047', 's533836163'] | [9032.0, 9044.0] | [25.0, 25.0] | [187, 200] |
p02718 | u944886577 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['n,m=map(int,input().split())\na=list(map(int,input().split()))\na_sort=[]\na_sort=sorted(a,reverse=True)\nsum=0\nfor i in a:\n sum+=i\n\nfor j in range(1,m+1):\n if j<=sum/(4*m):\n print("No")\n exit()\nprint("Yes")', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\na_sort=a.sorted()\nsum=0\nfor i in a:\n sum+=i\n\nfor j in (1,m+1):\n if j<=1/(4*m):\n print("No")\n exit()\nprint("Yes")\n', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\na_sort=[]\na_sort=sorted(a,reverse=True)\nsum=0\nfor i in a:\n sum+=i\nb_sort=a_sort[0:m]\nfor j in b_sort:\n if j<sum/(4*m):\n print("No")\n exit()\nprint("Yes")'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s782780415', 's833650919', 's732310703'] | [9056.0, 9068.0, 9184.0] | [30.0, 30.0, 29.0] | [210, 182, 221] |
p02718 | u945335181 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['N,M = map(int,input().split())\n\nvotos = list(map(int,input().split()))\n\nqtd_votos = sum(votos)\nminimo = qtd_votos//(4*M)\n\ncontador = 0\nfor i in votos:\n if i >= minimo:\n contador += 1\n\nprint(qtd_votos,contador,minimo)\nif contador >= M:\n print("Yes")\nelse:\n print("No")\n', 'N,M = map(int,input().split())\n\nvotos = list(map(int,input().split()))\n\nqtd_votos = sum(votos)\n\nminimo = qtd_votos/(4*M)\n\nvotos.sort(reverse = True)\n\nif votos[M-1] >= minimo:\n print("Yes")\nelse:\n print("No")\nトすることで判定できます。', 'N,M = map(int,input().split())\n\nvotos = list(map(int,input().split()))\n\nqtd_votos = sum(votos)\n\nminimo = qtd_votos/(4*M)\n\nvotos.sort(reverse = True)\n\nif votos[M-1] >= minimo:\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s662150002', 's852884434', 's126742778'] | [3060.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [284, 253, 214] |
p02718 | u946404093 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['import numpy as np\n\ntmp = input().split(" ")\nallItem, trendingItem = int(tmp[0]), int(tmp[1])\n\nvotes = input().split(" ")\nvotesInt = np.asarray([int(s) for s in votes])\nvotesTotal = np.sum(votesInt)\n\nstandard = votesTotal // (4 * trendingItem) + 1\nprint(votesInt)\nprint(standard)\n\nclearList = votesInt[votesInt >= standard]\n\nresult = \'Yes\' if len(clearList) >= trendingItem else \'No\'\n\nprint(result)', 'import numpy as np\n\ntmp = input().split(" ")\nallItem, trendingItem = int(tmp[0]), int(tmp[1])\n\nvotes = input().split(" ")\nvotesInt = np.asarray([int(s) for s in votes])\nvotesTotal = np.sum(votesInt)\n\nstandard = votesTotal / (4 * trendingItem)\n\nclearList = votesInt[votesInt >= standard]\n\nresult = \'Yes\' if len(clearList) >= trendingItem else \'No\'\n\nprint(result)'] | ['Wrong Answer', 'Accepted'] | ['s062228798', 's258308909'] | [13644.0, 12672.0] | [168.0, 152.0] | [398, 361] |
p02718 | u947000992 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['import math\nn,m=map(int,input().split())\n\nl=list(map(int,input().split()))\ns=sum(l)\nans=0\nt=s/(4*m)\nfor i in l:\n if i>=math.ceil(t):\n print(i,math.ceil(t))\n ans+=1\nif ans>=m:\n print("Yes")\nelse:\n print("No")\n \n', 'import math\nn,m=map(int,input().split())\n\nl=list(map(int,input().split()))\ns=sum(l)\nans=0\nt=s/(4*m)\nfor i in l:\n if i>=math.ceil(t):\n ans+=1\nif ans>=m:\n print("Yes")\nelse:\n print("No")\n \n'] | ['Wrong Answer', 'Accepted'] | ['s613535686', 's079544552'] | [3060.0, 3060.0] | [17.0, 18.0] | [236, 206] |
p02718 | u952708174 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ["N, M = [int(i) for i in input().split()]\nA = [int(i) for i in input().split()]\ntotal = sum(A)\nprint('Yes' if len(1 for a in A if a * 4 * M >= total) >= M else 'No')", "N, M = [int(i) for i in input().split()]\nA = [int(i) for i in input().split()]\ntotal = sum(A)\nprint('Yes' if len([1 for a in A if a * 4 * M >= total]) >= M else 'No')"] | ['Runtime Error', 'Accepted'] | ['s203853122', 's315233203'] | [2940.0, 2940.0] | [17.0, 17.0] | [164, 166] |
p02718 | u953020348 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['N_s,M_s=input().split()\nM=int(M_s)\nN=int(N_s)\nA=list(map(int,input().split()))\n\n\nth=sum(A)/(4*M)\n#print(\'th=\'+ str(th))\n\nA_th=[A_t for A_t in A if A_t>=th]\nprint(\'th=\'+ str(A_th))\n\nif len(A_th)>=M:\n print("Yes")\nelse:\n print("No")', 'N_s,M_s=input().split()\nM=int(M_s)\nN=int(N_s)\nA=list(map(int,input().split()))\n\n\nth=sum(A)/(4*M)\n#print(\'th=\'+ str(th))\n\nA_th=[A_t for A_t in A if A_t>=th]\n\nif len(A_th)>=M:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s821673999', 's538246535'] | [3064.0, 3060.0] | [17.0, 18.0] | [236, 212] |
p02718 | u956223466 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['nm = input().split(" ")\nn = int(nm[0])\nm = int(nm[1])\n\na = input().split(" ")\n\ntotal = 0\nfor v in a:\n total += int(a)\n \nmv = total / (4 * m)\nq = 0\nfor e in a:\n e = int(e)\n if e >= mv:\n q += 1\n \nif q >= m:\n print("Yes", end="")\nelse:\n print("No", end="")\n ', 'nm = input().split(" ")\nn = int(nm[0])\nm = int(nm[1])\n\na = input().split(" ")\n\ntotal = 0\nfor v in a:\n total += int(a)\n \nmv = total / (4 * m)\nq = 0\nfor e in a:\n e = int(e)\n if e >= mv:\n q += 1\n \nif q >= m:\n print("Yes")\nelse:\n print("No")\n ', '= input().split(" ")\nn = int(nm[0])\nm = int(nm[1])\n \na = input().split(" ")\n \ntotal = 0\nfor v in a:\n total += int(v)\n \nmv = total / (4 * m)\nq = 0\nfor e in a:\n e = int(e)\n if e >= mv:\n q += 1\n \nif q >= m:\n print("Yes")\nelse:\n print("No")\n ', 'nm = input().split(" ")\nn = int(nm[0])\nm = int(nm[1])\n \na = input().split(" ")\n \ntotal = 0\nfor v in a:\n total += int(v)\n \nmv = total / (4 * m)\nq = 0\nfor e in a:\n e = int(e)\n if e >= mv:\n q += 1\n \nif q >= m:\n print("Yes")\nelse:\n print("No")\n '] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s346921617', 's424354450', 's704671398', 's084476489'] | [3064.0, 3064.0, 2940.0, 3064.0] | [17.0, 18.0, 17.0, 17.0] | [267, 251, 250, 253] |
p02718 | u962423738 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['\nn,m=map(int,input().split())\na=list(map(int,input().split()))\n \ncnt=0\n \nfor i in a:\n\tif (s/(4*m))<=i:\n\t\tcnt+=1\n\t\tif cnt==m:\n\t\t\tprint("Yes")\n \nif cnt<m:\n\tprint("No")\n', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\n \ncnt=0\n \nfor i in a:\n\tif (sum(a)/(4*m))<=i:\n\t\tcnt+=1\n\t\tif cnt==m:\n\t\t\tprint("Yes")\n \nif cnt<m:\n\tprint("No")'] | ['Runtime Error', 'Accepted'] | ['s126627789', 's502044933'] | [9120.0, 9172.0] | [24.0, 30.0] | [177, 180] |
p02718 | u963349415 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['n, m = map(int, input().split())\n# n, m = map(int, "4 1".split())\n# inputText2 = "5 4 2 1"\ninputText2 = input()\ninput2List = list(map(int,inputText2.split()))\nsortList = sorted(input2List, reverse=True)\n# print(sortList) #380 19 1000\ntotal = sum(sortList)\n# print(total)\nh = (1/4*m) * total\n# print(h)\nflg = False\nfor i in range(m):\n if sortList[i] < h:\n flg = True\n\n\nif flg:\n print("NO")\nelse:\n print("YES")\n', 'n, m = map(int, input().split())\n# n, m = map(int, "12 3".split())\n# inputText2 = "4 56 78 901 2 345 67 890 123 45 6 789"\ninputText2 = input()\ninput2List = list(map(int,inputText2.split()))\nsortList = sorted(input2List, reverse=True)\n# print(sortList) #380 19 1000\ntotal = sum(sortList)\n# print(total)\nh = (1/(4*m)) * total\nflg = False\nfor i in range(m):\n if sortList[i] < h:\n flg = True\n break\n\n\nif flg:\n print("No")\nelse:\n print("Yes")\n'] | ['Wrong Answer', 'Accepted'] | ['s812057067', 's589409328'] | [3060.0, 3060.0] | [17.0, 17.0] | [426, 462] |
p02718 | u967484343 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['N,M = map(int,input().split())\nA = list(map(int,input().split)))\nsum = 0\nans = "Yes"\nfor i in range(len(A)):\n sum += A[i]\njudge = sum / (4*M)\nfor i in ramge(len(A)):\n if A[i] < judge:\n ans = "No"\n break\nprint(ans)', 'N,M = map(int,input().split())\nA = list(map(int,input().split()))\nsumA = sum(A)\ncount = 0\njudge = sumA / (4*M)\nfor i in range(len(A)):\n if A[i] >= judge:\n count += 1\nif count < M:\n ans = "No"\nelse:\n ans = "Yes"\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s835806616', 's647316793'] | [8944.0, 9168.0] | [26.0, 30.0] | [221, 227] |
p02718 | u968826463 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['n,m = input().split(" ")\nn=int(n)\nm=int(m)\narr = list(map(int,input().split(" ")))\n\nx = sum(arr)\n\nfrac = x/(m*4)\n\nans=0\nflag=False\nfor i in range(len(arr)):\n if(arr[i]>=frac):\n ans+=1\n if(ans>=m):\n print("Yes")\n flag=True\n break\n\nif(ans>=m):\n print("Yes")\nelse:\n print("No")', 'n,m = input().split(" ")\nn=int(n)\nm=int(m)\narr = list(map(int,input().split(" ")))\n\nx = sum(arr)\n\nfrac = x/(m*4)\n\nans=0\nfor i in range(len(arr)):\n if(arr[i]>=frac):\n ans+=1\nif(ans>=m):\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s797532156', 's810022428'] | [3064.0, 3064.0] | [17.0, 18.0] | [314, 233] |
p02718 | u969080040 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['N,M=map(int,input().split())\nA=list(map(int,input().split()))\nS=sum(A)\nl=S//(4*M)\nh=0\nfor i in range(N):\n if A[i]>=l:\n h+=1\nif h==M:\n print("Yes")\nelse:\n print("No")', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nS=sum(A)\nl=S//(4*M)\nh=0\nfor i in range(N):\n if A[i]>=l:\n h+=1\n else:\n h+=0\nif h==M:\n print("Yes")\nelse:\n print("No")', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nS=sum(A)\nl=S//(4*M)\nh=0\nfor i in range(N):\n if A[i]>=l:\n h+=1\n else:\n h+=0\nif h=M:\n print("Yes")\nelse:\n print("No")', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nS=sum(A)\nl=S//(4*M)\nh=0\nfor i in range(N):\n if int(A[i])>=l:\n h+=1\n else:\n h+=0\nif h==M:\n print("Yes")\nif h<M:\n print("No")', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nS=sum(A)\nl=1/(4*M)\nh=0\nfor i in range(len(A)):\n if A[i]>=l:\n h+=1\n else:\n h+=0\nif h=M:\n print("Yes")\nelse:\n print("No")', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nS=sum(A)\nl=1/(4*M)\nh=0\nfor i in range(len(A)):\n if A[i]>=l:\n h+=1\n else:\n h+=0\nif h=M:\n print("Yes")\nif M<h\n print("No")', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nS=sum(A)\nl=S//(4*M)\nh=0\nfor i in range(N):\n if A[i]>=l:\n h+=1\n else:\n h+=0\nif h=M:\n print("Yes")\nif h<M:\n print("No")', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nS=sum(A)\nl=S/(4*M)\nh=0\nfor i in range(N):\n if A[i]>=l:\n h+=1\n else:\n h+=0\nif h=M:\n print("Yes")\nelse:\n print("No")', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nS=sum(A)\nl=1/(4*M)\nh=0\nfor i in range(N):\n if A[i]>=l:\n h+=1\n else:\n h+=0\nif h=M:\n print("Yes")\nelse:\n print("No")', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nS=sum(A)\nl=S/(4*M)\nh=0\nfor i in range(N):\n if A[i]>=l:\n h+=1\nif h==M:\n print("Yes")\nelse:\n print("No")', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nS=sum(A)\nl=S//(4*M)\nh=0\nfor i in range(N):\n if A[i]>=l:\n h+=1\n else:\n h+=0\nif h==M:\n print("Yes")\nif h<M:\n print("No")', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nS=sum(A)\nl=S/(4*M)\nh=0\nfor i in range(N):\n if A[i]>=l:\n h+=1\nif h>=M:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s044960227', 's067229772', 's076115281', 's249487158', 's289766984', 's297758385', 's429176648', 's441952815', 's670012543', 's810099246', 's881887978', 's149243265'] | [3064.0, 3060.0, 2940.0, 3064.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3060.0, 3064.0, 3188.0] | [17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 18.0, 18.0] | [171, 188, 187, 195, 191, 192, 189, 186, 186, 170, 190, 170] |
p02718 | u969848070 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ["n, m = map(int, input().split())\nl = list(map(int, input().split()))\nl.sorted()\nif min(l[m-1]) < 1/(4*m):\n print('No')\nelse:\n print('Yes')", "n, m = map(int, input().split())\nl = list(map(int, input().split()))\nl.sort()\nl.reverse()\na = sum(l)\nfor i in range(m):\n if l[i]/a < 1/(4*m):\n print('No')\n exit()\nprint('Yes')\n"] | ['Runtime Error', 'Accepted'] | ['s290117553', 's512747594'] | [2940.0, 3060.0] | [17.0, 17.0] | [140, 183] |
p02718 | u970407071 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ["n, M = map(int, input().split())\na = list(map(float, input().split()))\nA = sum(a) / (4 * M)\nN = sum(x >= A for x in a)\nprint('Yes' if N >= m else 'No')", "n, m = map(int, input().split())\na = list(map(float, input().split()))\nA = sum(a) / (4 * M)\nN = sum(x >= A for x in a)\nprint('Yes' if N >= m else 'No')", "n, M = map(int, input().split())\na = list(map(int, input().split()))\nA = sum(A) / (4 * M)\nN = sum(x >= A for x in A)\nprint('Yes' if n >= M else 'No')", "n, m = map(int, input().split())\na = list(map(float, input().split()))\nA = sum(a) / (4 * m)\nN = sum(x >= A for x in a)\nprint('Yes' if N >= m else 'No')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s600197824', 's785168601', 's914431968', 's292688528'] | [2940.0, 2940.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0, 17.0] | [151, 151, 149, 151] |
p02718 | u972906674 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | [' n,m = map(int,input().split())\na = list(map(int, input().split()))\npopular = list(filter(lambda e: e>=(1/(4*m))*sum(a),a))\nprint("Yes" if len(popular) >= m else "No")', 'n,m = map(int,input().split())\na = list(map(int, input().split()))\npopular = list(filter(lambda e: e>=(1/(4*m))*sum(a),a))\nprint("Yes" if len(popular) >= m else "No")'] | ['Runtime Error', 'Accepted'] | ['s787872122', 's075535697'] | [2940.0, 3060.0] | [17.0, 19.0] | [167, 166] |
p02718 | u973108807 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['n,m = map(int, input().split())\nar = map(int,input().split())\nans = 0\nth = 1/4/m\nfor i in ar:\n if i < th:\n continue\n ans+=1\nprint(ans)', "n,m = map(int, input().split())\nar = list(map(int,input().split()))\nans = 0\nth = sum(ar)/4/m\nfor i in ar:\n if i < th:\n continue\n ans+=1\n\nif ans >= m:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s857273235', 's421579180'] | [2940.0, 3060.0] | [18.0, 18.0] | [139, 189] |
p02718 | u974231963 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ["\nn, m = (int(x) for x in input().split())\na_list = list(map(int, input().split()))\n\nborder = sum(a_list) / (4 * m)\n\nprint('border')\nprint(border)\n\ncount = 0\n\nfor i in range(len(a_list)):\n\n print('a_list')\n print(a_list[i])\n\n if border <= a_list[i] :\n print('カウント!')\n count = count + 1\n\nif m <= count :\n print('Yes')\nelse:\n print('No')", "\nn, m = (int(x) for x in input().split())\na_list = list(map(int, input().split()))\n\nborder = sum(a_list) / (4 * m)\n\n# print('border')\n# print(border)\n\ncount = 0\n\nfor i in range(len(a_list)):\n\n # print('a_list')\n # print(a_list[i])\n\n if border <= a_list[i] :\n \n count = count + 1\n\nif m <= count :\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s879794400', 's480946618'] | [3064.0, 3060.0] | [17.0, 18.0] | [371, 381] |
p02718 | u975719989 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['n, m = map(int, input().split())\na = list(map(int, input().split()))\ncount = 0\nfor i in range(n):\n if i > sum(a) / (4 * m):\n count+=1\nif count >= m:\n print("Yes")\nelse:\n print("No")\n \n ', 'n, m = map(int, input().split())\na = list(map(int, input().split()))\n\nfor i in range(n):\n if a[i] > sum(a) / 4 * m:\n if len(a) <= m:\n print("Yes")\n break;\n else:\n print("No")\n break;\n ', 'n,m = map(int, input().split())\na = list(map(int, input().split()))\ns = sum(a)\ncounter = 0\n\nfor i in a:\n if i >= s/(4*m):\n counter = counter + 1\n\nif counter >= m:\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s155149832', 's175854118', 's197901316'] | [2940.0, 3060.0, 2940.0] | [17.0, 19.0, 17.0] | [193, 206, 202] |
p02718 | u976320027 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['N,M=map(int,input().split())\nA=list(map(int,input().split()))\n\n\nChange=True\nround=1\nwhile Change:\n print("{}週目".format(round))\n Change=False\n for i in range(N-1):\n if A[i+1]>A[i]:\n print("A[{}]({})がA[{}]({})よりも大きいため、交換を行います".format(i+1,A[i+1],i,A[i]))\n temp=A[i+1]\n A[i+1]=A[i]\n A[i]=temp\n Change=True\n print(A)\n round+=1\nprint("for文終了後のChangeが{}なので、ソートを終了します".format(Change)) \nprint(A)\npopular=A[0:M]\nprint("投票数上位{0}個の商品を抽出しました。{0}個の商品の投票数は{1}です。".format(M,popular))\nSUM=sum(A)\nprint("投票数の総和は{}です".format(SUM))\n\ncount=True\nfor j in range(M):\n if SUM*(1/(4*M))>popular[j]:\n print("popular[{0}]({1})は,総投票数の1/8未満({1}<{2})の為、回答はNoとなります".format(j,popular[j],SUM*(1/(4*M))))\n count=False\n\nif(count):\n print("Yes")\nelse:\n print("No")\n\n\n\n\n \n\n\n', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nChange=True\nround=1\nwhile Change:\n Change=False\n for i in range(N-1):\n if A[i+1]>A[i]:\n temp=A[i+1]\n A[i+1]=A[i]\n A[i]=temp\n Change=True\n round+=1\npopular=A[0:M]\nSUM=sum(A)\ncount=True\nfor j in range(M):\n if SUM*(1/(4*M))>popular[j]:\n count=False\nif(count):\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s884148518', 's568036815'] | [4340.0, 3064.0] | [44.0, 19.0] | [1045, 427] |
p02718 | u977855674 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['n, m = map(int, input().split())\nai = list(map(int, input().split()))\nrequired = sum(ai) / (4 * m)\nprint(required)\ncount = 0\nfor a in sorted(ai, reverse=True):\n if a >= required:\n count += 1\n else:\n break\nprint("YNeos"[count < m::2])\n', 'b, c = map(int, input().split())\na = list(map(int, input().split()))\nd = sum(a)\nnew_a = list(reversed(sorted(a)))\ne = 0\nf = 0\ng = 4*c\nwhile new_a[e] >= d/g:\n e = e+1\n if e == n:\n break\n f = f+1\nif f >= c:\n print("Yes")\nelse:\n print("No")\n', 'n, m = map(int, input().split())\nai = list(map(int, input().split()))\nlowest_required = (1 / (4 * m)) * sum(ai)\ncount = 0\nfor a in ai:\n if a >= lowest_required:\n count += 1\n else:\n break\n\nprint("YNeos"[count >= m::2])\n', 'b, c = map(int, input().split())\na = list(map(int, input().split()))\nd = sum(a)\nnew_a = list(reversed(sorted(a)))\ne = 0\nf = 0\ng = 4*c\nwhile new_a[e] >= d/g:\n e = e+1\n f = f+1\n if e == b:\n break\nif f >= c:\n print("Yes")\nelse:\n print("No")\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s212192985', 's228554208', 's820492198', 's469179197'] | [3060.0, 3060.0, 3060.0, 3060.0] | [19.0, 17.0, 17.0, 17.0] | [254, 260, 238, 260] |
p02718 | u979444096 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ["def main():\n n, m = map(int, input().split())\n ary = sorted(list(map(int, input().split())), reverse=True)\n print(ary)\n su = sum(ary)\n if ary[m-1] >= su // (4*m):\n print('Yes')\n else:\n print('No')\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n _, m = map(int, input().split())\n ary = sorted(list(map(int, input().split())), reverse=True)\n if ary[m-1]*4*m >= sum(ary):\n print('Yes')\n else:\n print('No')\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s303182336', 's166372942'] | [2940.0, 2940.0] | [17.0, 17.0] | [269, 237] |
p02718 | u982471399 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ["N,M = list(map(int,input().split()))\nA=list(map(int, input().split())) \n\ntotal=sum(A)\nfor i in range(N):\n if A[i]*4*M>total:\n \tcnt=cnt+1\n\nif cnt>=M:\n print('Yes')\nelse:\n print('No')\n\n", 'N,M = list(map(int,input().split()))\nA=list(map(int, input().split())) \ntotal=sum(A)\ncnt=0\nfor a in A:\n if a*4*M>=total:\n \tcnt=cnt+1\n\nprint("Yes" if cnt>=M else "No")\n\n'] | ['Runtime Error', 'Accepted'] | ['s439460281', 's434165592'] | [2940.0, 2940.0] | [18.0, 18.0] | [187, 170] |
p02718 | u983327168 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['count=0\nn,m=map(int,input().split())\na=list(map(int,input().split()))\n\nfor i in range(n):\n if a[i]<sum(a)//(4*m):\n count=count\n else:\n count+=1\nif count==m:\n print("Yes")\nelse:print("No")\n ', 'count=0\nn,m=map(int,input().split())\na=list(map(int,input().split()))\nprint(sum(a))\nfor i in range(n):\n if a[i]<sum(a)//(4*m):\n pass\n else:\n count+=1\nif count==m:\n print("Yes")\nelse:print("No")\n ', 'n,m=input().split()\na=list(map(int,input().split()))\ncount=0\nfor i in range(int(n)):\n if a[i]<sum(a)//(4*int(m)):\n count=count\n else:\n count+=1\nif count==m:\n print("Yes")\nelse:\n print("No")\n ', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\ncount=0\nfor i in range(int(n)):\n if a[i]<sum(a)/(4*int(m)):\n count=count\n else:\n count=count+1\nif count>=int(m):\n print("Yes")\nelse:\n print("No")\n '] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s081827872', 's212097667', 's657082456', 's211114980'] | [3060.0, 3064.0, 3064.0, 3060.0] | [17.0, 17.0, 18.0, 17.0] | [219, 225, 224, 242] |
p02718 | u985835425 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['import pandas as pd\nN, M = map(int,input().split())\nA = pd.Series(list(map(int,input().split())))\nA[A >= A.sum()/(4*M)].count() >= M', "import numpy as np\nN, M = map(int,input().split())\nA = np.array(list(map(int,input().split())))\nif len(A[A >= A.sum()/(4*M)])>=M:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s633127550', 's254554282'] | [2940.0, 21272.0] | [17.0, 1496.0] | [132, 168] |
p02718 | u987326700 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['n,m = map(int,input().split())\nnumList = list(map(int,input().split()))\n\nsum = 0\ncnt = 0\nfor i in numList:\n\tsum += i\n\nfor _ in numList:\n if _ > sum/(4*m):\n cnt +=1\n else:\n continue\n \nif m >= cnt:\n print("Yes")\nelse:\n print("No")\n ', 'n,m = map(int,input().split())\nnumList = list(map(int,input().split()))\n\nsum = 0\nfor i in numList:\n\tsum += i\n\nfor _ in numList:\n if _ > sum/(4*m):\n continue\n else:\n print("No")\n exit\n \nprint("Yes")', 'n,m = map(int,input().split())\nnumList = list(map(int,input().split()))\n\nsum = 0\ncnt = 0\n\nfor i in numList:\n\tsum += i\n\nfor _ in numList:\n if _ > sum/(4*m):\n cnt +=1\n else:\n continue\n \nif m >= cnt:\n print("Yes")\nelse:\n print("No")\n ', 'n,m = map(int,input().split())\nnumList = list(map(int,input().split()))\n\nsum = 0\ncnt = 0\n\nfor i in numList:\n\tsum += i\n\nfor _ in numList:\n if _ > sum/(4*m):\n cnt +=1\n else:\n continue\n \nif m == cnt:\n print("Yes")\nelse:\n print("No")\n ', 'n,m = map(int,input().split())\nnumList = list(map(int,input().split()))\n\ny = 0\nn = 0\n\nfor i in len(nunList):\n if numList > 1/(4*m):\n y +=1\n else:\n n +=1\n \nif y > m:\n print("Yes")\nelse:\n print("No")\n \n ', 'n,m = map(int,input().split())\nAi = list(map(int,input().split()))\n\nsum = 0\ncnt = 0\n\nfor i in Ai:\n\tsum += i\n\nsorted = Ai.sort(reverse=True)\n\nif sorted[m-1] >= sum/(4*m):\n print("Yes")\nelse:\n print("No")\n \n', 'n,m = map(int,input().split())\nAi = list(map(int,input().split()))\n\nsum = 0\ncnt = 0\n\nfor i in Ai:\n\tsum += i\n\nfor _ in Ai:\n if _ >= sum*(1/(4*m)):\n cnt +=1\n else:\n continue\n \nif m == cnt:\n print("Yes")\nelse:\n print("No")\n ', 'n,m = map(int,input().split())\nnumList = list(map(int,input().split()))\n\nfor i in numList:\n\tsum += i\n\nfor _ in numList:\n if _ > sum/(4*m):\n continue\n else:\n print("No")\n exit\n \nprint("Yes")', 'n,m = map(int,input().split())\nnumList = list(map(int,input().split()))\n\ny = 0\nn = 0\n\nfor i in len(nunList):\n if i > 1/(4*m):\n y +=1\n else:\n n +=1\n \nif y > m:\n print("Yes")\nelse:\n print("No")', 'n,m = map(int,input().split())\nnumList = list(map(int,input().split()))\n\nfor i in numList:\n\tsum += i\n\nif sum > 1/(4*m):\n print("Yes")\nelse:\n print("No")\n', 'n,m = map(int,input().split())\nAi = list(map(int,input().split()))\n\nsum = 0\ncnt = 0\n\nfor i in Ai:\n\tsum += i\n\nfor _ in Ai:\n if _ >= sum*(1/(4*m)):\n cnt +=1\n else:\n continue\n \nif m >= cnt:\n print("Yes")\nelse:\n print("No")\n \n', 'n,m = map(int,input().split())\nAi = list(map(int,input().split()))\n\nsum = 0\n\nfor i in Ai:\n\tsum += i\n\nS = sorted(Ai,reverse=True)\n\nif S[m-1] >= sum/(4*m):\n print("Yes")\nelse:\n print("No")\n \n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s051251996', 's435149786', 's508759022', 's511366301', 's524987281', 's583503558', 's710157151', 's742006360', 's795822674', 's844878183', 's948884446', 's723230248'] | [3060.0, 3060.0, 3060.0, 3060.0, 2940.0, 3060.0, 3060.0, 2940.0, 3060.0, 2940.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0, 18.0, 18.0, 17.0, 17.0, 19.0, 19.0, 17.0, 19.0, 18.0] | [244, 211, 245, 245, 217, 208, 235, 203, 205, 155, 236, 192] |
p02718 | u991237710 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['N , M = input().split()\narray = input().split()\nflag = 0\n\nN = int(N)\nM = int(M)\n\niarray = []\n\nfor i in array:\n iarray.append(int(i))\n\ntotal = sum(iarray)\n\nfor i in iarray:\n if i >= total/(4*M):\n flag += 1\nif flag >= M:\n print("yes")\nelse:\n print("no")', 'N , M = input().split()\narray = input().split()\nflag = 0\n\nN = int(N)\nM = int(M)\n\niarray = []\n\nfor i in array:\n iarray.append(int(i))\n\ntotal = sum(iarray)\n\nfor i in iarray:\n if i >= total/(4*M):\n flag += 1\nif flag >= M:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s549709070', 's081600851'] | [3064.0, 3064.0] | [17.0, 18.0] | [270, 270] |
p02718 | u992951814 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['n,m = map(int,input().split())\nar = list(map(int,input().split()))\nsum = 0\nfor i in range(n):\n sum += ar[i]\nav = int(sum/(4*m))\nct = 0\nfor i in range(n):\n if(ar[i] > av):\n ct += 1\n else:\n ct -= 1\nif(ct >= m):\n print("Yes")\nelse:\n print("No")', 'n,m = map(int,input().split())\nar = list(map(int,input().split()))\ns = sum(ar)\nav = s/(4*m)\nct = 0\nfor i in range(n):\n if(ar[i] >= av):\n ct += 1\nif(ct >= m):\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s959559334', 's640547401'] | [3064.0, 3060.0] | [18.0, 18.0] | [252, 196] |
p02718 | u997927785 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['N, M = map(int, input().split())\nA = [int(input()) for k in range(N)]\n\ntotalVote = sum(A)\nborder = totalVote / (4 * M)\nA.sort(reverse = True)\n\nif A[M-1] >= border:\n print("Yes")\nelse:\n print("No")', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\ntotalVote = sum(A)\nborder = totalVote / (4 * M)\nA.sort(reverse = True)\n\nif A[M-1] >= border:\n print("Yes")\nelse:\n print("No")\n'] | ['Runtime Error', 'Accepted'] | ['s070614836', 's968516217'] | [3060.0, 2940.0] | [18.0, 17.0] | [202, 202] |
p02718 | u998077480 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ["n,m=map(int, input().split())\na=list(map(int, input().split()))\n\na.sort(reverse=True)\nb=sum(a)/4/m\nprint(a)\nprint(a[m])\nif a[m-1]<b:\n print('No')\nelse:\n print('Yes')", "n,m=map(int, input().split())\na=list(map(int, input().split()))\n\na.sort(reverse=True)\nb=sum(a)/4/m\nif a[m-1]<b:\n print('No')\nelse:\n print('Yes')"] | ['Runtime Error', 'Accepted'] | ['s362908501', 's959741052'] | [3060.0, 3060.0] | [17.0, 17.0] | [171, 150] |
p02718 | u998082063 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ["from collections import defaultdict, deque\nimport sys\nimport heapq\nimport bisect\nimport itertools\nimport queue\nimport copy\nimport time\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nmod = 10**9+7\neps = 10**-7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\nn, m = inpl()\na = inpl()\ns = sum(a)\ncnt = 0\nprint(s/(4*m))\nfor i in a:\n if i > s/(4*m):\n cnt += 1\n if cnt == m:\n print('Yes')\n exit()\nprint('No')", "from collections import defaultdict, deque\nimport sys\nimport heapq\nimport bisect\nimport itertools\nimport queue\nimport copy\nimport time\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nmod = 10**9+7\neps = 10**-7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\nn, m = inpl()\na = inpl()\ns = sum(a)\nfor i in a:\n if i < s//(4*m):\n print('No')\n exit()\nprint('Yes')", "from collections import defaultdict, deque\nimport sys\nimport heapq\nimport bisect\nimport itertools\nimport queue\nimport copy\nimport time\nsys.setrecursionlimit(10**8)\nINF = float('inf')\nmod = 10**9+7\neps = 10**-7\n\ndef inp(): return int(sys.stdin.readline())\n\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ndef inpl_str(): return list(sys.stdin.readline().split())\n\nn, m = inpl()\na = inpl()\ns = sum(a)\ncnt = 0\nfor i in a:\n if i*(4*m) >= s:\n cnt += 1\nif cnt >= m:\n print('Yes')\nelse: \n print('No')"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s194504383', 's856002976', 's878151639'] | [4072.0, 4072.0, 3944.0] | [30.0, 29.0, 27.0] | [552, 508, 526] |
p02718 | u998350437 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['n,m=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nb=a[::-1]\nprint(b)\nif b[m-1]<sum(a)/(4*m):\n print("No")\nelif True:\n print("Yes")', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\na.sort()\nb=a[::-1]\nif b[m-1]<sum(a)/(4*m):\n print("No")\nelif True:\n print("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s352737508', 's515774982'] | [2940.0, 3060.0] | [17.0, 17.0] | [157, 148] |
p02718 | u998867748 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['n,m = map(int,input().split())\n\na = list(map(int,input().split()))\n\nb = [b for b in a if b >= 1/4/m]\n\nif len(b)>= m:\n\tprint(‘Yes’)\nelse:\n\tprint(‘No’)', "n,m = map(int,input().split())\na = list(map(int,input().split()))\n\nx = max(a)\ns = 0\nfor i in a:\n s += i\ny = [l for l in a if l >=s]\nif len(y) >=m:\n print('Yes')\nelse:\n print('No')", "n,m = map(int,input().split())\n\na = list(map(int,input().split()))\nb = 0\nfor i in a:\n b += i\nc = [c for c in a if c >= b/4/m]\n\nif len(c) >= m:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s294749792', 's821775311', 's654179966'] | [9032.0, 3060.0, 9132.0] | [22.0, 20.0, 23.0] | [157, 188, 178] |
p02718 | u999893056 | 2,000 | 1,048,576 | We have held a popularity poll for N items on sale. Item i received A_i votes. From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes. If M popular items can be selected, print `Yes`; otherwise, print `No`. | ['n,m = list(map(int,input().split()))\nvotes = [int(x) for x in input().split()]\nvotesum = sum(votes)\nst = 1 // 4 * votesum\ncount = 0\nfor v in votes :\n if v >= st:\n count += 1\nprint("Yes" if count == m else "No")', 'n,m = list(map(int,input().split()))\nvotes = [int(x) for x in input().split()]\n\nvotesum = sum(votes)\nst = votesum // 4 * m\ncount = 0\nfor v in votes :\n if v >= st:\n count += 1\nprint("Yes" if count == m else "No")', 'n,m = list(map(int,input().split()))\nvotes = list(map(int,input().split())\n\ns_vote = sum(vote)\nst = 1 // 4 * s_vote\ncount = 0\nfor v in votes :\n if v >= st:\n count += 1\nprint("Yes" if count >= m else "No")', 'n,m = list(map(int,input().split()))\nvotes = [int(x) for x in input().split()]\nvotesum = sum(votes)\nst = votesum / (4 * m)\ncount = 0\nfor v in votes :\n if v >= st:\n count += 1\nprint("Yes" if count >= m else "No")'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s089492033', 's683441675', 's725251054', 's234551448'] | [3060.0, 3060.0, 2940.0, 3064.0] | [18.0, 17.0, 18.0, 17.0] | [220, 221, 214, 221] |
p02719 | u002459665 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N, K = list(map(int, input().split()))\n\nif N == K:\n ans = 0\nelif N > K:\n ans = N % K\nelse:\n ans = min(N, abs(N-K))\n\nprint(ans)', 'N, K = list(map(int, input().split()))\n\nif N == K:\n ans = 0\nelif N == 0:\n ans = 0\nelif N > K:\n t = N % K\n ans = min(t, abs(t-K))\nelse:\n ans = min(N, abs(N-K))\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s264769423', 's435458092'] | [3060.0, 3060.0] | [17.0, 17.0] | [135, 185] |
p02719 | u004482945 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n, k = map(int, input().split())\nprint(n%k, k - n%k)', 'n, k = map(int, input().split())\nprint(min(n%k, k - n%k))\n'] | ['Wrong Answer', 'Accepted'] | ['s788215680', 's300158585'] | [3064.0, 2940.0] | [16.0, 17.0] | [52, 58] |
p02719 | u005317312 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['import numpy as np\nimport math as mt\nN,K=map(int, input().split())\nif abs(N-K)<N:\n a,b=max(N,K),min(N,K)\n print(a-b*(a//b))\nelse:\n print(N)', 'import numpy as np\nimport math as mt\nN,K=map(int, input().split())\nif abs(N-K)<N:\n print(N-K*(N//K))\nelse:\n print(N)', 'import numpy as np\nimport math as mt\nN,K=map(int, input().split())\nwhile(1):\n if abs(N-K)<N:\n a,b=max(N,K),min(N,K)\n N=a-b*(a//b)\n else:\n print(N)\n break'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s449153053', 's660955085', 's743712814'] | [21152.0, 12424.0, 20896.0] | [300.0, 160.0, 368.0] | [148, 122, 187] |
p02719 | u005318559 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n,k = map(int, input().split())\nn = n % k\nabsolutes = abs(k-n)\nprint(absolutes if absolute < n else n)', 'N,K = map(int, input().split())\nN = N%K\nabsolute = abs(K-N)\nprint(absolute if absolute < N else N)'] | ['Runtime Error', 'Accepted'] | ['s886714175', 's937341576'] | [2940.0, 2940.0] | [17.0, 17.0] | [102, 98] |
p02719 | u005570675 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n, k = map(int,input().split())\nans = 0\nif n < k:\n ans = n\nelse:\n ans = min(n%k,k-n%k))\n\nprint(ans)\n', 'n, k = map(int,input().split())\nans = 0\nans = min(n%k,abs(n%k-k))\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s265629187', 's176718794'] | [2940.0, 2940.0] | [17.0, 17.0] | [106, 78] |
p02719 | u007263493 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n , k = map(int,input().split())\nprint(n%k)', 'n , k = map(int,input().split())\nm = n % k \nprint(min(m , abs(m-k)))'] | ['Wrong Answer', 'Accepted'] | ['s448168868', 's987131240'] | [2940.0, 2940.0] | [18.0, 17.0] | [43, 68] |
p02719 | u014982939 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['import numpy\n\nn = numpy.int64(n)\nm = numpy.int64(m)\nn = n % m\nprint(min(n, m-n))\n', 'import numpy\nn = numpy.int64(n)\nm = numpy.int64(m)\nn = n % m\nprint(min(n, m-n))\n', 'import numpy\n\nn, m = input().split()\nn = numpy.int64(n)\nm = numpy.int64(m)\nn = n % m\nprint(min(n, m-n))\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s114789250', 's164715083', 's913019111'] | [27020.0, 27144.0, 26948.0] | [115.0, 113.0, 118.0] | [81, 80, 104] |
p02719 | u015084832 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['def main():\n N, K = map(int, input().split())\n value_diff_abs = 0\n\n if N == 0 :\n print("0")\n elif N > K :\n ans = N % K\n print(ans)\n else :\n for i in range(0 , N + 1) :\n value_diff_abs = N\n N = abs(N - K)\n if value_diff_abs < N :\n print(str(value_diff_abs))\n break\n\n\nif __name__ == \'__main__\':\n main()', 'def main():\n N, K = map(int, input().split())\n value_diff_abs = 0\n\n if N == 0 or N == K :\n print("0")\n elif N > K :\n ans = N % K\n print(ans)\n else :\n for i in range(0 , N + 1) :\n value_diff_abs = N\n N = abs(N - K)\n if value_diff_abs < N :\n print(str(value_diff_abs))\n break\n\n\nif __name__ == \'__main__\':\n main()\n', 'def main():\n N, K = map(int, input().split())\n value_diff_abs = 0\n\n if N == 0 or N == K :\n print("0")\n elif N > K :\n ans = N % K\n print(ans)\n else :\n for i in range(0 , N + 1) :\n value_diff_abs = N\n N = abs(N - K)\n if value_diff_abs < N :\n print(str(value_diff_abs))\n break\n elif value_diff_abs == N :\n print(str(value_diff_abs))\n break\n\n\nif __name__ == \'__main__\':\n main()', 'def main():\n N, K = map(int, input().split())\n value_diff_abs = 0\n\n if N == 0 or N == K :\n print("0")\n elif N > K :\n ans = N % K\n print(ans)\n elif K == 1 and N != 0 :\n print("0")\n elif K == 2 and N % 2 == 0 and N != 0 :\n print("0")\n elif K == 2 and N % 2 != 0 and N != 0 :\n print ("1")\n else :\n for i in range(0 , N + 1) :\n value_diff_abs = N\n N = abs(N - K)\n if value_diff_abs < N :\n print(str(value_diff_abs))\n break\n elif value_diff_abs == N :\n print(str(value_diff_abs))\n break\n\n\nif __name__ == \'__main__\':\n main()', 'def main():\n N, K = map(int, input().split())\n value_diff_abs = 0\n\n if N == 0 or N == K :\n print("0")\n elif N > K :\n ans = N % K\n #print(ans)\n N = ans\n for i in range(0 , N + 1) :\n value_diff_abs = N\n N = abs(N - K)\n #print(str(value_diff_abs))\n if value_diff_abs < N :\n print(str(value_diff_abs))\n break\n elif value_diff_abs == N :\n print(str(value_diff_abs))\n break\n else :\n for i in range(0 , N + 1) :\n value_diff_abs = N\n N = abs(N - K)\n if value_diff_abs < N :\n print(str(value_diff_abs))\n break\n elif value_diff_abs == N :\n print(str(value_diff_abs))\n break\n\n\nif __name__ == \'__main__\':\n main()\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s144161216', 's242307173', 's419214796', 's603037604', 's811057270'] | [3064.0, 3060.0, 3064.0, 3064.0, 3064.0] | [18.0, 18.0, 17.0, 17.0, 17.0] | [409, 420, 523, 698, 880] |
p02719 | u016901717 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n,k=map(int,input().split())\n\n\n \nn1=n-(n//k)*k\nn2=n-k\nprint(min(n1,n2))', 'n,k=map(int,input().split())\n\n\n \nn1=n-(n//k)*k\nn2=abs(n1-k)\nprint(min(n1,n2))'] | ['Wrong Answer', 'Accepted'] | ['s063293307', 's679148109'] | [2940.0, 2940.0] | [17.0, 17.0] | [74, 80] |
p02719 | u017624958 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['import math\n\ninputted = list(map(int, input().split()))\nN = inputted[0]\nK = inputted[1]\n\nanswer = N - K * math.floor(N / K)\n\nprint(answer)\n', 'import math\n\ninputted = list(map(int, input().split()))\nN = inputted[0]\nK = inputted[1]\n\ncandidate1 = N - K * math.floor(N / K)\ncandidate2 = K - remainder\nanswer = min(candidate1, candidate2)\n\nprint(answer)\n', 'inputted = list(map(int, input().split()))\nN = inputted[0]\nK = inputted[1]\n\nanswer = N % K\n\nprint(answer)\n', 'import math\n\ninputted = list(map(int, input().split()))\nN = inputted[0]\nK = inputted[1]\n\ncandidate1 = N % K\ncandidate2 = K - candidate1\nanswer = min(candidate1, candidate2)\n\nprint(answer)\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s037258916', 's691410243', 's997807265', 's146260834'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 18.0] | [139, 207, 106, 188] |
p02719 | u022979415 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ["from fractions import gcd\n\n\ndef main():\n n, k = map(int, input().split())\n if k == 1 or n == 0 or n == k or n == 1:\n print(0)\n elif n % k == 0:\n print(0)\n else:\n ans = gcd(n, k)\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n\n", "from fractions import gcd\n\n\ndef main():\n n, k = map(int, input().split())\n if k == 1 or n == 0 or n == k:\n print(0)\n elif n <= k:\n print(n)\n elif n % k == 0:\n print(0)\n else:\n print(gcd(n, k))\n\n\nif __name__ == '__main__':\n main()\n\n", "from fractions import gcd\n\n\ndef main():\n n, k = map(int, input().split())\n print(gcd(n, k) if 1 < k else 0)\n\n\nif __name__ == '__main__':\n main()\n\n", "from fractions import gcd\n\n\ndef main():\n n, k = map(int, input().split())\n if k == 1 or n == 0 or n == k or n == 1:\n print(0)\n elif n % k == 0:\n print(0)\n elif n < k:\n print(min(n, k - n))\n else:\n ans = gcd(n, k)\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n\n", "from fractions import gcd\n\n\ndef main():\n n, k = map(int, input().split())\n if n % k == 0:\n print(0)\n else:\n print(gcd(n, k))\n\n\nif __name__ == '__main__':\n main()\n\n", "from fractions import gcd\n\n\ndef main():\n n, k = map(int, input().split())\n if k == 1 or n == 0 or n == k:\n print(0)\n elif n < k:\n print(min(n, k - n))\n elif n % k == 0:\n print(0)\n else:\n print(gcd(n, k))\n\n\nif __name__ == '__main__':\n main()\n\n", "from fractions import gcd\n\n\ndef main():\n n, k = map(int, input().split())\n if k == 1 or n == 0 or n == k:\n print(0)\n elif n <= k:\n print(n)\n else:\n print(gcd(n, k))\n\n\nif __name__ == '__main__':\n main()\n\n", "from fractions import gcd\n\n\ndef main():\n n, k = map(int, input().split())\n if n < k:\n print(min(n, k - n))\n elif k == 1 or n == 0 or n == k or n == 1:\n print(0)\n elif n % k == 0:\n print(0)\n else:\n ans = gcd(n, k)\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n\n", "from fractions import gcd\n\n\ndef main():\n n, k = map(int, input().split())\n if n % k == 0 and 1 < k:\n print(0 if n - k * k <= 0 else n - k * k)\n else:\n print(gcd(n, k) if 1 < k else 0)\n\n\nif __name__ == '__main__':\n main()\n\n", "def main():\n n, k = map(int, input().split())\n remainder = n % k\n print(min(remainder, k - remainder))\n\n\nif __name__ == '__main__':\n main()\n\n"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s165966974', 's205969837', 's212961659', 's228312387', 's420244480', 's468302844', 's561851438', 's820414916', 's985963036', 's112540793'] | [5052.0, 5600.0, 5048.0, 5600.0, 5048.0, 5688.0, 5432.0, 5688.0, 5052.0, 2940.0] | [35.0, 104.0, 37.0, 137.0, 36.0, 59.0, 41.0, 111.0, 35.0, 17.0] | [271, 277, 155, 316, 189, 288, 239, 316, 248, 153] |
p02719 | u024550857 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['import numpy as np\nimport sys\n\ntmp = list(map(int, input().split()))\n\nN = tmp[0]\nK = tmp[1]\n\n\n\n\nif N < K:\n print(N)\nelif N == K:\n print(0) \nelse:\n\n\n\n solve = [0] * K\n\n for i in range(0, K-1):\n solve[i] = N % (K - i)\n\n solve.reverse()\n\n for iter in range(0,K-1):\n if solve[iter] == 0:\n continue\n else:\n print(solve[iter])\n break\n print(0)\n\n\n\n\n # print(solve[1])\n\n\n # if K == 1:\n # print(solve[0])\n # else:\n # print(solve[1])\n\n\n', 'import numpy as np\n\ntmp = list(map(int, input().split()))\n\nN = tmp[0]\nK = tmp[1]\n\n\n\n\nif N < K:\n print(N)\nelif N == K:\n print(0) \nelse:\n\n\n\n solve = [0] * K\n\n for i in range(0, K-1):\n solve[i] = N % (K - i)\n\n solve.reverse()\n\n for iter in range(0,K-1):\n if solve[iter] == 0:\n continue\n else:\n print(solve[iter])\n break\n print(0)\n\n', 'import numpy as np\n\ntmp = list(map(int, input().split()))\n\nN = tmp[0]\nK = tmp[1]\n\n\n\n\n\n# if N > K:\n# N = N + K\n\n\n\n\n\n\nsolve = N % K\nif solve > abs(solve - K):\n solve = abs(solve - K)\n\nprint(solve)\n\n# solve.reverse()\n\n# for iter in range(0,K-1):\n# if solve[iter] == 0:\n# continue\n# else:\n# print(solve[iter])\n# break\n# print(0)\n\n '] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s660589428', 's831311044', 's569888664'] | [12396.0, 20520.0, 12484.0] | [149.0, 884.0, 150.0] | [538, 417, 454] |
p02719 | u025879810 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['import numpy as np\nimport fractions\nN, K = [int(i) for i in input().split(\' \')]\n\nif K % N == 0:\n\tresult = N\nelif N % K == 0:\n\tresult = 0\nelif fractions.gcd(N, K) == 1 and N > K:\n\tresult = 1\nelif fractions.gcd(N, K) == 1 and K > N:\n\tresult = K-N if N > K - N else N\nelse:\n result = fractions.gcd(N, K)\n \nprint("{}".format(result))\n\n#lis = np.array([int(n) for n in input().split(\' \')])\n#print("{} {}".format(sum(lis) / 4 / int(M), lis[int(M)-1]))\n\n#count = sum(sum(lis) / 4.0 / int(M) <= lis)\n\n', 'import numpy as np\nimport fractions\nN, K = [int(i) for i in input().split(\' \')]\n\nif N == 0:\n\tresult = 0\nelif K == 0:\n\tresult = N\nelif N % K == 0:\n\tresult = 0\nelif K % N == 0:\n\tresult = K/N if N > K/N else N\nelif fractions.gcd(N, K) == 1 and N > K:\n\tresult = 1\nelif fractions.gcd(N, K) == 1 and K > N:\n\tresult = K-N if N > K - N else N\nelif N > K:\n result = N % K if N % K < K - N % K else K-N%K\nelif N < K:\n result = K-N if N > K - N else N\n \nprint("{}".format(result))\n\n#lis = np.array([int(n) for n in input().split(\' \')])\n#print("{} {}".format(sum(lis) / 4 / int(M), lis[int(M)-1]))\n\n#count = sum(sum(lis) / 4.0 / int(M) <= lis)\n\n', 'import numpy as np\nimport fractions\nN, K = [int(i) for i in input().split(\' \')]\n\nif N == 0:\n\tresult = 0\nelif N % K == 0:\n\tresult = 0\nelif K % N == 0:\n\tresult = K/N if N > K/N else N\nelif fractions.gcd(N, K) == 1 and N > K:\n\tresult = 1\nelif fractions.gcd(N, K) == 1 and K > N:\n\tresult = K-N if N > K - N else N\nelif N > K:\n result = N % K if N % K < K - N % K else K-N%K\nelif N < K:\n result = K-N if N > K - N else N\n \nprint("{}".format(result))\n\n#lis = np.array([int(n) for n in input().split(\' \')])\n#print("{} {}".format(sum(lis) / 4 / int(M), lis[int(M)-1]))\n\n#count = sum(sum(lis) / 4.0 / int(M) <= lis)\n\n', 'import numpy as np\nimport fractions\nN, K = [int(i) for i in input().split(\' \')]\n\nif N == 0:\n\tresult = 0\nelif K == 0:\n\tresult = N\nelif N % K == 0:\n\tresult = 0\nelif K % N == 0:\n\tresult = K/N if N > K/N else N\nelif N > K:\n result = N % K if N % K < K - N % K else K-N%K\nelif N < K:\n result = K-N if N > K - N else N\n \nprint("{}".format(result))\n\n#lis = np.array([int(n) for n in input().split(\' \')])\n#print("{} {}".format(sum(lis) / 4 / int(M), lis[int(M)-1]))\n\n#count = sum(sum(lis) / 4.0 / int(M) <= lis)\n\n'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s177314173', 's404265031', 's777419702', 's200573470'] | [13540.0, 13664.0, 22692.0, 22164.0] | [159.0, 159.0, 1410.0, 1618.0] | [495, 636, 611, 508] |
p02719 | u026487567 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n, K = [int(x) for x in input().split()]\n\npn = n\nfor i in range(10**18):\n t = K - (n % K)\n print(t)\n if t == n or t > n:\n break\n n = t\n \nprint (n)', 'n, K = [int(x) for x in input().split()]\n\nif K > n:\n res = n\nelif n % K == 0:\n res = 0\nelse:\n res = K\n', 'n, K = [int(x) for x in input().split()]\n\npn = n\nfor i in range(10**18):\n if K == 1:\n n = 0\n break\n t = K - (n % K)\n print(t)\n if t == n or t > n:\n break\n n = t\n \nprint (n)', 'n, K = [int(x) for x in input().split()]\n\nres = 0\nif n % K > abs((n % K) - K):\n res = abs((n % K) - K)\nelse:\n res = n % K\n \nprint (res)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s120410480', 's327898621', 's341593471', 's501219947'] | [3060.0, 2940.0, 3060.0, 2940.0] | [17.0, 17.0, 18.0, 17.0] | [168, 111, 211, 144] |
p02719 | u026862065 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n, k = map(int, input().split())\nprint(n % k)\n', 'n, k = map(int, input().split())\nprint(min(n % k, - (n % k - k)))'] | ['Wrong Answer', 'Accepted'] | ['s157922914', 's050334187'] | [2940.0, 2940.0] | [17.0, 17.0] | [46, 65] |
p02719 | u028014940 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N, K = map(int, input().split())\namari%=K\n\nprint(amari,abs(amari-k))\n', '\nN, K = map(int, input().split())\namari%=K\n\nprint(min(amari,abs(amari-k)))\n', '\nN, K = map(int, input().split())\namari=N%K\n\nprint(min(amari,abs(amari-K)))\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s409013907', 's765305247', 's935665919'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [69, 75, 76] |
p02719 | u031132940 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N,K = map(int, input().split())\nprint(N%K,N%K-K,min(N%K,abs(N%K-K)))', 'N,K = map(int, input().split())\nprint(min(N%K,abs(N%K-K)))\n'] | ['Wrong Answer', 'Accepted'] | ['s616740465', 's833384655'] | [2940.0, 2940.0] | [17.0, 17.0] | [68, 59] |
p02719 | u031722966 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N,K = map(int,input().split())\ni = 0\nif K == 1:\n print(0)\nelse:\n results = [N]\n while N > min(results):\n N = N - K\n if N < 0:\n results.append(-N)\n N = -N\n else:\n results.append(N)\n i += 1\n print(min(results))', 'N,K = map(int,input().split())\nif N / 2 < K / 2:\n F = N // K + 1\nelse: \n F = N // K\nr = [\n abs(N),\n abs((N - (K * F)))\n]\nprint(min(r))', 'N,K = map(int,input().split())\nif N % K > K / 2:\n F = N // K + 1\nelse: \n F = N // K\nr = [\n abs(N),\n abs((N - (K * F)))\n]\nprint(min(r))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s301150777', 's484339835', 's650468104'] | [3060.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0] | [281, 146, 146] |
p02719 | u032267656 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N,K = map(int,input().split())\nfrom fractions import gcd\n\nif N >= K and N % K == 0: ans = 0\nelse:\n ans = gcd(N,K)\n if K == 1: ans = 0\nprint(ans)', 'N,K = map(int,input().split())\nfrom fractions import gcd\n\nans = gcd(N,K)\nif K == 1: ans = 0\nprint(ans)', 'N,K = map(int,input().split())\ntmp = N % K\nans = min(K-tmp,tmp)\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s674643278', 's945346264', 's241535759'] | [5432.0, 5560.0, 2940.0] | [38.0, 130.0, 17.0] | [150, 102, 74] |
p02719 | u036104576 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N, K = map(int, input().split())\nx = N % K\n\nprint(min(x, abs(x - K))', 'import sys\nimport itertools\n# import numpy as np\nimport time\nimport math\nimport heapq\nfrom collections import defaultdict\nsys.setrecursionlimit(10 ** 7)\n \nINF = 10 ** 18\nMOD = 10 ** 9 + 7\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n# map(int, input().split())\n\nA, B = map(int, input().split())\nx = A % B\nprint(min(x, B - x))'] | ['Runtime Error', 'Accepted'] | ['s805096997', 's739261198'] | [9024.0, 9264.0] | [25.0, 30.0] | [68, 386] |
p02719 | u039934639 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N, K = map(int, input().split())\n\nif abs(N-K) > N:\n print(N)\nelif N >= 10**18 or K >= 10**18:\n print(0)\nelse:\n while abs(N-K) < N:\n N = N-K\n if abs(N-K) > N:\n break\n print(N)', 'N, K = map(int, input().split())\n\na = N%K\nb = K-N%K\n\nif K > N:\n print(N)\nelif a > b:\n print(a)\nelif N >= 10**18 or K >= 10**18:\n print(0)\nelse:\n print(b)', 'N, K = map(int, input().split())\n\na = N%K\nb = K-N%K\n\nans = min(a,b)\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s068966659', 's158672360', 's141199005'] | [36852.0, 2940.0, 2940.0] | [2104.0, 17.0, 19.0] | [191, 157, 78] |
p02719 | u040141413 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n,k=map(int,input().split())\nif n>k:\n n=n-k\n print(n%val)\nelse:\n print(n)\n', 'n,k=map(int,input().split())\n\nif k==1:\n print(0)\nelif n>k:\n print(k-(n%k))\nelse:\n val=k-n\n if n<val:\n print(n)\n else:\n print(val)'] | ['Runtime Error', 'Accepted'] | ['s949768742', 's323084213'] | [2940.0, 3060.0] | [17.0, 20.0] | [83, 158] |
p02719 | u043623523 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N,K=map(int,input().split())\n\n\nb=N\nwhile (True):\n X=abs(b-K)\n if b>X:\n b=X\n print(b)\n continue\n else:\n break\n\nprint(int(b))', 'N,K=map(int,input().split())\n\na=N//K\n\n\nif a>=1:\n s=N-K*a\n if s>=abs(s-K):\n print(int(abs(s-K)))\n else:\n print(int(s))\n\nelif a==0 and N>=(abs(N-K)):\n print(int(abs(N-K)))\n\nelse:\n print(int(N))'] | ['Wrong Answer', 'Accepted'] | ['s984087289', 's239911598'] | [49140.0, 3188.0] | [2104.0, 19.0] | [160, 220] |
p02719 | u045529647 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['def minValue():\n n, k = list(map(int, input().split()))\n\n remainder = n % k\n if remainder == 0:\n print(remainder)\n return\n\n print(remainder)\n\n\nminValue()', 'n, k = list(map(int, input().split()))\n\nremainder = n % k\nprint(remainder)', 'def minValue():\n n, k = list(map(int, input().split()))\n\n remainder = n % k\n \n diff = abs(remainder - k)\n print(min(diff, remainder))\n\n\nminValue()'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s538845793', 's923630523', 's862392349'] | [2940.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0] | [179, 74, 161] |
p02719 | u048176319 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N, K = map(int, input().split())\n\nlN = [N]\nc = 0\nfor i in range(100000000000000000):\n N = abs(N - K)\n lN.append(N)\n c += 1\n\nprint(min(lN))', 'N, K = map(int, input().split())\n\nif N < K:\n if N <= K/2:\n print(N)\n else:\n print(K-N)\n\nelif N == K:\n print(0)\n\nelse:\n N = K + (N - K) % K\n N = abs(N - K)\n\n if N < K:\n if N <= K/2:\n print(N)\n else:\n print(K-N)\n\n elif N == K:\n print(0)'] | ['Time Limit Exceeded', 'Accepted'] | ['s016182499', 's180570944'] | [299540.0, 3064.0] | [2124.0, 17.0] | [147, 312] |
p02719 | u048521352 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n,k=map(int,input().split())\nif n<k:\n if:k<2*n:\n print(k-n)\n else:\n print(n)\nelif n==k:\n print(0)\nelse:\n m=n//k\n r=n-m*k\n print(min(r,abs(r-k)))', 'n,k=map(int,input().split())\nif n<k:\n if k<2*n:\n print(k-n)\n else:\n print(n)\nelif n==k:\n print(0)\nelse:\n m=n//k\n r=n-m*k\n print(min(r,abs(r-k)))'] | ['Runtime Error', 'Accepted'] | ['s967329731', 's852345289'] | [2940.0, 3060.0] | [17.0, 17.0] | [158, 158] |
p02719 | u055668007 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['import sys\ninput = sys.stdin.readline\n\nN ,K = map(int,input().split())\n\nintlist = [ (N % K) ,abs (( N % K ) - N )] \nprint ( min(intlist) )', 'import sys\ninput = sys.stdin.readline\n\nN ,K = map(int,input().split())\n\nintlist = [ (N % K) ,abs (( N % K ) - K )] \nprint (min(intlist))'] | ['Wrong Answer', 'Accepted'] | ['s979729801', 's756828071'] | [2940.0, 3064.0] | [17.0, 17.0] | [138, 136] |
p02719 | u056358163 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['import numpy as np\nN, K = map(int, input().split())\nn = N\nwhile 1:\n\ta = np.minumum(n, np.abs(n - K))\n\tif a == n:\n\t\tbreak\nprint(a)', 'import numpy as np\nN, K = map(int, input().split())\na = N % K\nb = K - a\nprint(min([a, b]))'] | ['Runtime Error', 'Accepted'] | ['s350757592', 's705630371'] | [21376.0, 12392.0] | [313.0, 150.0] | [129, 90] |
p02719 | u057079894 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['// #include "pch.h"\n\n#include <algorithm>\n#include <map>\n#include <set>\n\n#include <bitset>\n#include <limits.h>\n#include <string>\n#include <stack>\n#include <deque>\n#include <cmath>\n#include <bitset>\n#include <complex>\n#include <functional>\n#include <time.h>\n\n#include <fstream>\n#include <stdio.h>\n\n\ntypedef long long ll;\ntypedef std::pair<int, int> Pii;\ntypedef std::pair<long long, long long> Pll;\ntypedef std::pair<double, double> Pdd;\n\n\n#define mapa make_pair\n#define all(a) a.begin(), a.end()\n#define MM << " " <<\n\ntemplate<typename T>\nusing MaxHeap = std::priority_queue<T>;\ntemplate<typename T>\nusing MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;\n\ntemplate<typename T>\ninline bool chmax(T &a, T b) {\n\tif (a < b) {\n\t\ta = b;\n\t\treturn true;\n\t}\n\treturn false;\n}\ntemplate<typename T>\ninline bool chmin(T &a, T b) {\n\tif (a > b) {\n\t\ta = b;\n\t\treturn true;\n\t}\n\treturn false;\n}\n\ntemplate<typename T>\nstd::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }\ntemplate<typename T>\nvoid vdeb(std::vector<T> &da) {\n\tfor (int i = 0;i < da.size();i++) {\n\t\tif (i == da.size() - 1) std::cout << da[i];\n\t\telse std::cout << da[i] << \' \';\n\t}\n\tstd::cout << std::endl;\n}\ntemplate<typename T>\nvoid vdeb(std::vector<std::vector<T>> &da) {\n\tfor (int i = 0;i < da.size();i++) vdeb(da[i]);\n\tstd::cout << std::endl;\n}\n\nusing namespace std;\n\nint main(){\n\tint n,k,c; cin >> n >> k>> c;\n\tstring s; cin >> s;\n\tif(c == 0){\n\t\trip(i,n,0) if(s[i]==\'o\') k--;\n\t\tif(k < 0) return 0;\n\t\trip(i,n,0){\n\t\t\tif(s[i] == \'o\') printf("%d\\n", i+1);\n\t\t}\n\t\treturn 0;\n\t}\n\tvector<int> dp(n),dpp(n);\n\tdp[0] = 1;\n\tdpp[n-1] = 1;\n\tif(s[0] == \'x\') dp[0] = 0;\n\tif(s[n-1] == \'x\') dp[n-1] = 0;\n\trip(i,n,1){\n\t\tdp[i] = dp[i-1];\n\t\tif(c < i && s[i] == \'o\') chmax(dp[i], dp[i-c-1]+1);\n\t\telse chmax(dp[i], 1);\n\t}\n\tfor(int i = n-2;i>-1;i--){\n\t\tdpp[i] = dpp[i+1];\n\t\tif(i+c+1 < n && s[i] == \'o\') chmax(dpp[i], dpp[i+c+1]+1);\n\t\telse chmax(dpp[i], 1);\n\t}\n\tvector<int> ans(0);\n\tvector<int> su(n+1);\n\trip(i,c+1,0){\n\t\tif(dpp[i] >= k) su[0]++, su[i]--;\n\t}\n\trip(i,n-c-1,0){\n\t\tif(dp[i] + dpp[i+c+1] >=k) su[i+1]++, su[i+c+1]--;\n\t}\n\trip(i,n,n-c-1){\n\t\tif(dp[i] >= k) su[n]--, su[i+1]++;\n\t}\n\tint ok= 0;\n\trip(i,n,0){\n\t\tok += su[i];\n\t\tif(ok == 0) ans.push_back(i+1);\n\t}\n\t// vdeb(dp);vdeb(dpp);vdeb(su);\n\trip(i,ans.size(),0) printf("%d\\n", ans[i]);\n}', '# n = int(input())\n\nn,k = map(int,input().split())\n\n\n\n\nprint(min(n%k, k-n%k))\n'] | ['Runtime Error', 'Accepted'] | ['s792858554', 's548225617'] | [2940.0, 2940.0] | [17.0, 17.0] | [2439, 223] |
p02719 | u058592821 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n, k = (int(i) for i in input().split())\nif k > n:\n print(n)\nelif n % k == 0:\n print(0)\nelse:\n q = n % k\n p = n - q\n print(min(p, q))', 'n, k = (int(i) for i in input().split())\nif k > n:\n print(n)\nelif n % k == 0:\n print(0)\nelse:\n q = n % k\n p = (k * ((n//k) + 1)) - k\n print(min(p, q))', 'n, k = (int(i) for i in input().split())\nif k > n:\n print(min(n, abs(n-k)))\nelif n % k == 0:\n print(0)\nelse:\n q = n % k\n p = (k * (n//k+1)) - n\n print(min(p, q))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s207298405', 's638166311', 's942428442'] | [3060.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0] | [148, 165, 176] |
p02719 | u059210959 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['# encoding:utf-8\nN, K = LI()\n\n\nans = min(abs(N % K), abs(N % K - K), N)\nprint(ans)', 'n,k=map(int, input().split());print(min(n%k,-n%k))'] | ['Runtime Error', 'Accepted'] | ['s273441260', 's160222449'] | [2940.0, 2940.0] | [17.0, 17.0] | [82, 50] |
p02719 | u060736237 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['import fractions\nn, k = map(int, input().split())\nif n%k==0:\n print(0)\nelse:\n print(fractions.gcd(n, k))\n', 'import fractions\nn, k = map(int, input().split())\nif n%k==0:\n print(0)\nelif n < k:\n print(min(n, k-n))\nelse:\n work = n%k\n print(min(work, k-work))'] | ['Wrong Answer', 'Accepted'] | ['s500887312', 's544825047'] | [5560.0, 5692.0] | [149.0, 118.0] | [111, 158] |
p02719 | u060938295 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['from math import gcd\nimport sys\n#import numpy as np\n\nsys.setrecursionlimit(10 ** 9)\n\nK = int(input())\n\nans = 0\nfor i in range(1,K+1):\n for j in range(1,K+1):\n for k in range(1,K+1):\n ans += gcd(gcd(i,j), k)\nprint(ans)\n', 'N, K = map(int,input().split())\n\nx = N % K\n\nans = min(x,K-x)\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s575628738', 's684601880'] | [3060.0, 2940.0] | [18.0, 17.0] | [239, 72] |
p02719 | u064027771 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ["a,b=map(int,input().split())\na=a-10**str(a).count('0')\nans=[a]\nfor i in range(10000):\n ans.append(abs(ans[i]-b))\nprint(min(ans))", "a,b=map(int,input().split())\nif b==1:\n a=a-10**str(a).count('0')\nans=[a]\nfor i in range(1000000000):\n ans.append(abs(ans[i]-b))\nprint(min(ans))", 'a,b=map(int,input().split())\nans=[a,a%b]\nfor i in range(10000):\n ans.append(abs(ans[i]-b))\nprint(min(ans))'] | ['Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s257529996', 's709126594', 's170697625'] | [3316.0, 417428.0, 3316.0] | [20.0, 2130.0, 19.0] | [129, 145, 109] |
p02719 | u064434060 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['a = list(map(int,input().split()))\nprint(a)\nif a[0]<a[1]:\n print(str(min(a[0],a[1]-a[0])))\nelse:\n r=a[0]%a[1]\n print(str(min(r,a[1]-r)))', 'a = list(map(int,input().split()))\nprint(a)\nif a[0]<a[1]:\n print(min(a[0],a[1]-a[0]))\nelse:\n r=a[0]%a[1]\n print(min(r,a[1]-r))', 'a = list(map(int,input().split()))\nif a[0]<a[1]:\n print(str(min(a[0],a[1]-a[0])))\nelse:\n r=a[0]%a[1]\n print(str(min(r,a[1]-r)))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s075075623', 's406166102', 's061068460'] | [3060.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0] | [139, 129, 130] |
p02719 | u065137691 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N, K = map(int, input().split())\na = abs(N%K)\nprint(min(a, abs(a-K))', 'N, K = map(int, input().split())\na = abs(N%K)\nprint(min(a, abs(a-K)))'] | ['Runtime Error', 'Accepted'] | ['s903420508', 's209471626'] | [2940.0, 2940.0] | [17.0, 17.0] | [68, 69] |
p02719 | u068727970 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N, K = map(int, input().split())\nprint(min([N % K, abs(N-K)]))\n', 'N, K = map(int, input().split())\n\nif N % K == 0:\n print(0)\nelse:\n N = N % K\n print(min([N, abs(N-K)]))\n'] | ['Wrong Answer', 'Accepted'] | ['s285570711', 's513455521'] | [2940.0, 2940.0] | [17.0, 17.0] | [63, 112] |
p02719 | u069744971 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ["a,b=map(int,input().split())\nA=list(map(int,input().split()))\n \nS=sum(A)\nans=0\nfor i in range(a):\n if A[i]>=S/(4*b):\n ans+=1\nif ans>=b:\n print('Yes')\nelse:\n print('No')", 'n, k = map(int, input().split())\n \nans = min(n % k, abs(n % k - k))\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s875066874', 's915694605'] | [3060.0, 2940.0] | [18.0, 17.0] | [184, 78] |
p02719 | u072717685 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ["import sys\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\nfrom math import ceil\ndef main():\n n, k = map(int, input().split())\n if k == 1:\n print(0)\n sys.exit()\n r1 = k % n\n r2 = abs(r1 - k)\n r = min(r1, r2)\n print(r)\n\n\nif __name__ == '__main__':\n main()", "import sys\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\ndef main():\n n, k = map(int, input().split())\n if k == 1:\n print(0)\n sys.exit()\n r1 = abs(n - k)\n r = min(r1, k)\n print(r)\n\n\nif __name__ == '__main__':\n main()", "def main():\n n, m = map(int, input().split())\n n = abs(n - (n // m) * m)\n print(n)\n\nif __name__ == '__main__':\n main()\n", "import sys\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\ndef main():\n n, k = map(int, input().split())\n r = abs(n - (n//k)*k)\n print(r)\n\n\nif __name__ == '__main__':\n main()", "import sys\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\nfrom math import ceil\ndef main():\n n, k = map(int, input().split())\n if k == 1:\n print(0)\n sys.exit()\n r1 = n % k\n r2 = abs(r1 - k)\n r = min(r1, r2)\n print(r)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s084440965', 's093759141', 's553831319', 's799642369', 's548625528'] | [9180.0, 9172.0, 2940.0, 9008.0, 9100.0] | [34.0, 25.0, 17.0, 30.0, 27.0] | [295, 256, 131, 192, 296] |
p02719 | u074687136 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N, K = map(int, input().split())\n\nif N % K == 0:\n print(0)\n\nif N > K:\n b = N % K\n print(int(K/b))\n\nres = [N]\nif N < K:\n while True:\n res.append(abs(N - K))\n N = abs(N - K)\n if N in res:\n break\nprint(min(res))', 'N, K = map(int, input().split())\ncand1 = N % K\ncand2 = K - (N % K)\nprint(min(cand1, cand2))'] | ['Runtime Error', 'Accepted'] | ['s261152812', 's895717256'] | [3060.0, 2940.0] | [17.0, 17.0] | [226, 91] |
p02719 | u075304271 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['import math\nimport collections\nimport fractions\nimport itertools\nimport functools\nimport operator\nimport bisect\n\ndef solve():\n n, k = map(int, input().split())\n if n <= k:\n print(n)\n else:\n print(n%k)\n return 0\n\nif __name__ == "__main__":\n solve()', 'import math\nimport collections\nimport fractions\nimport itertools\nimport functools\nimport operator\nimport bisect\n\ndef solve():\n n, k = map(int, input().split())\n if n < k:\n print(n)\n else:\n print(n%k)\n return 0\n\nif __name__ == "__main__":\n solve()', 'import math\nimport collections\nimport fractions\nimport itertools\nimport functools\nimport operator\nimport bisect\n\ndef solve():\n n, k = map(int, input().split())\n print(min(n%k, k-(n%k)))\n return 0\n\nif __name__ == "__main__":\n solve()'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s583120209', 's840667514', 's346216652'] | [10388.0, 10464.0, 10352.0] | [40.0, 45.0, 40.0] | [276, 275, 244] |
p02719 | u082978753 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N, K = map(int, input().split())\nd = N\n\n# d = d - K\nsumk = (N//K)*K\nd = N - sumk\nif N == 0:\n ans=0\nelse :\n\n d2 = N\n if (d*(-1)-K)<0:\n d2 = (d*(-1)-K)*(-1)\n else :\n d2 = (d*(-1)-K)\n d3 = N\n if (d2-K)<0:\n d3 = (d2-K)*(-1)\n else :\n d3 = (d2-K)\n ans = min([(d*(-1)), d2, d3])\n print(ans)', 'N, K = map(int, input().split())\nd = N\n\n# d = d - K\nsumk = (N//K)*K\nd = N - sumk\n\nd2 = N\nif (d*(-1)-K)<0:\n d2 = (d*(-1)-K)*(-1)\nelse :\n d2 = (d*(-1)-K)\nd3 = N\nif (d2-K)<0:\n d3 = (d2-K)*(-1)\nelse :\n d3 = (d2-K)\nans = min([(d*(-1)), d2, d3])\nprint(ans)', 'import numpy as np\nN, K = map(int, input().split())\nans = min(\n (N - (N//K)*K), np.abs(N - (N//K + 1)*K), np.abs(np.abs(N - (N//K + 1)*K) - K)\n )\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s434409126', 's755100751', 's132340324'] | [3064.0, 3064.0, 12396.0] | [17.0, 17.0, 149.0] | [369, 293, 162] |
p02719 | u085910248 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N, K = map(int, input().split())\n\nif K == 1:\n print(0)\n exit()\nwhile True:\n b = N\n N = abs(N - K)\n print(b, N)\n if N >= b:\n print(b)\n break\n', 'N, K = map(int, input().split())\n\nif K == 1:\n print(0)\n exit()\nwhile True:\n b = N\n N = abs(N - K)\n print(b, N)\n if N >= b:\n print(b)\n break\n', 'n, k = map(int, input().split())\n\nn1 = n % k\nn2 = k - n1\nprint(n1 if n1 < n2 else n2)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s779022078', 's923192067', 's630185863'] | [63348.0, 62068.0, 2940.0] | [2103.0, 2104.0, 17.0] | [172, 172, 86] |
p02719 | u086503932 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['import fractions\nN,K = map(int, input().split())\nif K == 1:\n print(0)\nelse:\n print(fractions.gcd(N,K))', 'import fractions\nN,K = map(int, input().split())\nif K == 1 or N == 0 or N % K == 0:\n print(0)\nelse:\n print(fractions.gcd(N,K))', 'import fractions\nN,K = map(int, input().split())\nif K == 1 or N == 0:\n print(0)\nelse:\n print(fractions.gcd(N,K))', 'N,K = map(int, input().split())\nif K == 1 or N == 0:\n print(0)\nelse:\n print(min(N % K, K - N % K))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s419628351', 's624520826', 's835999224', 's396106510'] | [5560.0, 5688.0, 5560.0, 2940.0] | [155.0, 117.0, 189.0, 18.0] | [104, 128, 114, 100] |
p02719 | u087443256 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n,k=[int(x) for x in input().split()]\n#Sequence decreases first then starts increasing.This point has to be identified.\nprev,cur=n+1,n\nif k<=0:\n print(n)\nelse:\n\trem = n%k\n print(abs(rem-k))\n', 'n,k=[int(x) for x in input().split()]\n#Sequence decreases first then starts increasing.This point has to be identified.\nprev,cur=n+1,n\nif k<=0:\n print(n)\nelse:\n\trem = n%k\n print(abs(rem-k))\n', 'n,k=[int(x) for x in input().split()]\n#Sequence decreases first then starts increasing.This point has to be identified.\nprev,cur=n+1,n\nif k<=0:\n print(n)\nelse:\n\trem = n%k\n\tprint(min(rem,abs(rem-k)))\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s254169666', 's791925586', 's327517565'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [194, 194, 200] |
p02719 | u088063513 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ["## coding: UTF-8\nfrom decimal import *\nfrom itertools import permutations, combinations,combinations_with_replacement,product\ns = input().split()\nt = [int(p) for p in s]\n\nN = t[0]\nK = t[1]\n\np = int(N/K)\na = N - p * K\nb = abs(a - K)\nprint('N:{}, K:{}, p:{}, a:{}, b:{}'.format(N,K,p,a,b))", "## coding: UTF-8\nfrom decimal import *\nfrom itertools import permutations, combinations,combinations_with_replacement,product\ns = input().split()\nt = [int(p) for p in s]\n\nN = t[0]\nK = t[1]\n\n\n#a = N - p * K\n\n\na = N % K\nb = K - a\n\n#print('N:{}, K:{}, p:{}, a:{}, b:{}'.format(N,K,p,a,b))\nprint(min(a,b))\n# 1000000000000000000"] | ['Wrong Answer', 'Accepted'] | ['s024880849', 's033957690'] | [5588.0, 9752.0] | [154.0, 26.0] | [287, 374] |
p02719 | u088115428 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n, m = map(int, input().split())\nl = []\nans = 1\nif(n%m == 0):\n ans=0\nelse:\n for x in (0,1000000000000000000):\n n = abs(n%m)\n l.append(n)\n l.sort()\n ans = min(n,l[0])\nprint(ans)', 'n, m = map(int, input().split())\nl = []\nif(n%m = 0):\n ans=0\nelse:\n n = n-m\n l.append(n)\n \nprint(ans)', 'n, m = map(int, input().split())\nl = []\nans = 1\nif(n%m == 0):\n ans=0\nelse:\n for x in (0,1000000000000000000):\n n = abs(n%m)\n l.append(n)\n l.sort()\n ans = min(m-n,l[0])\nprint(ans)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s361130689', 's648726991', 's682937498'] | [3060.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0] | [186, 104, 188] |
p02719 | u089239168 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n, k = map(int, input().split())\n\nmo = n%k\n\nmok = abs(mo - k)\n\nif mo = mok:\n print(mo)\nelse:\n print(mok)', 'n, k = map(int, input().split())\n\nmo = n%k\n\nmok = abs(mo - k)\n\nif mo <= mok:\n print(mo)\nelse:\n print(mok)'] | ['Runtime Error', 'Accepted'] | ['s307527580', 's743460041'] | [2940.0, 2940.0] | [18.0, 17.0] | [110, 111] |
p02719 | u092460072 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n,k=list(map(int, input().split()))\nx=n//k\nprint(abs(n-k*x))', 'n,k=list(map(int, input().split()))\nx=n%k\nif x>(k+1)//2:\n print(k-x)\nelse:\n print(x)'] | ['Wrong Answer', 'Accepted'] | ['s069025937', 's044170099'] | [2940.0, 2940.0] | [17.0, 17.0] | [60, 86] |
p02719 | u094534261 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n,k=map(int,input().split())\nprint(min(abs(n-k)%k,n%k))', 'n,k=map(int,input().split())\nprint(min(n%k,k-(n%k)))'] | ['Wrong Answer', 'Accepted'] | ['s598347715', 's968347975'] | [9156.0, 8980.0] | [29.0, 28.0] | [55, 52] |
p02719 | u095021077 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['\nN, K=map(int, input().split())\n\n\nB=N%K\n\n\nprint(min(b, K-b))\n', '\nN, K=map(int, input().split())\n\n\nb=N%K\n\n\nprint(min(b, K-b))\n'] | ['Runtime Error', 'Accepted'] | ['s269130916', 's281417026'] | [2940.0, 2940.0] | [17.0, 18.0] | [147, 147] |
p02719 | u095384238 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N, K = list(map(int, input().split()))\nflag =False\nwhile flag==False:\n if 2*N > K:\n N = N%K\n else:\n print(N)\n flag = True', 'N, K = list(map(int, input().split()))\nprint(min(N%K, K-(N%K)))'] | ['Time Limit Exceeded', 'Accepted'] | ['s583083883', 's326381724'] | [2940.0, 2940.0] | [2104.0, 18.0] | [148, 63] |
p02719 | u098982053 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N,K = map(int,input().split(" "))\nMin = N\nwhile(Min%K<Min):\n Min = Min%K\nprint(Min)', 'N,K = map(int,input().split(" "))\nMin = N \nwhile(Min%K<Min):\n Min=Min%K\nif abs(Min-K) > Min:\n print(Min)\nelse:\n print(abs(Min-K))'] | ['Wrong Answer', 'Accepted'] | ['s989546638', 's571437198'] | [2940.0, 2940.0] | [17.0, 18.0] | [86, 138] |
p02719 | u100572972 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n,k = map(int,input().split())\nl = n%k\n\nif k !=1 and l == 0:\n if l >= abs(l-k):\n print(abs(l-k))\n else:\n print(l)\nelse:\n print(0)', 'n,k = map(int,input().split())\nl = n%k\n \n\nif l >= abs(l-k):\n print(abs(l-k))\nelse:\n print(l)'] | ['Wrong Answer', 'Accepted'] | ['s137104781', 's818966841'] | [2940.0, 2940.0] | [17.0, 17.0] | [152, 98] |
p02719 | u103341055 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N,K = map(int,input().split())\n\nprint(N%K)\n\n\n', 'N,K = map(int,input().split())\n\nMin = N%K\nt = abs(Min-K)\n\nprint(min(Min,t))\n\n'] | ['Wrong Answer', 'Accepted'] | ['s854129375', 's735198187'] | [2940.0, 3064.0] | [17.0, 18.0] | [45, 77] |
p02719 | u105302073 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['import fractions\nn, k = [int(i) for i in input().split()]\nif n <= k:\n print(n)\n exit()\n\nprint(fractions.gcd(n, k))\n', 'n, k = [int(i) for i in input().split()]\nt = n % k\nprint(min(t, k - t))\n'] | ['Wrong Answer', 'Accepted'] | ['s863818972', 's001000499'] | [5048.0, 2940.0] | [37.0, 18.0] | [121, 72] |
p02719 | u108648546 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['a, b = int(input().split(" "))\n\nquotinent = a // b\n\nres = max(a - b * quotinent, abs( a- b * (quotinent + 1)))\nprint(res)', 'a, b = map(int, input().split(" "))\n\nquotinent = a // b\n\nres = min(a - b * quotinent, abs(a- b * (quotinent + 1)))\nprint(res)'] | ['Runtime Error', 'Accepted'] | ['s917617119', 's769681814'] | [2940.0, 2940.0] | [17.0, 17.0] | [121, 126] |
p02719 | u110199424 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['N, K = map(int, input().split())\n\nN_set = set([])\nN_set.add(float(\'inf\'))\nN_new = N\n\nwhile (N_new > 0 and N_new < min(N_set)):\n N_set.add(N_new)\n if N_new >= K:\n N_new = N_new % K\n else:\n N_new = K - N_new\n print("N_new", N_new)\n\nN_set.add(N_new)\n\nans = min(N, min(N_set))\n\nprint(ans)', "N, K = map(int, input().split())\n\nN_set = set([])\nN_set.add(float('inf'))\nN_new = N\n\nwhile (N_new > 0 and N_new < min(N_set)):\n N_set.add(N_new)\n if N_new >= K:\n N_new = N_new % K\n else:\n N_new = K - N_new\n \nN_set.add(N_new)\n\nans = min(N, min(N_set))\n\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s625716399', 's480679499'] | [9132.0, 9184.0] | [23.0, 20.0] | [310, 285] |
p02719 | u112266373 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n, k = list(map(int, input().split(" ")))\nwhile True:\n a = abs(n-k)\n if n <= a:\n break\n else:\n n = a', 'n, k = list(map(int, input().split(" ")))\nn = n - k * (n // k)\nn_last = abs(n - k)\nif n_last < n:\n n = n_last\nprint(n)'] | ['Wrong Answer', 'Accepted'] | ['s567861283', 's475050677'] | [2940.0, 2940.0] | [2104.0, 17.0] | [123, 121] |
p02719 | u112747720 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ["N, K = [int(i) for i in input().split(' ')]\n\nmin1 = 0\nprev = 0\n\nwhile True:\n if prev < abs(N - K):\n break\n else:\n min1 = abs(N - K)\n\tN = abs(N - K)\n\tprev = min1\n\n\nprint(prev)\n\t\t", "N, K [int(i) for i in input().split(' ')]\n\nmin = 0\nprev = 0\n\nwhile abs(N - K) > prev:\n min = abs(N - K)\n prev = min\n\nprint(min)\n\t\t", "N, K = [int(i) for i in input().split(' ')]\n\ndef res():\n if N == K:\n return 0\n elif N > K:\n return N % K\n else :\n return N\n\nprint(res())", "N, K = [int(i) for i in input().split(' ')]\n\nmin = 0\nprev = 0\n\nwhile abs(N - K) > N:\n min = abs(N - K)\n N = min\n\n\nprint(min)\n\t\t", "N, K = [int(i) for i in input().split(' ')]\n\nprev = N\n\nif N == 0:\n print( N)\nelse:\n while True:\n if prev == 0:\n print(prev)\n break\n elif abs() >= prev:\n print(prev)\n break\n else\n N = abs()\n prev = N\n\n\n", "N, K = [int(i) for i in input().split(' ')]\n\nmin_value = 0\n\ncount = 0\nwhile True:\n if min_value < abs(N - K):\n count =+ 1\n if count > 1:\n\t break\n else:\n\t\tN = abs(N - K)\n\t\tmin_value = N\t\t\n else:\n\tN = abs(N - K)\n\tmin_value = N\n \nprint(min_value)\t", "N, K = [int(i) for i in input().split(' ')]\n\ndef res():\n if N == K:\n return 0\n elif N > K:\n return N % K if N - (N % K) > (N % K) else N - (N % K)\n else :\n return N\n\nprint(res())", "N, K = [int(i) for i in input().split(' ')]\n\nmin = 0\nprev = 0\n\nwhile abs(N - K) > min:\n min = abs(N - K)\n N = abs(N - K)\n prev = min\n\n\nprint(min)\n\t\t", "N, K = [int(i) for i in input().split(' ')]\n\nmin = 0\nprev = 0\n\nwhile abs(N - K) > min:\n min = abs(N - K)\n N = min\n\nprint(N - K)\t", "N, K = [int(i) for i in input().split(' ')]\n\ndef res():\n if N == K:\n return 0\n elif N > K:\n return N % K if K - (N % K) > (N % K) else K - (N % K)\n else :\n return abs(N - K) if abs(N - K) < abs(abs(N-K) - K) else abs(abs(N-K) - K)\n\nprint(res())"] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s280583633', 's350240116', 's500717987', 's501265331', 's785493230', 's824405915', 's848898711', 's940407347', 's957599214', 's116326993'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3188.0, 3060.0, 2940.0, 2940.0, 3060.0] | [18.0, 17.0, 17.0, 18.0, 17.0, 17.0, 17.0, 18.0, 17.0, 17.0] | [185, 132, 148, 129, 242, 261, 190, 151, 130, 256] |
p02719 | u113107956 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['n,k=map(int,input().split())\nt=n%k\nn=min(t,k)\nprint(n)', 'n,k=map(int,input().split())\nif n<k:\n for i in range(n):\n num=int(abs(n-k))\n if num<n:\n n=num\n else:\n break\nelse:\n t=n%k\n n=min(t,k)\nprint(n)', 'n,k=map(int,input().split())\nans=min(n%k,abs(k-(n%k)))\nprint(ans)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s501362912', 's913180931', 's295974237'] | [2940.0, 2940.0, 9060.0] | [17.0, 17.0, 28.0] | [54, 193, 65] |
p02719 | u116038906 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['\nN,K = (int(x) for x in input().split(" "))\n\n#\nzeroika = N//K\nN1 =abs(N-K*zeroika) \n N =N1\n N1 =abs(N-K)\n #print(N1,end=" ")\nprint(N)', '\nN,K = (int(x) for x in input().split(" "))\n\n#\nzeroika = 0\nif K <N:\n zeroika = N//K\nelse:\n zeroika = 1\nN1 =abs(N-K*zeroika) \nwhile N1<N:\n N =N1\n N1 =abs(N-K)\n #print(N1,end=" ")\nprint(N)'] | ['Runtime Error', 'Accepted'] | ['s555341982', 's779858378'] | [2940.0, 2940.0] | [17.0, 17.0] | [241, 300] |
p02719 | u119982001 | 2,000 | 1,048,576 | Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times. | ['from math\n\nN, K = map(int, input().split())\n\nif N==1 or K==1:\n print(0)\nelse:\n print(math.gcd(N, K))\n', 'N, K = map(int, input().split())\nprint(min(N%K, K-N%K))\n'] | ['Runtime Error', 'Accepted'] | ['s536139045', 's995928795'] | [2940.0, 2940.0] | [17.0, 17.0] | [107, 56] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.