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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03112 | u858670323 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['#!/usr/bin/python\n# coding: utf-8\nimport os\nfrom sys import stdin, stdout\n\nif(os.getenv(\'__LOCAL__\')):\n __dirname = os.path.dirname(__file__)\n __basename = os.path.splitext(os.path.basename(__file__))[0]\n __inputname = \'./input/\' + __basename + \'.txt\'\n __outputname = \'./output/\' + __basename + \'.txt\'\n __input_path = os.path.join(__dirname, __inputname)\n __output_path = os.path.join(__dirname, __outputname)\n stdin = open(__input_path)\n # stdout = open(__output_path, "w")\n\ndef main():\n A, B, Q = map(int, stdin.readline().rstrip().split(\' \'))\n s = list()\n t = list()\n s.append(-1e12)\n t.append(-1e12)\n s += [int(stdin.readline()) for _ in range(A)]\n t += [int(stdin.readline()) for _ in range(B)]\n X = [int(stdin.readline()) for _ in range(Q)]\n ansvec = list()\n s.append(1e12)\n t.append(1e12)\n stdout.write("{}\\n".format(s))\n stdout.write("{}\\n".format(t))\n stdout.write("{}\\n".format(X))\n for x in X:\n ls = 0\n rs = A+2\n lt = 0\n rt = B+2\n while(rs-ls>1):\n mids=(ls+rs)//2\n if(s[mids]<=x):\n ls = mids\n else:\n rs = mids\n\n while(rt-lt>1):\n midt=(lt+rt)//2\n if(t[midt]<=x):\n lt = midt\n else:\n rt = midt\n\n if(t[lt]<=s[ls] and s[rs]<=t[rt]):\n ans = min(abs(t[lt]-x),abs(t[rt]-x))\n elif(s[ls]<=t[lt] and t[rt]<=s[rs]):\n ans = min(abs(s[ls]-x),abs(s[rs]-x))\n elif(s[ls]<=t[lt] and s[rs]<=t[rt]):\n ans = min(abs(s[ls]-x),abs(t[rt]-x), 2*abs(s[rs]-x)+abs(t[lt]-x), 2*abs(t[lt]-x)+abs(s[rs]-x))\n elif(t[lt]<=s[ls] and t[rt]<=s[rs]):\n ans = min(abs(t[lt]-x),abs(s[rs]-x), 2*abs(s[ls]-x)+abs(t[rt]-x), 2*abs(t[rt]-x)+abs(s[ls]-x))\n ansvec.append(ans)\n\n for a in ansvec:\n stdout.write("{}\\n".format(a))\n\nif __name__ == "__main__":\n main()', '#!/usr/bin/python\n# coding: utf-8\nimport os\nfrom sys import stdin, stdout\n\nif(os.getenv(\'__LOCAL__\')):\n __dirname = os.path.dirname(__file__)\n __basename = os.path.splitext(os.path.basename(__file__))[0]\n __inputname = \'./input/\' + __basename + \'.txt\'\n __outputname = \'./output/\' + __basename + \'.txt\'\n __input_path = os.path.join(__dirname, __inputname)\n __output_path = os.path.join(__dirname, __outputname)\n stdin = open(__input_path)\n # stdout = open(__output_path, "w")\n\ndef main():\n A, B, Q = map(int, stdin.readline().rstrip().split(\' \'))\n s = list()\n t = list()\n s.append(-1e12)\n t.append(-1e12)\n s += [int(stdin.readline()) for _ in range(A)]\n t += [int(stdin.readline()) for _ in range(B)]\n X = [int(stdin.readline()) for _ in range(Q)]\n ansvec = list()\n s.append(1e12)\n t.append(1e12)\n # stdout.write("{}\\n".format(s))\n # stdout.write("{}\\n".format(t))\n # stdout.write("{}\\n".format(X))\n for x in X:\n ls = 0\n rs = A+2\n lt = 0\n rt = B+2\n while(rs-ls>1):\n mids=(ls+rs)//2\n if(s[mids]<=x):\n ls = mids\n else:\n rs = mids\n\n while(rt-lt>1):\n midt=(lt+rt)//2\n if(t[midt]<=x):\n lt = midt\n else:\n rt = midt\n\n if(t[lt]<=s[ls] and s[rs]<=t[rt]):\n ans = min(abs(t[lt]-x),abs(t[rt]-x))\n elif(s[ls]<=t[lt] and t[rt]<=s[rs]):\n ans = min(abs(s[ls]-x),abs(s[rs]-x))\n elif(s[ls]<=t[lt] and s[rs]<=t[rt]):\n ans = min(abs(s[ls]-x),abs(t[rt]-x), 2*abs(s[rs]-x)+abs(t[lt]-x), 2*abs(t[lt]-x)+abs(s[rs]-x))\n elif(t[lt]<=s[ls] and t[rt]<=s[rs]):\n ans = min(abs(t[lt]-x),abs(s[rs]-x), 2*abs(s[ls]-x)+abs(t[rt]-x), 2*abs(t[rt]-x)+abs(s[ls]-x))\n ansvec.append(ans)\n\n for a in ansvec:\n stdout.write("{}\\n".format(a))\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s728932517', 's194302510'] | [23964.0, 20224.0] | [1029.0, 949.0] | [1956, 1962] |
p03112 | u859897687 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['import bisect\n\nA,B,Q=map(int,input().split())\ninf = 10 ** 18\nS = [-inf] + [int(input()) for _ in range(A)] + [inf]\nT = [-inf] + [int(input()) for _ in range(B)] + [inf]\n\nfor q in range(Q):\n x = int(input())\n s_l = bisect.bisect_left(s,x)\n s_h = s_l + 1\n t_l = bisect.bisect_left(t,x)\n t_h = t_l + 1\n\n ans = inf\n for s in [s_l,s_h]:\n for t in [t_l,t_h]:\n d1 = abs(s-x)+abs(t-s)\n d2 = abs(t-x)+abs(s-t)\n ans = min(ans,d1,d2)\n \n print(ans)\n', 'import bisect\n\nA,B,Q=map(int,input().split())\ninf = 10 ** 18\nS = [-inf] + [int(input()) for _ in range(A)] + [inf]\nT = [-inf] + [int(input()) for _ in range(B)] + [inf]\n\nfor q in range(Q):\n x = int(input())\n s_l = bisect.bisect_left(s,x)\n s_h = s_l + 1\n t_l = bisect.bisect_left(t,x)\n t_h = t_l + 1\n\n ans = inf\n for s in [S[s_l],S[s_h]]:\n for t in [T[t_l],T[t_h]]:\n d1 = abs(s-x)+abs(t-s)\n d2 = abs(t-x)+abs(s-t)\n ans = min(ans,d1,d2)\n \n print(ans)\n', 'import bisect\n\nA,B,Q=map(int,input().split())\ninf = 10 ** 18\nS = [-inf] + [int(input()) for _ in range(A)] + [inf]\nT = [-inf] + [int(input()) for _ in range(B)] + [inf]\n\nfor q in range(Q):\n x = int(input())\n s_h = bisect.bisect(S,x)\n s_l = s_h - 1\n t_h = bisect.bisect(T,x)\n t_l = t_h - 1\n\n ans = inf\n for s in [S[s_l],S[s_h]]:\n for t in [T[t_l],T[t_h]]:\n d1 = abs(s-x)+abs(t-s)\n d2 = abs(t-x)+abs(s-t)\n ans = min(ans,d1,d2)\n \n print(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s272209631', 's417445547', 's247146841'] | [11664.0, 11664.0, 12800.0] | [326.0, 334.0, 1684.0] | [504, 516, 506] |
p03112 | u860649643 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['import sys\n\nA, B, Q = map(int, input().split())\nS = [int(sys.stdin.readline()) for _ in range(A)]\nT = [int(sys.stdin.readline()) for _ in range(B)]\nX = [int(sys.stdin.readline()) for _ in range(Q)]\nINF = 10**12\n\ndef binary_search(query, arr):\n arr = [-INF] + arr + [INF]\n low = 0\n high = len(arr)\n t = (low+high)//2\n for _ in range(100):\n if low<high-1:\n break\n if query>arr[t]:\n low = t\n else:\n high = t\n t = (low+high)//2\n return arr[low], arr[high]\n\ndef find(query):\n s1, s2 = binary_search(query, S)\n t1, t2 = binary_search(query, T)\n return s1, s2, t1, t2\n\ndef main():\n for x in X:\n s1, s2, t1, t2 = find(x)\n cands = [\n abs(t1-x) + abs(s2-t1),\n abs(s1-x) + abs(t2-s1),\n abs(s2-x) + abs(t1-s2),\n abs(t2-x) + abs(s1-t2),\n abs(t1-x) + abs(s1-t1),\n abs(s1-x) + abs(t1-s1),\n abs(s2-x) + abs(t2-s2),\n abs(t2-x) + abs(s2-t2)\n ]\n print(min(cands))\n return\n\nmain()', 'A, B, Q = map(int, input().split())\nINF = 10**12\nS = [-INF] + [int(input()) for _ in range(A)] + [INF]\nT = [-INF] + [int(input()) for _ in range(B)] + [INF]\nX = [int(input()) for _ in range(Q)]\n\n\ndef binary_search(query, arr):\n low = 0\n high = len(arr)\n while high-low>1:\n mid = (low+high)//2\n if query>arr[mid]:\n low = mid\n else:\n high = mid\n return arr[low], arr[high]\n\ndef main():\n for x in X:\n s1, s2 = binary_search(x, S)\n t1, t2 = binary_search(x, T)\n ans = [ abs(t-s)+min(abs(t-x), abs(s-x)) \\\n for t in [t1, t2] for s in [s1, s2] ]\n print(min(ans))\n return\n\nmain()'] | ['Runtime Error', 'Accepted'] | ['s413681331', 's727896722'] | [16564.0, 16256.0] | [164.0, 1591.0] | [1070, 672] |
p03112 | u864667985 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['def main():\n A, B, Q = list(map(int, input().split()))\n ss = [int(input()) for _ in range(A)]\n ts = [int(input()) for _ in range(B)]\n xs = [int(input()) for _ in range(Q)]\n \n for i, x in enumerate(xs):\n ss_diff = [(s-x) for s in ss]\n ts_diff = [(t-x) for t in ts]\n #print(ss_diff + ts_diff)\n p = x\n min1 = 1e10\n for a in (ss_diff + ts_diff):\n if abs(a) < min1:\n min1 = abs(a)\n p = a\n\n #print("p = ", p)\n if p in ss_diff:\n q = sorted([abs(p-t) for t in ts_diff])[0]\n \n else:\n q = sorted([abs(p-s) for s in ss_diff])[0]\n \n #ans.append(p+q)\n print(abs(p)+q)\n\n\nif __name__ == "__main__":\n main()\n', 'import bisect\n\n\ndef main():\n A, B, Q = map(int, input().split())\n INF = 10 ** 18\n s = [-INF] + [int(input()) for _ in range(A)] + [INF]\n t = [-INF] + [int(input()) for _ in range(B)] + [INF]\n for q in range(Q):\n x = int(input())\n b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)\n res = INF\n for S in [s[b-1], s[b]]:\n for T in [t[d-1], t[d]]:\n d1 = abs(S-x) + abs(T-S)\n d2 = abs(T-x) + abs(S-T)\n res = min(res, d1, d2)\n print(res)\n\n\nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s353516616', 's421895185'] | [30940.0, 12800.0] | [2105.0, 1547.0] | [818, 587] |
p03112 | u869519920 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['import bisect\n\na,b,q=map(int,input().split())\ns = []\nt = []\nfor i in range(a):\n s.append(int(input()))\nfor i in range(b):\n t.append(int(input()))\nfor _ in range(q):\n x = int(input())\n \n ans = [0,0,0]\n \n if x in s:\n sl = 0\n sr = 0\n else:\n i = bisect.bisect_left(s,x)\n if i == 0:\n sl = 100000000000\n else:\n sl = abs(s[i-1]-x)\n if i == a:\n sr = 100000000000\n else:\n sr = abs(s[i]-x)\n if x in t:\n tl = 0\n tr = 0\n else:\n i = bisect.bisect_left(t,x)\n if i == 0:\n tl = 100000000000\n else:\n tl = abs(t[i-1]-x)\n if i == b:\n tr = 100000000000\n else:\n tr = abs(t[i]-x)\n ans[0] = max(tl,sl)\n ans[1] = max(tr,sr)\n ans[2] = min(2*tl+sr,2*sl+tr)\n print(min(ans))', 'import bisect\n\na,b,q=map(int,input().split())\ns = []\nt = []\nfor i in range(a):\n s.append(int(input()))\nfor i in range(b):\n t.append(int(input()))\nfor _ in range(q):\n x = int(input())\n \n ans = [0,0,0]\n \n i = bisect.bisect_left(s,x)\n if i == 0:\n sl = 100000000000\n else:\n sl = abs(s[i-1]-x)\n if i == a:\n sr = 100000000000\n else:\n sr = abs(s[i]-x)\n i = bisect.bisect_left(t,x)\n if i == 0:\n tl = 100000000000\n else:\n tl = abs(t[i-1]-x)\n if i == b:\n tr = 100000000000\n else:\n tr = abs(t[i]-x)\n ans[0] = max(tl,sl)\n ans[1] = max(tr,sr)\n ans[2] = min(2*tl+sr,2*sl+tr,2*sr+tl,2*tr+sl)\n print(min(ans))'] | ['Wrong Answer', 'Accepted'] | ['s120187751', 's271049208'] | [17116.0, 16736.0] | [2206.0, 963.0] | [743, 637] |
p03112 | u879870653 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['from bisect import bisect_left, bisect_right\n\nA,B,Q = map(int,input().split())\nS = sorted(list(int(input()) for i in range(A)))\nT = sorted(list(int(input()) for i in range(B)))\nX = list(int(input()) for i in range(Q))\n\n\nfor i in range(len(X)) :\n calc1 = float("inf")\n calc2 = float("inf")\n calc3 = float("inf")\n calc4 = float("inf")\n \n ind_s_left = bisect_left(S,X[i])\n ind_t_left = bisect_left(T,X[i])\n ind_s_right = bisect_right(S,X[i])\n ind_t_right = bisect_right(T,X[i])\n \n \n res = []\n \n try :\n c1 = X[i] - min(S[ind_s_right], T[ind_t_right])\n res.append(c1)\n except IndexError :\n continue\n \n try :\n c2 = max(S[ind_s_left], T[ind_t_right]) - X[i]\n res.append(c2)\n except IndexError :\n continue\n\n try :\n c3 = abs(S[ind_s_left] - T[ind_t_right])\n c3 += min(abs(X[i] - S[ind_s_left]), abs(X[i] - T[ind_t_right]))\n \n except IndexError :\n continue\n \n \n try :\n c4 = abs(T[ind_t_left] - S[ind_s_right])\n c4 += min(abs(X[i] - T[ind_t_left]), abs(X[i] - S[ind_s_right]))\n except IndexError :\n continue\n print(min(res))\n ', 'import bisect\n\nA,B,Q = map(int,input().split())\nINF = 10**12\nS = [-INF]+[int(input()) for i in range(A)]+[INF]\nT = [-INF]+[int(input()) for i in range(B)]+[INF]\nfor i in range(Q) :\n x = int(input())\n \n right_s = S[bisect.bisect_right(S,x)]\n right_t = T[bisect.bisect_right(T,x)]\n left_s = S[bisect.bisect_right(S,x) - 1]\n left_t = T[bisect.bisect_right(T,x) - 1]\n \n dist = []\n \n for i in [left_s,right_s] :\n for j in [left_t,right_t] :\n d = min(abs(x-i), abs(x-j)) + abs(i-j)\n dist.append(d)\n ans = min(dist)\n \n print(ans)\n '] | ['Wrong Answer', 'Accepted'] | ['s139876824', 's006409770'] | [16436.0, 12804.0] | [1334.0, 1890.0] | [1186, 595] |
p03112 | u888337853 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ["import sys\nimport re\nimport math\nimport collections\nimport bisect\nimport itertools\nimport fractions\nimport functools\nimport copy\nimport heapq\nimport decimal\nimport statistics\nimport queue\n\n# import numpy as np\n\nsys.setrecursionlimit(10 ** 9)\nINF = 10 ** 16\nMOD = 10 ** 9 + 7\n# MOD = 998244353\n\nni = lambda: int(sys.stdin.readline())\nns = lambda: map(int, sys.stdin.readline().split())\nna = lambda: list(map(int, sys.stdin.readline().split()))\nna1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))\n\n\n# ===CODE===\n\ndef disLR(a, idx):\n small = a[max(0, idx - 1)]\n large = a[min(len(a) - 1, idx)]\n return small, large\n\n\ndef main():\n a, b, q = ns()\n s = [ni() for _ in range(a)]\n t = [ni() for _ in range(b)]\n\n for _ in range(q):\n ans = INF\n\n x = ni()\n\n idxs = bisect.bisect_left(s, x)\n a1 = [disLR(s, idxs)]\n\n idxt = bisect.bisect_left(t, x)\n a2 = [disLR(t, idxt)]\n\n for ta1 in a1:\n for ta2 in a2:\n tmp1 = abs(x - a1) + abs(a2 - a1)\n tmp2 = abs(x - a2) + abs(a1 - a2)\n ans = min(ans, tmp1, tmp2)\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "import sys\nimport re\nimport math\nimport collections\nimport bisect\nimport itertools\nimport fractions\nimport functools\nimport copy\nimport heapq\nimport decimal\nimport statistics\nimport queue\n\n# import numpy as np\n\nsys.setrecursionlimit(10 ** 9)\nINF = 10 ** 16\nMOD = 10 ** 9 + 7\n# MOD = 998244353\n\nni = lambda: int(sys.stdin.readline())\nns = lambda: map(int, sys.stdin.readline().split())\nna = lambda: list(map(int, sys.stdin.readline().split()))\nna1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))\n\n\n# ===CODE===\n\n\n\ndef main():\n a, b, q = ns()\n s = [ni() for _ in range(a)]\n t = [ni() for _ in range(b)]\n\n def disLR(a, idx):\n small = a[max(0, idx - 1)]\n large = a[min(len(a) - 1, idx)]\n return [small, large]\n\n for _ in range(q):\n ans = INF\n\n x = ni()\n\n idxs = bisect.bisect_left(s, x)\n a1 = disLR(s, idxs)\n\n idxt = bisect.bisect_left(t, x)\n a2 = disLR(t, idxt)\n\n for ta1 in a1:\n for ta2 in a2:\n tmp1 = abs(x - ta1) + abs(ta2 - ta1)\n tmp2 = abs(x - ta2) + abs(ta1 - ta2)\n ans = min(ans, tmp1, tmp2)\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Accepted'] | ['s608475575', 's815327960'] | [19020.0, 19164.0] | [101.0, 575.0] | [1200, 1221] |
p03112 | u896741788 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['jin,ter,q=map(int,input().split())\njil,tel=[-float("INF")]+[int(input()) for i in range(jin)]+[float("INF")],[-float("INF")]+[int(input()) for i in range(ter)]+[float("INF")]\nfrom bisect import bisect_left as bl\nfor _ in range(q):\n x=int(input())\n ans=float("INF")\n b,d=bl(jil,x),bl(tel,x)\n for s in jil[b:b+2]:\n for t in tel[d:d+2]:\n ans=min(min(abs(x-s),abs(t-x))+abs(t-s),ans)\n print(ans)', 'jin,ter,q=map(int,input().split())\nINF=10**19\njil,tel=[-INF]+[int(input()) for i in range(jin)]+[INF],[-INF]+[int(input()) for i in range(ter)]+[INF]\nfrom bisect import bisect_right as bl\nfor _ in range(q):\n x=int(input())\n ans=INF\n b,d=bl(jil,x),bl(tel,x)\n for s in jil[b-1:b+1]:\n for t in tel[d-1:d+1]:\n ans=min(min(abs(x-s),abs(t-x))+abs(t-s),ans)\n print(ans)'] | ['Wrong Answer', 'Accepted'] | ['s892622392', 's142551243'] | [12792.0, 13848.0] | [1823.0, 1755.0] | [424, 395] |
p03112 | u903596281 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['A,B,Q=map(int,input().split())\ns=[]\nt=[]\nfor i in range(A):\n s.append(int(input()))\nfor i in range(B):\n t.append(int(input()))\nfor i in range(Q):\n x=int(input())\n s1=s[:]\n s1.append(x)\n s1.sort()\n j=s1.index(x)\n if j==0:\n kouhoA=[s[j]]\n else:\n kouhoA=[s[j],s[j-1]]\n t1=t[:]\n t1.append(x)\n t1.sort()\n k=t1.index(x)\n if k==0:\n kouhoB=[t[k]]\n else:\n kouhoB=[t[k],t[k-1]]\n if j==0:\n \n if k==0:\n a=abs(kouhoA[0]-kouhoB[0])\n ans=min([abs(x-kouhoA[0])+a,abs(x-kouhoB[0])+a])\n else:\n u=abs(x-kouhoA[0])\n a=abs(kouhoA[0]-kouhoB[0])\n b=abs(kouhoA[0]-kouhoB[1])\n ans=min([u+a,abs(x-kouhoB[0])+a,u+b,abs(x-kouhoB[1])+b])\n else:\n if k==0:\n a=abs(kouhoA[0]-kouhoB[0])\n c=abs(kouhoB[0]-kouhoA[1])\n v=abs(x-kouhoB[0])\n ans=min([abs(x-kouhoA[0])+a,v+a,abs(x-kouhoA[1])+c,v+c])\n else:\n u=abs(x-kouhoA[0])\n a=abs(kouhoA[0]-kouhoB[0])\n b=abs(kouhoA[0]-kouhoB[1])\n c=abs(kouhoB[0]-kouhoA[1])\n d=abs(kouhoA[1]-kouhoB[1])\n v=abs(x-kouhoB[0])\n w=abs(x-kouhoA[1])\n y=abs(x-kouhoB[1])\n ans=min([u+a,v+a,w+d,y+d,w+c,v+c,u+b,y+b])\n print(ans)\n', 'A,B,Q=map(int,input().split())\ns=[]\nt=[]\nfor i in range(A):\n s.append(int(input()))\nfor i in range(B):\n t.append(int(input()))\nfor i in range(Q):\n x=int(input())\n s1=s[:]\n s1.append(x)\n j=s1.index(x)\n if j==0:\n kouhoA=[s[j]]\n elif j==A:\n kouhoA=[s[j-1]]\n else:\n kouhoA=[s[j],s[j-1]]\n t1=t[:]\n t1.append(x)\n t1.sort()\n k=t1.index(x)\n if k==0:\n kouhoB=[t[k]]\n elif k==B:\n kouhoB=[t[k-1]]\n else:\n kouhoB=[t[k],t[k-1]]\n if len(kouhoA)==1:\n if len(kouhoB)==1:\n ans=min([abs(x-kouhoA[0])+abs(kouhoA[0]-kouhoB[0]),abs(x-kouhoB[0])+abs(kouhoB[0]-kouhoA[0])])\n else:\n ans=min([abs(x-kouhoA[0])+abs(kouhoA[0]-kouhoB[0]),abs(x-kouhoB[0])+abs(kouhoB[0]-kouhoA[0]),abs(x-kouhoA[0])+abs(kouhoA[0]-kouhoB[1]),abs(x-kouhoB[1])+abs(kouhoB[1]-kouhoA[0])])\n else:\n if len(kouhoB)==1:\n ans=min([abs(x-kouhoA[0])+abs(kouhoA[0]-kouhoB[0]),abs(x-kouhoB[0])+abs(kouhoB[0]-kouhoA[0]),abs(x-kouhoA[1])+abs(kouhoA[1]-kouhoB[0]),abs(x-kouhoB[0])+abs(kouhoB[0]-kouhoA[1])])\n else:\n ans=min([abs(x-kouhoA[0])+abs(kouhoA[0]-kouhoB[0]),abs(x-kouhoB[0])+abs(kouhoB[0]-kouhoA[0]),abs(x-kouhoA[1])+abs(kouhoA[1]-kouhoB[1]),abs(x-kouhoB[1])+abs(kouhoB[1]-kouhoA[1]),abs(x-kouhoA[1])+abs(kouhoA[1]-kouhoB[0]),abs(x-kouhoB[0])+abs(kouhoB[0]-kouhoA[1]),abs(x-kouhoA[0])+abs(kouhoA[0]-kouhoB[1]),abs(x-kouhoB[1])+abs(kouhoB[1]-kouhoA[0])])\n print(ans)\n', 'import bisect\nA,B,Q=map(int,input().split())\ns=[]\nt=[]\nfor i in range(A):\n s.append(int(input()))\nfor i in range(B):\n t.append(int(input()))\nfor i in range(Q):\n x=int(input())\n j=bisect.bisect_left(s,x)\n if j==0:\n kouhoA=[s[j]]\n elif j==A:\n kouhoA=[s[j-1]]\n else:\n kouhoA=[s[j],s[j-1]]\n k=bisect.bisect_left(t,x)\n if k==0:\n kouhoB=[t[k]]\n elif k==B:\n kouhoB=[t[k-1]]\n else:\n kouhoB=[t[k],t[k-1]]\n if len(kouhoA)==1:\n \n if len(kouhoB)==1:\n a=abs(kouhoA[0]-kouhoB[0])\n ans=min([abs(x-kouhoA[0])+a,abs(x-kouhoB[0])+a])\n else:\n u=abs(x-kouhoA[0])\n a=abs(kouhoA[0]-kouhoB[0])\n b=abs(kouhoA[0]-kouhoB[1])\n ans=min([u+a,abs(x-kouhoB[0])+a,u+b,abs(x-kouhoB[1])+b])\n else:\n if len(kouhoB)==1:\n a=abs(kouhoA[0]-kouhoB[0])\n c=abs(kouhoB[0]-kouhoA[1])\n v=abs(x-kouhoB[0])\n ans=min([abs(x-kouhoA[0])+a,v+a,abs(x-kouhoA[1])+c,v+c])\n else:\n u=abs(x-kouhoA[0])\n a=abs(kouhoA[0]-kouhoB[0])\n b=abs(kouhoA[0]-kouhoB[1])\n c=abs(kouhoB[0]-kouhoA[1])\n d=abs(kouhoA[1]-kouhoB[1])\n v=abs(x-kouhoB[0])\n w=abs(x-kouhoA[1])\n y=abs(x-kouhoB[1])\n ans=min([u+a,v+a,w+d,y+d,w+c,v+c,u+b,y+b])\n print(ans)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s591923480', 's837772194', 's309881094'] | [15392.0, 13460.0, 12112.0] | [2104.0, 2104.0, 1594.0] | [1155, 1381, 1215] |
p03112 | u918009437 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ["if __name__ == '__main__':\n A, B, Q = map(int, input().split())\n\n s_list = [int(input()) for i in range(A)]\n t_list = [int(input()) for i in range(B)]\n x_list = [int(input()) for i in range(Q)]\n\n for xi in x_list:\n distance_ti_right_xi = [ti-xi for ti in t_list if ti >= xi]\n distance_ti_left_xi = [xi-ti for ti in t_list if ti <= xi]\n distance_si_right_xi = [si-xi for si in s_list if si >= xi]\n distance_si_left_xi = [xi-si for si in s_list if si <= xi]\n \n first_move = min(distance_si_left_xi, distance_si_right_xi, distance_ti_left_xi, distance_ti_right_xi)\n if first_move == distance_ti_left_xi or first_move == distance_si_left_xi:\n first_move = -1 * first_move\n xi += first_move\n\n if abs(first_move) == distance_si_left_xi or abs(first_move) == distance_si_right_xi:\n distance_ti_right_xi = [ti-xi for ti in t_list if ti >= xi]\n distance_ti_left_xi = [xi-ti for ti in t_list if ti <= xi]\n second_move = min(distance_ti_left_xi, distance_ti_right_xi)\n\n if abs(first_move) == distance_ti_left_xi or abs(first_move) == distance_ti_right_xi:\n distance_si_right_xi = [si-xi for si in s_list if si >= xi]\n distance_si_left_xi = [xi-si for si in s_list if si <= xi]\n second_move = min(distance_si_left_xi, distance_si_right_xi)\n answer = abs(first_move) + abs(second_move)\n print(answer)", "import bisect\nimport itertools\nimport sys\n\n\ndef most_simRL(ds, x):\n index = bisect.bisect_left(ds, x)\n if index == 0:\n return [ds[0]]\n elif index == len(ds):\n return [ds[-1]]\n return ds[index-1:index+1]\n\nif __name__ == '__main__':\n A, B, Q = map(int, input().split())\n\n\n s_list = [-sys.maxsize] + [int(input()) for i in range(A)] + [sys.maxsize]\n t_list = [-sys.maxsize] + [int(input()) for i in range(B)] + [sys.maxsize]\n x_list = [int(input()) for i in range(Q)]\n\n\n for xi in x_list:\n s_RL = most_simRL(s_list, xi)\n t_RL = most_simRL(t_list, xi)\n\n answer = sys.maxsize\n\n for a, b in itertools.product(s_RL, t_RL):\n answer = min(answer, min(abs(xi-a), abs(xi-b)) + abs(a-b))\n\n print(answer)"] | ['Runtime Error', 'Accepted'] | ['s602660029', 's376942020'] | [22992.0, 16144.0] | [560.0, 1205.0] | [1463, 778] |
p03112 | u923105140 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['import bisect\nA, B, Q = map(int, input().split())\nINF = 10 ** 18\ns = [-INF] + [int(input()) for i in range(A)] + [INF]\nt = [-INF] + [int(input()) for i in range(B)] + [INF]\n\nfor q in range(Q):\n x = int(input())\n b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)\n res = INF\n for S in [s[b - 1], s[b]]:\n for T in [t[d - 1], t[d]]:\n d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)\n res = min(res, d1, d2)\n print(res)', 'import bisect\nA, B, Q = map(int, input().split())\nINF = 10 ** 18\ns = [-INF] + [int(input()) for i in range(A)] + [INF]\nt = [-INF] + [int(input()) for i in range(B)] + [INF]\n\nfor q in range(Q):\n x = int(input())\n b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)\n res = INF\n for S in [s[b - 1], s[b]]:\n for T in [t[d - 1], t[d]]:\n d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)\n res = min(res, d1, d2)\n print(res)'] | ['Wrong Answer', 'Accepted'] | ['s498907272', 's918742089'] | [15744.0, 12812.0] | [1820.0, 1694.0] | [481, 477] |
p03112 | u932465688 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['import bisect\nA,B,Q = map(int,input().split())\na = []\nb = []\nx = []\nfor i in range(A):\n a.append(int(input()))\nfor j in range(B):\n b.append(int(input()))\nfor k in range(Q):\n x.append(int(input()))\nfor k in range(Q): \n terafirst = 0\n jinjyafirst = 0\n p = bisect.bisect_left(a,x[k])\n q = bisect.bisect_left(b,x[k])\n if A > p >= 1:\n terafirst = min(abs(x[k]-a[p-1]),abs(x[k]-a[p]))\n if abs(x[k]-a[p-1])<abs(x[k]-a[p]):\n r = bisect.bisect_left(b,a[p-1])\n if B > r >= 1: \n terafirst += min(abs(b[r-1]-a[p-1]),abs(b[r]-a[p-1]))\n elif r == 0:\n terafirst += abs(b[0]-a[p-1])\n elif r == B:\n terafirst += abs(b[B-1]-a[p-1])\n else:\n s = bisect.bisect_left(b,a[p])\n if B > s >= 1:\n terafirst += min(abs(b[s-1]-a[p]),abs(b[s]-a[p]))\n elif s == 0:\n terafirst += abs(b[0]-a[p])\n elif s == B:\n terafirst += abs(b[B-1]-a[p])\n elif p == 0:\n terafirst = abs(x[k]-a[0])\n tikai1 = bisect.bisect_left(b,a[0])\n if B > tikai1 >= 1:\n terafirst += min(abs(b[tikai1-1]-a[0]),abs(b[tikai1]-a[0]))\n elif tikai1 == 0:\n terafirst += abs(b[0]-a[0])\n elif tikai1 == B:\n terafirst += abs(b[B-1]-a[0])\n else:\n terafirst = abs(x[k]-a[p-1])\n tikai2 = bisect.bisect_left(b,a[p-1])\n if B > tikai2 >= 1:\n terafirst += min(abs(b[tikai2-1]-a[p-1]),abs(b[tikai2]-a[p-1]))\n elif tikai2 == 0:\n terafirst += abs(b[0]-a[p-1])\n elif tikai2 == B:\n terafirst += abs(b[B-1]-a[p-1])\n \n if B > q >= 1:\n jinjyafirst = min(abs(x[k]-b[q-1]),abs(x[k]-b[q]))\n if abs(x[k]-b[q-1])<abs(x[k]-b[q]):\n t = bisect.bisect_left(a,b[p-1])\n if A > t >= 1: \n jinjyafirst += min(abs(a[t-1]-b[q-1]),abs(a[t]-b[q-1]))\n elif t == 0:\n jinjyafirst += abs(a[0]-b[q-1])\n elif t == B:\n jinjyafirst += abs(a[A-1]-b[q-1])\n else:\n u = bisect.bisect_left(a,b[q])\n if A > u >= 1:\n jinjyafirst += min(abs(a[u-1]-b[q]),abs(a[u]-b[q]))\n elif u == 0:\n jinjyafirst += abs(a[0]-b[q])\n elif u == B:\n jinjyafirst += abs(a[A-1]-b[q])\n elif q == 0:\n jinjyafirst = abs(x[k]-b[0])\n tikai3 = bisect.bisect_left(a,b[0])\n if A > tikai3 >= 1:\n jinjyafirst += min(abs(a[tikai3-1]-b[0]),abs(a[tikai3]-b[0]))\n elif tikai3 == 0:\n jinjyafirst += abs(a[0]-b[0])\n elif tikai3 == A:\n jinjyafirst += abs(a[A-1]-b[0])\n else:\n jinjyafirst = abs(x[k]-b[q-1])\n tikai4 = bisect.bisect_left(a,b[q-1])\n if A > tikai4 >= 1:\n jinjyafirst += min(abs(a[tikai4-1]-b[q-1]),abs(a[tikai4]-b[q-1]))\n elif tikai4 == 0:\n jinjyafirst += abs(a[0]-b[q-1])\n elif tikai4 == A:\n jinjyafirst += abs(a[A-1]-b[q-1])\n print(min(terafirst,jinjyafirst))', 'import bisect\nA,B,Q = map(int,input().split())\na = []\nb = []\nx = []\nfor i in range(A):\n a.append(int(input()))\nfor j in range(B):\n b.append(int(input()))\nfor k in range(Q):\n x.append(int(input()))\na.insert(0,-(10**15))\na.append(10**15)\nb.insert(0,-(10**15))\nb.append(10**15)\nfor k in range(Q): \n p = bisect.bisect_left(a,x[k])\n q = bisect.bisect_left(b,x[k])\n teraleft_right = [a[p-1],a[p]]\n jinjyaleft_right = [b[q-1],b[q]]\n minlist = []\n for i in range(2):\n for j in range(2):\n minlist.append(abs(x[k]-teraleft_right[i])+abs(teraleft_right[i]-jinjyaleft_right[j]))\n minlist.append(abs(x[k]-jinjyaleft_right[i])+abs(jinjyaleft_right[i]-teraleft_right[j]))\n minlist.sort() \n print(minlist[0])'] | ['Wrong Answer', 'Accepted'] | ['s109410016', 's306429555'] | [16224.0, 16144.0] | [1344.0, 1445.0] | [2737, 717] |
p03112 | u938812966 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | [' from bisect import bisect\n A,B,Q=map(int, input().split())\n s=[int(input()) for _ in range(A)] + [99**99]\n t=[int(input()) for _ in range(B)] + [99**99]\n snt=[0]*A + [99**99]\n tns=[0]*B + [99**99]\n for i in range(A):\n \tp = bisect(t, s[i])\n \tsnt[i] = min(abs(s[i] - t[p-1]), abs(s[i] - t[p]))\n for i in range(B):\n \tp = bisect(s, t[i])\n \ttns[i] = min(abs(t[i] - s[p-1]), abs(t[i] - s[p]))\n for _ in range(Q):\n \tx = int(input())\n \tans = []\n \tp = bisect(s, x)\n \tans.append(abs(s[p] - x) + snt[p])\n \tans.append(abs(s[p-1] - x) + snt[p-1])\n \tp = bisect(t, x)\n \tans.append(abs(t[p] - x) + tns[p])\n \tans.append(abs(t[p-1] - x) + tns[p-1])\n \tprint(min(ans))', 'from bisect import bisect\nA,B,Q=map(int, input().split())\ns=[int(input()) for _ in range(A)] + [99**99]\nt=[int(input()) for _ in range(B)] + [99**99]\nsnt=[0]*A + [99**99]\ntns=[0]*B + [99**99]\nfor i in range(A):\n\tp = bisect(t, s[i])\n\tsnt[i] = min(abs(s[i] - t[p-1]), abs(s[i] - t[p]))\nfor i in range(B):\n\tp = bisect(s, t[i])\n\ttns[i] = min(abs(t[i] - s[p-1]), abs(t[i] - s[p]))\nfor _ in range(Q):\n\tx = int(input())\n\tans = []\n\tp = bisect(s, x)\n\tans.append(abs(s[p] - x) + snt[p])\n\tans.append(abs(s[p-1] - x) + snt[p-1])\n\tp = bisect(t, x)\n\tans.append(abs(t[p] - x) + tns[p])\n\tans.append(abs(t[p-1] - x) + tns[p-1])\n\tprint(min(ans))'] | ['Runtime Error', 'Accepted'] | ['s907373674', 's449026931'] | [2940.0, 20728.0] | [17.0, 1702.0] | [715, 627] |
p03112 | u955251526 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['import bisect\na, b, q = map(int, input().split())\ns = [int(input()) for _ in range(a)]\nt = [int(input()) for _ in range(b)]\nx = [int(input()) for _ in range(q)]\nprint(s, t, x)\nfor i in x:\n si = bisect.bisect_left(s,i)\n ti = bisect.bisect_left(t,i)\n sl = 100000000000 if si == 0 else i - s[si-1]\n sr = 100000000000 if si == a else s[si] - i\n tl = 100000000000 if ti == 0 else i - t[ti-1]\n tr = 100000000000 if ti == b else t[ti] - i\n print(min(max(sl,tl), max(sr,tr), max(sl,tr) + min(sl, tr)*2, max(sr,tl) + min(sr,tl)*2))\n', 'import bisect\na, b, q = map(int, input().split())\ns = [int(input()) for _ in range(a)]\nt = [int(input()) for _ in range(b)]\nx = [int(input()) for _ in range(q)]\nfor i in x:\n si = bisect.bisect_left(s,i)\n ti = bisect.bisect_left(t,i)\n sl = 100000000000 if si == 0 else i - s[si-1]\n sr = 100000000000 if si == a else s[si] - i\n tl = 100000000000 if ti == 0 else i - t[ti-1]\n tr = 100000000000 if ti == b else t[ti] - i\n print(min(max(sl,tl), max(sr,tr), max(sl,tr) + min(sl, tr)*2, max(sr,tl) + min(sr,tl)*2))\n'] | ['Wrong Answer', 'Accepted'] | ['s836997917', 's621173611'] | [21888.0, 17956.0] | [963.0, 954.0] | [544, 529] |
p03112 | u968846084 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['import bisect\na,b,q=map(int,input().split())\nA=[-10**11]\nfor i in range(a):\n A.append(int(input()))\nA.append(10**11)\nprint(A)\nB=[-10**11]\nfor i in range(b):\n B.append(int(input()))\nB.append(10**11)\nfor i in range(q):\n x=int(input())\n c=bisect.bisect_left(A,x,hi=len(A))\n print(c)\n d=bisect.bisect_left(B,x,hi=len(B))\n ans=min(abs(A[c-1]-x)+abs(B[d-1]-A[c-1]),abs(A[c-1]-x)+abs(B[d]-A[c-1]),abs(A[c]-x)+abs(B[d-1]-A[c]),abs(A[c]-x)+abs(B[d]-A[c]),abs(B[d-1]-x)+abs(B[d-1]-A[c-1]),abs(B[d-1]-x)+abs(B[d-1]-A[c]),abs(B[d]-x)+abs(B[d]-A[c-1]),abs(B[d]-x)+abs(B[d]-A[c]))\n print(ans)', 'import bisect\na,b,q=map(int,input().split())\nA=[-10**11]\nfor i in range(a):\n A.append(int(input()))\nA.append(10**11)\nB=[-10**11]\nfor i in range(b):\n B.append(int(input()))\nB.append(10**11)\nfor i in range(q):\n x=int(input())\n c=bisect.bisect_left(A,x,hi=len(A))\n d=bisect.bisect_left(B,x,hi=len(B))\n ans=min(abs(A[c-1]-x)+abs(B[d-1]-A[c-1]),abs(A[c-1]-x)+abs(B[d]-A[c-1]),abs(A[c]-x)+abs(B[d-1]-A[c]),abs(A[c]-x)+abs(B[d]-A[c]),abs(B[d-1]-x)+abs(B[d-1]-A[c-1]),abs(B[d-1]-x)+abs(B[d-1]-A[c]),abs(B[d]-x)+abs(B[d]-A[c-1]),abs(B[d]-x)+abs(B[d]-A[c]))\n print(ans)'] | ['Wrong Answer', 'Accepted'] | ['s797078739', 's813356794'] | [14352.0, 13364.0] | [1975.0, 1893.0] | [586, 566] |
p03112 | u969190727 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['import bisect\na,b,q=map(int,input().split())\nS,T=[],[]\nfor i in range(a):\n S.append(int(input()))\nfor i in range(b):\n T.append(int(input()))\ndef f(list,n):\n if n<list[0]:\n return [-float("inf"),list[0]]\n elif list[-1]<n:\n return [list[-1],float("inf")]\n else:\n i=bisect.bisect_left(list,n)\n return [list[i],list[i+1]]\ndef g(SS,TT,x):\n a,b,c,d=x-SS[0],SS[1]-x,x-TT[0],TT[1]-x\n dis1=max(a,c)\n dis2=min(2*a+d,2*d+a)\n dis3=max(b,d)\n dis4=min(2*b+c,2*c+b)\n return min([dis1,dis2,dis3,dis4])\nfor i in range(q):\n x=int(input())\n print(g(f(S,x),f(T,x),x))', 'import bisect\nimport sys\ninput = sys.stdin.readline\na,b,q=map(int,input().split())\nS,T=[],[]\nfor i in range(a):\n S.append(int(input()))\nfor i in range(b):\n T.append(int(input()))\ndef f(list,n):\n if n<list[0]:\n return [-float("inf"),list[0]]\n elif list[-1]<n:\n return [list[-1],float("inf")]\n else:\n i=bisect.bisect_left(list,n)\n return [list[i-1],list[i]]\ndef g(SS,TT,x):\n a,b,c,d=x-SS[0],SS[1]-x,x-TT[0],TT[1]-x\n dis1=max(a,c)\n dis2=min(2*a+d,2*d+a)\n dis3=max(b,d)\n dis4=min(2*b+c,2*c+b)\n return min([dis1,dis2,dis3,dis4])\nfor i in range(q):\n x=int(input())\n print(g(f(S,x),f(T,x),x))'] | ['Runtime Error', 'Accepted'] | ['s098007805', 's241686984'] | [12208.0, 12188.0] | [1612.0, 735.0] | [572, 610] |
p03112 | u970197315 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['#ABC119 D - Lazy Faith\nfrom bisect import bisect_left,bisect_right\nsi = lambda: input()\nni = lambda: int(input())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\n\na,b,q = map(int, input().split())\nINF = 10**11\nS = [-INF]+[int(input()) for _ in range(a)]+[INF]\nT = [-INF]+[int(input()) for _ in range(b)]+[INF]\nX = [int(input()) for _ in range(q)]\n\nfor i in range(q):\n idx_s = bisect_left(S,X[i])\n idx_t = bisect_left(T,X[i])\n ans = INF\n for s in [S[idx_s-1],S[idx_s]]:\n for t in [T[idx_s-1],T[idx_s]]:\n d1,d2 = abs(s-X[i])+abs(s-t),abs(t-X[i])+abs(t-s)\n ans = min(ans,d1,d2)\n print(ans)\n', 'uwaaaaaaaaaaaaaaaaaaaaaa', 'a,b,q = map(int, input().split())\ninf=10**18\ns=[-inf]+[int(input()) for _ in range(a)]+[inf]\nt=[-inf]+[int(input()) for _ in range(b)]+[inf]\nx=[int(input()) for _ in range(q)]\nfrom bisect import bisect_left,bisect_right\nfor i in range(q):\n idx_s=bisect_right(s,x[i])\n idx_t=bisect_right(t,x[i])\n ans=inf\n for ss in [s[idx_s-1],s[idx_s]]:\n for tt in [t[idx_t-1],t[idx_t]]:\n d1,d2=abs(ss-x[i])+abs(ss-tt),abs(tt-x[i])+abs(tt-ss)\n ans=min(ans,d1,d2)\n print(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s626427758', 's698522092', 's225090737'] | [16144.0, 2940.0, 16132.0] | [1203.0, 17.0, 1212.0] | [667, 24, 502] |
p03112 | u977389981 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['import bisect\n\na, b, q = map(int, input().split())\nS = [int(input()) for i in range(a)]\nT = [int(input()) for i in range(b)]\nX = [int(input()) for i in range(q)]\n\nfor i in range(q):\n id = bisect.bisect_left(S, X[i])\n if id == 0:\n s = S[id]\n elif id == len(S):\n s = S[id - 1]\n else:\n if abs(X[i] - S[id]) < abs(X[i] - S[id - 1]):\n s = S[id]\n else:\n s = S[id - 1]\n \n id2 = bisect.bisect_left(T, X[i])\n if id2 == 0:\n t = T[id2]\n elif id2 == len(T):\n t = T[id2 - 1]\n else:\n if abs(X[i] - T[id2]) < abs(X[i] - T[id2 - 1]):\n t = T[id2]\n else:\n t = T[id2 - 1]\n \n if abs(X[i] - s) < abs(X[i] - t):\n ans = abs(X[i] - s)\n id3 = bisect.bisect_left(T, s)\n if id3 == 0:\n ans += abs(s - T[id3])\n elif id3 == len(T):\n ans += abs(s - T[id3 -1])\n else:\n if abs(s - T[id3]) < abs(s - T[id3 - 1]):\n ans += abs(s - T[id3])\n else:\n ans += abs(s - T[id3 -1])\n \n elif abs(X[i] - s) > abs(X[i] - t):\n ans = abs(X[i] - t)\n id4 = bisect.bisect_left(S, t)\n if id4 == 0:\n ans += abs(t - S[id4])\n elif id4 == len(S):\n ans += abs(t - S[id4 -1])\n else:\n if abs(t - S[id4]) < abs(t - S[id4 - 1]):\n ans += abs(t - S[id4])\n else:\n ans += abs(t - S[id4 -1])\n \n print(ans)', "import bisect\na, b, q = map(int, input().split())\ninf = float('inf')\nS = [- inf] + [int(input()) for i in range(a)] + [inf]\nT = [- inf] + [int(input()) for i in range(b)] + [inf]\n\nfor i in range(q):\n x = int(input())\n s_idx = bisect.bisect_left(S, x)\n s1, s2 = S[s_idx - 1], S[s_idx]\n \n t_idx = bisect.bisect_left(T, x)\n t1, t2 = T[t_idx - 1], T[t_idx]\n \n ans = inf\n for i in s1, s2:\n for j in t1, t2:\n ans = min(ans, abs(x - i) + abs(i - j))\n ans = min(ans, abs(x - j) + abs(i - j))\n \n print(ans)"] | ['Wrong Answer', 'Accepted'] | ['s887275894', 's894573665'] | [16156.0, 13860.0] | [1040.0, 1808.0] | [1515, 571] |
p03112 | u978313283 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['import bisect\nimport numpy as np\nINF=10**18\nA,B,Q=map(int,input().split())\ns=[int(input()) for i in range(A)]\nt=[int(input()) for i in range(B)]\ns=[-INF]+s+[INF]\nt=[-INF]+t+[INF]\ns=np.array(s)\nt=np.array(t)\nfor q in range(G):\n X=int(input())\n t1=bisect.bisect_right(t,X)\n l1=X-t[t1]\n if (t[t1]-X)>(X-t[t1-1]):\n l1=X-t[t1-1]\n s1=bisect.bisect_right(s,X)\n l2=X-s[s1]\n if (s[s1]-X)>(X-s[s1-1]):\n l2=X-s[s1-1]\n l3=bisect.bisect_right(s,X-l1)\n l4=bisect.bisect_right(t,X-l2)\n print(min(abs(l1)+min(s[l3]-X+l1,X-l1-s[l3-1]),abs(l2)+min(t[l4]-X+l2,X-l2-t[l4-1])))\n\n', 'import bisect\nINF=10**18\nA,B,Q=map(int,input().split())\ns=[int(input()) for i in range(A)]\nt=[int(input()) for i in range(B)]\ns=[-INF]+s+[INF]\nt=[-INF]+t+[INF]\nfor q in range(Q):\n X=int(input())\n t1=bisect.bisect_right(t,X)\n s1=bisect.bisect_right(s,X)\n res=INF\n for T in [t[t1],t[t1-1]]:\n for S in [s[s1],s[s1-1]]:\n ans1=abs(X-T)+abs(S-T)\n ans2=abs(X-S)+abs(S-T)\n res=min(res,ans1,ans2)\n print(res)\n\n'] | ['Runtime Error', 'Accepted'] | ['s225434863', 's322714812'] | [21812.0, 12800.0] | [487.0, 1689.0] | [602, 459] |
p03112 | u983918956 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ["from bisect import bisect, bisect_left\ninf = float('inf')\n\nA,B,Q = map(int,input().split())\nS = [-inf] + [int(input()) for _ in range(A)] + [inf]\nT = [-inf] + [int(input()) for _ in range(B)] + [inf]\nX = [int(input()) for _ in range(Q)]\n\ndef solve(x):\n si = bisect(S,x)\n sl,sr = S[si-1],S[si]\n ti = bisect(T,x)\n tl,tr = T[ti-1],T[ti]\n ans = inf\n for s in [sl,sr]:\n for t in [tl,tr]:\n res = min(abs(s-x),abs(t-x)) + abs(s-t)\n ans = min(res,ans)\n return ans\n\nfor x in X:\n ans = solve(x)\n print(ans)", "from bisect import bisect, bisect_left\ninf = float('inf')\n\nA,B,Q = map(int,input().split())\nS = [-inf] + [int(input()) for _ in range(A)] + [inf]\nT = [-inf] + [int(input()) for _ in range(B)] + [inf]\nX = [int(input()) for _ in range(Q)]\n\ndef solve(x):\n si = bisect(S,x)\n sl,sr = S[si-1],S[si]\n ti = bisect(T,x)\n tl,tr = T[ti-1],T[ti]\n ans = inf\n for s in [sl,sr]:\n for t in [tl,tr]:\n res0 = abs(s-x) + abs(s-t)\n res1 = abs(t-x) + abs(s-t)\n ans = min(ans,res0,res1)\n return ans\n\nfor x in X:\n ans = solve(x)\n print(ans)"] | ['Wrong Answer', 'Accepted'] | ['s565552709', 's122095896'] | [16128.0, 16144.0] | [1110.0, 1112.0] | [552, 584] |
p03112 | u994988729 | 2,000 | 1,048,576 | Along a road running in an east-west direction, there are A shrines and B temples. The i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road. Answer the following Q queries: * Query i (1 \leq i \leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.) | ['import bisect\n\na,b,q=map(int,input().split())\ntem=[-10**18]+[int(input()) for _ in range(a)]+[10**18]\nshr=[-10**18]+[int(input()) for _ in range(b)]+[10**18]\nans=[]\n\nfor _ in range(q):\n x=int(input())\n t=bisect.bisect_right(tem, x)\n s=bisect.bisect_right(shr, x)\n dt=[x-tem[t-1], tem[t]-x]\n ds=[x-shr[s-1], shr[s]-x]\n\n m=min(dt+ds)\n if m in dt:\n m_ind=dt.index(m)\n m2=min(ds)\n m2_ind=ds.index(m2)\n else:\n m_ind=ds.index(m)\n m2=min(dt)\n m2_ind=dt.index(m2)\n\n if m_ind==m2_ind:\n ans.append(m2)\n else:\n ans.append(m2 + m*2)\n\nprint(*ans, sep="\\n")\n \n\n', 'import sys\nimport bisect\ninput = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 7)\nbl = bisect.bisect_left\n\nA, B, Q = map(int, input().split())\ninf = 10**18\nS = [-inf]+[int(input()) for _ in range(A)]+[inf]\nT = [-inf]+[int(input()) for _ in range(B)]+[inf]\n\n\ndef path(x):\n sl = S[bl(S, x) - 1]\n sr = S[bl(S, x)]\n tl = T[bl(T, x) - 1]\n tr = T[bl(T, x)]\n\n res = 10 ** 18\n res = min(res, abs(x - sl) + abs(sl - tl))\n res = min(res, abs(x - sl) + abs(sl - tr))\n res = min(res, abs(x - sr) + abs(sr - tr))\n res = min(res, abs(x - sr) + abs(sr - tl))\n res = min(res, abs(x - tr) + abs(tr - sl))\n res = min(res, abs(x - tr) + abs(tr - sr))\n res = min(res, abs(x - tl) + abs(tl - sl))\n res = min(res, abs(x - tl) + abs(tl - sr))\n return res\n\n\nX = [int(input()) for _ in range(Q)]\nfor x in X:\n print(path(x))'] | ['Wrong Answer', 'Accepted'] | ['s870900515', 's866350256'] | [18000.0, 17808.0] | [958.0, 772.0] | [636, 851] |
p03125 | u000557170 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['# -*- coding: utf-8 -*-\n\ndef parse_input():\n line = [int(e) for e in input().split(" ")]\n a = line[0]\n b = line[1]\n\n returnr (a, b)\n\n\ndef solve(a, b):\n\n result = 0\n if b % a == 0:\n result = a + b\n else:\n result = b - a\n\n return str(result)\n\ndef main():\n \n\n a, b = parse_input()\n print(solve(a, b))\n\nif __name__ == \'__main__\':\n\n main()\n', '# -*- coding: utf-8 -*-\n\ndef parse_input(lines_as_string = None):\n\n if lines_as_string is None:\n lines = [e for e in input()]\n else:\n lines = [e for e in lines_as_string.split("\\n")][1:-1]\n\n params = lines[0].split(" ")\n a = int(params[0])\n b = int(params[1])\n\n return (a, b)\n\n\ndef solve(a, b):\n\n result = 0\n if b % a == 0:\n result = a + b\n else:\n result = b - a\n\n return result\n\ndef main():\n \n\n a, b = parse_input()\n print("%d" % solve(a, b))\n\nif __name__ == \'__main__\':\n\n main()\n', '# -*- coding: utf-8 -*-\n\nimport sys\nimport math\n\ndef parse_input(lines_as_string = None):\n\n lines = []\n if lines_as_string is None:\n for line in sys.stdin:\n lines.append(line)\n else:\n lines = [e for e in lines_as_string.split("\\n")][1:-1]\n\n params = lines[0].split(" ")\n a = int(params[0])\n b = int(params[1])\n\n return (a, b)\n\n\ndef solve(a, b):\n\n result = 0\n if b % a == 0:\n result = a + b\n else:\n result = b - a\n\n return result\n\ndef main():\n \n\n print("%d" % solve(*parse_input()))\n\nif __name__ == \'__main__\':\n\n main()\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s561031592', 's834350797', 's979286806'] | [3060.0, 3064.0, 3064.0] | [18.0, 18.0, 18.0] | [393, 559, 608] |
p03125 | u012914970 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A,B = map(int,input().split())\n\nif A%B == 0:\n print(A+B)\nelse:\n print(B-A)\n', 'A,B = map(int,input().split())\n\nif A%B == 0:\n print(A+B)\nelse:\n print(B-A)\n', 'A,B = map(int,input().split())\n\nif 0<A<21 and 0<B<21:\n if A%B == 0:\n print(A+B)\n else:\n print(B-A)\nelse :\n print("error")\n', 'A,B = map(int,input().split())\n\nif 0<A<21 and 0<B<21:\n if B%A == 0:\n print(A+B)\n else:\n print(B-A)\nelse :\n print("error")\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s038760132', 's686425317', 's765930120', 's515341017'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [81, 81, 145, 145] |
p03125 | u013408661 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a=map(int,input().split())\nif a[1]%a[0]==0:\n print(a[0]+a[1])\nelse:\n print(a[1]-a[0])', 'a=list(map(int,input().split()))\nif a[1]%a[0]==0:\n print(a[0]+a[1])\nelse:\n print(a[1]-a[0])'] | ['Runtime Error', 'Accepted'] | ['s049022503', 's126529448'] | [2940.0, 2940.0] | [18.0, 17.0] | [91, 97] |
p03125 | u014333473 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['def check(A):\n check_result = []\n for i in range(1, len(A)):\n check_result.append(list(set(A[i-1])&set(A[i])))\n if len(check_result) != len(A):\n return check_result\n return False\n\nN, M = map(int, input().split())\nA = [list(map(int, input().split())) for _ in range(N)]\nfor i in range(len(A)):\n A[i].pop(0)\nwhile True:\n check_result = check(A)\n if check_result:\n A = check_result\n else:\n if not A[0]:\n print(0)\n break\n else:\n print(len(A[0]))\n break', 'a,b=map(int,input().split());print([b-a,a+b][b%a==0])'] | ['Runtime Error', 'Accepted'] | ['s729409775', 's610890856'] | [3188.0, 9080.0] | [17.0, 27.0] | [491, 53] |
p03125 | u016567570 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A, B = map(int, input().split())\n\nif B // A != 0:\n print(B - A)\nelse:\n print(A+B)', 'A, B = map(int, input().split())\n\nif B % A != 0:\n print(B - A)\nelse:\n print(A+B)'] | ['Wrong Answer', 'Accepted'] | ['s536241085', 's151579673'] | [2940.0, 2940.0] | [17.0, 17.0] | [83, 82] |
p03125 | u017063101 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b=map(int,input().split())\nif a%b==0:\n print(a+b)\nelse:\n print(b-a)', 'a,b=map(int,input().split())\nif b%a==0:\n print(a+b)\nelse:\n print(b-a)'] | ['Wrong Answer', 'Accepted'] | ['s514705651', 's336021037'] | [2940.0, 2940.0] | [17.0, 17.0] | [75, 75] |
p03125 | u024555159 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['x,y=[int(i) for i in input().split()]\n\nif x%y==0:\n\tprint(x%y)\nelse:\n\tprint(x-y)', 'x,y=[int(i) for i in input().split()]\n\nif x%y==0:\n\tprint(x+y)\nelse:\n\tprint(x-y)', 'x,y=[int(i) for i in input().split()]\n\nif x-y>0:\n A=x\n B=y\nelse:\n A=y\n B=x\n\nif A%B==0:\n\tprint(A+B)\nelse:\n\tprint(A-B)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s224045995', 's974899718', 's290285417'] | [2940.0, 2940.0, 2940.0] | [18.0, 18.0, 17.0] | [79, 79, 120] |
p03125 | u025463382 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b = map (int , input().split())\nif b % a == 0 ;\n c = a+b\nelse;\n c = b-a\nprint (c)', 'a,b = map (int , input().split())\nif b % a == 0 ;\n c = a+b\nelse;\n c = b-a\nprint (c)', 'a,b = map (int , input().split())\nif b % a == 0 :\n c = a+b\nelse:\n c = b-a\nprint (c)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s006368606', 's968415392', 's958465173'] | [2940.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0] | [89, 89, 89] |
p03125 | u027675217 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b = map(int, input().split())\nif a%b==0:\n print(a+b)\nelse:\n print(b-a)\n', 'a,b = map(int, input().split())\nif b%a==0:\n print(a+b)\nelse:\n print(b-a)\n'] | ['Wrong Answer', 'Accepted'] | ['s555933386', 's474718578'] | [3316.0, 2940.0] | [19.0, 17.0] | [79, 79] |
p03125 | u033524082 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b=map(int,input().split())\nprint(a+b if a%b==0 else b-a)', 'a,b=map(int,input().split())\nprint(a+b if b%a==0 else b-a)'] | ['Wrong Answer', 'Accepted'] | ['s582924908', 's878836656'] | [2940.0, 2940.0] | [17.0, 17.0] | [58, 58] |
p03125 | u033602950 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A, B = list(map(int,input().split()))\nif (A==0) or (B == 0);\n\tprint(A-B)\n\nelif B%A ==0 :\n\tprint(A+B)\n\nelse:\n\tprint(A-B)', 'A, B = list(map(int,input().split()))\nif A or B == 0;\n\tprint(A-B)\n\nelif B%A ==0 :\n\tprint(A+B)\n\nelse:\n\tprint(A-B)', 'A, B = list(map(int,input().split()))\n\nif B%A ==0:\n\tprint(A+B)\n\nelse:\n\tprint(B-A)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s368921458', 's860700808', 's155042399'] | [2940.0, 2940.0, 2940.0] | [18.0, 17.0, 18.0] | [119, 112, 81] |
p03125 | u033627628 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b=map(int,input().split())\nprint(a+b if a%b==0 else a-b)', 'a,b=map(int,input().split())\nprint(a+b if b%a==0 else b-a)'] | ['Wrong Answer', 'Accepted'] | ['s729589806', 's196284720'] | [2940.0, 2940.0] | [18.0, 17.0] | [58, 58] |
p03125 | u037221289 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ["import heapq\n\nN = int(input())\nA = list(map(int,input().split(' ')))\nA_min = heapq.nsmallest(2,A)\nX= A_min[0]\nY = A_min[1]\n\nwhile X > 0 and Y > 0:\n if X <= Y:\n Y -= X\n else:\n X -= Y\nprint(max(X,Y))\n", "A, B = map(int, input().split(' '))\n\nif B % A == 0:\n print(B+A)\nelse:\n print(B-A)\n "] | ['Runtime Error', 'Accepted'] | ['s964260826', 's000935504'] | [3060.0, 2940.0] | [18.0, 17.0] | [206, 95] |
p03125 | u041382530 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['N = int(input())\nA = input().split()\nA = [int(i) for i in A]\n\ndef yakusuu(p):\n\tA.reverse()\n\tfor i in range(1,p):\n\t\tif A[0] % A[i] == 0:\n\t\t\tA.pop(0)\n\t\t\treturn\n\telse:\n\t\treturn\ndef syou(k):\n\tA.sort()\n\tif A[0] == 0:\n\t\tA.pop(0)\n\t\tif len(A) > 1:\n\t\t\tA[k-1] = A[k-1] % A[0]\n\telse:\n\t\tA[k] = A[k] % A[0]\n\treturn A\nfor i in range(N):\n\tif len(A) >= 1:\n\t\tyakusuu(len(A))\nwhile\tlen(A) > 1:\n\tsyou(len(A)-1)\nprint(A[0])', 'A,B=map(int,input().split())\nif B%A==0:\n\tprint(A+B)\nelse:\n\tprint(B-A)'] | ['Runtime Error', 'Accepted'] | ['s937047818', 's438094870'] | [3064.0, 2940.0] | [18.0, 18.0] | [403, 69] |
p03125 | u044459372 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['import fractions\nfrom functools import reduce\n\ndef gcd_list(numbers):\n\treturn reduce(fractions.gcd,numbers)\n\nn=int(input())\nhp=list(map(int,input().split()))\nprint(gcd_list(hp))', 'a,b=map(int,input().split())\nif b%a:\n print(b-a)\nelse:\n print(b+a)'] | ['Runtime Error', 'Accepted'] | ['s586747702', 's564485043'] | [5048.0, 2940.0] | [36.0, 18.0] | [177, 68] |
p03125 | u049182844 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b = map(int,input().split())\nif a % b == 0 :\n print(a + b)\nelse:\n print(b -a)', 'a,b = map(int,input().split())\nif b % a == 0 :\n print(a + b)\nelse:\n print(b -a)'] | ['Wrong Answer', 'Accepted'] | ['s693813351', 's348792677'] | [2940.0, 2940.0] | [17.0, 17.0] | [81, 81] |
p03125 | u049354454 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['N = input()\nA = int(N[0])\nB = int(N[2])\n\nif B % A == 0:\n ans = B - A\nelse:\n ans = A + B\n\nprint(ans)', 'N = input().split(" ")\nA = int(N[0])\nB = int(N[1])\n\nif B % A == 0:\n ans = B - A\nelse:\n ans = A + B\n\nprint(ans)', 'N = input().split(" ")\nA = int(N[0])\nB = int(N[1])\n\nif B % A == 0:\n ans = B + A\nelse:\n ans = B - A\n\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s013466763', 's992991165', 's808110559'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [105, 116, 116] |
p03125 | u050698451 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A,B = int(input().split())\nif (B%A==0):\n print(A+B)\nelse:\n print(B-A)', 'from sys import stdin\nA, B = [int(x) for x in stdin.readline().rstrip().split()]\nif (B%A==0):\n print(A+B)\nelse:\n print(B-A)\n'] | ['Runtime Error', 'Accepted'] | ['s368806265', 's259431978'] | [2940.0, 2940.0] | [18.0, 18.0] | [71, 126] |
p03125 | u051496905 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A, B = map(int, input().split())\nif A % B == 0:\n print(A+B)\nelse:\n print(B-A)', 'A, B = map(int, input().split())\nif B % A == 0:\n print(A+B)\nelse:\n print(B-A)'] | ['Wrong Answer', 'Accepted'] | ['s325238328', 's197357887'] | [2940.0, 2940.0] | [18.0, 17.0] | [83, 83] |
p03125 | u054501336 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['l =input().split()\n\nl[0] = A\nl[1] = B\nif B%A == 0:\n print(A+B)\nelse:\n print(B-A)', 'l =input().split()\n\nA = int(l[0])\nB = int(l[1])\n\nif B%A == 0:\n print(A+B)\nelse:\n print(B-A)\n '] | ['Runtime Error', 'Accepted'] | ['s559511116', 's145807617'] | [2940.0, 2940.0] | [17.0, 17.0] | [86, 102] |
p03125 | u058348416 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b = map(int,input().split())\nif a%b == 0:\n print(a+b)\nelse:\n print(b-a)', 'a,b = map(int,input().split())\nif b%a == 0:\n print(a+b)\nelse:\n print(b-a)'] | ['Wrong Answer', 'Accepted'] | ['s295426682', 's282307803'] | [3316.0, 3316.0] | [20.0, 21.0] | [79, 79] |
p03125 | u058592821 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a, b = (int(i) for i in input(),split())\nprint(a+b) if b%a == 0 else print(b-a)', 'a, b = (int(i) for i in input().split())\nprint(a+b) if b%a == 0 else print(b-a)'] | ['Runtime Error', 'Accepted'] | ['s186196707', 's075648174'] | [2940.0, 2940.0] | [17.0, 17.0] | [79, 79] |
p03125 | u058861899 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b=map(int,input().split())\n\nif a%b==0:\n print(a+b)\nelse:\n print(b-a)', 'a,b=map(int,input().split())\n\nif a%b==0:\n print(a+b)\nelse:\n print(b-a)', 'a,b=map(int,input().split())\n\nif b%a!=0:\n print(b-a)\nelse:\n print(b+a)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s114776038', 's807008903', 's492827468'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0] | [76, 76, 76] |
p03125 | u058882869 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b = input().split(" ")\nif int(b)%int(a)==0:\n print(int(a)+int(b)\nelse:\n print(int(b)-int(a))', 'a,b = input().split(" ")\nprint(int(a)+int(b)) if int(b)%int(a)==0 else print(int(b)-int(a))'] | ['Runtime Error', 'Accepted'] | ['s554639081', 's403810101'] | [2940.0, 2940.0] | [17.0, 17.0] | [96, 91] |
p03125 | u062604519 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b = map(int,input().split())\ns=b/a\nif s == isinstance(s,int):\n print(a+b)\nelse:\n print(b-a)', 'a,b = map(int,input().split())\nif b%a == 0:\n print(a+b)\nelse:\n print(b-a)'] | ['Wrong Answer', 'Accepted'] | ['s453959218', 's998463668'] | [2940.0, 2940.0] | [17.0, 17.0] | [95, 75] |
p03125 | u063073794 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b=map(int,input().split())\nif b&a==0:\n print(a+b)\nelse:\n print(b-a)', 'a,b=map(int,input().split())\nif b%a==0:\n print(a+b)\nelse:\n print(b-a)'] | ['Wrong Answer', 'Accepted'] | ['s828429386', 's916619013'] | [2940.0, 2940.0] | [17.0, 17.0] | [71, 71] |
p03125 | u063346608 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A,B = map(int,input().split())\n\nif B / A == 0:\n\tprint(int(A + B))\nelse:\n\tprint(int(B - A))', 'A,B = map(int,input().split())\n\nif B / A == 0:\n\tprint(int(A + B))\nelse:\n\tprint(int(B - A))', 'A,B = map(int,input().split())\n\nif B / A == 0:\n\tprint(A + B)\nelse:\n\tprint(B - A)', 'A,B = map(int,input().split())\n\nif B / A == 0:\n\tprint(A + B)\nelse:\n\tprint(int(B - A))', 'A,B = map(int,input().split())\n\nif B % A == 0:\n\tprint(int(A + B))\nelse:\n\tprint(int(B - A))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s355073194', 's363093301', 's529204523', 's565412213', 's660587230'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [18.0, 17.0, 18.0, 17.0, 17.0] | [90, 90, 80, 85, 90] |
p03125 | u064246852 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A,B = map(int,input().split())\nprint(A+B if A % B == 0 else B-A)', 'A,B = map(int,input().split())\nprint(A+B if B % A == 0 else B-A)'] | ['Wrong Answer', 'Accepted'] | ['s257969581', 's853801680'] | [2940.0, 2940.0] | [20.0, 20.0] | [64, 64] |
p03125 | u064408584 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ["n,m=map(int, input().split())\nmt=[0,2,5,5,4,5,6,3,7,6]\na=sorted(map(int, input().split()))\ndp=['']*(n+1)\ndp[0]='*'\nfor i in range(n+1):\n if not dp[i]:continue\n for j in a:\n if i+mt[j]<n+1:\n dp[i+mt[j]]=str(j)+dp[i]\nprint(''.join(sorted(dp[-1][:-1])[::-1]))", 'a,b=map(int, input().split())\nif b%a==0:print(a+b)\nelse:print(b-a)'] | ['Runtime Error', 'Accepted'] | ['s168623444', 's771653656'] | [3064.0, 2940.0] | [17.0, 17.0] | [280, 66] |
p03125 | u066455063 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A, B = map(int, input().split())\n\nif A % B == 0:\n print(A + B)\nelse:\n print(B - A)\n ', 'A, B = map(int, input().split())\n\nif A % B == 0:\n print(A + B)\nelse:\n print(B - A)', 'A, B = map(int, input().split())\n\nif B % A == 0:\n print(A + B)\nelse:\n print(B - A)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s269997029', 's355629475', 's715343110'] | [2940.0, 2940.0, 2940.0] | [17.0, 19.0, 17.0] | [93, 88, 88] |
p03125 | u070449185 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A,B = int(input().split())\nif(B%A==0):\n print(A+B)\nelse:\n print(B-A)', 'A,B = map(int, input().split())\nif(B%A == 0):\n print(A+B)\nelse:\n print(B-A)'] | ['Runtime Error', 'Accepted'] | ['s996399728', 's844514799'] | [2940.0, 2940.0] | [17.0, 17.0] | [70, 81] |
p03125 | u076996519 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['*l = map(int, open(0).read().split())\nif l[1] % l[0] == 0:\n\tprint(l[0] + l[1])\nelse:\n\tprint(l[1] - l[0])', '*l, = map(int, open(0).read().split())\nif l[1] % l[0] == 0:\n\tprint(l[0] + l[1])\nelse:\n\tprint(l[1] - l[0])'] | ['Runtime Error', 'Accepted'] | ['s354020962', 's960718905'] | [2940.0, 2940.0] | [17.0, 18.0] | [104, 105] |
p03125 | u077498363 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ["num = int(input())\nnum_ls = sorted([x for x in map(int, input().split(' '))])\nwhile True:\n dam = []\n searchMin = [ x for x in num_ls if x != 1 ]\n for x in num_ls:\n div = x % min(searchMin)\n if div == 0:\n dam.append(x)\n else:\n dam.append(div)\n\n if num_ls == dam:\n break\n else:\n num_ls = dam\n\nprint(min(num_ls))", "x, y = map(int, input().split(' '))\nif y % x == 0:\n print(x+y)\nelse:\n print(y-x)"] | ['Runtime Error', 'Accepted'] | ['s641041261', 's853635843'] | [3060.0, 2940.0] | [17.0, 18.0] | [381, 86] |
p03125 | u089376182 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a, b = map(int, input().split())\nprint(b-a if a%b else a+b)', 'a,b = map(int, input().split()) \nprint(b-a if a%b a+b)\n', 'a,b = map(int, input().split()) \nprint(b-a if a%b else a+b)\n', 'a,b = map(int, input().split()) \nprint(b-a a%b a+b)', 'a,b = map(int, input().split()) \nprint(b-a if b%a else a+b)\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s427481112', 's588089734', 's605775407', 's614776712', 's473587401'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0, 17.0] | [59, 55, 60, 51, 60] |
p03125 | u093033848 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['from fractions import gcd\n\nn = int(input())\ne = [int(i) for i in input().split()] \n\n\nanswer = 5000000000000000000000000000000000\n\ne.sort(reverse=True)\nfor i in range(0,n-2):\n for j in e[i+1:n-1]:\n if gcd(e[i],j) < answer:\n answer = gcd(e[i],j)\n \nprint(answer)', 'a, b = map(int, input().split())\n\nif b % a == 0:\n print(a + b)\nelse :\n print(b - a)'] | ['Runtime Error', 'Accepted'] | ['s832471051', 's500634143'] | [5048.0, 2940.0] | [36.0, 17.0] | [291, 89] |
p03125 | u094191970 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['ii=lambda:int(input())\nmiis=lambda:map(int,input().split())\nlmiis=lambda:list(:map(int,input().split()))\n\na,b=miis()\nprint(a+b if b%a==0 else b-a)', 'from sys import stdin\nnii=lambda:map(int,stdin.readline().split())\nlnii=lambda:list(map(int,stdin.readline().split()))\n\na,b=nii()\nprint(a+b if b%a==0 else b-a)'] | ['Runtime Error', 'Accepted'] | ['s169336412', 's827694333'] | [2940.0, 9164.0] | [17.0, 29.0] | [146, 159] |
p03125 | u095756391 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['\ndef f(a, b):\n if (b % a == 0):\n return a + b \n else:\n return b - a ', 'm = list(map(int, input().split()))\n\nhp = list(map(int, input().split()))\nresult = 0\ncheckyakusuru = []\ncheckodd = []\ncheckeven = []\n\nif (hp.count(hp[0]) == m[0]):\n result = hp[0]\n\nminhp = min(hp)\n\nfor p in hp:\n if (p % minhp == 0):\n checkyakusuru.append(1)\n \n if (checkyakusuru.count(1) == m[0]):\n result = p\n break\n else:\n if (p % 2 == 0):\n checkeven.append(1)\n if (checkeven.count(1) == m[0]):\n result = 2\n else:\n result = 1', 'm = list(map(int, input().split()))\n\nhp = list(map(int, input().split()))\nresult = 0\ncheckyakusuru = []\ncheckodd = []\ncheckeven = []\n\nif (hp.count(hp[0]) == m[0]):\n result = hp[0]\n\nminhp = min(hp)\n\nfor p in hp:\n if (p % minhp == 0):\n checkyakusuru.append(1)\n \n if (checkyakusuru.count(1) == m[0]):\n result = p\n break\n else:\n if (p % 2 == 0):\n checkeven.append(1)\n if (checkeven.count(1) == m[0]):\n result = 2\n break\n else:\n result = 1', 'a = list(map(int, input().split()))\n\ndef f(a, b):\n if (b % a == 0):\n return a + b \n else:\n return b - a \nprint(f(a[0], a[1]))'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s299745853', 's546114148', 's883319807', 's385078876'] | [2940.0, 3064.0, 3064.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [88, 517, 535, 145] |
p03125 | u096635831 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['[a, b] = read().split().map(int)\nprint(a + b if b % a == 0 else b - a)\n', '[a, b] = map(int, input().split())\nprint(a + b if b % a == 0 else b - a)\n'] | ['Runtime Error', 'Accepted'] | ['s105011160', 's621984143'] | [2940.0, 2940.0] | [17.0, 18.0] | [71, 73] |
p03125 | u098026648 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A,B = map(int, input().split())\nprint(B/A)\nif B%A == 0:\n print(A+B)\nelse:\n print(B-A)', 'A,B = map(int, input().split())\nif B%A == 0:\n print(A+B)\nelse:\n print(B-A)'] | ['Wrong Answer', 'Accepted'] | ['s103236814', 's044334795'] | [2940.0, 2940.0] | [17.0, 17.0] | [91, 80] |
p03125 | u101742684 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['import fraction\nfrom functools import reduce\n\n\ndef gcd_list(numbers):\n return reduce(fraction.gcd, numbers)\n\n\nN = input()\nA = input().split()\nfor i in range(len(A)):\n A[i] = int(A[i]) \nprint("{}".format(gcd_list(A)))', 'A, B = map(int, input().split())\nif B%A==0:\n print("{}".format(A+B))\nelse:\n print("{}".format(B-A))\n'] | ['Runtime Error', 'Accepted'] | ['s692463976', 's992770932'] | [3060.0, 2940.0] | [17.0, 17.0] | [222, 106] |
p03125 | u102242691 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['\na,b = map(int,input().split())\n\nif a % b == 0:\n print(a+b)\nelse:\n print(b-a)\n', '\na,b = map(int,input().split())\n\nif b % a == 0:\n print(a+b)\nelse:\n print(b-a)\n'] | ['Wrong Answer', 'Accepted'] | ['s524946607', 's958555560'] | [2940.0, 2940.0] | [17.0, 17.0] | [84, 84] |
p03125 | u104740664 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A, B = map(int, input().split(" "))\nif A % B == 0:\n print(A + B)\nelse:\n print(B - A)', 'A, B = map(int, input().split(" "))\nif B % A == 0:\n print(A + B)\nelse:\n print(B - A)'] | ['Wrong Answer', 'Accepted'] | ['s369968668', 's404128833'] | [2940.0, 3316.0] | [17.0, 21.0] | [86, 86] |
p03125 | u106181248 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['x, y = map(int,input().split()))\n \nif b%a == 0:\n print(a+b)\nelse:\n print(b-a)', 'a, b = map(int,input().split())\n \nif b%a == 0:\n print(a+b)\nelse:\n print(b-a)'] | ['Runtime Error', 'Accepted'] | ['s761088164', 's651526588'] | [2940.0, 2940.0] | [17.0, 17.0] | [80, 79] |
p03125 | u112002050 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A, B = map(int,input().split())\nif B % A == 0:\n print(A+B)\n else:\n print(B-A)\n ', 'A, B = list(map(int,input().split()))\nif B % A == 0:\n print(A+B)\nelse:\n print(B-A)\n'] | ['Runtime Error', 'Accepted'] | ['s159741917', 's211978493'] | [2940.0, 2940.0] | [17.0, 17.0] | [84, 85] |
p03125 | u112317104 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a, b = list(map(int(), input()))\nprint(a+b if b%a == 0 else b-a)', 'a, b = list(map(int, input().split()))\nprint(a+b if b%a == 0 else b-a)\n'] | ['Runtime Error', 'Accepted'] | ['s237056130', 's599700200'] | [2940.0, 2940.0] | [18.0, 17.0] | [64, 71] |
p03125 | u115284827 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['from collections import Counter;N, M = map(int, input().split());print(len([i for i in Counter([flatten for inner in [i[1:] for i in [[int(i) for i in input().split()] for i in range(N)]] for flatten in inner]).most_common() if i[1] == N]))', 'A, B = map(int, input().split())\nprint(A+B if B%A == 0 else B-A)'] | ['Runtime Error', 'Accepted'] | ['s615579317', 's442624274'] | [3316.0, 2940.0] | [21.0, 17.0] | [240, 64] |
p03125 | u116233709 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['n,m=map(int,input().split())\nans=[0]*m\nfor i in range(n):\n x=[int(a),for a in input().split()]\n for j in range(1,x[0]+1):\n ans[x[j]-1]+=1\n \nprint(ans.count(n)) \n \n', 'a,b=map(int,input().split())\nif b%a==0:\n print(a+b)\nelse:\n print(b-a)'] | ['Runtime Error', 'Accepted'] | ['s634800174', 's661129406'] | [2940.0, 2940.0] | [17.0, 17.0] | [172, 71] |
p03125 | u123745130 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['x,y=map(int,input().split())\nprint([y-x,x+y][y//x == 0] )', 'x,y=map(int,input().split())\nprint([y-x,x+y][y%x==0])'] | ['Wrong Answer', 'Accepted'] | ['s775709884', 's841346980'] | [2940.0, 2940.0] | [17.0, 17.0] | [57, 53] |
p03125 | u124025116 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['x,y = map(int,input().split())\nif x >= y and x % y == 0:\n print(str(x + y))\nelse:\n print(str(y - x))', 'x,y = map(int,input().split())\nif x % y == 0:\n print(str(x + y))\nelse:\n print(str(x - y))', 'x,y = map(int(input()))\nif x % y == 0:\n print(str(x + y))\nelse:\n print(str(x - y))', 'x,y = map(int,input().split())\nif x % y == 0:\n print(str(x + y))\nelse:\n print(str(y - x))', 'x,y = map(int,input().split())\nif y % x == 0:\n print(str(x + y))\nelse:\n print(str(y - x))'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s083335153', 's500479879', 's506584550', 's828521512', 's970123396'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0, 18.0] | [102, 91, 84, 91, 91] |
p03125 | u125205981 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['from sys import stdin\n\ndef main():\n A, B = map(int, input().split())\n\n if A % B:\n print(B - A)\n else:\n print(A + B)\n\ninput = lambda: stdin.readline()\nmain()\n', 'from sys import stdin\n\ndef main():\n A, B = map(int, input().split())\n\n if B % A:\n print(B - A)\n else:\n print(A + B)\n\ninput = lambda: stdin.readline()\nmain()\n'] | ['Wrong Answer', 'Accepted'] | ['s121648767', 's304035898'] | [2940.0, 2940.0] | [17.0, 18.0] | [180, 180] |
p03125 | u129978636 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['n=int(input())\na=sorted(list(map(int,input().split())))\ni=0\nwhile(a[1] != 0):\n a[i+1]=a[i+1]-(a[i+1]//a[i])*a[i]\n a=sorted(a)\n if(a[0] == 0):\n i += 1\n while(a[1] != 0):\n a[i+1]=a[i+1]-(a[i+1]//a[i])*a[i]\n a=sorted(a)\nprint(a[i+1])', 'n=int(input())\na=sorted(list(map(int,input().split())))\ni=0\nwhile(a[-2] != 0):\n if(a[-1]%a[i]==0):\n a[-1]=0\n i+=1\n else:\n a[-1]=a[-1]-(a[-1]//a[i])*a[i]\n a=sorted(a)\nprint(a[-1])', 'a,b=map(int,input().split())\nif(b%a==0):\n print(a+b)\nelse:\n print(b-a)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s118039406', 's690557673', 's676010883'] | [3064.0, 3064.0, 2940.0] | [17.0, 17.0, 18.0] | [275, 208, 77] |
p03125 | u131264627 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['n, m = map(int, input().split())\ncnt = [0] * m\nfor _ in range(n):\n k, *a = map(int, input().split())\n for A in a:\n cnt[A - 1] += 1\nprint(sum(c == n for c in cnt))\n', 'a, b = map(int, input().split())\nif b % a == 0:\n print(a + b)\nelse:\n print(b - a)'] | ['Runtime Error', 'Accepted'] | ['s288711260', 's573915408'] | [2940.0, 2940.0] | [17.0, 17.0] | [176, 83] |
p03125 | u133347536 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a = int(input())\nb = int(input())\nif b % a == 0:\n print(a + b)\nelse:\n print(b-a)', 'a, b = list(map(int, input().split()))\nif b % a == 0:\n print(a + b)\nelse:\n print(b-a)\n'] | ['Runtime Error', 'Accepted'] | ['s041254712', 's837190880'] | [2940.0, 2940.0] | [18.0, 17.0] | [82, 92] |
p03125 | u133356863 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b=map(input().split())\nprint(a+b if b%a==0 else b-a)', 'a,b=map(int,input().split())\nprint(a+b if b%a==0 else b-a)'] | ['Runtime Error', 'Accepted'] | ['s417549364', 's611666404'] | [2940.0, 2940.0] | [17.0, 17.0] | [54, 58] |
p03125 | u133966084 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a=int(input())\nb=int(input())\nif b%a==0:\n print(a+b)\nelse:\n print(b-a)', 'a,b=(map(int, input().split()))\nif b%a==0:\n print(a+b)\nelse:\n print(b-a)'] | ['Runtime Error', 'Accepted'] | ['s861054937', 's970828957'] | [2940.0, 2940.0] | [17.0, 18.0] | [74, 76] |
p03125 | u143051858 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A,B = map(int,input().split())\nif B%A==1:\n print(A+B)\nelse:\n print(A-B)', 'A,B = map(int,input().split())\nif B%A==0:\n print(A+B)\nelse:\n print(B-A)'] | ['Wrong Answer', 'Accepted'] | ['s612303880', 's016193633'] | [2940.0, 2940.0] | [18.0, 17.0] | [73, 73] |
p03125 | u143322814 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['import fractions\nfrom functools import reduce\n\nN = int(input())\nA = list(map(int,input().split()))\n\ndef gcd(*numbers):\n return reduce(fractions.gcd, numbers)\n\nprint(gcd(*A))', 'A,B = map(int,input().split())\n\nif int(B % A) == 0:\n print(A+B)\nelse:\n print(B-A)'] | ['Runtime Error', 'Accepted'] | ['s720518674', 's819304479'] | [5048.0, 2940.0] | [35.0, 17.0] | [176, 87] |
p03125 | u146305092 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a, b = map(int, input().split())\nif b%a==0:;print(a+b)\nelse:;print(b-a)', 'a, b = map(int, input().split())\nif b%a==0:\n print(a+b)\nelse:\n print(b-a)'] | ['Runtime Error', 'Accepted'] | ['s606685581', 's418372435'] | [2940.0, 2940.0] | [17.0, 17.0] | [71, 79] |
p03125 | u149284596 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b = map(int ,input().split())\nif a%b == 0:\n print(a+b)\nelse :\n print(b-a)', 'a,b = map(int ,input().split())\nif b%a == 0:\n print(a+b)\nelse :\n print(b-a)'] | ['Wrong Answer', 'Accepted'] | ['s362957079', 's817029729'] | [2940.0, 2940.0] | [17.0, 18.0] | [89, 89] |
p03125 | u153094838 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['# -*- coding: utf-8 -*-\n"""\nCreated on Sat Feb 16 20:59:16 2019\n\n@author: doppe\n"""\n\nN, M = map(int, input().split())\nlikeList = []\n\nfor i in range(0, N):\n L = [int(i) for i in input().split()]\n likeListTmp = []\n if (i == 0):\n likeList = L\n else:\n for j in range(1, L[0] + 1):\n if (L[j] in likeList):\n likeListTmp.append(L[j])\n likeList = likeListTmp\n\nprint(len(likeList))', '# -*- coding: utf-8 -*-\n"""\nCreated on Sat Feb 16 20:59:16 2019\n\n@author: doppe\n"""\n\nA, B = map(int, input().split())\n\nif (B % A == 0):\n print(A + B)\nelse:\n print(B - A)'] | ['Runtime Error', 'Accepted'] | ['s198236072', 's771825128'] | [3064.0, 2940.0] | [17.0, 17.0] | [431, 175] |
p03125 | u154143730 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a, b = (int(i) for i in input().split()) \n \nif a/b % 0:\n\tc = a + b\nelse:\n\tc = b - a\n \nprint(c)\n', 'a, b = (int(i) for i in input().split()) \n \nif a/b == 0:\n\tc = a + b\nelse:\n\tc = b - a\n \nprint(c)\n', 'a, b = (int(i) for i in input().split()) \n \nif b/a % 0:\n\tc = a + b\nelse:\n\tc = b - a\n \nprint(c)\n', 'a, b = map(int, input().split())\n\nif b%a == 0:\n\tc = a + b\nelse:\n\tc = b - a\n \nprint(c)\n'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s629959211', 's633177852', 's934705219', 's189362881'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [100, 101, 100, 89] |
p03125 | u158126367 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['n, m = [int(c) for c in input().split()]\n \nk = [list(map(int, input().split())) for _ in range(n)]\n \nfood_count = [0] * m\n \nfor p in k:\n for i in range(1, len(p)):\n food_count[p[i]-1] += 1\n \ncount = 0\nfor f in food_count:\n if f == n:\n count += 1\n \nprint(count)\n', 'a,b = map(int, input().split())\nif b%a == 0:\n print(a+b)\nelse:\n print(b-a)'] | ['Runtime Error', 'Accepted'] | ['s846391415', 's262512931'] | [3060.0, 2940.0] | [17.0, 18.0] | [281, 80] |
p03125 | u158628538 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b=map(int,input().split())\nif(a%b==0):\n print(a+b)\nelse:\n print(b-a)', 'a,b=map(int,input().split())\nif(int(b%a)==0):\n print(a+b)\nelse:\n print(b-a)'] | ['Wrong Answer', 'Accepted'] | ['s455075932', 's790952246'] | [2940.0, 2940.0] | [17.0, 17.0] | [76, 81] |
p03125 | u167751176 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ["def main():\n\ts = input().strip()\n\ta = s[0]\n\tb = s[1]\n\tif (b/a)*a == b:\n\t\tprint(a+b)\n\telse:\n\t\tprint(b-a)\n\nif __name__ == '__main__':\n\tmain()", "def main():\n\ta,b = map(int, input().split())\n\tif (b %= a) == 0:\n\t\tprint(a+b)\n\telse:\n\t\tprint(b-a)\n\nif __name__ == '__main__':\n\tmain()", "def main():\n\ta,b = map(int, input().split())\n\tif (b % a) == 0:\n\t\tprint(a+b)\n\telse:\n\t\tprint(b-a)\n\nif __name__ == '__main__':\n\tmain()"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s379236552', 's794782778', 's270845627'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 19.0] | [139, 132, 131] |
p03125 | u170201762 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A,B = map(int,inpit().split())\nif B%A==0:\n print(A+B)\nelse:\n print(B-A)', 'A,B = map(int,input().split())\nif B%A==0:\n print(A+B)\nelse:\n print(B-A)'] | ['Runtime Error', 'Accepted'] | ['s557787633', 's829836763'] | [2940.0, 2940.0] | [18.0, 17.0] | [77, 77] |
p03125 | u170920398 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a = int(input())\nb = int(input())\nif b % a == 0:\n print (a + b)\nelse:\n print (b - a)', "a, b = map(int, input().split(' '))\nif b % a == 0:\n print (a + b)\nelse:\n print (b - a)"] | ['Runtime Error', 'Accepted'] | ['s292274235', 's999098036'] | [2940.0, 2940.0] | [17.0, 18.0] | [86, 88] |
p03125 | u171366497 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ["n,m=map(int,input().split())\na=list(map(int,input().split()))\na.sort(reverse=True)\nnum=[0,2,5,5,4,5,6,3,7,6]\ncanmake=dict()\nb=[]\nfor i in a:\n b.append(num[i])\n if num[i] not in canmake.keys():\n canmake[num[i]]=i\nb.sort()\nc=[]\nd=[]\namari=n%b[0]\nlongest=n//b[0]\nif amari==0:print(str(b[0])*(n//b[0]))\n\nfor i in range(1,len(b)):\n count=0\n now=amari\n while True:\n count+=1\n now+=b[0]\n if count>b[i]:break\n if now%b[i]==0:\n c.append(count-now//b[i])\n d.append((count,now//b[i],b[i]))\n break\nres=min(c)\nans=[]\nfor i in range(c.count(res)):\n an=dict()\n idx=c.index(res)\n an[b[0]]=longest-d[idx][0]\n an[d[idx][2]]=d[idx][1]\n ans.append(an)\n c[idx]=-1\n\nresult=0\nfor i in ans:\n x=[]\n for i in an.keys():\n x.append((canmake[i],an[i]))\n x.sort(key=lambda y:y[0])\n re=''\n for i in range(len(x)):\n y=x.pop()\n re+=str(y[0])*y[1]\n ima=int(re)\n if ima>result:result=ima\n \nif amari!=0:print(result)", 'a,b=map(int,input().split())\nif b%a==0:print(a+b)\nelse:print(b-a)'] | ['Runtime Error', 'Accepted'] | ['s303596038', 's944761175'] | [3192.0, 2940.0] | [18.0, 18.0] | [1079, 65] |
p03125 | u173374079 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['#!/usr/bin/python\n# coding: UTF-8\na,b = map(int,input().split())\n\nif a % b == 0:\n print(a+b)\nelse:\n print(b-a)', '#!/usr/bin/python\n# coding: UTF-8\na,b = map(int,input().split())\n\nif b % a == 0:\n print(a+b)\nelse:\n print(b-a)'] | ['Wrong Answer', 'Accepted'] | ['s298571528', 's523283100'] | [2940.0, 2940.0] | [17.0, 17.0] | [112, 112] |
p03125 | u175590965 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ["a,b = map(int,input().split('/'))\nif b%a ==0:\n print(a+b)\nelse:\n print(b-a)\n ", 'a,b = map(int,input().split())\nif b%a ==0:\n print(a+b)\nelse:\n print(b-a)\n '] | ['Runtime Error', 'Accepted'] | ['s753271769', 's422650749'] | [2940.0, 2940.0] | [18.0, 17.0] | [86, 83] |
p03125 | u177411511 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a, b = map((int, input().split()))\nprint(a + b if b % a == 0 else b-a)', 'a, b = map(int, input().split())\nprint(a + b if b % a == 0 else b - a)'] | ['Runtime Error', 'Accepted'] | ['s738224282', 's214269607'] | [2940.0, 2940.0] | [17.0, 18.0] | [70, 70] |
p03125 | u177756077 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['N=int(input())\nA=list(map(int,input().split()))\n\nwhile len(set(A))!=1:\n\n A.sort()\n for i in range(len(A)-1):\n if A.count(0):\n A.remove(0)\n break\n A[i+1]=A[i+1]%A[0]\n\nprint(max(A))', 'N=int(input())\nA=list(map(int,input().split()))\n\nwhile len(set(A)!=1:\n\n A.sort()\n for i in range(len(A)-1):\n if A.count(0):\n A.remove(0)\n break\n A[i+1]=A[i+1]%A[0]\n\nprint(max(A))', 'A,B=map(int,input().split())\nif B%A==0:\n print(A+B)\nelse:print(B-A)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s544919125', 's673500342', 's356029984'] | [3060.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [240, 239, 70] |
p03125 | u178192749 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a.b = map(int, input().split())\nif b%a == 0:\n print(a+b)\nelse:\n print(b-a)', 'a,b = map(int, input().split())\nif b%a == 0:\n print(a+b)\nelse:\n print(b-a)\n'] | ['Runtime Error', 'Accepted'] | ['s235775372', 's037133588'] | [2940.0, 2940.0] | [17.0, 18.0] | [76, 77] |
p03125 | u179169725 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A, B = list(map(int, input().split()))\n\nif A % B == 0:\n print(A + B)\nelse:\n print(B-A)', 'A, B = list(map(int, input().split()))\n\nif B % A == 0:\n print(A + B)\nelse:\n print(B-A)\n'] | ['Wrong Answer', 'Accepted'] | ['s050445735', 's529235968'] | [2940.0, 2940.0] | [17.0, 17.0] | [92, 93] |
p03125 | u189479417 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A, B = map(int,input().split())\nans = A+B if A % B == 0 else B-A\nprint(ans)', 'A, B = map(int,input().split())\n\nif B % A == 0:\n print(A + B)\nelse:\n print(B - A)'] | ['Wrong Answer', 'Accepted'] | ['s077796472', 's404905280'] | [3064.0, 9124.0] | [18.0, 28.0] | [75, 87] |
p03125 | u197300773 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['import sys\n\ndef chk(i,j):\n tmp=[p[i][k] for k in range(M)]\n tmp[j]=p[i][j]+1\n for k in range(M-1,-1,-1):\n if tmp[k] > p[i+x[j]][k] :\n p[i+x[j]]=[tmp[k] for k in range(M)]\n\nN,M=map(int,input().split())\nx=[0,2,5,5,4,5,6,3,7,6]\na=list(map(int,input().split()))\na.sort()\nb=[]\nfor i in range(M):\n for j in range(M):\n if x[a[j]]==x[a[i]]: tmp=j\n b.append(a[tmp]) \n\na=list(set(b))\na.sort()\nM=len(a)\nx=[ x[a[i]] for i in range(M) ]\n\n\np=[-100 for i in range(N+10)]\np[0]=0\nfor i in range(N):\n if p[i]>-1:\n for j in range(M):\n p[i+x[j]]=max(p[i+x[j]],p[i]+1)\n\nans=""\nwhile N>0:\n for j in range(M-1,-1,-1):\n if p[N]==p[N-x[j]]+1:\n ans+=str(a[j])\n N-=x[j]\n break\nprint(ans)\n\n\n', 'N,K=map(int,input().split())\nprint(N+K if K%N==0 else K-N)'] | ['Runtime Error', 'Accepted'] | ['s723382831', 's342127285'] | [3064.0, 2940.0] | [18.0, 18.0] | [767, 58] |
p03125 | u198758525 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a = [int(x) for x in input().split()]\nprint(a[0] - a[1])', 'a = [int(x) for x in input().split()]\nif a[1] % a[0] == 0:\n print(a[0] + a[1])\nelse:\n print(a[1] - a[0])'] | ['Wrong Answer', 'Accepted'] | ['s961785862', 's161934578'] | [2940.0, 2940.0] | [17.0, 17.0] | [56, 110] |
p03125 | u207036582 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a, b = int(input().split())\nif b % a == 0 : print(a+b)\nelse : print(b-a)', 'a, b = map(int, input().split())\nif b % a == 0 : print(a+b)\nelse : print(b-a)\n'] | ['Runtime Error', 'Accepted'] | ['s509275248', 's064971273'] | [2940.0, 2940.0] | [17.0, 17.0] | [72, 78] |
p03125 | u207075364 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['a,b=map(int,input().split())\nif b/a == 0:\n print(a+b)\nelse:\n print(b-a)\n', 'a,b=map(int,input().split())\nif b%a == 0:\n print(a+b)\nelse:\n print(b-a)\n'] | ['Wrong Answer', 'Accepted'] | ['s995551900', 's046401868'] | [2940.0, 2940.0] | [17.0, 17.0] | [74, 74] |
p03125 | u207464563 | 2,000 | 1,048,576 | You are given positive integers A and B. If A is a divisor of B, print A + B; otherwise, print B - A. | ['A,B = map(int,input().split())\nx = A + B if A % B == 0 else B - A\nprint(x)', 'A,B = map(int,input().split)\nx = A + B if A % B == 0 else B - A\nprint(x)', 'A,B = map(int,input().split())\nx = A + B if B % A == 0 else B - A\nprint(x)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s735175261', 's906696383', 's507158143'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [74, 72, 74] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.