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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02582 | u985929170 | 2,000 | 1,048,576 | We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day. Find the maximum number of consecutive rainy days in this period. | ["S = input()\nif S = 'RRR':print(3)\nif S = 'RRS':print(2)\nif S = 'RSR':print(1)\nif S = 'RSS':print(1)\nif S = 'SRR':print(2)\nif S = 'SRS':print(1)\nif S = 'SSR':print(1)\nif S = 'SSS':print(0)", "S = input()\nif S == 'SSS':print(0)\nif S == 'SSR':print(1)\nif S == 'SRS':print(1)\nif S == 'RSS':print(1)\nif S == 'S... | ['Runtime Error', 'Accepted'] | ['s819969900', 's609067973'] | [9008.0, 9044.0] | [22.0, 27.0] | [187, 195] |
p02582 | u988661952 | 2,000 | 1,048,576 | We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day. Find the maximum number of consecutive rainy days in this period. | ["S = input()\n\nif S == 'RRR':\n print(3)\nelif S == 'RSR' or 'SSR' or 'RSS':\n print(1)\nelif S == 'RRS' or S=='SRR':\n print(2)\nelse:\n print(0)", "S = input()\n\nif S == 'RRR':\n print(3)\nelif S == 'RSR' or S=='SSR' or S=='RSS' or S=='SRS':\n print(1)\nelif S == 'RRS' or S=='SRR':\n print(2)\... | ['Wrong Answer', 'Accepted'] | ['s735036734', 's885933322'] | [9024.0, 9100.0] | [35.0, 33.0] | [149, 167] |
p02582 | u994935583 | 2,000 | 1,048,576 | We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day. Find the maximum number of consecutive rainy days in this period. | ['W = input()\nans = 0\ncount = 0\nfor i in range(len(W)):\n if W[i] == R:\n count += 1\n ans = max(ans,count)\n else:\n count = 0\nprint(ans)', 'W = input()\nans = 0\ncount = 0\nfor i in range(len(W)):\n if W[i] == "R":\n count += 1\n ans = max(ans,count)\n else:\n count = 0\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s984123132', 's417414613'] | [8996.0, 8944.0] | [28.0, 30.0] | [142, 144] |
p02582 | u999327182 | 2,000 | 1,048,576 | We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it means it was rainy on that day. Find the maximum number of consecutive rainy days in this period. | ['S = input()\n\nif S =="SSS":\n print(0)\nelif S[1] == "S":\n print(1)\nelif S = "SRS":\n print(1)\nelif S == "RRR":\n print(3)\nelse:\n print(2)', 'S = input()\n\nif S =="SSS":\n print(0)\nelif S[1] == "S":\n print(1)\nelif S == "SRS":\n print(1)\nelif S == "RRR":\n print(3)\nelse:\n print(2)'] | ['Runtime Error', 'Accepted'] | ['s471793965', 's179452822'] | [9008.0, 9036.0] | [29.0, 34.0] | [138, 139] |
p02584 | u000040786 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d = map(int, input().split())\nx=abs(x)\nif x-d*k > 0:\n print(x-d*k)\nelse:\n print(x+d*k)', 'x, k, d = map(int, input().split())\nx=abs(x)\nif x-d*k > 0:\n print(x-d*k)\nelse:\n n=x//d\n x-=n*d\n if (k-n)%2==0:\n print(x)\n else:\n print(abs(x-d))'] | ['Wrong Answer', 'Accepted'] | ['s244720519', 's791421440'] | [9160.0, 9152.0] | [26.0, 31.0] | [98, 173] |
p02584 | u013105797 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['print(-1 // 2)\n\nX, K, D = map(int, input().split())\n\nans = 0\ncount = X // D\n\n\n\nif X >= 0:\n if K <= count:\n ans = X - D * K\n else:\n ans = X - D * count\n if ((K - count) % 2 == 1):\n ans = ans - D\nelse:\n if K <= (-1) * count:\n ans = X + D * K\n elif X ... | ['Wrong Answer', 'Accepted'] | ['s451126280', 's847103984'] | [9108.0, 9216.0] | [33.0, 35.0] | [557, 541] |
p02584 | u013864607 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D=map(int,input().split())\n\ndef valid(value1, value2, diff):\n if diff%2==0:\n return value1\n else:\n return value2\n\nif abs(X)>K:\n tmp = abs(X)//D\n if D>K:\n tmp=K\n print(tmp)\n if X < 0:\n X += tmp*D\n else:\n X -= tmp*D\n K -= tmp\n\nmin_score =... | ['Wrong Answer', 'Accepted'] | ['s012989789', 's530562319'] | [9176.0, 9212.0] | [29.0, 27.0] | [567, 554] |
p02584 | u017271555 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['#from math import abs\nx,k,d=input().split()\nx=int(x)\nk=int(k)\nd=int(d)\nif(x<=0):\n if(x+k*d<=0):print(x+k*d)\n else:\n res=x%d\n k-=abs(res-x)//d\n if(k%2):\n ans1=res+d\n ans2=res-d\n if(abs(ans1)>abs(ans2)):print(ans2)\n else:print(ans1)\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s145372085', 's549247690', 's625417603'] | [9224.0, 9204.0, 9236.0] | [31.0, 33.0, 31.0] | [586, 364, 625] |
p02584 | u018808362 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['li= list(map(int,input().split()))\t \nX, K, D=li[0], li[1], li[2]\nif abs(X)>K*D:\n print(min(abs(X-K*D), abs(X+K*D)))\nelse:\n N=abs(X)//D\n Min=10**16\n n=0\n for i in range(N-1, N+2):\n M=abs(X-i*D)\n if M<Min:\n Min=M\n n=i\n if (K-n)%2==0:\n pr... | ['Wrong Answer', 'Accepted'] | ['s580646159', 's507295409'] | [9188.0, 9216.0] | [2206.0, 34.0] | [574, 373] |
p02584 | u035210736 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['from decimal import *\nx, k, d = map(Decimal, input().split())\n\nif x >= 0:\n if x-k*d >= 0:\n print(abs(x-k*d))\n else:\n if d%2 == k%2:\n print(abs(k-x%d))\n else:\n print(abs(x%d))\nelse:\n if x+k*d <= 0:\n print(abs(x+k*d))\n else:\n if d%2 == k%2:\n print(abs(k+x%d))\n else:... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s541639426', 's623133911', 's638172530', 's141275261'] | [9876.0, 9872.0, 9852.0, 9928.0] | [36.0, 39.0, 36.0, 40.0] | [324, 326, 330, 331] |
p02584 | u043170743 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D = map(int, input().split())\nX=abs(X)\nif X>=K*D:\n print(X-K*D)\nelse:\n y=X//D\n z=K-y\n if z%2==0:\n print(K-y*D)\n else:\n print(K-(y+1)*D)', 'X,K,D = map(int, input().split())\nX=abs(X)\nif X>=K*D:\n print(X-K*D)\nelse:\n y=X//D\n z=K-y\n if z%2==0:\n print(K-y*D)\n else:\n print(K-(y... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s333333943', 's762358287', 's850621990', 's074730010'] | [9176.0, 9180.0, 9184.0, 9092.0] | [28.0, 31.0, 30.0, 30.0] | [150, 150, 155, 162] |
p02584 | u050622763 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['\nx,k,d = list(map(int,input().split()))\n\n\n\ncapa_iter = abs(x) // abs(d)\nif capa_iter < k:\n if (k - capa_iter) % 2 == 0:\n print(x - capa_iter*d)\n else:\n print(max([abs(x - capa_iter*d-d),abs(x - capa_iter*d+d)]))\n exit()\n\n\nans = min([abs(x-d),abs(x+d)])\n\nprint(ans)\n', 'import numpy as np\n\nx... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s335598421', 's406629868', 's243450186'] | [9180.0, 26884.0, 9076.0] | [33.0, 137.0, 34.0] | [348, 395, 586] |
p02584 | u051174463 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d = [int(i) for i in input().split()]\nprint(min([abs(x // d), abs(x // d - d)]))', 'x, k, d = [int(i) for i in input().split()]\nif x < 0:\n x = -x\nl = min(k, x // d)\nk -= l\nx -= l * d\nif k % 2 == 0:\n print(x)\nelse:\n print(d - x)'] | ['Wrong Answer', 'Accepted'] | ['s812139555', 's290682594'] | [9164.0, 9060.0] | [29.0, 27.0] | [86, 146] |
p02584 | u051261043 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['n, k, d = map(int, input().split())\nn = abs(n)\nok = n // d\nleft = k - (ok)\nif left % 2:\n print(d - (n%d))\n else:\n print(n%d)', 't = int(input())\n\nfor i in range(t):\n n, k, d = map(int, input().split())\n n = abs(n)\n ok = n // d\n left = k - (ok)\n if left % 2:\n print(d - (n%d))\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s286600752', 's444038324', 's093063225'] | [9044.0, 9096.0, 9168.0] | [26.0, 25.0, 32.0] | [129, 198, 170] |
p02584 | u054825571 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D=map(int,input().split())\ndef solve(X,K,D):\n if abs(X)>D:\n a=abs(X)//D\n if K>a:\n X=X%D\n K-=a\n else:\n if X>0:\n return X-D*K\n else:\n return -1*(X+D*K)\n if K%2==0:\n return X\n else:\n if X>0:\n return X-D\n else:\n return -1*(X+D)\nprint(... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s220090762', 's312640147', 's530442850'] | [9192.0, 9188.0, 9172.0] | [30.0, 30.0, 28.0] | [312, 304, 223] |
p02584 | u065079240 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X, K, D = map(int, input().split())\nif X + K * D <= 0:\n print(-X - K * D)\n elif X - K * D >= 0:\n print(X - K * D)\n else:\n mod = abs(X) // D\n if (K-mod) % 2 == 0:\n print(abs(abs(X) - K * mod))\n else:\n print(abs(abs(X) - K * (mod + 1)))', 'X, K, D = map(int, input().split(... | ['Runtime Error', 'Accepted'] | ['s306116289', 's133136316'] | [9012.0, 9104.0] | [29.0, 29.0] | [271, 257] |
p02584 | u066413086 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ["def point(x):\n return (abs(x), x)\n\ndef main():\n X, K, D = map(int, input().split())\n\n if X < 0:\n k = abs(X) // D\n k = min(k, K)\n ans = X + D*k\n K -= k\n \n if K >= 1 and point(ans + D) < point(ans):\n ans += D\n K -= 1\n \n ... | ['Wrong Answer', 'Accepted'] | ['s847123501', 's742474992'] | [9228.0, 9192.0] | [33.0, 31.0] | [756, 761] |
p02584 | u068538925 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d = map(int,input().split())\n\ninit = 10**15\n\nfor i in range(abs(k) // abs(d)):\n tempx = x + i*d - (k-i)*d\n init = min(init, abs(tempx))\n\nprint(init)', 'x,k,d = map(int,input().split())\nif abs(x)//abs(d) >= k:\n print(abs(x)-abs(d)*k)\n exit()\n\nstep = abs(x)//abs(d)\ny = abs(x)-abs(d)*step\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s054398114', 's332370680', 's763884562'] | [9168.0, 8980.0, 9192.0] | [2206.0, 26.0, 28.0] | [158, 199, 204] |
p02584 | u069486477 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D = map(int,input().split()) \nX = abs(X)\nif X >= K*D:\n print(X-K*D)\nelse:\n if (K-X//D) % 2 ==1:\n print(D-(X-K*D))\n else:\n print(X-X//D*D)', 'X,K,D = map(int,input().split()) \nmlist = []\nfor i in range(K+1):\n t = X + i*D - (K-i)*D\n if t < 0 :\n t = -t\n mlist.appe... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s390087130', 's519753769', 's682789401', 's074857263'] | [9180.0, 395852.0, 9196.0, 9172.0] | [31.0, 2216.0, 29.0, 31.0] | [164, 172, 153, 168] |
p02584 | u075317232 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ["def WalkingTakahashi():\n \n data = list(map(int,input().split()))\n \n position = data[0]\n\n print(data[1]%2)\n \n if data[0] == data[2] and data[1]%2 == 0:\n print(data[2])\n \n elif data[0] == data[2] and data[1]%2 == 1:\n print(0)\n \n else:\n for i in ra... | ['Wrong Answer', 'Accepted'] | ['s154818000', 's498904656'] | [9060.0, 9144.0] | [2206.0, 37.0] | [630, 375] |
p02584 | u080885857 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d = map(int,input().split())\n\nif x>0 and x-k*d<0:\n tem = int(x/k)\n if (x-tem)>abs(x-(tem+1)):\n print(abs(x - d*(tem + 1)))\n\n else:\n print(x - d*tem)\n\nelse:\n print(x-k*d)', 'x,k,d = map(int,input().split())\n\n\nx=abs(x)\nif k*d<=x:\n print(x-k*d)\nelse:\n tem = int(x/d)... | ['Wrong Answer', 'Accepted'] | ['s245739050', 's659944319'] | [9084.0, 9068.0] | [33.0, 30.0] | [200, 189] |
p02584 | u090649502 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ["#!/usr/bin/env python3\nimport sys\n\n\ndef solve(X: int, K: int, D: int):\n X=abs(X)\n\n ans=min(X, X - K * D)\n\n if K%2 == 1:\n X += D\n ans = min(ans, X)\n Kh=(K+1)//2\n\n N = X // (D*2)\n ans = min(ans, abs(X - D * 2 * (N - 1)))\n ans = min(ans, abs(X - D * 2 * N))\n if N < ... | ['Wrong Answer', 'Accepted'] | ['s274503952', 's070913307'] | [9144.0, 9192.0] | [29.0, 35.0] | [889, 1001] |
p02584 | u092104621 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d = list(map(int, input().split()))\nx = abs(x)\nfor i in range(k,0,-1):\n if x > 0:\n x -= d\n else:\n x += d * (i % 2)\n break\nprint(x)\n', 'x,k,d = list(map(int, input().split()))\nx = abs(x)\na,b = divmod(x, d)\n\n#print(a,b)\n\n# if x > 0:\n# x -= d\n# else:\n# x += d * (i % 2)\n# brea... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s357565529', 's625998654', 's091058022'] | [9156.0, 9096.0, 9172.0] | [2205.0, 28.0, 28.0] | [146, 189, 178] |
p02584 | u094425865 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d=map(int,(input().split()))\n\nzx=x\nif abs(x)<d*k:\n wk,x=divmod(abs(x),d)\n k-=wk \nelse:\n abs(x)-=d*k\n k=0\n\nfor i in range(k):\n xm=abs(x+d)\n xu=abs(x-d)\n x=min(xm,xu)\n k-=1\n if zx+x==d:\n if k%2!=0:\n x=zx\n break\n else:\n ... | ['Runtime Error', 'Accepted'] | ['s307878046', 's611143036'] | [9136.0, 9204.0] | [25.0, 31.0] | [326, 325] |
p02584 | u098679988 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['import sys\nx, k, d = map(int, input().split())\n\nif x > 0:\n if abs(x-d) < x:\n div = x//d\n if div > k:\n print(x-d*k)\n sys.exit()\n else:\n if k%2 == 0:\n print(x)\n sys.exit()\n else:\n print(x-d)\n ... | ['Wrong Answer', 'Accepted'] | ['s729962773', 's849729832'] | [9224.0, 9148.0] | [31.0, 34.0] | [780, 959] |
p02584 | u102655885 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d = list(map(lambda x: int(x), input().split()))\n\nmin_pos = x % d\nmin_neg = min_pos - d\n\nnum_to_min_pos = x // d\nif k <= num_to_min_pos:\n print(x - d * k)\n \nelse:\n if (k - num_to_min_pos) % 2 == 0:\n print(min_pos)\n else:\n print(abs(min_neg)\n', 'x, k, d = list(map(lambda x... | ['Runtime Error', 'Accepted'] | ['s659720457', 's604995485'] | [9000.0, 9108.0] | [29.0, 32.0] | [273, 285] |
p02584 | u108650331 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['#!/usr/bin/env python3\nimport math\n\nX, K, D = map(int, input().split())\n\ncross = abs(math.ceil(X / D))\n\nif cross >= K:\n for i in range(K):\n if X >= 0:\n X -= D\n else:\n X += D\n print(X)\nelse:\n for i in range(cross):\n if X >= 0:\n X -= D\n ... | ['Wrong Answer', 'Accepted'] | ['s885399368', 's398598767'] | [9152.0, 9140.0] | [2206.0, 34.0] | [511, 457] |
p02584 | u115877451 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['a,b,c=map(int,input().split())\n\nif abs(a)>=abs(b*c):\n print(abs(abs(a)-abs(b*c)))\n exit()\n\nn=abs(a)\nm=n//c\nif abs(a)-abs(c*m)>abs(a)-abs(c*(m+1)):\n m=m+1\nprint(m)\nif (b-m)%2==0:\n print(abs(abs(a)-abs(c*m)))\nelse:\n print(min(abs(abs(a)-abs(c*(m+1))),abs(abs(a)-abs(c*(m-1)))))', 'a,b,c=map(... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s503078454', 's854069874', 's169302337'] | [9200.0, 9136.0, 9172.0] | [34.0, 31.0, 30.0] | [290, 285, 339] |
p02584 | u129749062 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['import sys\nX, K, D = map(int,input().split())\ncnt = 0\na = X\nb = 999999999\ntmp = 0\nif X == 0:\n if K % 2 == 0:\n print(0)\n else:\n print(D)\n sys.exit()\nif X >= K*D:\n print(X - K*D)\n sys.exit()\nif K % 2 == 0:\n tmp = int(X/D)\n if tmp% 2 == 0:\n a = X - D*tmp\n else:\n a = X - D*tmp + D\... | ['Wrong Answer', 'Accepted'] | ['s108760475', 's776783232'] | [9068.0, 9208.0] | [33.0, 29.0] | [534, 412] |
p02584 | u129898499 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D = map(int,input().split())\nans = 0\nif X<0:\n X = (-1)*X\n \nif X-K*D >=0:\n ans = X-K*D\nelse:\n Y = int(X/D)\n z = X%D\n if (K-Y)%2=0:\n ans = Z\n if (K-Y)%2=1:\n ans = D-Z\nif ans<0:\n ans = (-1)*ans\nprint(ans)\n \n', 'X,K,D = map(int,input().split())\nans = 0\nif X<0:\n X = (-1)*X\n \nif ... | ['Runtime Error', 'Accepted'] | ['s863645533', 's094657741'] | [9028.0, 9180.0] | [27.0, 34.0] | [223, 194] |
p02584 | u130076114 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D=map(int,input().split())\nans=0\nif abs(X)>=K*D:\n ans=abs(X)-K*D\nelse:\n M=abs(X)//D\n if abs(X)-M*D>abs(abs(X)-(M+1)*D):\n M=M+1\n if (K-M)%2==0:\n ans=abs(abs(X)-M*D)\n else:\n ans=abs(X)-(M-1)*D\nprint(ans)\n', 'X,K,D=map(int,input().split())\nans=0\nif abs(X)>=K*D:\n ... | ['Wrong Answer', 'Accepted'] | ['s833415562', 's734639470'] | [9172.0, 9196.0] | [32.0, 31.0] | [242, 267] |
p02584 | u131881594 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d=map(int,input().split())\n\nif abs(x)>=k*d: print(abs(x)-k*d)\nelse:\n if (k-abs(x)//d)%2==0: print(abs(x)-d*x//d)\n else: print(abs(abs(x)-d*x//d-d))\n', 'x,k,d=map(int,input().split())\n\nif abs(x)>=k*d: print(abs(x)-k*d)\nelse:\n if (k-abs(x)//d)%2==0: print(abs(x)-d*(abs(x)//d))\n else: print(ab... | ['Wrong Answer', 'Accepted'] | ['s503190392', 's288909109'] | [9112.0, 9172.0] | [35.0, 30.0] | [158, 172] |
p02584 | u137038354 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D = map(int,input().split())\nA = abs(X)\nans = 0\nif A >= D*K:\n print( A - (D * K))\nelse :\n e = A//D\n K -= e\n x %= D\n if K%2 == 0:\n print(x)\n else:\n print(D-x)', 'X,K,D = map(int,input().split())\nA = abs(X)\nans = 0\nif A >= D*K:\n print( A - (D * K))\nelse :\n e =... | ['Runtime Error', 'Accepted'] | ['s065775222', 's406709921'] | [9200.0, 9184.0] | [28.0, 27.0] | [193, 193] |
p02584 | u137316733 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D=map(int, input().split())\n\nX = abs(X)\na = X / D\nb = round(a)\n\nc = K - b\n\nif c < 0:\n print(X-(K*D))\nelif c % 2 != 0:\n if a > b:\n b = b + 1\n else:\n b = b - 1\n d = abs(X - (D*b))\n print(d)', 'X,K,D=map(int, input().split())\n\nX = abs(X)\na = X / D\nb = round(a)\n\nc = ... | ['Wrong Answer', 'Accepted'] | ['s511496523', 's150640052'] | [9176.0, 9200.0] | [32.0, 26.0] | [220, 247] |
p02584 | u139940813 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d = map(int, input().split())\n\na = [abs(x // d), x % d]\n\nif a[0] > k:\n ans = min(abs(x+k*d) ,abs(x-k*d))\nelse:\n b = (k- a[0]) % 2\n ans = min(abs(a[1]+b*d) ,abs(a[1]-b*d))\n\nprint(ans))', 'x, k, d = map(int, input().split())\n\na = [abs(x // d), x % d]\n\nif a[0] > k:\n ans = min(abs(x+k*d) ,a... | ['Runtime Error', 'Accepted'] | ['s785133723', 's876629692'] | [9032.0, 9088.0] | [26.0, 27.0] | [197, 196] |
p02584 | u141574039 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D=map(int,input().split())\nif K%2==0:\n if abs(2*D)>=abs(X):\n print(X)\n else:\n p=K*D\n q=abs(X-p)\n r=min(q%D,abs(q%D-D))\n print(r) \nelse:\n if K==1:\n print(min(X,min(X+D,X-D)))\n else:\n if abs(D)>=abs(X):\n print(X)\n else:\n p=K*D\n q=abs(X-p)\n r=min(q%... | ['Wrong Answer', 'Accepted'] | ['s318863552', 's614640485'] | [9200.0, 9136.0] | [33.0, 29.0] | [330, 161] |
p02584 | u153686508 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D=map(int,input().split())\nif X<0:\n X*=-1\nif X-K*D>0:\n print(X-K*D)\nelif 2*X>D:\n print(X)\nelse:\n p=X-(X//D)*D\n p=min(abs(p-D),p)\n print(p)\n', 'X,K,D=map(int,input().split())\nif X<0:\n X*=-1\nif X-K*D>0:\n print(X-K*D)\nelse:\n p=X-(X//D)*D\n K-=X//D\n q=abs(p-D)\n if K%2==0:\n print(p)\... | ['Wrong Answer', 'Accepted'] | ['s241008010', 's467854156'] | [9172.0, 9172.0] | [31.0, 32.0] | [149, 165] |
p02584 | u163971674 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['import math\nx,k,d=map(int,input().split(" "))\n\n\nif x<0:\n x=(-1)*x\nif d<0:\n d=(-1)*d\n \ns=math.floor(x/d)\n\nif k<s:\n print(x-d*k)\nelse:\n w=k-s\n v=x-d*s\n if w%2==0:\n print(v)\n else:\n print(v-d)\n ', 'import math\nx,k,d=map(int,input().split(" "))\n\n\nif x<0:\n x=(-1)*x\nif d<0:\n d=(-... | ['Wrong Answer', 'Accepted'] | ['s952717227', 's955400949'] | [9204.0, 9180.0] | [33.0, 30.0] | [206, 211] |
p02584 | u165114979 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d = input().split()\nx = int(x)\nk = int(k)\nd = int(d)\nx = abs(x)\nif x > d:\n if x // d > k:\n x = x - k*d\n print(x)\n exit()\n else:\n \tk -= x // d\n x = x % d\n \n \nif k % 2 == 1:\n x = abs(x-d)\n\nprint(x)\n ', 'x, k, d = input().split()\nx = int(x)\nk = int(k)\nd = int(d)\nx ... | ['Runtime Error', 'Accepted'] | ['s288104997', 's032444304'] | [9020.0, 9184.0] | [25.0, 32.0] | [229, 228] |
p02584 | u165318982 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X, K, D = map(int,input().split())\nprint(X)\ntime = X // D\nX = X - (D * time)\nK = K - time\nprint(X)\nprint(K)\n\nif K % 2 == 0:\n print(X)\nelse:\n print(abs(X - D))', 'X, K, D = map(int,input().split())\nX = abs(X)\ntime = X // D\ntime = min(K, time)\nX = X - (D * time)\nK = K - time\n\nif K % 2 == 0:\n print... | ['Wrong Answer', 'Accepted'] | ['s456548991', 's439454780'] | [9044.0, 9056.0] | [34.0, 31.0] | [160, 164] |
p02584 | u173178698 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d = map(int,input().split())\nx = abs(x)\nif x>k*d:\n ans = x-k*d\nelse:\n cnt = x//d\n if (k-cnt)%2==0:\n ans = x-cnt*d\n else:\n if x > 0:\n ans = x-cnt*d-d\n else:\n ans = x-cnt*d+d\nprint(ans)', 'x, k, d = map(int,input().split())\nx = x\nif x>k*d:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s043480591', 's939043054', 's396039589'] | [9176.0, 9192.0, 9196.0] | [30.0, 30.0, 29.0] | [285, 280, 293] |
p02584 | u174394352 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X, K, D = map(int, input().split())\nif (abs(X) - K * D) >= 0:\n print(abs(X) - K * D)\nelse:\n print(min(X%D, abs(X%D - D))\n', 'X, K, D = map(int, input.split())\nif (abs(X) - K * D) > = 0:\n print(abs(X) - K * D)\nelse:\n print(min(X%D, D-X%D))', 'X, K, D = map(int, input().split())\nif (abs(X) - K * D) >= 0:\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s241770663', 's856066016', 's161117410'] | [9020.0, 8916.0, 9184.0] | [27.0, 28.0, 31.0] | [123, 115, 164] |
p02584 | u175590965 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d = ,ap(int,input().split())\nx = abs(x)\nif x-k*d>0:\n print(x-k*d)\nelif (k-x//d)%2 ==1:\n print(abs(x%d-d))\nelse:\n print(x%d)', 'x,k,d = map(int,input().split())\nx = abs(x)\nif x-k*d>0:\n print(x-k*d)\nelif (k-x//d)%2 ==1:\n print(abs(x%d-d))\nelse:\n print(x%d)'] | ['Runtime Error', 'Accepted'] | ['s453962087', 's880482834'] | [8872.0, 9080.0] | [29.0, 29.0] | [136, 136] |
p02584 | u177182853 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['import numpy as np\nimport math\nimport scipy as sp\nimport queue\nimport collections\n\nMOD = 10 ** 9 + 7\nINF = 10 ** 9\n\ndef main(kwargs):\n x = kwargs["x"]\n k = kwargs["k"]\n d = kwargs["d"]\n if k * d < abs(x):\n res = abs(x) - k * d\n else:\n res_1 = abs(x) % d\n res_2 = re... | ['Wrong Answer', 'Accepted'] | ['s424151649', 's309059496'] | [31180.0, 30940.0] | [152.0, 157.0] | [547, 508] |
p02584 | u185042816 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['a,k,d = map(int, input().split())\n\nif a < 0:\n x = -a\nelse:\n x = a\n\ny = x % d\nl = x // d\nm = k - l\n\nif m < 0:\n ans = x - (k * d)\nelif m % 2 ==0:\n ans = y\nelse :\n ans = y - d', 'a,k,d = map(int, input().split())\n\nif a < 0:\n x = -a\nelse:\n x = a\n\ny = x % d\nl = x // d\nm = k - ... | ['Wrong Answer', 'Accepted'] | ['s191559102', 's091726369'] | [9124.0, 9128.0] | [28.0, 30.0] | [187, 204] |
p02584 | u185405877 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d= list(map(int, input().split()))\na=x//d\nif k>=a:\n if (k-a)%2==0:\n x=abs(x)\n print(x%d)\n else:\n x=abs(x)\n if x%d>d-(x%d):\n print(d-(x%d))\n else:\n print(d+(x%d))\nelse:\n x=abs(x)\n print(x-(k*d))\n\n ', 'x,k,d= list(map(int, input... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s223552347', 's525876252', 's958881549'] | [9096.0, 9036.0, 9160.0] | [27.0, 27.0, 29.0] | [272, 159, 160] |
p02584 | u188305619 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X, K, D = map(int,input().split())\nabsX = abs(X)\nt = K % 2\nif t == 0:\n a = abs(X - (D * 2))\n b = abs(X + (D * 2))\n if absX < a:\n a = absX\n if absX < b:\n a = absX\nelse:\n a = abs(X - D)\n b = abs(X + D)\n\nif a < b:\n print(a)\nelse:\n print(b)', 'X, K, D = map(int,input... | ['Wrong Answer', 'Accepted'] | ['s027844887', 's855823371'] | [9148.0, 9124.0] | [33.0, 32.0] | [274, 575] |
p02584 | u190167135 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ["X,K,D=map(int,input().split(' '))\ntime=0\nif X>=0:\n while X>0:\n X-=D\n time+=1\n if time==K:\n break\n if (K-time)%2==0:\n print(abs(X))\nelse:\n print(X+D)\nelse:\n while X<0:\n X+=D\n time+=1\n if time==K:\n break\n if (K-time)%2==... | ['Runtime Error', 'Accepted'] | ['s910117312', 's422561783'] | [9008.0, 9132.0] | [28.0, 33.0] | [341, 318] |
p02584 | u196297781 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d=[int(i) for i in input().split()]\n\nx=abs(x)\n\nt=x\n\nif k%2==1:\n t-=d\n k-=1\n\nmin=abs(t)\n\nif t-k*d>0:\n print(t-k*d)\n exit(0)\n\nif t-k*d<0:\n s=int(t/(d*2))\n print(s)\n k-=s*2\n t-=d*s*2\n min=abs(t)\n\nwhile(-x<t and k>0):\n t-=d*2\n k-=2\n if min < abs(t):\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s767517209', 's959569679', 's961987558', 's303009745'] | [9200.0, 9192.0, 9192.0, 9104.0] | [33.0, 2205.0, 31.0, 28.0] | [341, 297, 308, 140] |
p02584 | u198073053 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d = map(int,input().split())\nc = abs(x)//d\nif c < k:\n if (k-c) % 2 == 0:\n print(abs(x)%d)\n else:\n print(abs(x)%d+d)\nelse:\n print(abs(x)-d*k)', 'x,k,d = map(int,input().split())\nc = abs(x)//d\nif c < k:\n if (k-c) % 2 == 0:\n print(abs(x)%d)\n else:\n print(min(a... | ['Wrong Answer', 'Accepted'] | ['s194528650', 's999803454'] | [9152.0, 9088.0] | [26.0, 31.0] | [167, 193] |
p02584 | u208308361 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['xkd = list(map(int,input().split()))\nxkd[0] = abs(xkd[0])\nx = xkd[0] // xkd[2]\nx = abs(x)\nxkd[0] -= xkd[2] * x\nxkd[1] -= x\nif xkd[1] < 1:\n xkd[0] += abs(xkd[1]) * xkd[2]\n print(xkd[0])\nelse:\n ans = xkd[0]\n if xkd[1] % 2 != 0:\n ans -= xkd[2]\n if ans > xkd[0] + xkd[2]:\n an... | ['Wrong Answer', 'Accepted'] | ['s754592882', 's830012070'] | [9112.0, 9088.0] | [28.0, 28.0] | [347, 131] |
p02584 | u216392490 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d = map(int, input().split())\n\n\nn = int(x / d + 0.5)\nif n > k:\n ans = x - k*d\nelse:\n a = x - n*d\n if (k - n) % 2:\n if a > 0:\n ans = a - d\n else:\n ans = a + d\n else:\n ans = a\n \nprint(ans)', 'x, k, d = map(int, input().split())\n\nax = ... | ['Wrong Answer', 'Accepted'] | ['s998847723', 's353377466'] | [9116.0, 9080.0] | [29.0, 31.0] | [254, 202] |
p02584 | u223904637 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d=map(int,input().split())\nx=abs(x)\nif x>k*d:\n print(x-k*d)\nelse:\n p=x//k\n if p%2==k%2:\n print(x-k*p)\n else:\n print(abs(x-(k+1)*p))', 'x,k,d=map(int,input().split())\nx=abs(x)\nif x>k*d:\n print(x-k*d)\nelse:\n p=x//d\n if p%2==k%2:\n print(x-p*d)\n else:\n ... | ['Wrong Answer', 'Accepted'] | ['s416493649', 's905423426'] | [9180.0, 9180.0] | [29.0, 32.0] | [161, 161] |
p02584 | u225702362 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['import sys\n\nx = abs(int(input()))\nk = int(input())\nd = int(input())\n\nmove_cnt = int(x / d)\nif (move_cnt <= k):\n k -= move_cnt\n amari = x - move_cnt * d\n\nelse:\n amari = x - k * d\n k = 0\n\nif (k > 0):\n if (k % 2 == 1):\n if (amari > 0):\n amari -= d\n else:\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s124164861', 's599329207', 's293344437'] | [9116.0, 9136.0, 9140.0] | [25.0, 26.0, 31.0] | [333, 347, 522] |
p02584 | u231570044 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['IN = list(map(int, input().split()))\nX, K, D = IN[0], IN[1], IN[2]\n\nmv = int(-X / D + 0.5)\nif (abs(mv)>K): mv = mv * K / abs(mv)\nresidual_moves = K - abs(mv)\n\nif residual_moves % 2 == 0:\n print (int(abs(X + D * mv)))\nelse:\n posa = X+D*(mv+1)\n posb = X+D*(mv-1)\n posc = X+D*(mv+2)\n posd = X+... | ['Wrong Answer', 'Accepted'] | ['s486347934', 's545793144'] | [9212.0, 9212.0] | [30.0, 33.0] | [369, 401] |
p02584 | u233254147 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['import sys\ninput = sys.stdin.readline\n\nx, k, d = map(int, input().split())\n\na = abs(x) // d\nb = abs(x) // d + 1\n\nif a > k:\n print(abs(x) - k * d)\nelse:\n if b < a:\n a = b\n\n if (k - a) % 2 == 0:\n print(abs(x) - a * d)\n else:\n print(abs(x) - a * k + d)\n', 'import sys\ni... | ['Wrong Answer', 'Accepted'] | ['s859728173', 's128221347'] | [9176.0, 9212.0] | [34.0, 27.0] | [283, 318] |
p02584 | u250734103 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X, K, D = map(int, input().split())\n\nif int(abs(X) / D) > K:\n if abs(X) < abs(X) % D:\n if K % 2 == 0:\n print(abs(X))\n else:\n print(min(abs(X - D), abs(X + D)))\n else:\n if int(K - int(abs(X) / D)) % 2 == 0:\n print(abs(X) % D)\n else:\n ... | ['Wrong Answer', 'Accepted'] | ['s339136443', 's670930957'] | [9216.0, 9028.0] | [30.0, 28.0] | [395, 209] |
p02584 | u252405453 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['def abc175c_walking_takahashi():\n x, k, d = map(int, input().split())\n x = -x if x < 0 else x\n num = math.ceil(x / d)\n if num > k:\n print(x-k*d)\n return\n else:\n k -= num\n x -= num*d\n if k % 2 == 0:\n print(abs(x))\n else:\n print... | ['Runtime Error', 'Accepted'] | ['s839221750', 's427475012'] | [9212.0, 9176.0] | [25.0, 32.0] | [338, 352] |
p02584 | u258807490 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X, K, D = map(int,input().split())\nans = abs(X)\nk = min(X//D,K)\nans -= k*D\nK -= k\nif k % 2 == 0:\n print(ans)\nelse:\n ans += D\n print(ans)\n\n\n', 'X, K, D = map(int,input().split())\nans = abs(X)\nk = min(X//D,K)\nans -= k*D\nK -= k\nif K % 2 == 0:\n print(ans)\nelse:\n ans += D\n print(ans)... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s025059112', 's281014190', 's716456310', 's846059788', 's506909172'] | [9024.0, 8976.0, 9128.0, 9104.0, 9076.0] | [29.0, 29.0, 29.0, 32.0, 29.0] | [148, 148, 188, 190, 192] |
p02584 | u272754211 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d = list(map(int,input().split()))\n\nx = abs(x)\n\nmod = x % d\n\nif mod >= k:\n ans = x - (d*k)\n\nelif (k-mod) % 2 == 0:\n ans = x - (d*mod)\n\nelse:\n ans = x - (d*mod) - d\n\nprint(ans)', 'x,k,d = list(map(int,input().split()))\n\nx = abs(x)\n\nm = x // d\n\nif m >= k:\n ans = x - (d*k)\n\nelif (... | ['Wrong Answer', 'Accepted'] | ['s220660391', 's371262655'] | [9160.0, 9176.0] | [30.0, 28.0] | [188, 184] |
p02584 | u276941198 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X, K, D = map(int, input().split())\n\nX= abs(X)\nmin_pos = X%D\nmin_neg = min_pos - D\n\nif(X/D > K):\n print(X-D*K)\nelse:\n if(int(X/D)%2 == 0):\n print(int(X/D))\n print("A", min_pos)\n else:\n print(int(X/D))\n print("B", abs(min_neg))', 'X, K, D = map(int, input().split())\n\nX= abs(X)\nmin_pos =... | ['Wrong Answer', 'Accepted'] | ['s836659141', 's871595845'] | [9060.0, 9164.0] | [29.0, 27.0] | [241, 208] |
p02584 | u285891772 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ["import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\nfrom operator import item... | ['Wrong Answer', 'Accepted'] | ['s126455383', 's606819272'] | [10568.0, 10540.0] | [45.0, 43.0] | [1304, 1309] |
p02584 | u298976461 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d = map(int, input().split())\n\nif x >= 0:\n if x >= k * d:\n print(x - k * d)\n else:\n func(x, k, d)\n \n \n \n # print(mod)\n # else:\n # print(abs(mod - d))\nelse:\n if abs(x) >= k * d:\n print(abs(x) - k * d)\n else:\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s001953276', 's134555516', 's266517052', 's467947512'] | [9128.0, 9104.0, 9024.0, 9092.0] | [36.0, 27.0, 26.0, 39.0] | [658, 671, 543, 197] |
p02584 | u304058693 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['import math\n\nx,k,d = map(int,input().split())\n\nans = 0\nif x == 0:\n if k%2 == 0:\n ans = 0\n elif k%2 == 0:\n ans = abs(d)\nelse :\n if abs(x) - k*d >= 0:\n ans = x - k*d\n #if abs(x) - k*d == 0:\n \n \n #else:\n \n elif ... | ['Wrong Answer', 'Accepted'] | ['s614914413', 's588339541'] | [9152.0, 9200.0] | [36.0, 32.0] | [746, 250] |
p02584 | u310286716 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['# -*- coding: utf-8 -*-\nx, k, d = map(int, input().split())\nx = abs(x)\nt = x // d\nif t >= k:\n answer = x - (t * d)\nelse:\n if (k - t) % 2 == 0:\n answer = x - (t * d)\n else:\n answer = x - (t - 1) * d\n \nprint(answer)', '# -*- coding: utf-8 -*-\nx, k, d = map(int, input().split()... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s195872399', 's715267491', 's855270708'] | [9176.0, 9180.0, 9160.0] | [31.0, 32.0, 29.0] | [243, 243, 248] |
p02584 | u313445895 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d = map(int, input().split())\nx = abs(x)\ns = x//d\nelif s>k:\n print(x-d*k)\nelif s<k:\n if (k-s)%2==0:\n print(x-d*s)\n elif (k-s)%2==1:\n print(abs(x-d*(s+1)))', 'x, k, d = map(int, input().split())\nend = False\nplus =True\nif x >= 0:\n for i in range(k):\n if x >= 0 and pl... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s544986957', 's619330145', 's993271205', 's671204584'] | [9008.0, 9140.0, 8796.0, 9120.0] | [26.0, 2206.0, 28.0, 30.0] | [183, 888, 541, 182] |
p02584 | u321605735 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['import math\nN=input().split()\nX=int(math.fabs(int(N[0])))\nK=int(N[1])\nD=int(N[2])\nif X-K*D>=0:\n print(X-K*D)\nelse:\n x=X%D\n y=X-X%D\n ans_pre=min(x,y)\n i=int((X-ans_pre)/D)\n if i%2==K%2:\n print(ans_pre)\n else:\n print(max(x,y))', 'import math\nN=input().split()\nX=int(ma... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s284906975', 's853277564', 's751377666'] | [9228.0, 9052.0, 9212.0] | [32.0, 34.0, 32.0] | [259, 352, 378] |
p02584 | u325492232 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ["def abc175_c_1():\n x, k, d = map(int, input().split())\n\n def solve(x, k, d):\n to_l_max = x - (k * d)\n to_r_max = x + (k * d)\n\n if to_l_max > 0:\n return to_l_max\n if to_r_max < 0:\n return to_r_max\n\n current_x = x\n\n for i in range(k):\n... | ['Wrong Answer', 'Accepted'] | ['s626394726', 's914486296'] | [9076.0, 9116.0] | [2206.0, 28.0] | [481, 444] |
p02584 | u329730886 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X, K, D = map(int, input().split())\n\nX = abs(X)\n\nn = X // D\nm = K - n\n\nA1 = abs(X - n*D)\nA2 = abs(X - (n+1)*D)\n\nAns = A2\n\nif m > 1:\n if A1 <= A2:\n if m % 2 == 0:\n Ans = A1\n else:\n if m-1 % 2 != 0:\n Ans = A2\nelse:\n Ans = X - K*D\n\nprint(Ans)', 'X, K, L ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s339766868', 's356559325', 's461572533', 's727795320', 's464402054'] | [9144.0, 9028.0, 9200.0, 9120.0, 9096.0] | [28.0, 29.0, 36.0, 31.0, 29.0] | [284, 178, 251, 284, 289] |
p02584 | u335406314 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ["X, K, D = (list(map(int, input('').split(' '))))\ndX = np.arange(-K,K+1,2)\nnew_X = X + D * dX\nprint(np.min(np.abs(new_X)))", "import numpy as np\nX, K, D = (list(map(int, input('').split(' '))))\nX = np.abs(X)\n\nif np.abs(X)/D <= K:\n new_K = K - int(X/D)\n new_X = X - D*int(X/D)\n if new_K%2==0:\n ... | ['Runtime Error', 'Accepted'] | ['s634934699', 's474859965'] | [9128.0, 27020.0] | [24.0, 123.0] | [121, 267] |
p02584 | u344888046 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X, K, D = map(int, input().split())\nif X < 0:\n X = -X\nk = X // D\nX -= K * D\nif k >= K:\n print(abs(X))\nelse:\n K -= k\n if K % 2 == 0:\n print(abs(X))\n else:\n print(abs(X - D))', 'X, K, D = map(int, input().split())\nif X < 0:\n X = -X\nk = X // D\nif k >= K:\n X -= K * D\n ... | ['Wrong Answer', 'Accepted'] | ['s526836326', 's248075067'] | [9172.0, 9072.0] | [33.0, 37.0] | [201, 220] |
p02584 | u345621867 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ["N, K = map(int, input().split())\nP = list(map(int, input().split()))\nC = list(map(int, input().split()))\n\nans = -float('inf')\nfor s in range(N):\n ### Step1\n S = [] \n \n i = P[s] - 1\n S.append(C[i])\n \n while i != s:\n i = P[i] - 1\n S.append(S[-1] + C[i])\n\n \n \n ... | ['Runtime Error', 'Accepted'] | ['s350071092', 's322417178'] | [9296.0, 9188.0] | [25.0, 29.0] | [1369, 222] |
p02584 | u346207191 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D=(int(x) for x in input().split())\nx=abs(X)\na=x//D\n\nb=x-a*D\nB=abs(x-(a+1)*D)\n\nif b>B:\n a=a+1\n\nif a>=K:\n print(abs(x-K*D))\n\nelse:\n c=K-a\n if c%2 == 0:\n print(abs(x-a*D))\n elif:\n d=abs(x-(a-1)*D)\n e=abs(x-(a+1)*D)\n print(min(d,e))', 'X,K,D=(int(x) for x in input().split())\nx=a... | ['Runtime Error', 'Accepted'] | ['s818093482', 's992049953'] | [8868.0, 9200.0] | [28.0, 30.0] | [250, 250] |
p02584 | u348137609 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d = input().split()\nans = 0\nif abs(x) > abs(k*d):\n ans = abs(x) - abs(k*d)\nelse:\n kaisuu = abs(x)/d \n k_2 = k - kaisuu\n if k_2/2 == 2:\n ans = abs(x) - d*kaisuu \n else:\n ans = (abs(x) - d*kaisuu) - d\nprint(ans)\n', 'x,k,d = input().split()\nx = int(x)\nk = int(k)\nd = int(d... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s077391343', 's330472226', 's389426193', 's748381021', 's763318376', 's907277541'] | [9056.0, 9132.0, 9096.0, 9140.0, 9188.0, 9220.0] | [30.0, 30.0, 30.0, 30.0, 28.0, 26.0] | [244, 276, 292, 287, 276, 296] |
p02584 | u354174235 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['param_x, param_k, param_d = map(int, input().split())\n\nparam_x_tmp = param_x\n\nif param_x > 0:\n int_times_nega_posi = -1\nelse:\n int_times_nega_posi = 1\n\ncount = 0\nwhile param_x_tmp*param_x > 0:\n \n param_x_tmp = param_x_tmp + param_d*int_times_nega_posi\n \n count = count + 1\n \n if param_k - coun... | ['Wrong Answer', 'Accepted'] | ['s273027769', 's895939615'] | [9200.0, 9088.0] | [2205.0, 31.0] | [546, 1110] |
p02584 | u355853184 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X, K, D = map(int, input().split())\n\nans_list = []\n\nif X+K*D <= 0:\n ans = abs(X+K*D)\nelse:\n if D>0:\n a = int((X+K*D)/(2*D))\n ans = abs(X+(K-(a+i))*D - (a+i)*D)\nprint(ans)', 'X, K, D = map(int, input().split())\n\nans_list = []\n\nif X+K*D <= 0:\n ans = abs(X+K*D)\nelse:\n if D>... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s501637863', 's572232063', 's727523908'] | [9016.0, 9004.0, 9184.0] | [30.0, 30.0, 29.0] | [194, 186, 292] |
p02584 | u363207161 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d = map(int, input().split())\n\n\ndef is_even(num):\n if num % 2 == 0:\n return True\n else:\n return False\n\n\nans = 0\n\nif 2 * x < d:\n ans = x\nelse:\n t = x // d\n if k > t - 2:\n if (k - t) / 2 == 0:\n t0 = abs(x - (t - 2) * d)\n t1 = abs(x - (t)... | ['Runtime Error', 'Accepted'] | ['s569992805', 's945390395'] | [9120.0, 9068.0] | [37.0, 31.0] | [561, 182] |
p02584 | u363320559 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D=map(int,input().split())\nX=abs(X)\nE=X%D\nA=(X-E)/D\nA=K-A\nif X>=K*D:\n print(X-K*D)\neise:\n E=X%D\n A=(X-E)/D\n A=K-A\n A=A%2\n if A==0:\n print(E)\n eise:\n print(D-E)\n', 'X,K,D=map(int,input().split())\nX=abs(X)\nE=X%D\nA=(X-E)/D\nA=K-A\nif X>=K*D:\n print(X-K*D)\nelse:\n E=X%D\n A=(X-E)/... | ['Runtime Error', 'Accepted'] | ['s102320704', 's601491320'] | [9036.0, 9188.0] | [24.0, 31.0] | [177, 177] |
p02584 | u363421241 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d = map(int, input().split())\nx = abs(x)\n\nif d*k < x:\n print(abs(x)-abs(d*k))\nelse:\n if abs(x%d-d) > abs(x%d):\n if (k-x//d)%2 == 0:\n print(abs(x%d))\n else:\n print(abs(x%d-d))\n elif abs(x%d-d) < abs(x%d)\n if (k-x//(d+1))%2 == 0:\n print(a... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s594273490', 's850544480', 's862531517'] | [8960.0, 9204.0, 9172.0] | [29.0, 29.0, 29.0] | [358, 358, 161] |
p02584 | u367323774 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ["x,k,d=input().split()\nx=abs(int(x))\nk=int(k)\nd=int(d)\na=x//d\nb=x-a*d\nc=(x-b)/d\ni=int(c)\nif k<=i:\n print(abs(x)-d*k)\n print('a')\nelse:\n if (k-(i))%2==0:\n print(abs(x)-d*(i))\n print('b')\n else:\n print(abs(abs(x)-d*(i+1)))\n print('c')", 'x,k,d=input().split()\nx=int(x)\nk=int(k)\nd=int(d... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s748635918', 's790176028', 's157881356'] | [9076.0, 9112.0, 9208.0] | [29.0, 36.0, 30.0] | [247, 213, 204] |
p02584 | u372802746 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X, K, D = map(int, input().split())\nX=abs(X)\nif D>=X and K%2==0:\n ans=X\nelif D>=X and K%2==1:\n ans=D-X\nelif D<X and K*D<X:\n ans=X-K*D\nelse:\n if X<K*D-X:\n ans=X\n for i in range(0,K):\n ans=ans-D\n if ans<0 and (K-i)%2==0:\n ans=ans+D\n ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s192225967', 's212171122', 's318783527', 's480976182', 's502189932', 's568960721', 's615748032', 's872165550', 's864999346'] | [9268.0, 9060.0, 9140.0, 9244.0, 9120.0, 9204.0, 9036.0, 9160.0, 9120.0] | [2206.0, 28.0, 2206.0, 2206.0, 2206.0, 2206.0, 2205.0, 2206.0, 27.0] | [661, 637, 386, 661, 380, 466, 396, 466, 212] |
p02584 | u376324032 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D = [int(input()) for i in range(3)]\nprint(2)', 'X,K,D = list(map(int, input().split()))\nco,ans = divmod(abs(X),D)\nif (K - co) > 0:\n if (K - co) % 2 == 0:\n pass\n else:\n ans = abs(ans) - D\nelse:\n ans = abs(X) - K*D\n\nprint(abs(ans))'] | ['Runtime Error', 'Accepted'] | ['s392810096', 's072826865'] | [9108.0, 9148.0] | [26.0, 30.0] | [49, 204] |
p02584 | u388862071 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x = int(input())\nk = int(input())\nd = int(input())\n\nif ((k * d) > abs(x)):\n y = x // d\n if ((k - y) % 2 == 0):\n ans = abs(x) - y * d\n else:\n ans = abs(x - (x // abs(x)) * (y + 1) * d)\nelse:\n ans = abs(x) - k * d\n\n\nprint(ans)', 'v = input().split(" ")\nx = int(v[0])\nk = int(v[1... | ['Runtime Error', 'Accepted'] | ['s892776127', 's550085409'] | [9196.0, 9180.0] | [27.0, 31.0] | [250, 346] |
p02584 | u392361133 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d= map(int, input().split())\nx = abs(x)\nif x - k * d >= 0:\n print(x - k * d)\nelse:\n ans1 = x % d\n check = x // d\n ans2 = ans1 - d\n if((k-check%2)==0):\n print(ans1)\n else:\n print(ans2)\n', 'x, k, d= map(int, input().split())\nx = abs(x)\nif x - k * d >= 0:\n print(x ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s582010268', 's620931553', 's661409837', 's088387219'] | [9104.0, 9068.0, 9008.0, 9096.0] | [32.0, 30.0, 34.0, 32.0] | [222, 220, 222, 227] |
p02584 | u402629484 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ["import sys\nsys.setrecursionlimit(1000000000)\nimport math\nfrom math import gcd\ndef lcm(a, b): return a * b // gcd(a, b)\nfrom itertools import count, permutations, combinations, chain, product\nfrom functools import lru_cache\nfrom collections import deque, defaultdict\nfrom operator import itemgetter\nfrom pprint... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s002857922', 's439639423', 's630726563', 's071318107'] | [9988.0, 9988.0, 9972.0, 9992.0] | [46.0, 47.0, 42.0, 45.0] | [2494, 2520, 2496, 2507] |
p02584 | u405137387 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d = map(int, input().split())\ni = 1\n\nif k*d <= x:\n print(x-k*d)\nelse:\n while(d*i < x):\n i += 1\n print(i)\n if (k-i)%2 == 0:\n print(abs(x-d*i))\n else:\n print(x-d*i + d)\n', 'x, k, d = map(int, input().split())\ni = 1\nx = abs(x)\n\nif k*d <= x:\n print(x-k*d)\nel... | ['Wrong Answer', 'Accepted'] | ['s877561708', 's989202011'] | [9192.0, 9116.0] | [30.0, 30.0] | [209, 203] |
p02584 | u406138190 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d=map(int,input().split())\nx1=abs(x)%d\nx2=abs(abs(x1)-d)\nnum=abs(x)//d\nif((k-num>=0):\n\tif((k-num)%2==0):\n \tprint(x1)\n\telse:\n \tprint(x2)\nelse:\n print(abs(x)-k*d)', 'x,k,d=map(int,input().split())\nx1=abs(x)%d\nx2=abs(abs(x1)-d)\nnum=abs(x)//d\nif((k-num)>=0):\n\tif((k-num)%2==0):\n \tprint... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s693228943', 's883615507', 's570575507'] | [8932.0, 9032.0, 9188.0] | [28.0, 28.0, 27.0] | [172, 173, 186] |
p02584 | u410558877 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['line = input()\n\nstrL = line.split()\nX = abs(int(strL[0]))\nK = int(strL[1])\nD = int(strL[2])\n\nmod = X % D\ndiv = int(X / D)\n\nif div > K:\n ans = X - K * D\nelif (K - div) % 2 != 0:\n ans = mod - D\nelse:\n ans = mod\n\nprint(int(ans))', 'line = input()\n\nstrL = line.split()\nX = abs(int(strL[0]))\nK... | ['Wrong Answer', 'Accepted'] | ['s755927103', 's427825053'] | [9220.0, 9108.0] | [28.0, 28.0] | [234, 239] |
p02584 | u413021823 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['import sys\n\ndef I(): return int(sys.stdin.readline().rstrip())\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\ndef S(): return sys.stdin.readline().rstrip()\ndef LS(): return list(sys.stdin.readline().rstrip().split())\n\nX,K,D = LI()\n\nsho = X // D\namari = X % D\n\nif (sho>=K):\n saigo... | ['Runtime Error', 'Accepted'] | ['s212742095', 's193141625'] | [9208.0, 9204.0] | [31.0, 34.0] | [499, 509] |
p02584 | u413278979 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X, K, D = (int(x) for x in input().split())\nX = abs(X)\n\nstraight = min(K, X // D)\nK -= straight\nX -= straight * D\n\nif K % 2 == 0:\n print(X)\nelse:\n print(D+X)', 'X, K, D = (int(x) for x in input().split())\nX = abs(X)\n\nstraight = min(K, X // D)\nK -= straight\nX -= straight * D\n\nif K % 2 == 0:\n ... | ['Wrong Answer', 'Accepted'] | ['s216054267', 's383666096'] | [9172.0, 9104.0] | [29.0, 31.0] | [163, 163] |
p02584 | u418197217 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X, K, D = map(int, input().split(" "))\nX = abs(X)\n \na = X // D\nb = X % D\n \nremain_count = K - a\n \nif remain_count < 0:\n ans = X - K * D\nelse:\n if remain_count % 2 == 0:\n ans = b\n else:\n ans = abs(b - D)', 'X, K, D = map(int, input().split(" "))\nX = abs(X)\n \na = X // D\nb = X % ... | ['Wrong Answer', 'Accepted'] | ['s295886015', 's173568786'] | [9132.0, 8892.0] | [28.0, 30.0] | [225, 241] |
p02584 | u418826171 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['import math\nX, K, D = map(int,input().split())\nX = math.fabs(X)\nans = 0\nE = X//D\nif E > K:\n ans = X - K * D\nelif K%2 == E%2:\n ans = X-E*D\nelse:\n ans = -X+(E+1)*D\nprint(ans)', 'import math\nX, K, D = map(int,input().split())\nX = math.fabs(X)\nans = 0\nif X - K*D > math.fabs(X- (K+1)*D):\n ans =... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s614105677', 's761153048', 's766645613', 's459260696'] | [8872.0, 9152.0, 9244.0, 9164.0] | [30.0, 29.0, 29.0, 28.0] | [181, 230, 210, 188] |
p02584 | u433375322 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D=map(int,input().split())\na=round(abs(X/D))\nif K<a:\n print(abs(abs(X)-K*abs(D)))\nelif (K-a)%2==0:\n l=[]\n l.append(abs(abs(X)-a*abs(D)))\n l.append(abs(abs(X)-(a+2)*abs(D)))\n l.append(abs(abs(X)-(a-2)*abs(D)))\n print(min(l))\nelif (K-a)%2!=0:\n l=[]\n l.append(abs(abs(X)-(a+1)*abs(D)))\n l.ap... | ['Runtime Error', 'Accepted'] | ['s700952542', 's631049451'] | [9028.0, 9036.0] | [27.0, 30.0] | [353, 264] |
p02584 | u459104414 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['nums = [int(e) for e in input().split()]\ncurrent = nums[0]\nnum = nums[1]\nmove = nums[2]\n\n\ncurrent = abs(current)\nif num%2 == 1:\n current -= move\n\nres = current / move\nif res < num:\n tmp = current - res*move\n if abs(tmp) > abs(tmp-move):\n print(abs(tmp-move))\n else:\n print(tmp... | ['Wrong Answer', 'Accepted'] | ['s521906913', 's128168974'] | [9100.0, 9112.0] | [29.0, 30.0] | [340, 323] |
p02584 | u464912173 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x, k, d = map(int,input().split())\nx =abs(x)\ns = x//d\nif x-k*d>0:\n print(x-k*d>0)\nelse:\n if (K-s)%2==0:\n print(X-s*D)\n else:\n print(-X+(s+1)*D)\n', 'x, k, d = map(int,input().split())\nx =abs(x)\ns = x//d\nif x-k*d>0:\n print(x-k*d)\nelse:\n if (k-s)%2==0:\n print(x-s*d)\n ... | ['Runtime Error', 'Accepted'] | ['s830779043', 's717684041'] | [8940.0, 9172.0] | [29.0, 28.0] | [165, 163] |
p02584 | u472534477 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['X,K,D = map(int,input().split())\nX=abs(X)\nq=X//D\nmod=X%D\n\nif q <= K:\n if (K-q)%2==0:\n ans=mod\n print("A")\n else:\n ans=D-mod\n print("B")\nelse:\n ans=X-K*D\nprint(ans)\n', 'X,K,D = map(int,input().split())\nX=abs(X)\nq=X//D\nmod=X%D\n\nif q <= K:\n if (K-q)%2==0:\n ... | ['Wrong Answer', 'Accepted'] | ['s559481370', 's671220836'] | [9172.0, 9164.0] | [33.0, 30.0] | [201, 163] |
p02584 | u474137393 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d = map(int,input().split())\nan = x\n\nif x < 0:\n x = -x\n \nfor i in range(k):\n x -= d\n if an > abs(x):\n an = x\n else:\n if (k-i)%2 != 0 and i!=0:\n print((k-i)%2)\n an = x\n break\n \nprint(abs(an))', 'x,k,d = map(int,input().split())\nan = ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s020612751', 's148107362', 's572688785'] | [9212.0, 9108.0, 9172.0] | [2206.0, 2206.0, 31.0] | [259, 282, 202] |
p02584 | u475402977 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['import itertools\nN=int(input())\nA=list(map(int, input().split()))\nans=0\nfor any_pair in itertools.combinations(A, 3):\n pair=sorted(any_pair)\n print(type(pair))\n if pair[0]+pair[1]>pair[2] and pair[0]!=pair[1] and pair[1]!=pair[2]:\n ans+=1\n print(pair)\nprint(ans)', 'import itertools\nN... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s126401257', 's901325216', 's580481275'] | [9112.0, 9204.0, 9200.0] | [29.0, 29.0, 28.0] | [313, 315, 235] |
p02584 | u475966842 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['x,k,d=map(int,input().split())\nx=abs(x) \n\nif x%d==0:\n minNear = x%d + d\n minFar = x%d\n minTransitionToNear = (x-minNear)/d\nelse:\n minNear = x%d\n minFar = x%d - d\n minTransitionToNear = (x-minPlus)/d\n \nif k<minTransitionToNear:\n print(x-k*d)\nelse:\n if (k-minTransitionToNear)... | ['Runtime Error', 'Accepted'] | ['s296941143', 's009238048'] | [9268.0, 9256.0] | [26.0, 32.0] | [364, 521] |
p02584 | u478719560 | 2,000 | 1,048,576 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction. More specifically, in one move, he can go from coordinate x to x + D or x - D. He wants to make K moves so that the absolute value of the coordinate of the destination wil... | ['import sys\n#import string\n#from collections import defaultdict, deque, Counter\n\n#import heapq\n#import math\n#from itertools import accumulate\n#from itertools import permutations as perm\n#from itertools import combinations as comb\n#from itertools import combinations_with_replacement as combr\n#from fractions i... | ['Wrong Answer', 'Accepted'] | ['s302039655', 's388209409'] | [9284.0, 9212.0] | [30.0, 33.0] | [1574, 1557] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.