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
|
|---|---|---|---|---|---|---|---|---|---|---|
p02719
|
u122184618
| 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.
|
['ans =0\nfor i in range(1000000000000000000):\n ans += 1\nprint(ans)', 'n,k = map(int,input().split())\nans =[k]\nmod = n%k \nans.append(mod)\n\nans.append(k - mod) \nprint(min(ans))']
|
['Time Limit Exceeded', 'Accepted']
|
['s344166388', 's813310745']
|
[8860.0, 9100.0]
|
[2206.0, 21.0]
|
[65, 104]
|
p02719
|
u122428774
| 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())\nprint(N % K)', 'N,K = (int(x) for x in input().split())\na = N % K\nprint(min((a, K-a)))']
|
['Wrong Answer', 'Accepted']
|
['s699320268', 's987473620']
|
[2940.0, 2940.0]
|
[17.0, 18.0]
|
[53, 70]
|
p02719
|
u123282507
| 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.
|
['#Input\nn, k = map(int, input().split())\n\n#Process\nmod = n % k\nif(mod > abs(mod - k)):\n Ans = aqbs(mod - k)\nelse:\n Ans = mod\n\n#Output\nprint(Ans)', '#Input\nn, k = map(int, input().split())\n\n#Process\nmod = n % k\nif(mod > abs(mod - k)):\n Ans = abs(mod - k)\nelse:\n Ans = mod\n\n#Output\nprint(Ans)']
|
['Runtime Error', 'Accepted']
|
['s732013837', 's100238128']
|
[2940.0, 2940.0]
|
[18.0, 17.0]
|
[149, 148]
|
p02719
|
u123745130
| 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())\nans=(n % m)\nans=min(ans,abs(n-m))\nprint(ans)', 'n,m=map(int,input().split())\nans=1e20\nans=(n % m)\nans=min(abs(ans),abs(n-m))\nprint(ans)', 'n,m=map(int,input().split())\nans=(n % m)\nans=min(abs(ans),abs(ans-m))\nprint(ans)']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s468038092', 's910112156', 's076708053']
|
[3064.0, 2940.0, 3064.0]
|
[17.0, 17.0, 18.0]
|
[73, 87, 80]
|
p02719
|
u126823513
| 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, k = map(int, input().split())\namari = n % k\nprint(min(amari, abs(amari - k)))\n']
|
['Wrong Answer', 'Accepted']
|
['s191946338', 's903233743']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[47, 81]
|
p02719
|
u127288756
| 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-k))', 'n,k=map(int,input().split())\nprint(min(n%k,n%k-k))', 'n,k=map(int,input().split())\nprint(min(n,n%k,abs(n%k-k)))']
|
['Runtime Error', 'Wrong Answer', 'Accepted']
|
['s276015396', 's980568164', 's864627154']
|
[2940.0, 2940.0, 2940.0]
|
[17.0, 17.0, 17.0]
|
[54, 50, 57]
|
p02719
|
u129978636
| 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())\ncount=abs(n-k)\ncount2=count\nans=count\nif(k==1):\n print(0)\n exit()\nwhile(1):\n count=abs(ans-k)\n if(count>=ans):\n print(ans)\n exit()\n else:\n print(ans)\n ans=count\n continue', 'n,k=map(int,input().split())\nc=n%k\no=abs(c-k)\nprint(min(c,o))\n']
|
['Wrong Answer', 'Accepted']
|
['s058966842', 's269826558']
|
[52084.0, 2940.0]
|
[2104.0, 17.0]
|
[249, 62]
|
p02719
|
u131638468
| 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=int(n)\nk=int(k)\nn = n % k\nminimam = k\nrecord=[]\nfor i in range(k):\n if n < minimam:\n minimam = n\n n = abs(n-k)\n record.append(n)\n if n in record:\n break\nprint(minimam)', 'n,k=map(int,input().split())\nn=int(n)\nk=int(k)\nn = n % k\nminimam = n\nrecord=[]\nfor i in range(k):\n n=abs(n-k)\n if n < minimam:\n minimam = n\n record.append(n)\n if n in record:\n break\nprint(minimam)']
|
['Wrong Answer', 'Accepted']
|
['s559775041', 's049831822']
|
[3060.0, 3060.0]
|
[17.0, 17.0]
|
[208, 206]
|
p02719
|
u131881594
| 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(max(n%k,k-n%k))', 'n,k=map(int,input().split())\nprint(min(n%k,k-n%k))\n']
|
['Wrong Answer', 'Accepted']
|
['s823239298', 's224854997']
|
[9044.0, 8884.0]
|
[27.0, 28.0]
|
[50, 51]
|
p02719
|
u132331017
| 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 min(a, b):\n if a >= b:\n res = a - b\n elif a < b:\n res = b - a\n return res\n\nn,k = map(int, input().split())\nif n%k == 0:\n print(0)\n quit()\n\nmin_num = float('inf')\n\n\nprint(min_num)\n", "def min(a, b):\n if a >= b:\n res = a - b\n elif a < b:\n res = b - a\n return res\n\nn,k = map(int, input().split())\nif n%k == 0:\n print(0)\n quit()\nelse:\n n = n%k\n\nmin_num = float('inf')\nres_list = []\nwhile(1):\n res = min(n, k)\n if res < min_num:\n min_num = res\n if res == 0:\n break\n if res in res_list:\n break\n n = res\n res_list.append(res)\n\nprint(min_num)\n"]
|
['Wrong Answer', 'Accepted']
|
['s312777006', 's448622328']
|
[2940.0, 3064.0]
|
[18.0, 18.0]
|
[212, 423]
|
p02719
|
u133936772
| 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\nif n<k: n,k=k,n\nif n%k==0 and n//k%2==0:\n print(0)\nelse:\n print(gcd(n,k))', 'n,k=map(int,input().split())\nprint(min(n%k,-n%k))']
|
['Runtime Error', 'Accepted']
|
['s434340594', 's978836682']
|
[5560.0, 9092.0]
|
[52.0, 30.0]
|
[130, 49]
|
p02719
|
u137542041
| 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)\n exit()\n\ndec = N - abs(N - K)\n\nq, r = divmod(N, dec)\n\nprint(r)\n\n', 'N, K = map(int, input().split())\n\ndec = N - abs(N - K)\n\nif dec < 0:\n print(N)\n exit()\n\nq, r = divmod(N, dec)\n\nprint(r)\n\n', 'N, K = map(int, input().split())\n\nif N >= K:\n q, r = divmod(N, K)\n v = min(r, abs(K - r))\n print(v)\nelse:\n print(min(N, abs(N - K)))\n']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s101763915', 's732296602', 's827768324']
|
[2940.0, 2940.0, 2940.0]
|
[17.0, 17.0, 17.0]
|
[133, 126, 145]
|
p02719
|
u141419468
| 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(min(x, x-k))', 'n, k = list(map(int, input().split()))\nx = n % k\nprint(max(x, x-k))', 'n, k = map(int, input().split())\nx = n % k\nprint(min(x, k-x))']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s288797285', 's604255013', 's142617839']
|
[3064.0, 2940.0, 2940.0]
|
[19.0, 17.0, 18.0]
|
[67, 67, 61]
|
p02719
|
u145582359
| 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 collections\n\nN,k=map(int,input().split())\n\nroop=0\ni=[]\nwhile roop==0 :\n N=abs(N-k)\n i.append(N)\n if collections.Counter(i)["N"] > 2 :\n roop=1\n\nprint(min(i))', 'N,k=map(int,input().split())\n\nprint(min(N%k,abs(N%k-k)))']
|
['Time Limit Exceeded', 'Accepted']
|
['s395851022', 's507226702']
|
[4404.0, 2940.0]
|
[2104.0, 17.0]
|
[179, 56]
|
p02719
|
u146057001
| 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\na = n // k\n\nif n - k * a <= -(n - k * (a + 1)):\n print(n - k * a)\n\nelse:\n print(-n)\n', 'n, k = map(int, input().split())\n\na = n // k\n\nif n - k * a <= -(n - k * (a + 1)):\n print(n - k * a)\n\nelse:\n print(-(n - k * (a + 1)))\n']
|
['Wrong Answer', 'Accepted']
|
['s212834349', 's633456163']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[124, 140]
|
p02719
|
u152891327
| 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())\nprint(fractions.gcd(N, K))', 'N,K = map(int, input().split())\nN %= K\nprint(min(N, abs(N - K)))']
|
['Wrong Answer', 'Accepted']
|
['s762093676', 's930791429']
|
[5432.0, 2940.0]
|
[38.0, 17.0]
|
[75, 64]
|
p02719
|
u155946404
| 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\ntest = n\n\nwhile True:\n zet = abs(test-k)\n if zet == 0:\n print(zet)\n break\n if zet > test:\n print(f)\n break\n test = zet', 'n,k =map(int,input().split())\n\nwhile True:\n zet = abs(-k)\n if zet == 0:\n print(zet)\n break\n if zet > n:\n print(n)\n break\n n = zet', 'n,k =map(int,input().split())\n\nsyou = n//k\n\nzet = abs(n-k*syou)\nif zet == 0:\n print(zet)\nelse:\n zet1 = abs(n-k*(syou+1))\n if zet > zet1:\n print(zet1)\n else: \n print(zet)']
|
['Runtime Error', 'Wrong Answer', 'Accepted']
|
['s480319901', 's834957515', 's502775895']
|
[2940.0, 2940.0, 2940.0]
|
[2104.0, 2104.0, 17.0]
|
[165, 145, 179]
|
p02719
|
u161693347
| 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, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom fractions import gcd\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom functools import reduce\nfrom bisect import bisect_left, insort_left\nfrom heapq import heapify, heappush, heappop\n\nINPUT = lambda: sys.stdin.readline().rstrip()\nINT = lambda: int(INPUT())\nMAP = lambda: map(int, INPUT().split())\nS_MAP = lambda: map(str, INPUT().split())\nLIST = lambda: list(map(int, INPUT().split()))\nS_LIST = lambda: list(map(str, INPUT().split()))\nZIP = lambda: zip(*(MAP() for _ in range(n)))\n\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\n\n\ndef main():\n N, K = MAP()\n\n print(0 if N%K == 0 else gcd(N, K))\n\n\nif __name__ == '__main__':\n main()\n", "import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\n# from fractions import gcd\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom functools import reduce\nfrom bisect import bisect_left, insort_left\nfrom heapq import heapify, heappush, heappop\n\nINPUT = lambda: sys.stdin.readline().rstrip()\nINT = lambda: int(INPUT())\nMAP = lambda: map(int, INPUT().split())\nS_MAP = lambda: map(str, INPUT().split())\nLIST = lambda: list(map(int, INPUT().split()))\nS_LIST = lambda: list(map(str, INPUT().split()))\nZIP = lambda: zip(*(MAP() for _ in range(n)))\n\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\n\n\ndef main():\n N, K = MAP()\n\n ans = gcd(N, K) \n print(0 if ans == 1 else ans)\n\n\nif __name__ == '__main__':\n main()\n", "import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom fractions import gcd\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom functools import reduce\nfrom bisect import bisect_left, insort_left\nfrom heapq import heapify, heappush, heappop\n\nINPUT = lambda: sys.stdin.readline().rstrip()\nINT = lambda: int(INPUT())\nMAP = lambda: map(int, INPUT().split())\nS_MAP = lambda: map(str, INPUT().split())\nLIST = lambda: list(map(int, INPUT().split()))\nS_LIST = lambda: list(map(str, INPUT().split()))\nZIP = lambda: zip(*(MAP() for _ in range(n)))\n\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\n\n\ndef main():\n N, K = MAP()\n\n ans = gcd(N, K) \n print(0 if ans == 1 else ans)\n\n\nif __name__ == '__main__':\n main()\n", "import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\n# from fractions import gcd\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom functools import reduce\nfrom bisect import bisect_left, insort_left\nfrom heapq import heapify, heappush, heappop\n\nINPUT = lambda: sys.stdin.readline().rstrip()\nINT = lambda: int(INPUT())\nMAP = lambda: map(int, INPUT().split())\nS_MAP = lambda: map(str, INPUT().split())\nLIST = lambda: list(map(int, INPUT().split()))\nS_LIST = lambda: list(map(str, INPUT().split()))\nZIP = lambda: zip(*(MAP() for _ in range(n)))\n\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7\n\n\ndef main():\n N, K = MAP()\n\n r = N%K\n if r == 0:\n print(0)\n else:\n if 2*r > K:\n print(abs(r - K))\n else:\n print(r)\n\n\nif __name__ == '__main__':\n main()\n"]
|
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
|
['s239474390', 's325241392', 's364969242', 's550441166']
|
[5260.0, 3572.0, 5900.0, 3956.0]
|
[40.0, 24.0, 176.0, 28.0]
|
[956, 978, 971, 1057]
|
p02719
|
u161712560
| 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(min(N%K, N-N%K))\nelse:\n print(0)', 'N, K = map(int, input().split())\n\nprint(N%K)', 'N, K = map(int, input().split())\n\nprint(min(N%K, N-N%K))', 'N, K = map(int, input().split())\n\nif N%K != 0:\n print(min(N%K, K-N%K))\nelse:\n print(0)']
|
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s081089773', 's297368895', 's381241070', 's214833342']
|
[2940.0, 3444.0, 2940.0, 2940.0]
|
[18.0, 22.0, 18.0, 17.0]
|
[92, 44, 56, 92]
|
p02719
|
u163320134
| 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))']
|
['Wrong Answer', 'Accepted']
|
['s743594624', 's577244026']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[45, 50]
|
p02719
|
u163783894
| 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\n# import math\n# import itertools\n# from collections import deque\n# from collections import defaultdict\n# import heapq\n# import copy\n\n# import numpy as np\n# from scipy.special import comb\n\n\n\n# INF = 1001001001001\n# MOD = 1000000007\n\ndef main():\n\n N = int(input())\n A, B = map(int, input().split())\n L = list(map(int, input().split()))\n\n\nif __name__ == '__main__':\n main()\n", "# import sys\n# import math\n# import itertools\n# from collections import deque\n# from collections import defaultdict\n# import heapq\n# import copy\n\n# import numpy as np\n# from scipy.special import comb\n\n\n\ndef main():\n N, K = map(int, input().split())\n dt = N//K\n ans = min(abs(N - dt * K), abs(N - (dt+1)*K))\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"]
|
['Runtime Error', 'Accepted']
|
['s528167345', 's970876549']
|
[8988.0, 9132.0]
|
[21.0, 25.0]
|
[496, 440]
|
p02719
|
u166621202
| 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())\n\na = N%K\nb = abs(a - K)\n\nlst = []\nlst.append(a)\nlst.append(b)\nprint(min(lst))\n']
|
['Wrong Answer', 'Accepted']
|
['s307369756', 's670209010']
|
[9120.0, 9076.0]
|
[21.0, 20.0]
|
[42, 110]
|
p02719
|
u167647458
| 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 = n % k\nprint(min(abs(n - k)), n)', 'n, k = map(int, input().split())\n\nn = n % k\nprint(min(abs(n - k), n))']
|
['Runtime Error', 'Accepted']
|
['s926164442', 's170622619']
|
[9080.0, 9036.0]
|
[23.0, 22.0]
|
[69, 69]
|
p02719
|
u177370876
| 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())\nwhile(n > 0):\n n-=k\nif abs(n - k) > abs (k - n):\n print(abs (k - n)) \nelse:\n print(abs (n - k)) \n', 'n, k = map(int, input().split())\nn = n % k\nif abs(n - k) > abs(k - n):\n if n > abs(k - n)\n print(abs (k - n))\n else:\n print(n) \nelse:\n if n > abs(n - k)\n print(abs (n - k))\n else:\n print(n) \n', 'n, k = map(int, input().split())\nn = n % k\nif abs(n - k) > abs(k - n):\n if n > abs(k - n):\n print(abs (k - n))\n else:\n print(n) \nelse:\n if n > abs(n - k):\n print(abs (n - k))\n else:\n print(n) \n']
|
['Wrong Answer', 'Runtime Error', 'Accepted']
|
['s400974938', 's789997200', 's043958802']
|
[2940.0, 2940.0, 2940.0]
|
[2104.0, 17.0, 17.0]
|
[142, 234, 236]
|
p02719
|
u178509296
| 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\nN, K = map(int, input().split())\n\nif N > K:\n N = N - K*(N//K)\n\nif N=K:\n print(0)\nelse:\n print(K-N)', '\nimport fractions\nN, K = map(int, input().split())\n\nk = fractions.gcd(N, K)\n\nif K == 1:\n print(0)\nelse:\n print(k)\n', 'N, K = map(int, input().split())\n\nif N > K:\n N = N - K*(N//K)\n\nif N==K:\n print(0)\nelse:\n print(min(N,K-N))']
|
['Runtime Error', 'Wrong Answer', 'Accepted']
|
['s166711173', 's835682323', 's218744576']
|
[2940.0, 5560.0, 2940.0]
|
[17.0, 53.0, 17.0]
|
[109, 120, 115]
|
p02719
|
u182898140
| 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=mapp(int,input().split())\n\nprint(min(N%K,abs(N%K-K)))', 'N,K=mapp(int,input().split())\n\nprint(min(N%K,abs(N%K-K)))\n', 'N,K=map(int,input().split())\n\nprint(min(N%K,abs(N%K-K)))']
|
['Runtime Error', 'Runtime Error', 'Accepted']
|
['s685890198', 's797081780', 's998323659']
|
[2940.0, 2940.0, 3060.0]
|
[17.0, 17.0, 19.0]
|
[57, 58, 56]
|
p02719
|
u185350737
| 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\nx = n - k * int(n/k)\nif(x == 0):\n l.append(abs(x-k))\n l.append(abs(l[0]-k))\n print(min(l))\nelse:\n print(n)\n', 'n,k=map(int, input().split())\nl=[]\n\ni = n % k \nl.append(abs(i-k))\nl.append(abs(l[0]-k))\nprint(min(l))\n']
|
['Wrong Answer', 'Accepted']
|
['s629082052', 's469586312']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[147, 102]
|
p02719
|
u185405877
| 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.
|
['x,y= list(map(int, input().split()))\nif x%y==0:\n print(0)\nelse:\n print(min((x%y),(y-(x%y)))', 'x,y= list(map(int, input().split()))\nif x%y==0:\n print(0)\nelse:\n z=min((x%y),(y-(x%y)))\n print(z) ']
|
['Runtime Error', 'Accepted']
|
['s369397028', 's621474346']
|
[3064.0, 2940.0]
|
[19.0, 17.0]
|
[97, 112]
|
p02719
|
u186729829
| 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, k = map(int, input().split())\n\nmod = n%k\nif mod < k:\n print(min(abs(mod-k),mod))\nelse:\n print(mod)']
|
['Wrong Answer', 'Accepted']
|
['s499688166', 's712081449']
|
[2940.0, 2940.0]
|
[18.0, 17.0]
|
[44, 107]
|
p02719
|
u187193817
| 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())\nm = a % k\nprint(min(m, k - m))', 'a,b =map(int, input().split())\nm = a % k\nprint(min(m, k - m))', 'a,b =map(int, input().split())\nm = a % k\nprint(min(m, k - m))', 'n,k =map(int, input().split())\nm = n % k\nprint(min(m, k - m))']
|
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
|
['s285972454', 's460086519', 's692945695', 's123597727']
|
[2940.0, 2940.0, 2940.0, 2940.0]
|
[17.0, 17.0, 17.0, 17.0]
|
[61, 61, 61, 61]
|
p02719
|
u189089176
| 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\n\nN,K = list(map(int,input().split()))\n\nwhile 1 != 0:\n if N - K >= 0:\n N = abs(N - K)\n print(N)\n else:\n print((N))\n exit()', '\n\n\nN,K = list(map(int,input().split()))\n\nwhile 1 != 0:\n if N - K >= 0:\n N = abs(N - K)\n else:\n print(N)\n exit()', '\n\n\nN,K = list(map(int,input().split()))\n\n# while 1 != 0:\n# if N - K >= 0:\n\n# else:\n# print(N)\n# exit()\n\n\n\n\n# 7%3 -> 1\n# 3-(7%3) -> 2\n\nprint(min((N%K),K-(N%K)))']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s359332899', 's424143085', 's642546410']
|
[47348.0, 2940.0, 3068.0]
|
[2103.0, 2104.0, 17.0]
|
[231, 212, 428]
|
p02719
|
u189516107
| 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\nm = -(-N//K)\nprint(min(N - m*K, -(N - (m+1)*K)))\n\n', 'N, K = map(int, input().split())\n\n\n\nm = N//K\nprint(min(N - m*K, -(N - (m+1)*K)))\n\n']
|
['Wrong Answer', 'Accepted']
|
['s136162073', 's811081354']
|
[9096.0, 9080.0]
|
[23.0, 20.0]
|
[197, 193]
|
p02719
|
u194472175
| 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())\nwhile N>0:\n if N <K:\n if 2*N<=K:\n print(abs(N))\n break\n else:\n\n print(K)\n break\n if N >= K:\n if N==K:\n print(0)\n break\n else :\n N -= K', 'n,k=map(int,input().split())\n\nif n >= k:\n n = n % k\n \nif abs(n-k)<n:\n n = abs(n-k)\n print(n)\nelse:\n print(n)\n']
|
['Wrong Answer', 'Accepted']
|
['s363394605', 's727873527']
|
[2940.0, 9132.0]
|
[2104.0, 21.0]
|
[276, 124]
|
p02719
|
u198073053
| 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.
|
['x,y,z=map(int,input().split())\nprint(z,x,y)', 'n,k=map(int,input().split())\nprint(min(n%k,abs((-1*n)%k)))']
|
['Runtime Error', 'Accepted']
|
['s805247778', 's793747217']
|
[2940.0, 3060.0]
|
[18.0, 17.0]
|
[43, 58]
|
p02719
|
u200887663
| 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=int(input())\nn,k=map(int,input().split())\n#l=list(map(int,input().split()))\n\nans=0\nimport fractions\nif n>=k:\n if n%k==0:\n ans=0\n else:\n ans=fractions.gcd(n,k)\nelse:\n ans=fractions.gcd(n,k)\nprint(ans)\n\n', '#n=int(input())\nn,k=map(int,input().split())\n#al=list(map(int,input().split()))\n\n\nprint(min(n%k,k-n%k))\n']
|
['Wrong Answer', 'Accepted']
|
['s508273110', 's700972043']
|
[5304.0, 9052.0]
|
[39.0, 25.0]
|
[280, 157]
|
p02719
|
u202019924
| 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()))\n\nN = a[0]\nK = a[1]\n\nif K >= 2*N:\n print(N)\nelif N >= K:\n print(N%K)\nelse:\n while 1:\n cul_result1 = abs(N-K)\n cul_result2 = abs(cul_result1-K)\n if cul_result1 < N and cul_result2 >=N:\n print(cul_result1)\n break\n elif cul_result1 < N and cul_result2 < cul_result1:\n N = cul_result1\n continue\n\n', 'a = list(map(int,input().split()))\n\nN = a[0]\nK = a[1]\n\nif N < K:\n print(N)\nelif N > K:\n print(N%K)\n\n', 'a = list(map(int,input().split()))\n\nN = a[0]\nK = a[1]\n\nif K >= 2*N:\n print(N)\nelif K > N :\n print(abs(N-K))\nelif N >= K:\n res = N%K\n min = res\n cul_result1 = abs(res-K)\n if cul_result1 < min:\n min = cul_result1\n cul_result2 = abs(cul_result1-K)\n if cul_result2 < min:\n min = cul_result2\n print(min)\n\n']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s548994058', 's594794165', 's765458670']
|
[3060.0, 2940.0, 3064.0]
|
[17.0, 17.0, 17.0]
|
[407, 106, 341]
|
p02719
|
u203669169
| 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.
|
['NS = [int(_) for _ in input().split()]\n\nN = NS[0]\nK = NS[1]\n\ndef rep(x, K):\n return abs(x-K)\n\ndef solve(N, K):\n return N % K\n\nprint(solve(N, K))', 'NS = [int(_) for _ in input().split()]\n\nN = NS[0]\nK = NS[1]\n\ndef rep(x, K):\n return abs(x-K)\n\ndef solve(N, K):\n\n if N < K:\n return N\n else:\n return N % K\n\nprint(solve(N, K))', '\nNS = [int(_) for _ in input().split()]\n\nN = NS[0]\nK = NS[1]\n\ndef rep(x, K):\n return abs(x-K)\n\ndef solve(N, K):\n b = N % K\n if b != 0:\n b = rep(N%K, K)\n \n if b > N:\n b = N\n\n return b\n\nprint(solve(N, K))']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s145455714', 's335222793', 's621655411']
|
[2940.0, 2940.0, 3060.0]
|
[17.0, 18.0, 17.0]
|
[150, 196, 234]
|
p02719
|
u207235471
| 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.
|
['data=input().split()\na=int(data[0])\nb=int(data[1])\nwhile(a>=b):\n a=a%b\nprint(a)\n', 'data=input().split()\na=int(data[0])\nb=int(data[1])\na=a%b\nprint(a)\n', 'a=int(input())\nb=int(input())\nwhile(a>=b):\n\ta=abs(a-b)\nprint(a)', 'n, k = map(int, input().split())\nj = n % k\nprint(j if k-j > j else k-j )\n']
|
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
|
['s176505550', 's436435539', 's517788594', 's763606324']
|
[2940.0, 2940.0, 2940.0, 2940.0]
|
[17.0, 17.0, 17.0, 17.0]
|
[83, 66, 63, 73]
|
p02719
|
u207400417
| 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\nremin = N%K\nprint(K-remin)\nprint(remin)\nans = min(remin,K-remin)\n\nprint(ans)\n ', 'N , K = (int(x) for x in input().split())\n\nremin = N%K\n\nans = min(remin,K-remin)\n\nprint(ans)\n ']
|
['Wrong Answer', 'Accepted']
|
['s023251622', 's766195719']
|
[2940.0, 2940.0]
|
[18.0, 18.0]
|
[122, 95]
|
p02719
|
u208309047
| 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\n\n\nif (N < K):\n ans = N\n#elif(N % K == 0):\n # ans = 0\nelse:\n if (N % K == 0):\n ans = 0\n else:\n N = N % K\n if(N <= abs(N-K)):\n ans = N\n else:\n ans = abs(N-K)\n\nprint(ans)', 'N,K = map(int, input().split())\nans = 0\n\n\n\n # ans = N\nif(N % K == 0):\n ans = 0\nelse:\n if (N < K):\n ans = N\n N = N % K\n if(N <= abs(N-K)):\n ans = N\n else:\n ans = abs(N-K)\n\nprint(ans)\n']
|
['Runtime Error', 'Accepted']
|
['s651174491', 's843790431']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[248, 232]
|
p02719
|
u212263866
| 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, kk = input().split(" ")\nn = int(nn)\nk = int(kk)\n \nremain = n % k\nif( kk=="1" ):\n print(0)', 'nn, kk = input().split(" ")\nn = int(nn)\nk = int(kk)\n \nremain = n % k\nif( kk=="1" ):\n print(0)\nelif( remain == 0 ):\n print(remain)\nelse:\n print( min(abs( remain - k), abs(abs(remain-k)-k) ))']
|
['Wrong Answer', 'Accepted']
|
['s322512162', 's950785097']
|
[2940.0, 3060.0]
|
[17.0, 17.0]
|
[94, 192]
|
p02719
|
u213498391
| 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:\n x1 = n % k\n x2 = k - x1\n print(min(x1, x2))\nelse n == k:\n print(0)', 'n, k = map(int, input().split())\n\nif n != k:\n x1 = n % k\n x2 = k - x1\n print(min(x1, x2))\nelse:\n print(0)']
|
['Runtime Error', 'Accepted']
|
['s577403153', 's427419021']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[116, 109]
|
p02719
|
u214209871
| 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\nx = n\nli = [n]\nwhile True:\n x = abs(k - x)\n if x in li:\n break\n li.append(x)', 'n, k = map(int, input().split())\n\na = n % k\nif a <= k/2:\n print(a)\nelse:\n print(k-a)\n']
|
['Wrong Answer', 'Accepted']
|
['s696482280', 's394481622']
|
[9616.0, 8992.0]
|
[2205.0, 30.0]
|
[126, 91]
|
p02719
|
u215286521
| 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.
|
['nums = list(map(int, input().split()))\nn = nums[0]\nk = nums[1]\n\nx = n % k\n\nprint(min(n, k - n))\n', 'nums = list(map(int, input().split()))\nn = nums[0]\nk = nums[1]\n\nn = n % k\n\nprint(min(n, k - n))\n\n\n']
|
['Wrong Answer', 'Accepted']
|
['s686534492', 's776767791']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[97, 99]
|
p02719
|
u218487926
| 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())\nm = n % k\nprint(m, abs(m-k))', 'n, k = map(int, input().split())\nm = n % k\nprint(min(m, abs(m-k)))']
|
['Wrong Answer', 'Accepted']
|
['s312175412', 's001698140']
|
[3064.0, 2940.0]
|
[17.0, 17.0]
|
[61, 66]
|
p02719
|
u221537793
| 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())\ns = N // K\nmin(abs(N - s * K), abs(N- (s+1) * K))', 'N = int(input())\nK = int(input())\nwhile(1):\n new_N = abs(N-K)\n if new_N >= N:\n print(N)\n break\n else:\n N=new_N', 'N, K = map(int, input().split())\nif N >= 2*K:\n s = N // K\n print(min(abs(N - s * K), abs(N- (s+1) * K)))\nelse:\n print(min(abs(N-K), abs(abs(N-K)-K)))']
|
['Wrong Answer', 'Runtime Error', 'Accepted']
|
['s413911321', 's859470862', 's820304032']
|
[2940.0, 2940.0, 3060.0]
|
[20.0, 17.0, 18.0]
|
[82, 140, 158]
|
p02719
|
u222185706
| 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.
|
['\nfirst_input = list(map(lambda x:int(x), input().split(" ")))\n#second_input = list(map(lambda x:int(x), input().split(" ")))\n\nN = first_input[0]\nK = first_input[1]\n\nfirst_min_N = N - K*round(N/K)\n\nprint(min(first_min_N,abs(first_min_N-K)))\n', 'import math\nfirst_input = list(map(lambda x:int(x), input().split(" ")))\n#second_input = list(map(lambda x:int(x), input().split(" ")))\n\nN = first_input[0]\nK = first_input[1]\n\nprint(math.floor(N//K))\nprint(K*math.floor(N//K))\nif N>K:\n first_min_N = N - K*math.floor(N//K)\nelse:\n first_min_N = N\n\nprint(min(first_min_N,abs(first_min_N-K)))\n', 'import math\nfirst_input = list(map(lambda x:int(x), input().split(" ")))\n#second_input = list(map(lambda x:int(x), input().split(" ")))\n\nN = first_input[0]\nK = first_input[1]\n\nprint(math.floor(N // K))\nprint(K*math.floor(N // K))\nif N>K:\n first_min_N = N - K*math.floor(N // K)\nelse:\n first_min_N = N\n\nprint(min(first_min_N,abs(first_min_N-K)))\n', 'import math\nfirst_input = list(map(lambda x:int(x), input().split(" ")))\n#second_input = list(map(lambda x:int(x), input().split(" ")))\n\nN = first_input[0]\nK = first_input[1]\n\n\n\nif N>K:\n first_min_N = N - K*math.floor(N // K)\nelse:\n first_min_N = N\n\nprint(min(first_min_N,abs(first_min_N-K)))\n']
|
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s420641064', 's778229007', 's968065463', 's724399609']
|
[2940.0, 3060.0, 3060.0, 2940.0]
|
[17.0, 17.0, 17.0, 17.0]
|
[240, 345, 351, 353]
|
p02719
|
u225003503
| 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())\nint tmp = 0\n\n\nwhile:\n\ttmp = N\n\tif(abs(tmp - K) < tmp):\n \ttmp = abs(tmp - K)\n \telse:\n \tbreak\n \t\nprint(tmp)', 'N,K = map(int,input().split())\nint tmp = 0\n \nwhile:\n\ttmp = N\n\tif(abs(tmp - K) < tmp):\n \ttmp = abs(tmp - K)\n \telse:\n \tbreak\n \t\nprint(tmp)', 'N,K = map(int,input().split())\nint tmp = 0\n \nwhile();\n N = tmp\n \tif(abs(tmp - K) < tmp);\n tmp = abs(tmp - K)\n \telse;\n break\n\n \nprint(tmp)', 'N,K = map(int,input().split())\nint tmp = 0\n \nwhile:\n\ttmp = N\n\tif(abs(tmp - K) < tmp):\n \ttmp = abs(tmp - K)\n \telse:\n \tbreak\n \t\nprint(tmp)', 'N,K = map(int,input().split())\nint tmp = 0\n\nwhile(){\n N = tmp\n \tif(abs(tmp - K) < tmp){\n tmp = abs(tmp - K)\n }\n \telse{\n break;\n }\n}\n\nprint(tmp)', 'N,K = map(int,input().split())\nint tmp = 0\n \nwhile();\n\ttmp = N\n\tif(abs(tmp - K) < tmp);\n \ttmp = abs(tmp - K)\n \telse;\n \tbreak\n \t\nprint(tmp)', 'N,K = map(int,input().split())\nint tmp = 0\n \nwhile:\n\ttmp = N\n\tif(abs(tmp - K) < tmp):\n \ttmp = abs(tmp - K)\n \telse:\n \tbreak\n \t\nprint(tmp)', 'import math\n\nN,K = map(int,input().split())\ntmp = N%K\n\nwhile True:\n if abs(tmp - K) < tmp:\n tmp = abs(tmp - K)\n else:\n break\n \t\nprint(tmp)']
|
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
|
['s101690056', 's401855857', 's498931516', 's811696317', 's839303236', 's896876287', 's950195383', 's639045525']
|
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
|
[18.0, 17.0, 18.0, 17.0, 17.0, 17.0, 17.0, 18.0]
|
[148, 148, 153, 148, 162, 150, 148, 146]
|
p02719
|
u228636605
| 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\nmini = N % K\n\nif mini < abs(mini - K):\n mini = mini\nelse:\n mini = abs(mini - k)\n\nprint(mini)\n', 'N , K = map(int , input().split())\nmini = N\n\nmod = N % K\n\n\nif K == 1:\n mini = 0\n \nelif N >= K:\n mini = mod\n \nelif N < K and abs(N-K) > N:\n mini = N\nelse:\n \n for i in range(10000):\n x = abs(mini - K)\n if x < mini:\n mini = x\n \n\nprint(mini)\n', 'N , K = map(int , input().split())\nmini = N\n\nmod = N % K\n\n\nif K == 1:\n mini = 0\n \nelif N >= K:\n mini = mod\n \nelif N < K and abs(N-K) > N:\n mini = N\nelse:\n \n for i in range(1000000):\n x = abs(mini - K)\n if x < mini:\n mini = x\n \n\nprint(mini)\n', 'N , K = map(int , input().split())\n\nmini = N % K\n\nif mini < abs(mini - K):\n mini = mini\nelse:\n mini = abs(mini - K)\n\nprint(mini)\n']
|
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s095831295', 's452362003', 's918387698', 's013378107']
|
[2940.0, 3060.0, 3060.0, 2940.0]
|
[17.0, 19.0, 227.0, 17.0]
|
[135, 287, 289, 135]
|
p02719
|
u234189749
| 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\nprint(min(x,k-x))', 'N, K = map(int,input().split())\nx = N%K\nprint(min(x,K-x))']
|
['Runtime Error', 'Accepted']
|
['s734186134', 's246581577']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[57, 57]
|
p02719
|
u235027735
| 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\nmax_i = max(n, k)\n\n\nif n>=k:\n n = n%k\nelse:\n for _ in range(max_i):\n tmp = abs(n-k)\n if tmp >= n:\n break\n else :\n n = tmp\n \n print(n)\n', 'n, k = map(int, input().split())\n\nmax_i = max(n, k)\n\n\nif n>=k:\n n = n%k\nif n==0 or k==1:\n print(0)\nelse:\n for _ in range(max_i):\n tmp = abs(n-k)\n if tmp >= n:\n break\n else :\n n = tmp\n \n print(n)\n']
|
['Wrong Answer', 'Accepted']
|
['s649429250', 's074036139']
|
[2940.0, 3060.0]
|
[17.0, 17.0]
|
[223, 253]
|
p02719
|
u236809838
| 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\nN = int(input())\nK = int(input())\nmod = N % K\n \nif(abs(mod-K) < mod)\n mod = abs(mod-K);\n \nprint(mod)\n', 'import math\n \nN, K = map(int, input().split())\nmod = N % K\n \nif abs(mod-K) < mod:\n mod = abs(mod-K)\n \nprint(mod)']
|
['Runtime Error', 'Accepted']
|
['s027980186', 's037938772']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[117, 115]
|
p02719
|
u238084414
| 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\nmin = n\n\nif n < k and k - n <= k/2:\n n = k - n\n if n > min:\n n = min\n\nprint(min)\n# 7 3 1 =2', 'n,k = map(int, input().split())\nn = n%k\nmin = n\n\nif k - n < min:\n min = k-n\n\nprint(min)']
|
['Wrong Answer', 'Accepted']
|
['s975444126', 's770568090']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[136, 88]
|
p02719
|
u240630407
| 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,K-N%K])', 'N, K = map(int, input().split())\nprint(min([N%K,K-N%K]))\n']
|
['Runtime Error', 'Accepted']
|
['s981192338', 's437097976']
|
[9128.0, 9092.0]
|
[23.0, 27.0]
|
[54, 57]
|
p02719
|
u244416763
| 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 abs(n-k) < n:\n print(abs(n-k))\n exit()\n else:\n print(n)\n exit()\nelse:\n print(n%k)', 'n,k = map(int,input().split())\nif n < k:\n print(min(n,abs(n-k)))\nelse:\n print(min(min(n,n%k),abs(n%k - k)))']
|
['Wrong Answer', 'Accepted']
|
['s551064074', 's166617820']
|
[2940.0, 2940.0]
|
[17.0, 18.0]
|
[163, 113]
|
p02719
|
u244466744
| 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 \nsur = N % K\n\nprint(sur)', 'N, K = map(int, input().split())\nN = N % K\n\nprint(min(N, abs(N-K))', 'N, K = map(int, input().split())\n\nif N % K == 0:\n print(0)\n \nwhile True:\n N = N - K\n if N < 0:\n print(N + K)\n exit()', 'N, K = map(int, input().split())\nN = N % K\n\nprint(min(N, abs(N-K)))\n']
|
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
|
['s038223973', 's381491645', 's926473238', 's684207987']
|
[9116.0, 8812.0, 9100.0, 8996.0]
|
[28.0, 20.0, 2205.0, 27.0]
|
[86, 66, 126, 68]
|
p02719
|
u252828980
| 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#L = list(map(int,input().split()))\n#a = max(n,k)%min(n,k)\nL = []\na = 1\nwhile a <=10:\n if max(n,k)%min(n,k) == 0:\n print(0)\n exit()\n if n >= k and k!=0:\n n = n%k\n if n == 0:\n print(k)\n elif n<k and n!=0:\n k = k%n\n if k == 0:\n print(n)\n L.append((n,k))\n a +=1', 'n,k = map(int,input().split())\nprint(max(abs(n%k-k),n%k))', 'n,k = map(int,input().split())\nprint(min(abs(n%k-k),n%k))']
|
['Runtime Error', 'Wrong Answer', 'Accepted']
|
['s121488784', 's366698845', 's888291057']
|
[3064.0, 2940.0, 2940.0]
|
[18.0, 18.0, 17.0]
|
[369, 57, 57]
|
p02719
|
u252964975
| 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(max([N%K,abs(N%K-K)]))', 'N,K=map(int, input().split())\nprint(min([N%K,abs(N%K-K)]))']
|
['Wrong Answer', 'Accepted']
|
['s921850980', 's091277442']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[58, 58]
|
p02719
|
u259755734
| 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\nx = n % k\nprint(min(x, abs(k-x))', 'n, k = map(int, input().split())\n\nx = n % k\nprint(min(x, abs(k-x)))']
|
['Runtime Error', 'Accepted']
|
['s871643464', 's820104865']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[66, 67]
|
p02719
|
u261700262
| 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())\nstore = N\nx = N % K\nif N == 0:\n print(0)\nelif N == store:\n print(abs(N - K))\nelse:\n while x < store:\n store = x\n x = abs(x - K)\n\n print(store)\n', 'N, K = map(int, input().split())\nstore = N\nx = N % K\nif N == 0:\n print(0)\nelse:\n while x < store:\n store = x\n x = abs(x - K)\n\n if store > abs(N - K):\n print(abs(N - K))\n else:\n print(store)\n']
|
['Wrong Answer', 'Accepted']
|
['s793311974', 's267834006']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[202, 230]
|
p02719
|
u262244504
| 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 ln=0\nelif n>=k :\n if n//k==0:\n ln=0\nelse:\n while 1:\n ln = n\n n = abs(n-k)\n if ln<=n:\n break\nprint(ln)', 'n,k = map(int,input().split())\n\nif k==1 :\n ln=0\nelif n>=k and k!=0 :\n if n//k==0:\n ln=0\nelse:\n while 1:\n ln = n\n n = abs(n-k)\n if ln<=n:\n break\nprint(ln)', 'n,k = map(int,input().split())\n \nif k==1 :\n ln=0\nelif k==0 :\n ln=n\nelif n>=k:\n a = n%k\n n=a\n while 1:\n ln = n\n n = abs(a-k)\n if ln<=n:\n break\nelse:\n while 1:\n ln = n\n n = abs(n-k)\n if ln<=n:\n break\nprint(ln)']
|
['Runtime Error', 'Runtime Error', 'Accepted']
|
['s008702064', 's211864382', 's486442496']
|
[3060.0, 3060.0, 3060.0]
|
[17.0, 17.0, 17.0]
|
[164, 173, 241]
|
p02719
|
u266264498
| 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.
|
['inp=[int(x) for x in input().split()]\nn,k=inp[0],inp[1]\nif n>k:\n print(n%k,k-n%k)\nelif n<k:\n print(min(n,k-n))\nelse:\n print(0)', 'inp=[int(x) for x in input().split()]\nn,k=inp[0],inp[1]\nif n>k:\n print(min(n%k,k-n%k))\nelif n<k:\n print(min(n,k-n))\nelse:\n print(0)']
|
['Wrong Answer', 'Accepted']
|
['s341483399', 's944220540']
|
[3060.0, 2940.0]
|
[18.0, 17.0]
|
[129, 134]
|
p02719
|
u267466261
| 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(abs(n-k) % k)', 'n,k = map(int, input().split())\nn = n % k\na = abs(n-k)\nif n <= a:\n print(n)\nelse:\n print(a)']
|
['Wrong Answer', 'Accepted']
|
['s540372022', 's368602415']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[51, 93]
|
p02719
|
u269792839
| 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 = int(input())\nprint(n % k)', 'n, k = map(int, input().split())\nn %= k\nm = n\nm -= k\nm = abs(m)\nn = min(n, m)\nprint(n)']
|
['Wrong Answer', 'Runtime Error', 'Accepted']
|
['s102454881', 's621340649', 's467208853']
|
[2940.0, 2940.0, 2940.0]
|
[17.0, 17.0, 18.0]
|
[45, 32, 86]
|
p02719
|
u273345915
| 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=N%K\nprint(a,K-a)', 'N,K=map(int, input().split())\na=N%K\nprint(min(a,K-a))']
|
['Wrong Answer', 'Accepted']
|
['s682306442', 's866118174']
|
[2940.0, 3064.0]
|
[17.0, 17.0]
|
[48, 53]
|
p02719
|
u277104886
| 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\nn, k = map(int, input().split())\nx = math.ceil( n/k )\nif abs(n - k*x) < n:\n n = n - k*x\nprint(n)', 'n, k = map(int, input().split())\na = n%k\nprint(min(a, abs(a-k)))']
|
['Wrong Answer', 'Accepted']
|
['s212955925', 's222607245']
|
[8964.0, 9164.0]
|
[22.0, 22.0]
|
[111, 64]
|
p02719
|
u279121950
| 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\nN,K=map(int,input().split())\n\nif (N%K) <=(K/2):\n\tx=N%K\nelse:\n\tx=N-N%K\n\t\nprint(x)', '#coding:utf-8\nN,K=map(int,input().split())\n\nif (N%K) <=(K/2):\n\tx=N%K\nelse:\n\tx=K-N%K\n\t\nprint(x)']
|
['Wrong Answer', 'Accepted']
|
['s105025588', 's014222898']
|
[2940.0, 3068.0]
|
[17.0, 19.0]
|
[94, 94]
|
p02719
|
u282813849
| 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\nprev = -1\nwhile prev != min(N,K):\n prev = min(N,K)\n if N == K or N == 0 or K == 0:\n prev = 0\n break\n if N > K:\n N = N % K\n else:\n K = K % N\n \nprint(prev)', 'N, K = map(int,input().split())\n\nif N > K:\n N = N % K\n\nmin_N = float("inf")\nwhile min_N != N:\n min_N = min(N,min_N)\n if N == K or N == 0 or K == 0:\n print(0)\n exit(0)\n \n N = abs(N - K)\n \nprint(min_N)']
|
['Wrong Answer', 'Accepted']
|
['s506013400', 's545392754']
|
[9140.0, 9096.0]
|
[29.0, 31.0]
|
[203, 211]
|
p02719
|
u283683979
| 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.
|
["k=int(input(''))\nr=[]\ndef detr(n):\n sn=str(n)\n j=0\n for a in sn:\n j=j+1\n \n if j==1:\n return True\n\n ok=1\n for a in range(j-1):\n if int(sn[a])-int(sn[a+1])==0 or int(sn[a])-int(sn[a+1])==1 or int(sn[a])-int(sn[a+1])==-1:\n ok=ok*1\n else:\n ok=ok*0\n break\n \n if ok==1:\n return True\n else:\n return False\n\nlis=[]\nx=1\nc=0\nwhile len(lis)<k:\n if detr(x)==True:\n lis.append(x)\n if x>=10:\n c=c+1\n \n if c<=2:\n x=x+1\n else:\n c=0\n x=x+9\n\nprint(lis[-1])", "k=int(input(''))\nr=[]\ndef detr(n):\n sn=str(n)\n j=0\n for a in sn:\n j=j+1\n \n if j==1:\n return True\n\n ok=1\n for a in range(j-1):\n if int(sn[a])-int(sn[a+1])==0 or int(sn[a])-int(sn[a+1])==1 or int(sn[a])-int(sn[a+1])==-1:\n ok=ok*1\n else:\n ok=ok*0\n break\n \n if ok==1:\n return True\n else:\n return False\n\nlis=[]\nx=1\nc=0\nwhile len(lis)<k:\n if detr(x)==True:\n lis.append(x)\n if x>=10:\n c=c+1\n \n if c<=2:\n x=x+1\n else:\n c=0\n x=x+9\n\nprint(lis[-1])", "n,k=map(int,input('').split(' '))\ns=0\nh=0\n\nn=n%k\nwhile s==0:\n h=n\n n=n-k\n if n<0:\n n=n*(-1)\n if h>n:\n s=0\n else:\n s=1\n n=h\n\nprint(n)"]
|
['Runtime Error', 'Runtime Error', 'Accepted']
|
['s809061730', 's820766945', 's938843084']
|
[3064.0, 3064.0, 3060.0]
|
[17.0, 17.0, 17.0]
|
[600, 600, 175]
|
p02719
|
u288430479
| 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 collections import deque\nk = int(input())\na = deque([1,2,3,4,5,6,7,8,9])\ncount=0\nwhile count !=k:\n b = a.popleft()\n count += 1\n if b%10==0:\n a.append(b*10)\n a.append(b*10+1)\n elif b%10==9:\n a.append(b*10+8)\n a.append(b*10+9)\n else:\n a.append(b*10+b%10-1)\n a.append(b*10+b%10)\n a.append(b*10+b%10+1)\nprint(b)', 'n,k = map(int,input().split())\na = n%k\nb = abs(a-k)\nprint(min(a,b))']
|
['Runtime Error', 'Accepted']
|
['s927660808', 's051650398']
|
[3316.0, 2940.0]
|
[21.0, 17.0]
|
[338, 67]
|
p02719
|
u290187182
| 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\nimport copy\nimport math\nimport bisect\nimport pprint\nimport bisect\nfrom functools import reduce\nfrom copy import deepcopy\nfrom collections import deque\nfrom decimal import *\n\n\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\n\n\nif __name__ == '__main__':\n b, c = map(int, input().split())\n maxnum =b\n print( abs(b% c) )", "import sys\nimport copy\nimport math\nimport bisect\nimport pprint\nimport bisect\nfrom functools import reduce\nfrom copy import deepcopy\nfrom collections import deque\nfrom decimal import *\n\n\ndef lcm(x, y):\n return (x * y) // math.gcd(x, y)\n\n\nif __name__ == '__main__':\n b, c = map(int, input().split())\n a =abs(b% c)\n \n if abs(a-c) < a:\n print(abs(a-c))\n else:\n print(a)\n"]
|
['Wrong Answer', 'Accepted']
|
['s074538403', 's629890633']
|
[5656.0, 5144.0]
|
[178.0, 36.0]
|
[340, 398]
|
p02719
|
u293436958
| 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 time\nN,K=(int(x) for x in input().split())\nx=N\nif K!=1:\n while True:\n x = abs(x-K)\n y=abs(x-K)\n if y>x or time.time()>1.99999:\n break\n print(x)\nelse:\n print(0)', 'N,K=(int(x) for x in input().split())\nx=N%K\nif K!=1:\n while True:\n x = abs(x-K)\n y = abs(x-K)\n if y>x:\n break\n print(x)\nelse:\n print(0)']
|
['Wrong Answer', 'Accepted']
|
['s383785761', 's199792881']
|
[3184.0, 2940.0]
|
[19.0, 17.0]
|
[209, 178]
|
p02719
|
u294542073
| 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())\n\nnum=[int(i) for i in input().split()]\n\nnum=sorted(num,reverse=True)\n\nsum_num=sum(num)\n\nの1/4Mは未満は人気商品と言えないNo\nif num[m-1]<sum_num/(4*m):\n print("No")\nelse:\n print("Yes")\n', 'n,k=map(int,input().split())\n\n\nprint(min(n%k,-n%k))']
|
['Runtime Error', 'Accepted']
|
['s863216014', 's288309228']
|
[9152.0, 8936.0]
|
[20.0, 22.0]
|
[388, 166]
|
p02719
|
u295797489
| 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 abs_result(x,y):\n tmp = abs(x-y)\n return tmp\n\ndef main():\n line = list(map(int,input().split()))\n n,k = line[0],line[1]\n \n \n if n == 0 or k == 1:\n print(0)\n return\n \n if n % 2 == 0 and k % 2 == 0 and n < k:\n print(2)\n \n if n % 2 == 0 and k % 2 == 0 and n > k:\n print(0)\n \n if n % 2 == 1 and k % 2 == 0 and n > k:\n print(1)\n \n \n com = 2\n for i in range(0,10**18):\n ans = abs_result(n,k)\n if ans == 0:\n print(0)\n return\n elif ans == 1:\n print(1)\n return\n if ans <= com:\n print(ans)\n return\n n = ans\n\nmain()', 'def abs_result(x,y):\n tmp = abs(x-y)\n return tmp\n\ndef main():\n line = list(map(int,input().split()))\n n,k = line[0],line[1]\n \n \n if n == 0 or k == 1:\n print(0)\n return\n \n if n % 2 == 0 k % 2 == 0 and n < k:\n print(2)\n \n if n % 2 == 0 k % 2 == 0 and n > k:\n print(0)\n \n if n % 2 == 1 and k % 2 == 0 and n > k:\n print(1)\n \n \n com = 2\n for i in range(0,10**18):\n ans = abs_result(n,k)\n if ans == 0:\n print(0)\n return\n elif ans == 1:\n print(1)\n return\n if ans <= com:\n print(ans)\n return\n n = ans\n\nmain()', 'def main():\n n,k = map(int,input().split())\n t = n % k\n x = k - t\n if t < x:\n print(t)\n else:\n print(x)\nmain()']
|
['Wrong Answer', 'Runtime Error', 'Accepted']
|
['s584405845', 's710071683', 's101112011']
|
[3064.0, 2940.0, 2940.0]
|
[2103.0, 17.0, 17.0]
|
[753, 745, 139]
|
p02719
|
u296557772
| 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 = [int(x) for x in input().split()]\n return n%k\n\nprint(main())', 'def main():\n n,k = [int(x) for x in input().split()]\n return min(n%k, k-n%k)\n\nprint(main())']
|
['Wrong Answer', 'Accepted']
|
['s929769745', 's838977350']
|
[2940.0, 3064.0]
|
[17.0, 17.0]
|
[81, 93]
|
p02719
|
u301043830
| 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 N > K:\n print(N % K)\nelif N <= K:\n if K - N < N:\n print(K - N)\n else:\n print(N)\n', 'N, K = [int(i) for i in input().split()]\nif N > K:\n if N % K == 0:\n print(0)\n else:\n print(K % (N % K))\nelif N <= K:\n if K < 2 * N:\n print(K - N)\n else:\n print(N)\n']
|
['Wrong Answer', 'Accepted']
|
['s623528361', 's695772279']
|
[2940.0, 2940.0]
|
[18.0, 17.0]
|
[147, 203]
|
p02719
|
u301624971
| 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 print(N)\nelif(N % K == 0):\n print(0)\nelse:\n print(abs(N % K - K))', 'import sys\n\nN, K = map(int, input().split())\n\n\nif(N > K):\n if(N % K == 0):\n print(0)\n sys.exit()\n else:\n tmp=N % K\n print(min(tmp,abs(K - tmp)))\n sys.exit()\nelse:\n tmp = abs(N - K)\n if(tmp <= N):\n print(tmp)\n else:', 'N,K = map(int,input().split())\nprint(min(abs(N % K - K),N % K))\n']
|
['Wrong Answer', 'Runtime Error', 'Accepted']
|
['s214446135', 's596799694', 's296534424']
|
[2940.0, 2940.0, 2940.0]
|
[17.0, 17.0, 20.0]
|
[110, 271, 64]
|
p02719
|
u301908263
| 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()))\nreminder = n % k\n\nprint(reminder)\n', 'n, k = list(map(int, input().split()))\nreminder = n % k\ns = abs(reminder - k)\n\nres = min(reminder, s)\nprint(res)\n']
|
['Wrong Answer', 'Accepted']
|
['s594920187', 's934531205']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[73, 113]
|
p02719
|
u302697704
| 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\nmin = N\nwhile True:\n #print (min)\n if min<=min%K:\n break\n else:\n min = min%K\nprint (min)', 'N,K = map(int,input().split())\n\nmin = N%K\nif min>abs(min-K):\n min = abs(min-K)\n\nprint (min)']
|
['Wrong Answer', 'Accepted']
|
['s564128700', 's278427676']
|
[9088.0, 9144.0]
|
[27.0, 28.0]
|
[129, 92]
|
p02719
|
u309469516
| 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 CalAbs(a, b):\n sol=a-b\n if sol<0:\n sol=sol*(-1)\n return sol\n\ninput_line = input().split(" ")\nN=int(input_line[0])\nK=int(input_line[1])\n\nrec=10**18+1\ni=0\n\nwhile i<10**19:\n if rec>N:\n rec=N\n N=CalAbs(N,K)\n i=i+1\nprint(rec)\n', 'input_line = input().split(" ")\nN,K,sol=int(input_line[0])%int(input_line[1])+int(input_line[1]),int(input_line[1]),10**18+1\nfor i in range(10):\n if sol>N:\n sol=N\n N=abs(N-K)\nprint(sol)']
|
['Time Limit Exceeded', 'Accepted']
|
['s908771728', 's563892341']
|
[3060.0, 3060.0]
|
[2104.0, 17.0]
|
[257, 198]
|
p02719
|
u311379832
| 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 print(0)\n exit()\n\ntmp1 = 0\nif N > K:\n tmp, m = divmod(N, K)\n if m == 0:\n tmp1 = N % (tmp + 1)\nelse:\n tmp = abs(N - K)\n tmp1 = min(N % K, tmp)\n\nprint(tmp1)', 'N, K = map(int, input().split())\nif N == K:\n print(0)\n exit()\n\ntmp1 = 0\nif N > K:\n tmp, m = divmod(N, K)\n tmp1 = m\n tmp1 = min(tmp1, abs(m - K))\nelse:\n tmp = abs(N - K)\n tmp1 = min(N % K, tmp)\n\nprint(tmp1)']
|
['Wrong Answer', 'Accepted']
|
['s954052936', 's085607543']
|
[3060.0, 3060.0]
|
[17.0, 17.0]
|
[224, 226]
|
p02719
|
u311488536
| 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())\nsetlist = set()\ntmp = N\nans = float('inf')\nwhile True:\n tmp = abs(N-K)\n ans = min(tmp,ans)\n if tmp in setlist:\n break\n setlist.add(tmp)\nreturn ans", 'def main():\n N, K = map(int,input().split())\n print(min(N%K, K-N%K))\n return \nmain()']
|
['Runtime Error', 'Accepted']
|
['s359293738', 's492212553']
|
[9072.0, 9144.0]
|
[22.0, 28.0]
|
[186, 87]
|
p02719
|
u314089899
| 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\nx = abs(N - K*(int(N/K)-1))\n\nfor i in range(0,5):\n x = abs(x-K)\n ans = min(ans,x)\n\nprint(ans)', 'N,K = map(int, input().split())\n\nx = abs(N - K*(int(N/K)-1))\nans = N\n\nfor i in range(0,100000):\n x = abs(x-K)\n ans = min(ans,x)\n\nprint(ans)']
|
['Runtime Error', 'Accepted']
|
['s920692940', 's517785076']
|
[2940.0, 2940.0]
|
[17.0, 55.0]
|
[132, 145]
|
p02719
|
u317423698
| 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\nn, k = map(int, sys.stdin.buffer.read())\nprint(n % k)', 'import sys\nn, k = map(int, sys.stdin.buffer.read().split())\nprint(n % k)', 'import sys\nn, k = map(int, sys.stdin.buffer.read().split())\nrem = n % k\nprint(min(rem, k - rem)', 'import sys\nn, k = map(int, sys.stdin.buffer.read().split())\nrem = n % k\nprint(min(rem, k - rem))']
|
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
|
['s385616271', 's722319916', 's747857863', 's440577738']
|
[9084.0, 9148.0, 8848.0, 8980.0]
|
[23.0, 29.0, 22.0, 24.0]
|
[64, 72, 95, 96]
|
p02719
|
u318662224
| 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 answer = 0\nelse:\n if N % K >= N:\n answer = N\n else:\n answer = N % K\n\n \nprint(answer)', 'N, K = map(int, input().split())\n\nif N % K == 0:\n answer = 0\nelse:\n if abs(N % K - K) >= N % K:\n answer = N % K\n else:\n answer = abs(N % K - K)\n\n \nprint(answer)\n ']
|
['Wrong Answer', 'Accepted']
|
['s965964110', 's297247003']
|
[9120.0, 9108.0]
|
[25.0, 27.0]
|
[144, 175]
|
p02719
|
u321096814
| 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 -*-\nimport sys\n\ndef get_abs(N, K):\n return abs(N-K)\n\nN, K = map(int, input().split())\nif K == 1:\n print(0)\n sys.exit()\n \nif N/K > 1:\n N = N - (N / K) * K\na = abs(N-K)\nwhile abs(a - K) < a:\n a = abs(a-K)\n\nprint(int(a))', '# -*- coding: utf-8 -*-\nimport sys\n\ndef get_abs(N, K):\n return abs(N-K)\n\nN, K = map(int, input().split())\nif K == 1:\n print(0)\n sys.exit()\n \nif N/K > 1:\n N = N - (N / K) * 2\na = abs(N-K)\nwhile abs(a - K) < a:\n a = abs(a-K)\n\nprint(int(a))', '# -*- coding: utf-8 -*-\nimport sys\n\nN, K = map(int, input().split())\nif K == 1:\n print(0)\n sys.exit()\n \nif N / K > 1:\n N = N - int(N / K) * K\na = abs(N-K)\nwhile abs(a - K) < a:\n a = abs(a-K)\n\nprint(int(a))']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s376955614', 's695402282', 's123059800']
|
[3060.0, 3060.0, 3060.0]
|
[17.0, 2104.0, 17.0]
|
[243, 243, 210]
|
p02719
|
u322297639
| 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))', 'n, k = map(int, input().split())\nif n < k:\n print(min(n, k - n))\nelif n == k:\n print(0)\nelse:\n print(min(n % k, abs(k - n % k)))']
|
['Wrong Answer', 'Accepted']
|
['s698031581', 's081918015']
|
[5688.0, 3060.0]
|
[139.0, 17.0]
|
[111, 137]
|
p02719
|
u323045245
| 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())\nmov = n%k\nans = min(mov,abs(mov-k))', 'n, k = map(int, input().split())\nmov = n%k\nans = min(mov,abs(mov-k))\nprint(ans)']
|
['Wrong Answer', 'Accepted']
|
['s649571051', 's016286371']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[68, 79]
|
p02719
|
u325282913
| 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 print(N%K)\nelse:\n print(max(N,K-N))', 'N, K = map(int, input().split())\nif N >= K:\n print(N%K)\nelse:\n print(min(N,K-N))', 'N, K = map(int, input().split())\nprint(N%K)', 'N, K = map(int, input().split())\ntmp = N%K\nprint(min(N,K-tmp,tmp))']
|
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s297342078', 's792152986', 's884317760', 's128757531']
|
[2940.0, 2940.0, 2940.0, 2940.0]
|
[17.0, 17.0, 17.0, 17.0]
|
[86, 86, 43, 66]
|
p02719
|
u325660636
| 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())\nans1 = n%k\nans2 = k-ans1\nprint(min(ans1,ans2))']
|
['Wrong Answer', 'Accepted']
|
['s385930782', 's209747341']
|
[8972.0, 9100.0]
|
[28.0, 28.0]
|
[42, 77]
|
p02719
|
u329799519
| 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\ndef absdiff(x, K):\n return abs(x - K)\n\ndef culc(N, K):\n if K == 1:\n print(0)\n return\n\n if N*2 == K:\n print(N)\n return\n\n if N%K == 0:\n print(0)\n return\n\n x = N\n min = x\n while min >= x:\n print(min, x)\n min = x\n x = absdiff(x, K)\n if min == 1:\n break\n\n print(min)\n return\n\n\nculc(N, K)\n", "N, K = map(int, input().split(' '))\n\ndef absdiff(x, K):\n return abs(x - K)\n\ndef culc(N, K):\n if K == 1:\n print(0)\n return\n\n x = N\n min = x\n while min > x:\n print(min, x)\n min = x\n x = absdiff(x, K)\n\n print(min)\n return\n\n\nculc(N, K)\n", "N, K = map(int, input().split(' '))\n\ndef absdiff(x, K):\n return abs(x - K)\n\ndef culc(N, K):\n if K == 1:\n print(0)\n return\n\n x = N\n min = x\n x = absdiff(x, K)\n prev = -1\n while min >= x:\n print(min, prev, x)\n min = x\n x = absdiff(x, K)\n if prev == min:\n break\n prev = min\n\n print(min)\n return\n\n\nculc(N, K)\n", "N, K = map(int, input().split(' '))\n\ndef absdiff(x, K):\n return abs(x - K)\n\ndef culc(N, K):\n if K == 1:\n print(0)\n return\n\n if N*2 == K:\n print(N)\n return\n\n x = N\n min = x\n while min >= x:\n print(min, x)\n min = x\n x = absdiff(x, K)\n\n print(min)\n return\n\n\nculc(N, K)\n", "N, K = map(int, input().split(' '))\n\ndef absdiff(x, K):\n return abs(x - K)\n\ndef culc(N, K):\n if K == 1:\n print(0)\n return\n\n x = N\n min = x\n while min > x:\n #print(min, x)\n min = x\n x = absdiff(x, K)\n\n print(min)\n return\n\n\nculc(N, K)\n", "N, K = map(int, input().split(' '))\n\ndef absdiff(x, K):\n return abs(x - K)\n\ndef culc(N, K):\n if K == 1:\n print(0)\n return\n\n if N*2 == K:\n print(N)\n return\n\n if N%K == 0:\n print(0)\n return\n\n x = N\n min = x\n while min >= x:\n print(min, x)\n min = x\n x = absdiff(x, K)\n\n print(min)\n return\n\n\nculc(N, K)\n", "N, K = map(int, input().split(' '))\n\ndef absdiff(x, K):\n return abs(x - K)\n\ndef culc(N, K):\n if K == 1:\n print(0)\n return\n\n if N*2 == K:\n print(N)\n return\n\n if N%K == 0:\n print(0)\n return\n\n x = N % K\n min = x\n while min >= x:\n #print(min, x)\n min = x\n x = absdiff(x, K)\n if min == 1:\n break\n\n print(min)\n return\n\n\nculc(N, K)\n"]
|
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s096782986', 's126946985', 's400512046', 's529556835', 's626267783', 's895843371', 's726497020']
|
[64500.0, 3060.0, 72180.0, 65652.0, 3060.0, 66036.0, 3064.0]
|
[2104.0, 17.0, 2104.0, 2103.0, 17.0, 2104.0, 17.0]
|
[428, 288, 392, 339, 289, 389, 433]
|
p02719
|
u330201623
| 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())\nm=a%b\nif b<m:\n m=b\nprint(m)', 'a,b=map(int,input().split())\nm=a%b\nif abs(b-m)<m:\n m=abs(b-m)\nprint(m)']
|
['Wrong Answer', 'Accepted']
|
['s976550873', 's568787968']
|
[2940.0, 2940.0]
|
[19.0, 17.0]
|
[59, 73]
|
p02719
|
u332253305
| 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 k==1 or n%k==0:\n ans=0\nelse:\n if k%2==0:\n ans=2\n if k%2==1:\n ans=1\nprint(ans)\n', 'n,k=map(int,input().split())\nif k==1 or n%k==0:\n ans=0\nelse:\n if n/2<k:\n x=abs(n-k)\n y=abs(x-k)\n ans=min(n,min(x,y))\n else:\n x=n%k\n y=abs(x-k)\n ans=min(x,y)\nprint(ans)\n']
|
['Wrong Answer', 'Accepted']
|
['s825592670', 's094401523']
|
[2940.0, 3060.0]
|
[17.0, 18.0]
|
[133, 219]
|
p02719
|
u337626942
| 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(input().split())\nprint(min(N%K, abs((N%K)-K)))', 'N, K=map(int, input().split())\nprint(min(N%K, abs((N%K)-K)))']
|
['Runtime Error', 'Accepted']
|
['s220780191', 's841247767']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[55, 60]
|
p02719
|
u339199690
| 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 = N % K\n\nif (N > abs(N - K)):\n N = abs(N - K)\nelse:\n print(N)\n break', 'N, K = map(int, input().split())\n\nN = N % K\n\nif (N > abs(N - K)):\n N = abs(N - K)\n\nprint(N)']
|
['Runtime Error', 'Accepted']
|
['s695871380', 's585565818']
|
[2940.0, 2940.0]
|
[17.0, 17.0]
|
[113, 94]
|
p02719
|
u341267151
| 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,n-n%k))', 'n,k=map(int,input().split())\nprint(min(n%k,k-n%k))']
|
['Wrong Answer', 'Accepted']
|
['s793800387', 's151690830']
|
[2940.0, 2940.0]
|
[18.0, 17.0]
|
[50, 50]
|
p02719
|
u341543478
| 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 k == 1:\n print(0)\n\nq, r = divmod(n, k)\n\nif q >= 1:\n if (n - q * k) > (k - r):\n print(q +1)\n else:\n print(q)\nelse:\n while n > abs(n - k):\n n = abs(n - k)\n print(n)', 'n, k = list(map(int, input().split()))\n\nif k == 1:\n print(0)\n\nq, r = divmod(n, k)\n\nif r == 0:\n print(0)\n exit()\n\nif q >= 1:\n if (n - q * k) > (k - r):\n print(q + 1)\n else:\n print(q)\nelse:\n if n < (k - r):\n print(n)\n else:\n print(k - r)\n', 'n, k = list(map(int, input().split()))\n\nq, r = divmod(n, k)\n\nif r == 0:\n print(0)\n exit()\n\nif q < 1:\n if n < (k - r):\n print(n)\n else:\n print(k - r)\n\nelse:\n s = n - q * k\n t = abs(s - k)\n if s < t:\n print(s)\n else:\n print(t)']
|
['Wrong Answer', 'Wrong Answer', 'Accepted']
|
['s044933556', 's837844863', 's405527284']
|
[3060.0, 3064.0, 3060.0]
|
[17.0, 17.0, 17.0]
|
[241, 285, 276]
|
p02719
|
u343454379
| 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\nfrom fractions import gcd\n\nif N%K==0:\n print(0)\nelse:\n print(gcd(N,K))', 'N,K=map(int,input().split())\n\nprint(min(N%K,K-(N%K)))']
|
['Wrong Answer', 'Accepted']
|
['s678309971', 's758046942']
|
[5688.0, 2940.0]
|
[229.0, 17.0]
|
[102, 53]
|
p02719
|
u343671593
| 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()))\nprint(N%K)', 'N,K = list(map(int,input().split()))\ndivisor = N//K\nif abs(N-(K*divisor)) < abs(N-(K*(divisor+1))):\n\tprint(abs(N-(K*divisor)))\nelse:\n\tprint(abs(N-(K*(divisor+1))))']
|
['Wrong Answer', 'Accepted']
|
['s952898027', 's226937458']
|
[2940.0, 3060.0]
|
[17.0, 17.0]
|
[47, 163]
|
p02719
|
u350093546
| 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\nwhile True:\n x=n\n n=abs(n-k)\n if x==n:\n break\n \n print (n)\n \n', 'n,k=map(int,input()split())\n\nwhile True:\n x=n\n n=abs(n-k)\n if x==n:\n break\n \n print n\n ', 'n,k=map(int,input().split())\na=n%k\nb=k-a\nprint(min(a,b))']
|
['Runtime Error', 'Runtime Error', 'Accepted']
|
['s002066886', 's217057705', 's897534180']
|
[8824.0, 8928.0, 9080.0]
|
[21.0, 20.0, 22.0]
|
[99, 96, 56]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.