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
p03326
u207707177
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['n,m = [int(i) for i in input().split()]\n\ncakes = []\nranking = [[] for i in range(8)]\nranking2 = []\n\nfor i in range(n):\n cakes.append(list(map(int,input().split())))\n\na = 0\nfor i in range(2):\n for j in range(2):\n for k in range(2):\n for x in range(n):\n kirei = cakes[x][0]\n oisii = cakes[x][1]\n ninki = cakes[x][2]\n if i ==1:\n kirei = (-1)*kirei\n if j ==1:\n oisii = (-1) * oisii\n if k==1:\n ninki = (-1)*ninki\n sum = kirei + oisii + ninki\n ranking[a].append(sum)\n a += 1\n\nfor i in ranking:\n i = sorted(i)\n i = i[::-1]\n ranking2.append(i)\n\nans = 0\n\nmaxi = 0\n\nfor x in ranking2:\n ans = 0\n for i in range(m):\n ans += x[i]\n maxi = max(maxi,ans)\nprint(maxi)n,m = [int(i) for i in input().split()]\n\ncakes = []\nranking = [[] for i in range(8)]\nranking2 = []\n\nfor i in range(n):\n cakes.append(list(map(int,input().split())))\n\na = 0\nfor i in range(2):\n for j in range(2):\n for k in range(2):\n for x in range(n):\n kirei = cakes[x][0]\n oisii = cakes[x][1]\n ninki = cakes[x][2]\n if i ==1:\n kirei = (-1)*kirei\n if j ==1:\n oisii = (-1) * oisii\n if k==1:\n ninki = (-1)*ninki\n sum = kirei + oisii + ninki\n ranking[a].append(sum)\n a += 1\n\nfor i in ranking:\n i = sorted(i)\n i = i[::-1]\n ranking2.append(i)\n\nans = 0\n\nmaxi = 0\n\nfor x in ranking2:\n ans = 0\n for i in range(m):\n ans += x[i]\n maxi = max(maxi,ans)\nprint(maxi)', 'n,m = [int(i) for i in input().split()]\nck = []\nfor i in range(n):\n ck.append(list(map(int,input().split())))\n\nco1=co2=co3=-1\n\nscores = []\nmaxi = 0\nfor i in range(2):\n co1 *= -1\n for j in range(2):\n co2 *= -1\n for k in range(2):\n co3*= -1\n scores = []\n score = 0\n for a,b,c in ck:\n scores.append(a*co1 + b*co2 + c*co3)\n scores.sort(reverse=True)\n for x in range(m):\n score += scores[x]\n maxi = max(maxi,score)\n\nprint(maxi)']
['Runtime Error', 'Accepted']
['s183723023', 's473590769']
[3064.0, 3316.0]
[18.0, 27.0]
[1774, 552]
p03326
u218843509
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['from itertools import accumulate\n\nn, m = map(int, input().split())\na = [list(map(int, input().split())) for _ in range(n)]\nx = list(accumulate([a[i][0] for i in range(n)]))\ny = list(accumulate([a[i][1] for i in range(n)]))\nz = list(accumulate([a[i][2] for i in range(n)]))\n\n\n#\treturn abs(x[0]) + abs(x[1]) + abs(x[2])\n\ndef choose(x, y):\n\tif abs(x[0]) + abs(x[1]) + abs(x[2]) > abs(y[0]) + abs(y[1]) + abs(y[2]):\n\t\treturn x\n\telse:\n\t\treturn y\n\ndp = [[[] for _ in range(n + 1)] for _ in range(n)]\n\n\n\nfor i in range(n):\n\tdp[i][0] = [0, 0, 0]\n\ndp[0][1] = a[0]\n\nfor i in range(1, n):\n\tdp[i][1] = choose(dp[i-1][1], a[i])\n\nfor i in range(1, n):\n\tdp[i][i + 1] = [x[i], y[i], z[i]]\n\n#print(dp)\n\nfor i in range(2, n):\n\tfor j in range(2, i + 1):\n\t\tdp[i][j] = choose(dp[i-1][j], [x + y for x, y in zip(dp[i-1][j-1], a[i])])\n\n\n\nprint(dp)\n\nprint(abs(dp[n-1][m][0]) + abs(dp[n-1][m][1]) + abs(dp[n-1][m][2]))', 'from itertools import accumulate\n\nn, m = map(int, input().split())\na = [list(map(int, input().split())) for _ in range(n)]\n\nmax_point = []\n\npoints = sorted([a[i][0] + a[i][1] + a[i][2] for i in range(n)], reverse=True)\nmax_point.append(sum(points[:m]))\n\npoints = sorted([a[i][0] + a[i][1] - a[i][2] for i in range(n)], reverse=True)\nmax_point.append(sum(points[:m]))\n\npoints = sorted([a[i][0] - a[i][1] + a[i][2] for i in range(n)], reverse=True)\nmax_point.append(sum(points[:m]))\n\npoints = sorted([a[i][0] - a[i][1] - a[i][2] for i in range(n)], reverse=True)\nmax_point.append(sum(points[:m]))\n\npoints = sorted([- a[i][0] + a[i][1] + a[i][2] for i in range(n)], reverse=True)\nmax_point.append(sum(points[:m]))\n\npoints = sorted([- a[i][0] + a[i][1] - a[i][2] for i in range(n)], reverse=True)\nmax_point.append(sum(points[:m]))\n\npoints = sorted([- a[i][0] - a[i][1] + a[i][2] for i in range(n)], reverse=True)\nmax_point.append(sum(points[:m]))\n\npoints = sorted([- a[i][0] - a[i][1] - a[i][2] for i in range(n)], reverse=True)\nmax_point.append(sum(points[:m]))\n\nprint(max(max_point))']
['Wrong Answer', 'Accepted']
['s667980680', 's136444571']
[236880.0, 3444.0]
[1785.0, 25.0]
[991, 1081]
p03326
u242196904
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['N,M = map(int,input().split())\n\nx = []\ny = []\nz = []\nfor k in range(N):\n xx,yy,zz = map(int,input().split())\n x.append(xx)\n y.append(yy)\n z.append(zz)\n\nite = [-1,1]\n\ns_ori = np.stack([x,y,z])\ncc = []\nfor i in ite:\n for j in ite:\n for k in ite:\n s = s_ori.copy()\n s[0,:] *= i\n s[1,:] *= j\n s[2,:] *= k\n a = np.sum(s,axis = 0)\n b = np.sort(a)[::-1][:M]\n c = sum(b)\n cc.append(c)\nprint(np.max(cc))', 'import numpy as np\nN,M = map(int,input().split())\n\nx = []\ny = []\nz = []\nfor k in range(N):\n xx,yy,zz = map(int,input().split())\n x.append(xx)\n y.append(yy)\n z.append(zz)\n\nite = [-1,1]\n\ns_ori = np.vstack([x,y,z])\ncc = []\nfor i in ite:\n for j in ite:\n for k in ite:\n s = s_ori.copy()\n s[0,:] *= i\n s[1,:] *= j\n s[2,:] *= k\n a = np.sum(s,axis = 0)\n b = np.sort(a)[::-1][:M]\n c = sum(b)\n cc.append(c)\nprint(np.max(cc))']
['Runtime Error', 'Accepted']
['s054472585', 's906242281']
[3064.0, 21644.0]
[21.0, 1411.0]
[504, 524]
p03326
u299869545
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['N,M = list(map(int, input().split()))\ncakes = []\nfor i in range(N):\n cakes.append(list(map(int, input().split())))\n\nans = 0\n\nvalues = []\nfor x,y,z in cakes:\n values.append(x+y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\nvalues = []\nfor x,y,z in cakes:\n values.append(x+y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n values.append(x-y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n values.append(x-y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n values.append(-x+y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n values.append(-x+y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\n\nvalues = []\nfor x,y,z in cakes:\n values.append(-x-y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n values.append(-x-y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nprint(ans/3)\n', 'N,M = list(map(int, input().split()))\ncakes = []\nfor i in range(N):\n cakes.append(list(map(int, input().split())))\n\nans = 0\n\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(x+y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(x+y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(x-y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(x-y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(-x+y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(-x+y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(-x-y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(-x-y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nprint(ans)\n ', 'N,M = list(map(int, input().split()))\ncakes = []\nfor i in range(N):\n cakes.append(list(map(int, input().split())))\n\nans = 0\n\nvalues = []\nfor x,y,z in cakes:\n value = 0\n for j in range(3):\n values.append(x+y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\nvalues = []\nfor x,y,z in cakes:\n value = 0\n for j in range(3):\n values.append(x+y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n value = 0\n for j in range(3):\n values.append(x-y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n value = 0\n for j in range(3):\n values.append(x-y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n value = 0\n for j in range(3):\n values.append(-x+y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n value = 0\n for j in range(3):\n values.append(-x+y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\n\nvalues = []\nfor x,y,z in cakes:\n value = 0\n for j in range(3):\n values.append(-x-y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n value = 0\n for j in range(3):\n values.append(-x-y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nprint(ans/3)\n', 'N,M = list(map(int, input().split()))\ncakes = []\nfor i in range(N):\n cakes.append(list(map(int, input().split())))\n\nans = 0\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(x+y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(x+y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(x-y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(x-y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(-x+y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(-x+y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(-x-y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor cake in cakes:\n value = 0\n for j in range(3):\n values.append(-x-y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nprint(ans)\n ', 'N,M = list(map(int, input().split()))\ncakes = []\nfor i in range(N):\n cakes.append(list(map(int, input().split())))\n\nans = 0\n\nvalues = []\nfor x,y,z in cakes:\n values.append(x+y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\nvalues = []\nfor x,y,z in cakes:\n values.append(x+y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n values.append(x-y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n values.append(x-y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n values.append(-x+y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n values.append(-x+y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\n\nvalues = []\nfor x,y,z in cakes:\n values.append(-x-y+z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nvalues = []\nfor x,y,z in cakes:\n values.append(-x-y-z)\nvalues.sort()\nvalues = values[::-1]\nans = max(ans, sum(values[:M]))\n\n\nprint(ans)\n']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s346248807', 's459026374', 's629665944', 's965646875', 's335284441']
[3316.0, 3316.0, 3484.0, 3316.0, 3316.0]
[25.0, 21.0, 35.0, 21.0, 25.0]
[1161, 1471, 1489, 1483, 1159]
p03326
u306142032
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['n, m = map(int, input().split())\n\nx = []\nma = [0, 0, 0]\nwa = 0\nsakujo_cnt = 0\nfor i in range(n):\n x.append(list(map(int, input().split())))\n\nfor i in range(n):\n for j in range(3):\n ma[j] += x[i][j]\n wa = abs(ma[0]) + abs(ma[1]) + abs(ma[2])\n\nfor i in range(n):\n for j in range(3):\n ma[j] -= x[i][j]\n\n wa_tmp = abs(ma[0]) + abs(ma[1]) + abs(ma[2])\n\n if wa_tmp <= wa:\n for j in range(3):\n ma[j] += x[i][j]\n else:\n sakujo_cnt += 1\n if (n - sakujo_cnt) == m:\n break\nprint(wa_tmp)\n', 'n, m = map(int, input().split())\na = [[] for i in range(8)]\n\nfor i in range(n):\n x, y, z = map(int, input().split())\n a[0].append(x+y+z)\n a[1].append(x+y-z)\n a[2].append(x-y+z)\n a[3].append(x-y-z)\n a[4].append(-x+y+z)\n a[5].append(-x+y-z)\n a[6].append(-x-y+z)\n a[7].append(-x-y-z)\n\n\nans = 0\nfor x in a:\n tmp = sum(sorted(x, reverse = True)[:m])\n if ans < tmp:\n ans = tmp\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s867689268', 's773084216']
[3188.0, 3444.0]
[26.0, 59.0]
[550, 423]
p03326
u334712262
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
["# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\n\nsys.setrecursionlimit(10000)\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n\n error_print(e - s, 'sec')\n return ret\n\n return wrap\n\n\n@mt\ndef slv(N, M, XYZ):\n\n cakes = []\n\n \n \n # cakes.sort(reverse=True)\n\n def v(xyz):\n return abs(xyz[0]) + abs(xyz[1]) + abs(xyz[2])\n\n take = list(range(M))\n V = 0\n f = True\n while f:\n f = False\n X = Y = Z = 0\n for i in take:\n x, y, z = XYZ[i]\n X += x\n Y += y\n Z += z\n\n V = v((X, Y, Z))\n IJ = None\n for i in range(N):\n if i in take:\n continue\n for j in take:\n C = (X - XYZ[j][0] + XYZ[i][0], Y - XYZ[j][1] + XYZ[i][1],\n Z - XYZ[j][2] + XYZ[i][2])\n if V < v(C):\n V = v(C)\n IJ = (i, j)\n if IJ:\n take.remove(IJ[1])\n take.append(IJ[0])\n f = True\n print(take, V)\n print(take)\n\n return V\n\n\ndef main():\n N, M = read_int_n()\n XYZ = [read_int_n() for _ in range(N)]\n print(slv(N, M, XYZ))\n\n\nif __name__ == '__main__':\n main()\n", "# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\n\nsys.setrecursionlimit(10000)\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n\n error_print(e - s, 'sec')\n return ret\n\n return wrap\n\n\n@mt\ndef slv(N, M, XYZ):\n ans = 0\n for i, j, k in product([-1, 1], [-1, 1], [-1, 1]):\n ans = max(ans,\n sum(\n sorted(\n [i * x + j * y + k * z for x, y, z in XYZ],\n reverse=True)[:M]))\n return ans\n\n\ndef main():\n N, M = read_int_n()\n XYZ = [read_int_n() for _ in range(N)]\n\n print(slv(N, M, XYZ))\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s057845259', 's110199099']
[7908.0, 8004.0]
[2104.0, 244.0]
[2049, 1389]
p03326
u335295553
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['N, M = map(int, input().split())\nxyz = [list(map(int, input().split())) for i in range(N)]\ntmp = [[0]*N for i in range(8)]\n\nfor n, _ in enumerate(xyz):\n x,y,z = _\n tmp[0][n] = x+y+z\n tmp[1][n] = x+y-z\n tmp[2][n] = x-y+z\n tmp[3][n] = x-y-z\n tmp[4][n] = -x+y+z\n tmp[5][n] = -x+y-z\n tmp[6][n] = -x-y+z\n tmp[7][n] = -x-y-z\n\nresult = [0]*8\nfor i in range(8):\n print(sorted(tmp[i]))\n result[i] = sum(sorted(tmp[i])[-M:])\n\nprint(max(result))', 'N, M = map(int, input().split())\nxyz = [list(map(int, input().split())) for i in range(N)]\ntmp = [[0]*N for i in range(8)]\n\nfor n, _ in enumerate(xyz):\n x,y,z = _\n tmp[0][n] = x+y+z\n tmp[1][n] = x+y-z\n tmp[2][n] = x-y+z\n tmp[3][n] = x-y-z\n tmp[4][n] = -x+y+z\n tmp[5][n] = -x+y-z\n tmp[6][n] = -x-y+z\n tmp[7][n] = -x-y-z\n\nresult = -float("inf")\nfor i in range(8):\n result = max(result, sum(sorted(tmp[i], reverse=True)[:M]))\nprint(result)\n']
['Wrong Answer', 'Accepted']
['s683431180', 's986131287']
[3700.0, 3700.0]
[27.0, 25.0]
[467, 467]
p03326
u357529599
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['N, M = map(int, input().split())\nx, y, z = [], [], []\n\nfor i in range(N):\n xi, yi, zi = map(int, input().split())\n x.append(xi)\n y.append(yi)\n z.append(zi)\n\nbits = [[1,1,1], [1,1,-1], [1,-1,1], [1,-1,-1], [-1,1,1], [-1,1,-1], [-1,-1,1], [-1,-1,-1]]\n\n\nprint(x)\nresults = []\nfor i in range(len(bits)):\n xyzsum=[0 for _ in range(N) ]\n for j in range(N):\n xyzsum[j] = (x[j]*bits[0][0] + y[j]*bits[0][1] + z[j]*bits[0][2])\n\n xyzsum = sorted(xyzsum, reverse=True)\n results.append(xyzsum[:M])\n\nprint(sum(max(results)))', 'N, M = map(int, input().split())\nx, y, z = [], [], []\n\nfor i in range(N):\n xi, yi, zi = map(int, input().split())\n x.append(xi)\n y.append(yi)\n z.append(zi)\n\nbits = [[1,1,1], [1,1,-1], [1,-1,1], [1,-1,-1], [-1,1,1], [-1,1,-1], [-1,-1,1], [-1,-1,-1]]\n\n\nresults = []\nfor i in range(len(bits)):\n xyzsum=[0 for _ in range(N)]\n for j in range(N):\n xyzsum[j] = (x[j]*bits[i][0] + y[j]*bits[i][1] + z[j]*bits[i][2])\n xyzsum = sorted(xyzsum, reverse=True)\n results.append(sum(xyzsum[:M]))\n\nprint(max(results))']
['Wrong Answer', 'Accepted']
['s580994459', 's976378103']
[3568.0, 3316.0]
[28.0, 29.0]
[542, 531]
p03326
u380524497
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['import numpy as np\n\nn, m = map(int, input().split())\nDP = [[np.array([0, 0, 0]) for j in range(m+1)] for i in range(8)]\n\nfor _ in range(n):\n xyz = list(map(int, input().split()))\n for sign in range(8):\n check = np.zeros(3, dtype=np.int)\n for i in range(3):\n if (sign >> i) & 1:\n check[i] = 1\n else:\n check[i] = -1\n\n for i in range(m-1, -1, -1):\n candidate = DP[sign][i] + xyz\n delta = DP[sign][i+1] - DP[sign][i]\n delta_value = sum(delta*check)\n if delta_value < sum(xyz*check):\n DP[sign][i+1] = DP[sign][i] + xyz\n\nans = 0\nfor i in range(8):\n total = sum(np.abs(DP[i][m]))\n ans = max(ans, total)\n\nprint(ans)\n', 'import numpy as np\n\nn, m = map(int, input().split())\nDP = [[0] * (m+1) for i in range(8)]\n\nfor _ in range(n):\n xyz = list(map(int, input().split()))\n for sign in range(8):\n check = np.zeros(3, dtype=np.int)\n for i in range(3):\n if (sign >> i) & 1:\n check[i] = 1\n else:\n check[i] = -1\n\n value = sum(xyz*check)\n DP[sign][1:] = np.maximum(DP[sign][1:], DP[sign][:-1]+value)\n\n\nans = 0\nfor i in range(8):\n ans = max(ans, DP[i][m])\n\nprint(ans)\n', 'n, m = map(int, input().split())\ncakes = []\nfor i in range(n):\n x, y, z = map(int, input().split())\n cakes.append([x, y, z])\n\nans = []\nfor sign in range(8):\n check = [0, 0, 0]\n for i in range(3):\n if (sign >> i) & 1:\n check[i] = 1\n else:\n check[i] = -1\n\n cakes.sort(reverse=True, key=lambda x: x[0]*check[0] + x[1]*check[1] + x[2]*check[2])\n value = [0, 0, 0]\n for i in range(m):\n a, b, c = cakes[i]\n value[0] += a\n value[1] += b\n value[2] += c\n \n candidate = 0\n for i in range(3):\n candidate += abs(value[i])\n\n ans.append(candidate)\n\nprint(max(ans))\n']
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s359849035', 's626794521', 's716443227']
[21448.0, 14820.0, 3188.0]
[2108.0, 2109.0, 31.0]
[752, 527, 659]
p03326
u388697579
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['b = input().split()\nl = np.zeros((int(b[0]), 3))\nfor i in range(int(b[0])):\n\tbuf = input().split()\n\tfor j in range(3):\n\t\tl[i][j] = int(buf[j])\nr = 0\n\nfor p in range(8):\n\trbuf = 0\n\tbox = ((-1)**p)*l.T[0]+((-1)**(p//2))*l.T[1]+((-1)**(p//4))*l.T[2]\n\t#print((-1)**p, (-1)**(p//2), (-1)**(p//4))\n\tfor i in range(int(b[1])):\n\t\trbuf += np.max(box)\n\t\tbox[np.argmax(box)] = 0\n\tif(rbuf > r):\n\t\tr = rbuf\n\t\t\nprint(int(r))# your code goes here', 'import numpy as np\n\nb = input().split()\nl = np.zeros((int(b[0]), 3))\nfor i in range(int(b[0])):\n\tbuf = input().split()\n\tfor j in range(3):\n\t\tl[i][j] = int(buf[j])\nr = 0\n\nfor p in range(8):\n\trbuf = 0\n\tbox = ((-1)**p)*l.T[0]+((-1)**(p//2))*l.T[1]+((-1)**(p//4))*l.T[2]\n\tbox = np.sort(box)[::-1]\n\tfor i in range(int(b[1])):\n\t\trbuf += box[i]\n\tif(rbuf > r):\n\t\tr = rbuf\n\t\t\nprint(int(r))']
['Runtime Error', 'Accepted']
['s764235618', 's586838284']
[3064.0, 21124.0]
[17.0, 1655.0]
[431, 380]
p03326
u461454424
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['#input\nN, M = map(int, input().split())\nx = []\ny = []\nz = []\nfor i in range(N):\n x_temp, y_temp, z_temp = map(int, input().split())\n x.append(x_temp)\n y.append(y_temp)\n z.append(z_temp)\n\n#output\n#+++\na1 = [p+q+r for p, q, r in zip(x, y, z)]\na1.sort(reverse = True)\nb1 = np.sum(a1[:M])\n\n#++-\na2 = [p+q-r for p, q, r in zip(x, y, z)]\na2.sort(reverse = True)\nb2 = np.sum(a2[:M])\n\n#+-+\na3 = [p-q+r for p, q, r in zip(x, y, z)]\na3.sort(reverse = True)\nb3 = np.sum(a3[:M])\n\n#-++\na4 = [-p+q+r for p, q, r in zip(x, y, z)]\na4.sort(reverse = True)\nb4 = np.sum(a4[:M])\n\n#+--\na5 = [p-q-r for p, q, r in zip(x, y, z)]\na5.sort(reverse = True)\nb5 = np.sum(a5[:M])\n\n#-+-\na6 = [-p+q-r for p, q, r in zip(x, y, z)]\na6.sort(reverse = True)\nb6 = np.sum(a6[:M])\n\n#--+\na7 = [-p-q+r for p, q, r in zip(x, y, z)]\na7.sort(reverse = True)\nb7 = np.sum(a7[:M])\n\n#---\na8 = [-p-q-r for p, q, r in zip(x, y, z)]\na8.sort(reverse = True)\nb8 = np.sum(a8[:M])\n\nprint(max(b1, b2, b3, b4, b5, b6, b7, b8))', '#input\nN, M = map(int, input().split())\nx = []\ny = []\nz = []\nfor i in range(N):\n x_temp, y_temp, z_temp = map(int, input().split())\n x.append(x_temp)\n y.append(y_temp)\n z.append(z_temp)\n\n#output\n#+++\na1 = [p+q+r for p, q, r in zip(x, y, z)]\na1 = sorted(a1, reverse = True)\nb1 = np.sum(a1[:M])\n\n#++-\na2 = [p+q-r for p, q, r in zip(x, y, z)]\na2 = sorted(a2, reverse = True)\nb2 = np.sum(a2[:M])\n\n#+-+\na3 = [p-q+r for p, q, r in zip(x, y, z)]\na3 = sorted(a3, reverse = True)\nb3 = np.sum(a3[:M])\n\n#-++\na4 = [-p+q+r for p, q, r in zip(x, y, z)]\na4 = sorted(a4, reverse = True)\nb4 = np.sum(a4[:M])\n\n#+--\na5 = [p-q-r for p, q, r in zip(x, y, z)]\na5 = sorted(a5, reverse = True)\nb5 = np.sum(a5[:M])\n\n#-+-\na6 = [-p+q-r for p, q, r in zip(x, y, z)]\na6 = sorted(a6, reverse = True)\nb6 = np.sum(a6[:M])\n\n#--+\na7 = [-p-q+r for p, q, r in zip(x, y, z)]\na7 = sorted(a7, reverse = True)\nb7 = np.sum(a7[:M])\n\n#---\na8 = [-p-q-r for p, q, r in zip(x, y, z)]\na8 = sorted(a8, reverse = True)\nb8 = np.sum(a8[:M])\n\nprint(max(b1, b2, b3, b4, b5, b6, b7, b8))', '#input\nN, M = map(int, input().split())\nx = []\ny = []\nz = []\nfor i in range(N):\n x_temp, y_temp, z_temp = map(int, input().split())\n x.append(x_temp)\n y.append(y_temp)\n z.append(z_temp)\n\n#output\n#+++\na1 = [p+q+r for p, q, r in zip(x, y, z)]\na1.sort(reverse = True)\nb1 = sum(a1[:M])\n\n#++-\na2 = [p+q-r for p, q, r in zip(x, y, z)]\na2.sort(reverse = True)\nb2 = sum(a2[:M])\n\n#+-+\na3 = [p-q+r for p, q, r in zip(x, y, z)]\na3.sort(reverse = True)\nb3 = sum(a3[:M])\n\n#-++\na4 = [-p+q+r for p, q, r in zip(x, y, z)]\na4.sort(reverse = True)\nb4 = sum(a4[:M])\n\n#+--\na5 = [p-q-r for p, q, r in zip(x, y, z)]\na5.sort(reverse = True)\nb5 = sum(a5[:M])\n\n#-+-\na6 = [-p+q-r for p, q, r in zip(x, y, z)]\na6.sort(reverse = True)\nb6 = sum(a6[:M])\n\n#--+\na7 = [-p-q+r for p, q, r in zip(x, y, z)]\na7.sort(reverse = True)\nb7 = sum(a7[:M])\n\n#---\na8 = [-p-q-r for p, q, r in zip(x, y, z)]\na8.sort(reverse = True)\nb8 = sum(a8[:M])\n\nprint(max(b1, b2, b3, b4, b5, b6, b7, b8))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s169693779', 's927417468', 's905331741']
[3192.0, 3192.0, 3564.0]
[21.0, 22.0, 24.0]
[981, 1045, 958]
p03326
u472821430
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
["import itertools\nimport numpy as np\ndef main():\n n, m = map(int, input().split())\n x = np.zeros((n, 3))\n for i in range(n):\n x[i, 0], x[i, 1], x[i, 2] = map(int, input().split())\n output = 0\n for i in list(itertools.combinations(range(n), m)):\n r = abs(np.sum(x[i, 0])) + abs(np.sum(x[i, 1])) + abs(np.sum(x[i, 2]))\n if output <= r:\n output = r\n print(output)\n \nif __name__ == '__main__':\n main()", "import sys\n\ndef main():\n input = sys.stdin.readline\n N, M = map(int, input().split())\n ppp = []\n ppm = []\n pmp = []\n pmm = []\n mpp = []\n mpm = []\n mmp = []\n mmm = []\n for _ in range(N):\n x, y, z = map(int, input().split())\n ppp.append(x+y+z)\n ppm.append(x+y-z)\n pmp.append(x-y+z)\n pmm.append(x-y-z)\n mpp.append(-x+y+z)\n mpm.append(-x+y-z)\n mmp.append(-x-y+z)\n mmm.append(-x-y-z)\n ppp = sorted(ppp, key=lambda x:-x)\n ppm = sorted(ppm, key=lambda x:-x)\n pmp = sorted(pmp, key=lambda x:-x)\n pmm = sorted(pmm, key=lambda x:-x)\n mpp = sorted(mpp, key=lambda x:-x)\n mpm = sorted(mpm, key=lambda x:-x)\n mmp = sorted(mmp, key=lambda x:-x)\n mmm = sorted(mmm, key=lambda x:-x)\n\n ans = max(sum(ppp[:M]), sum(ppm[:M]), sum(pmp[:M]), sum(pmm[:M]),\n sum(mpp[:M]), sum(mpm[:M]), sum(mmp[:M]), sum(mmm[:M]))\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s653427114', 's479487979']
[1483464.0, 3444.0]
[2197.0, 23.0]
[419, 901]
p03326
u473952728
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['from itertools import combinations\n\ndef score (cids):\n x = abs(sum(data[cid][0] for cid in cids))\n y = abs(sum(data[cid][1] for cid in cids))\n z = abs(sum(data[cid][2] for cid in cids))\n return x + y + z\n\nn, m = map(int, input().split())\ndata = list([int(x) for x in input().split()] for _ in range(n))\nprint(max(score(x) for x in combinations(range(n), m)))\n~', 'n, m = map(int, input().split())\ndata = [[int(x) for x in input().split()] for _ in range(n)]\n\npats = [(x,y,z) for x in [-1,1] for y in [-1,1] for z in [-1,1]] # +++,++-,...,---\nscore = lambda sgns, vals: sum([s * x for(s, x) in zip(sgns, vals)]) # i.e.x+y-z\nresult = max(sum(sorted((score(pat, row) for row in data), reverse=True )[:m]) for pat in pats)\nprint(result)']
['Runtime Error', 'Accepted']
['s999353807', 's109681527']
[3064.0, 3292.0]
[17.0, 36.0]
[372, 369]
p03326
u476604182
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
["import numpy as np\nN, M, *L = map(int, open('0').read().split())\nL = [np.array(m) for m in zip(*[iter(L)]*3)]\nans = 0\nfor i in range(8):\n X = []\n c = []\n for j in range(3):\n if i%2==1:\n c.append(-1)\n else:\n c.append(1)\n i >>= 1\n c = np.array(c)\n X = list(map(lambda x:sum(x*c), L))\n X.sort(reverse=True)\n ans = max(ans, sum(X[:M]))\nprint(ans)", 'import numpy as np\nN, M, *L = map(int, open(0).read().split())\nL = [np.array(m) for m in zip(*[iter(L)]*3)]\nans = 0\nfor i in range(8):\n X = []\n c = []\n for j in range(3):\n if i%2==1:\n c.append(-1)\n else:\n c.append(1)\n i >>= 1\n c = np.array(c)\n X = list(map(lambda x:sum(x*c), L))\n X.sort(reverse=True)\n ans = max(ans, sum(X[:M]))\nprint(ans)']
['Runtime Error', 'Accepted']
['s327441467', 's715190433']
[12504.0, 12564.0]
[151.0, 189.0]
[368, 366]
p03326
u496344397
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
[", M = list(map(int, input().split()))\n\ncakes = [] \nfor _ in range(N):\n cakes.append(list(map(int, input().split())))\n\nmemo = dict()\n\ndef pick_cake(picked):\n key = ','.join([str(p) for p in sorted(picked)])\n if key in memo: \n return memo[key]\n\n if len(picked) == M:\n memo[key] = sum([abs(sum([cakes[i][j] for i in picked])) for j in range(3)])\n return memo[key]\n\n answer = 0 \n for i in range(N):\n if i in picked:\n continue\n answer = max(answer, pick_cake(picked + [i]))\n return answer\n\nprint(pick_cake([]))", "from itertools import product\n\nN, M = list(map(int, input().split()))\n\ncakes = []\nfor _ in range(N):\n cakes.append(list(map(int, input().split())))\n\ndef _eval1(op):\n def _eval2(x):\n return eval(''.join(['{}{}'.format(op[i], x[i]) for i in range(3)]))\n\n return _eval2\n\nanswer = 0\nfor op in product('+-', repeat=3):\n answer = max(answer, sum([abs(sum([cake[j] for cake in sorted(cakes, key=_eval1(op))[:M]])) for j in range(3)]))\n\nprint(answer)"]
['Runtime Error', 'Accepted']
['s103015459', 's419167911']
[3064.0, 3400.0]
[17.0, 421.0]
[573, 461]
p03326
u497625442
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['import functools # Python3 \nN,M = map(int,input().split())\nx, y, z = [0] * N, [0] * N, [0] * N\nfor i in range(N):\n\tx[i], y[i], z[i] = map(int,input().split())\n\n# N, M = 5, 3\n# x = [1, -4, 7, -10, 13]\n\n\nppp = [ x[i]+y[i]+z[i] for i in range(N)]\npmp = [ x[i]-y[i]+z[i] for i in range(N)]\nppm = [ x[i]+y[i]-z[i] for i in range(N)]\npmm = [ x[i]-y[i]-z[i] for i in range(N)]\nmpp = [-x[i]+y[i]+z[i] for i in range(N)]\nmpm = [-x[i]+y[i]-z[i] for i in range(N)]\nmmp = [-x[i]-y[i]+z[i] for i in range(N)]\nmmm = [-x[i]-y[i]-z[i] for i in range(N)]\n\nMAX = 0\nfor lis in [ppp,pmp,ppm,pmm,mpp,mpm,mmp,mmm]:\n\tcur = functools.reduce(lambda x,y: x+y,filter(lambda t: t >= 0,lis))\n\tprint(cur)\n\tif cur > MAX:\n\t\tMAX = cur\nprint(MAX)\n\n\n', 'import functools # Python3 \nN,M = map(int,input().split())\nx, y, z = [0] * N, [0] * N, [0] * N\nfor i in range(N):\n\tx[i], y[i], z[i] = map(int,input().split())\n\nppp = sorted([ x[i]+y[i]+z[i] for i in range(N)])[-M:]\npmp = sorted([ x[i]-y[i]+z[i] for i in range(N)])[-M:]\nppm = sorted([ x[i]+y[i]-z[i] for i in range(N)])[-M:]\npmm = sorted([ x[i]-y[i]-z[i] for i in range(N)])[-M:]\nmpp = sorted([-x[i]+y[i]+z[i] for i in range(N)])[-M:]\nmpm = sorted([-x[i]+y[i]-z[i] for i in range(N)])[-M:]\nmmp = sorted([-x[i]-y[i]+z[i] for i in range(N)])[-M:]\nmmm = sorted([-x[i]-y[i]-z[i] for i in range(N)])[-M:]\n\nMAX = 0\nfor lis in [ppp,pmp,ppm,pmm,mpp,mpm,mmp,mmm]:\n\tcur = functools.reduce(lambda x,y: x+y,filter(lambda t: t >= 0,lis))\n\tif cur > MAX:\n\t\tMAX = cur\nprint(MAX)\n', 'import functools # Python3 \nN,M = map(int,input().split())\nx, y, z = [0] * N, [0] * N, [0] * N\nfor i in range(N):\n\tx[i], y[i], z[i] = map(int,input().split())\n\nppp = sorted([ x[i]+y[i]+z[i] for i in range(N)])[-M:]\npmp = sorted([ x[i]-y[i]+z[i] for i in range(N)])[-M:]\nppm = sorted([ x[i]+y[i]-z[i] for i in range(N)])[-M:]\npmm = sorted([ x[i]-y[i]-z[i] for i in range(N)])[-M:]\nmpp = sorted([-x[i]+y[i]+z[i] for i in range(N)])[-M:]\nmpm = sorted([-x[i]+y[i]-z[i] for i in range(N)])[-M:]\nmmp = sorted([-x[i]-y[i]+z[i] for i in range(N)])[-M:]\nmmm = sorted([-x[i]-y[i]-z[i] for i in range(N)])[-M:]\n\nMAX = 0\nfor lis in [ppp,pmp,ppm,pmm,mpp,mpm,mmp,mmm]:\n\tcur = functools.reduce(lambda x,y: x+y,lis)\n\t\tMAX = cur\nprint(MAX)\n\n\n', 'import functools # Python3 \nN,M = map(int,input().split())\nx, y, z = [0] * N, [0] * N, [0] * N\nfor i in range(N):\n\tx[i], y[i], z[i] = map(int,input().split())\n\n# N, M = 5, 3\n# x = [1, -4, 7, -10, 13]\n\n\nppp = [ x[i]+y[i]+z[i] for i in range(N)]\npmp = [ x[i]-y[i]+z[i] for i in range(N)]\nppm = [ x[i]+y[i]-z[i] for i in range(N)]\npmm = [ x[i]-y[i]-z[i] for i in range(N)]\nmpp = [-x[i]+y[i]+z[i] for i in range(N)]\nmpm = [-x[i]+y[i]-z[i] for i in range(N)]\nmmp = [-x[i]-y[i]+z[i] for i in range(N)]\nmmm = [-x[i]-y[i]-z[i] for i in range(N)]\n\nMAX = 0\nfor lis in [ppp,pmp,ppm,pmm,mpp,mpm,mmp,mmm]:\n\tcur = functools.reduce(lambda x,y: x+y,filter(lambda t: t >= 0,lis))\n\tif cur > MAX:\n\t\tMAX = cur\nprint(MAX)\n', 'import functools # Python3 \nN,M = map(int,input().split())\nx, y, z = [0] * N, [0] * N, [0] * N\nfor i in range(N):\n\tx[i], y[i], z[i] = map(int,input().split())\n\nif M==0:\n\tprint(0)\n\texit()\n\nppp = functools.reduce(lambda x,y: x+y,sorted([ x[i]+y[i]+z[i] for i in range(N)])[-M:])\npmp = functools.reduce(lambda x,y: x+y,sorted([ x[i]-y[i]+z[i] for i in range(N)])[-M:])\nppm = functools.reduce(lambda x,y: x+y,sorted([ x[i]+y[i]-z[i] for i in range(N)])[-M:])\npmm = functools.reduce(lambda x,y: x+y,sorted([ x[i]-y[i]-z[i] for i in range(N)])[-M:])\nmpp = functools.reduce(lambda x,y: x+y,sorted([-x[i]+y[i]+z[i] for i in range(N)])[-M:])\nmpm = functools.reduce(lambda x,y: x+y,sorted([-x[i]+y[i]-z[i] for i in range(N)])[-M:])\nmmp = functools.reduce(lambda x,y: x+y,sorted([-x[i]-y[i]+z[i] for i in range(N)])[-M:])\nmmm = functools.reduce(lambda x,y: x+y,sorted([-x[i]-y[i]-z[i] for i in range(N)])[-M:])\n\nMAX = 0\nfor lis in [ppp,pmp,ppm,pmm,mpp,mpm,mmp,mmm]:\n\tif lis > MAX:\n\t\tMAX = lis\nprint(MAX)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s050919154', 's441458970', 's859209295', 's967655239', 's964129016']
[4064.0, 4064.0, 3064.0, 4188.0, 3700.0]
[30.0, 30.0, 18.0, 106.0, 30.0]
[768, 764, 726, 754, 995]
p03326
u509368316
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['n,m=map(int, input().split())\nimport numpy as np\nxyz=np.array([list(map(int,input().split())) for i in range(n)])\nans=0\nif m>0:\n for i in range(8):\n a=np.dot(xyz,np.array(((-1)**i,(-1)**(i//2),(-1)**(i//4))))\n print(np.sort(a)[-m:])\n ans=max(ans,np.sum(np.sort(a)[-m:]))\nprint(ans)', 'n,m=map(int, input().split())\nimport numpy as np\nxyz=np.array([list(map(int,input().split())) for i in range(n)])\nans=0\nif m>0:\n for i in range(8):\n a=np.dot(xyz,np.array(((-1)**i,(-1)**(i//2),(-1)**(i//4))))\n ans=max(ans,np.sum(np.sort(a)[-m:]))\nprint(ans)']
['Wrong Answer', 'Accepted']
['s732399038', 's356115294']
[13224.0, 12524.0]
[186.0, 153.0]
[305, 274]
p03326
u536377809
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
["[N,M]=list(map(int,input().split()\n )\n )\nXYZ=[[int(i) for i in input().split()] for i in range(N)] \nmaxabs=0\n\nfor i in range(8):\n pm=list(map(int,format(i, 'b')))\n pm=[0,]*(3-len(pm))+pm\n\n newXYZ=sorted([[item[0]*(-1)**pm[0],item[1]*(-1)**pm[1],item[2]*(-1)**pm[2]] for item in XYZ],\n reverse=True)\n \n maxabs=max(sum([abs(sum([newXYZ[m][j] for m in range(M)]\n )\n ) for j in range(3)\n ]\n ),\n maxabs\n )\n\n\nprint(maxabs)", "[N,M]=list(map(int,input().split()\n )\n )\nXYZ=[[int(i) for i in input().split()] for i in range(N)] \nmaxabs=0\n\nfor i in range(8):\n pm=list(map(int,format(i, 'b')))\n pm=[0,]*(3-len(pm))+pm\n pm=[(-1)**item for item in pm]\n \n newXYZ=sorted([[item[0]*pm[0],item[1]*pm[1],item[2]*pm[2]] for item in XYZ],\n key=lambda x:sum(x),\n reverse=True)\n \n maxabs=max(sum([abs(sum([newXYZ[m][j] for m in range(M)]\n )\n ) for j in range(3)\n ]\n ),\n maxabs\n )\n\n\nprint(maxabs)\n"]
['Wrong Answer', 'Accepted']
['s911472974', 's768483742']
[3700.0, 3700.0]
[34.0, 32.0]
[563, 619]
p03326
u556225812
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['N, M = map(int, input().split())\nlst = []\nfor i in range(N):\n a, b, c = map(int, input().split())\n lst.append([a, b, c])\nans = []\n\nfor i in [-1, 1]:\n for j in [-1, 1]:\n for k in [-1, 1]:\n total = []\n for l in range(N):\n total.append(lst[i][0]*i + lst[i][1]*j + lst[i][2]*k)\n total.sort(reverse=True)\n ans.append(sum(total[:M]))\n\nprint(max(ans), ans)', 'N, M = map(int, input().split())\nlst = [list(map(int, input().split())) for _ in range(N)]\nans = []\n\nfor i in [-1, 1]:\n for j in [-1, 1]:\n for k in [-1, 1]:\n total = []\n for l in range(N):\n total.append(lst[l][0]*i + lst[l][1]*j + lst[l][2]*k)\n total.sort(reverse=True)\n ans.append(sum(total[:M]))\n\nprint(max(ans))']
['Wrong Answer', 'Accepted']
['s141963691', 's012413867']
[3280.0, 3316.0]
[25.0, 27.0]
[425, 384]
p03326
u556487440
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['n,m = map(int,input().split())\nx = []\ny = []\nz = []\nfor i in range(n):\n a,b,c = map(int,input().split())\n x.append([a,b,c])\n y.append([-1*a,-1*b,-1*c])\n\n\nmax = 0\nfor i in range(2):\n for j in range(2):\n for k in range(2):\n list = []\n sum = 0\n for l in range(n):\n if i == 1:\n tmp1 = x[l][0]\n else:\n tmp1 = y[l][0]\n if j == 1:\n tmp2 = x[l][1]\n else:\n tmp2 = y[l][1]\n if k == 1:\n tmp3 = x[l][2]\n else:\n tmp3 = y[l][2]\n list.append(tmp1+tmp2+tmp3)\n list.sort()\n print(list)\n for t in list[n-m:]:\n print(t)\n sum += t\n if sum > max:\n max = sum\nprint("max = ")\nprint(max)\n', 'n,m = map(int,input().split())\nx = []\ny = []\nz = []\nfor i in range(n):\n a,b,c = map(int,input().split())\n x.append([a,b,c])\n y.append([-1*a,-1*b,-1*c])\n\n\nmax = 0\nfor i in range(2):\n for j in range(2):\n for k in range(2):\n list = []\n sum = 0\n for l in range(n):\n if i == 1:\n tmp1 = x[l][0]\n else:\n tmp1 = y[l][0]\n if j == 1:\n tmp2 = x[l][1]\n else:\n tmp2 = y[l][1]\n if k == 1:\n tmp3 = x[l][2]\n else:\n tmp3 = y[l][2]\n list.append(tmp1+tmp2+tmp3)\n list.sort()\n for t in list[n-m:]:\n sum += t\n if sum > max:\n max = sum\nprint(max)\n']
['Wrong Answer', 'Accepted']
['s576778857', 's939996541']
[3828.0, 3444.0]
[35.0, 30.0]
[924, 859]
p03326
u562016607
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['import itertools\nN,M=map(int,input().split())\nx=[0 for i in range(N)]\ny=[0 for i in range(N)]\nz=[0 for i in range(N)]\nfor i in range(N):\n x[i],y[i],z[i]=map(int,input().split())\nw=[[0 for i in range(N)] for i in range(8)]\nS=list(itertools.product([-1,1],repeat=3))\ndef num(inp):\n res=0\n for i in range(3):\n res+=2*i(inp[i]+1)//2\n return res\nfor sg in S:\n for i in range(N):\n w[num(sg)][i]=x[i]sg[0]+y[i]sg[1]+z[i]*sg[2]\ntmp=[0 for i in range(8)]\nfor sg in S:\n w[num(sg)].sort(reverse=True)\n for i in range(M):\n tmp[num(sg)]+=w[num(sg)][i]\nprint(max(tmp))', 'import itertools\nN,M=map(int,input().split())\nx=[0 for i in range(N)]\ny=[0 for i in range(N)]\nz=[0 for i in range(N)]\nfor i in range(N):\n x[i],y[i],z[i]=map(int,input().split())\nS=list(itertools.product([-1,1],repeat=3))\ndef num(seq):\n res=0\n for i in range(3):\n if seq[i]==1:\n res+=2**i\n return res\nans=0\nfor seq in S:\n A=[seq[0]*x[i]+seq[1]*y[i]+seq[2]*z[i] for i in range(N)]\n A.sort(reverse=True)\n tmp=0\n for i in range(M):\n tmp+=A[i]\n if tmp>ans:\n ans=tmp\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s104385011', 's127822833']
[3064.0, 3188.0]
[17.0, 27.0]
[596, 531]
p03326
u570944601
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['n,m = map(int, input().split())\nx = [tuple(map(int, input().split())) for _ in range(n)]\nfrom itertools import *\nres = 0\nfor a in product([-1, 1], [-1, 1], [-1, 1]):\n res = max(res, sum(sorted(((sum(i*j for i,j in zip(a,t)) for t in x),reverse=True)[:m]))\nprint(res)', 'n,m = map(int, input().split())\nx = [tuple(map(int, input().split())) for _ in range(n)]\nfrom itertools import *\nprint(max(sum(sorted((sum(i*j for i,j in zip(a,t)) for t in x),reverse=True)[:m]) for a in product([-1,1],[-1,1],[-1,1])))\n']
['Runtime Error', 'Accepted']
['s568553583', 's638723244']
[2940.0, 3276.0]
[18.0, 30.0]
[267, 236]
p03326
u606045429
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['N, M, *XYZ = map(int, open(0).read().split())\n\nP = tuple(product((1, -1), repeat=3))\n\nA = [[] for _ in range(8)]\nfor x, y, z in zip(*[iter(XYZ)] * 3):\n A[0].append(sum((x, y, z)))\n A[1].append(sum((x, y, -z)))\n A[2].append(sum((x, -y, z)))\n A[3].append(sum((x, -y, -z)))\n A[4].append(sum((-x, y, z)))\n A[5].append(sum((-x, y, -z)))\n A[6].append(sum((-x, -y, z)))\n A[7].append(sum((-x, -y, -z)))\n\ncand = []\nfor i in range(8):\n A[i].sort(reverse=True)\n cand.append(sum(A[i][:M]))\n\nprint(max(cand))\n', 'from itertools import product\n\nN, M, *XYZ = map(int, open(0).read().split())\n\nA = [[] for _ in range(8)]\nfor x, y, z in zip(*[iter(XYZ)] * 3):\n for i, (a, b, c) in enumerate(product([1, -1], repeat=3)):\n A[i].append(a * x + b * y + c * z)\n\nB = []\nfor a in A:\n a.sort(reverse=True)\n B.append(sum(a[:M]))\n\nprint(max(B))']
['Runtime Error', 'Accepted']
['s945798457', 's748305455']
[3444.0, 3572.0]
[19.0, 27.0]
[526, 333]
p03326
u607075479
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['import sys\nimport math\nfrom collections import deque\n\nsys.setrecursionlimit(1000000)\nMOD = 10 ** 9 + 7\ninput = lambda: sys.stdin.readline().strip()\nNI = lambda: int(input())\nNMI = lambda: map(int, input().split())\nNLI = lambda: list(NMI())\nSI = lambda: input()\n\n\ndef make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]\n\n\ndef make_cumulative(A):\n C = [0] * (len(A) + 1)\n for i, a in enumerate(A):\n i += 1\n C[i] = C[i - 1] + a\n return C\n\n\ndef main():\n N, M = NMI()\n cakes = [[] for _ in range(8)]\n for i in range(N):\n x, y, z = NMI()\n cakes[0].append(sum([x, y, z]))\n cakes[1].append(sum([x, y, -z]))\n cakes[2].append(sum([x, -y, z]))\n cakes[3].append(sum([x, -y, -z]))\n cakes[4].append(sum([-x, y, z]))\n cakes[5].append(sum([-x, y, -z]))\n cakes[6].append(sum([-x, -y, z]))\n cakes[7].append(sum([-x, -y, -z]))\n for i in range(8):\n cakes[i] = sorted(cakes[i], reverse=True)\n cakes[i] = max(make_cumulative(cakes[i][:M+1]))\n print(max(cakes))\n\n\nif __name__ == "__main__":\n main()', 'import sys\nimport math\nfrom collections import deque\n\nsys.setrecursionlimit(1000000)\nMOD = 10 ** 9 + 7\ninput = lambda: sys.stdin.readline().strip()\nNI = lambda: int(input())\nNMI = lambda: map(int, input().split())\nNLI = lambda: list(NMI())\nSI = lambda: input()\n\n\ndef make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]\n\n\ndef make_cumulative(A):\n C = [0] * (len(A) + 1)\n for i, a in enumerate(A):\n i += 1\n C[i] = C[i - 1] + a\n return C\n\n\ndef main():\n N, M = NMI()\n cakes = [[] for _ in range(8)]\n for i in range(N):\n x, y, z = NMI()\n cakes[0].append(sum([x, y, z]))\n cakes[1].append(sum([x, y, -z]))\n cakes[2].append(sum([x, -y, z]))\n cakes[3].append(sum([x, -y, -z]))\n cakes[4].append(sum([-x, y, z]))\n cakes[5].append(sum([-x, y, -z]))\n cakes[6].append(sum([-x, -y, z]))\n cakes[7].append(sum([-x, -y, -z]))\n for i in range(8):\n cakes[i] = sorted(cakes[i], reverse=True)\n cakes[i] = sum(cakes[i][:M])\n print(max(cakes))\n\n\nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Accepted']
['s383618785', 's225961588']
[9772.0, 9716.0]
[39.0, 37.0]
[1105, 1086]
p03326
u612721349
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['n,m = map(int,input().split())\nl = [[int(i)for i in input().split()]for _ in [0]*n]\n\ndef g(k):\n a = [x[0]if k&1 else -x[0])+(x[1]if k&2 else -x[1])+(x[2]if k&4 else -x[2]) for x in l]\n a.sort(reverse=True)\n return sum(a[:m])\nprint(max([g(i) for i range(8)]))', 'n, m = map(int, input().split())\nal = [[int(i) for i in input().split()] for _ in [0]*n]\nans = 0\n\ndef getmm(k):\n al.sort(key=lambda x: [(x[0] if k & 1 else -x[0]), (x[1] if k & 2 else -x[1]), (x[2] if k & 4 else -x[2])])\n t = 0\n for i in range(3):\n t += abs(sum([e[i] for e in al[:m]]))\n return t\n\nfor i in range(3):\n ans = max(ans, getmm(i))\nprint(ans)', 'p=input\nn,m=map(int,p().split())\nl=[p().split()for _ in[0]*n]\nprint(max([sum(sorted([sum([int(x[i])*[1,-1][k>>i&1]for i in range(3)])for x in l])[::-1][:m])for k in range(8)]))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s030421217', 's108124541', 's602399678']
[2940.0, 3356.0, 3444.0]
[17.0, 24.0, 39.0]
[263, 362, 176]
p03326
u623819879
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['import sys\nsys.setrecursionlimit(1000000)\n#def input():\n# return sys.stdin.readline()[:-1]\n\n\n\ntest_data1 = \'\'\'\\\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\'\'\'\n\ntest_data2 = \'\'\'\\\n5 3\n1 -2 3\n-4 5 -6\n7 -8 -9\n-10 11 -12\n13 -14 15\n\'\'\'\n\ntest_data3 = \'\'\'\\\n10 5\n10 -80 21\n23 8 38\n-94 28 11\n-26 -2 18\n-69 72 79\n-26 -86 -54\n-72 -50 59\n21 65 -32\n40 -94 87\n-62 18 82\n\'\'\'\ntd_num=3\n\ndef GetTestData(index):\n if index==1:\n return test_data1\n if index==2:\n return test_data2\n if index==3:\n return test_data3\n \nif False:\n with open("../test.txt", mode=\'w\') as f:\n f.write(GetTestData(td_num))\n with open("../test.txt") as f:\n # Start Input code ---------------------------------------\n n,m=map(int,f.readline().split())\n a=[[0 for i in range(n)] for j in range(8)]\n for i in range(n):\n x,y,z=map(int,f.readline().split())\n t=0\n for p in range(2):\n for q in range(2):\n for r in range(2):\n a[t][i]=x*(1-2*p)+y*(1-2*q)+z*(1-2*r)\n t+=1\n\n # End Input code ---------------------------------------\nelse:\n # Start Input code ---------------------------------------\n n,m=map(int,input.split())\n a=[[0 for i in range(n)] for j in range(8)]\n for i in range(n):\n x,y,z=map(int,input.split())\n t=0\n for p in range(2):\n for q in range(2):\n for r in range(2):\n a[t][i]=x*(1-2*p)+y*(1-2*q)+z*(1-2*r)\n t+=1\n # End Input code ---------------------------------------\n\nans=0\nfor i in range(8):\n b=a[i]\n b.sort(reverse=True)\n ans=max(ans,sum(b[:m]))\nprint(ans)\n#print(\'n,m=\',n,m,\' a=\',a,\' b=\',b,\' c=\',c)', 'import sys\nsys.setrecursionlimit(1000000)\n#def input():\n# return sys.stdin.readline()[:-1]\n\n\n\ntest_data1 = \'\'\'\\\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\'\'\'\n\ntest_data2 = \'\'\'\\\n5 3\n1 -2 3\n-4 5 -6\n7 -8 -9\n-10 11 -12\n13 -14 15\n\'\'\'\n\ntest_data3 = \'\'\'\\\n10 5\n10 -80 21\n23 8 38\n-94 28 11\n-26 -2 18\n-69 72 79\n-26 -86 -54\n-72 -50 59\n21 65 -32\n40 -94 87\n-62 18 82\n\'\'\'\ntd_num=3\n\ndef GetTestData(index):\n if index==1:\n return test_data1\n if index==2:\n return test_data2\n if index==3:\n return test_data3\n \nif False:\n with open("../test.txt", mode=\'w\') as f:\n f.write(GetTestData(td_num))\n with open("../test.txt") as f:\n # Start Input code ---------------------------------------\n n,m=map(int,f.readline().split())\n a=[[0 for i in range(n)] for j in range(8)]\n for i in range(n):\n x,y,z=map(int,f.readline().split())\n t=0\n for p in range(2):\n for q in range(2):\n for r in range(2):\n a[t][i]=x*(1-2*p)+y*(1-2*q)+z*(1-2*r)\n t+=1\n\n # End Input code ---------------------------------------\nelse:\n # Start Input code ---------------------------------------\n n,m=map(int,input().split())\n a=[[0 for i in range(n)] for j in range(8)]\n for i in range(n):\n x,y,z=map(int,input().split())\n t=0\n for p in range(2):\n for q in range(2):\n for r in range(2):\n a[t][i]=x*(1-2*p)+y*(1-2*q)+z*(1-2*r)\n t+=1\n # End Input code ---------------------------------------\n\nans=0\nfor i in range(8):\n b=a[i]\n b.sort(reverse=True)\n ans=max(ans,sum(b[:m]))\nprint(ans)\n#print(\'n,m=\',n,m,\' a=\',a,\' b=\',b,\' c=\',c)']
['Runtime Error', 'Accepted']
['s649037994', 's244295954']
[3188.0, 3400.0]
[18.0, 31.0]
[2621, 2625]
p03326
u633105820
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
["def run(n, m, x, y, z):\n s1 = [x[i] + y[i] + z[i] for i in range(n)]\n s1.sort(reverse=True)\n s2 = [-x[i] + y[i] + z[i] for i in range(n)]\n s2.sort(reverse=True)\n s3 = [x[i] - y[i] + z[i] for i in range(n)]\n s3.sort(reverse=True)\n s4 = [-x[i] - y[i] + z[i] for i in range(n)]\n s4.sort(reverse=True)\n s5 = [x[i] + y[i] - z[i] for i in range(n)]\n s5.sort(reverse=True)\n s6 = [-x[i] + y[i] - z[i] for i in range(n)]\n s6.sort(reverse=True)\n s7 = [x[i] - y[i] - z[i] for i in range(n)]\n s7.sort(reverse=True)\n s8 = [-x[i] - y[i] - z[i] for i in range(n)]\n s8.sort(reverse=True)\n max_sum = sum(s1[0:m])\n tmp_sum = sum(s2[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n tmp_sum = sum(s3[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n tmp_sum = sum(s4[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n tmp_sum = sum(s5[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n tmp_sum = sum(s6[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n tmp_sum = sum(s7[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n tmp_sum = sum(s8[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n return max_sum\n\n\ndef read_line():\n n, m = map(int, input().split())\n x = []\n y = []\n z = []\n for i in range(n):\n x[i], y[i], z[i] = map(int, input().split())\n return (n, m, x, y, z)\n\n\ndef main():\n n, m, x, y, z = read_line()\n print(run(n, m, x, y, z))\n\n\nif __name__ == '__main__':\n main()\n", "def run(n, m, x, y, z):\n s1 = [x[i] + y[i] + z[i] for i in range(n)]\n s1.sort(reverse=True)\n s2 = [-x[i] + y[i] + z[i] for i in range(n)]\n s2.sort(reverse=True)\n s3 = [x[i] - y[i] + z[i] for i in range(n)]\n s3.sort(reverse=True)\n s4 = [-x[i] - y[i] + z[i] for i in range(n)]\n s4.sort(reverse=True)\n s5 = [x[i] + y[i] - z[i] for i in range(n)]\n s5.sort(reverse=True)\n s6 = [-x[i] + y[i] - z[i] for i in range(n)]\n s6.sort(reverse=True)\n s7 = [x[i] - y[i] - z[i] for i in range(n)]\n s7.sort(reverse=True)\n s8 = [-x[i] - y[i] - z[i] for i in range(n)]\n s8.sort(reverse=True)\n max_sum = sum(s1[0:m])\n tmp_sum = sum(s2[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n tmp_sum = sum(s3[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n tmp_sum = sum(s4[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n tmp_sum = sum(s5[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n tmp_sum = sum(s6[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n tmp_sum = sum(s7[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n tmp_sum = sum(s8[0:m])\n if max_sum < tmp_sum:\n max_sum = tmp_sum\n return max_sum\n\n\ndef read_line():\n n, m = map(int, input().split())\n x = []\n y = []\n z = []\n for i in range(n):\n tx, ty, tz = map(int, input().split())\n x.append(tx)\n y.append(ty)\n z.append(tz)\n return (n, m, x, y, z)\n\n\ndef main():\n n, m, x, y, z = read_line()\n print(run(n, m, x, y, z))\n\n\nif __name__ == '__main__':\n main()"]
['Runtime Error', 'Accepted']
['s265715924', 's910892107']
[3192.0, 3572.0]
[18.0, 24.0]
[1527, 1583]
p03326
u636311816
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['n=5\nm=3\nscores=[[1, -2, 3],\n[-4, 5, -6],\n[7, -8, -9],\n[-10, 11, -12],\n[13, -14, 15]]\n\nsmax=None\nfor x in range(2):\n scores_=copy.deepcopy(scores)\n \n for i in range(n):\n scores_[i][0] = pow(-1,x)*scores[i][0]\n for y in range(2):\n for i in range(n):\n scores_[i][1] = pow(-1,y)*scores[i][1]\n for z in range(2):\n for i in range(n):\n scores_[i][2] = pow(-1,z)*scores[i][2]\n \n sumlist=list()\n for i in range(n):\n sumlist.append(sum(scores_[i]))\n sumlist.sort()\n \n tmp=0\n for eat in range(m):\n tmp+=sumlist[-1]\n sumlist.pop()\n if smax==None or tmp>smax:\n smax=tmp\nprint(smax)', 'n,m = map(int,input().split())\n\nscores = list()\nfor i in range(n):\n s = list(map(int,input().split()))\n for j in range(len(s)):\n s[j]=abs(s[j])\n print(s)\n ssum=sum(s)\n scores.append(ssum)\n\nscores.sort()\nres=0\nfor i in range(m):\n res+=scores[-1]\n scores.pop()\n\nprint(res)', 'n,m = map(int,input().split())\n\nscores = list()\nfor i in range(n):\n scores.append(sum(list(map(int,input().split()))))\n print(i)\n\nscores.sort()\nres=0\nfor i in range(m):\n res+=scores[-1]\n scores.pop()\n\nprint(res)', 'n,m = map(int,input().split())\n\nscores = list()\nfor i in range(n):\n score = list(map(int,input().split()))\n scores.append(score)\n\nsmax=None\nfor i in range(n):\n scores_=list()\n for j in range(len(scores[i])): \n if scores[i][j]<0:\n for k in range(n):\n scores_[k][j] = -scores[k][j]\n else:\n for k in range(n):\n scores_[k][j] = scores[k][j]\n ssum=list()\n for j in range(n):\n ssum.append(sum(scores_[j]))\n ssum.sort()\n \n for j in range(m):\n tmp+=ssum[-1]\n ssum.pop()\n if smax==None or tmp>smax:\n smax=tmp\nprint(smax)', 'import copy\nn,m = map(int,input().split())\n\n\nscores = list()\nfor i in range(n):\n score = list(map(int,input().split()))\n scores.append(score)\n\nsmax=None\nfor p in range(8):\n x=math.floor((p/4)%2)\n y=math.floor((p/2)%2)\n z=math.floor((p/1)%2)\n \n scores_=copy.deepcopy(scores)\n sumlist=list()\n\n for i in range(n):\n scores_[i][0] = pow(-1,x)*scores[i][0]\n scores_[i][1] = pow(-1,y)*scores[i][1]\n scores_[i][2] = pow(-1,z)*scores[i][2]\n sumlist.append(sum(scores_[i]))\n sumlist.sort()\n \n tmp=0\n for eat in range(m):\n tmp+=sumlist[-1]\n sumlist.pop()\n if smax==None or tmp>smax:\n smax=tmp\nprint(smax)', 'import copy\nimport math\nn,m = map(int,input().split())\n\n\nscores = list()\nfor i in range(n):\n score = list(map(int,input().split()))\n scores.append(score)\n\nsmax=None\nfor p in range(8):\n x=math.floor((p/4)%2)\n y=math.floor((p/2)%2)\n z=math.floor((p/1)%2)\n \n scores_=copy.deepcopy(scores)\n sumlist=list()\n\n for i in range(n):\n scores_[i][0] = pow(-1,x)*scores[i][0]\n scores_[i][1] = pow(-1,y)*scores[i][1]\n scores_[i][2] = pow(-1,z)*scores[i][2]\n sumlist.append(sum(scores_[i]))\n sumlist.sort()\n \n tmp=0\n for eat in range(m):\n tmp+=sumlist[-1]\n sumlist.pop()\n if smax==None or tmp>smax:\n smax=tmp\nprint(smax)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s253868705', 's355431425', 's720635617', 's828229771', 's889649029', 's178577088']
[3064.0, 3064.0, 3188.0, 3316.0, 3700.0, 4212.0]
[17.0, 30.0, 28.0, 20.0, 26.0, 72.0]
[782, 298, 223, 638, 691, 703]
p03326
u667024514
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['n, m = map(int, input().split())\nl = []\nli = []\nlis = []\n\nfor i in range(n):\n a, b, c = map(int, input().split())\n l.append(a)\n li.append(b)\n lis.append(c)\nans = []\n #for a in range(2): for b in range(2):for c in range(2):if a == 0:\nl1 = sorted(l)\nli1 = li\nlis1 = lis\ncou1 = 0\ncou1 += abs(sum(l1[0:m]))\nlili1 = []\nlislis1 = []\nfor i in range(m):\n lili1.append(li[l.index(l1[i])])\n lislis1.append(lis[l.index(l1[i])])\ncou1 += abs(sum(lili1))+abs(sum(lislis1))\nans.append(cou1)\n\nl2 = sorted(l,reverse=True)\nli2 = li\nlis2 = lis\ncou2 = 0\ncou2 += abs(sum(l2[0:m]))\nlili2 = []\nlislis2 = []\nfor i in range(m):\n lili2.append(li[l.index(l2[i])])\n lislis2.append(lis[l.index(l2[i])])\ncou2 += abs(sum(lili2))+abs(sum(lislis2))\nans.append(cou2)\n\nl3 = l\nli3 = sorted(li)\nlis3 = lis\ncou3 = 0\ncou3 += abs(sum(li3[0:m]))\nll3 = []\nlislis3 = []\nfor i in range(m):\n ll3.append(l[li.index(li3[i])])\n lislis3.append(lis[li.index(li3[i])])\ncou3 += abs(sum(ll3))+abs(sum(lislis3))\nans.append(cou3)\n\nl4 = l\nli4 = sorted(li,reverse=True)\nlis4 = lis\ncou4 = 0\ncou4 += abs(sum(li4[0:m]))\nll4 = []\nlislis4 = []\nfor i in range(m):\n ll4.append(l[li.index(li4[i])])\n lislis4.append(lis[li.index(li4[i])])\ncou4 += abs(sum(ll4))+abs(sum(lislis4))\nans.append(cou4)\n\nl5 = l\nli5 = li\nlis5 = sorted(lis)\ncou5 = 0\ncou5 += abs(sum(lis5[0:m]))\nll5 = []\nlili5 = []\nfor i in range(m):\n ll5.append(l[lis.index(lis5[i])])\n lili5.append(li[lis.index(lis5[i])])\ncou5 += abs(sum(ll5))+abs(sum(lili5))\nans.append(cou5)\n\nl6 = l\nli6 = li\nlis6 = sorted(lis,reverse=True)\ncou6 = 0\ncou6 += abs(sum(lis6[0:m]))\nll6 = []\nlili6 = []\nfor i in range(m):\n ll6.append(l[lis.index(lis6[i])])\n lili6.append(li[lis.index(lis6[i])])\ncou6 += abs(sum(ll6))+abs(sum(lili6))\nans.append(cou6)\n\nprint(max(ans))', 'def solve(lis):\n a,b,c = 0,0,0\n for i in range(m):\n a += lis[i][0]\n b += lis[i][1]\n c += lis[i][2]\n return abs(a) + abs(b) + abs(c)\n\nn,m = map(int,input().split())\nlis = [list(map(int,input().split())) for i in range(n)]\nans = 0\n\nlis.sort(key = lambda x:x[0])\nlis.sort(key = lambda x:x[1])\nlis.sort(key = lambda x:x[2])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0])\nlis.sort(key = lambda x:x[1])\nlis.sort(key = lambda x:x[2],reverse=True)\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0])\nlis.sort(key = lambda x:x[2])\nlis.sort(key = lambda x:x[1])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0])\nlis.sort(key = lambda x:x[2])\nlis.sort(key = lambda x:x[1],reverse=True)\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[2])\nlis.sort(key = lambda x:x[1])\nlis.sort(key = lambda x:x[0])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[2])\nlis.sort(key = lambda x:x[1])\nlis.sort(key = lambda x:x[0],reverse=True)\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0],reverse=True)\nlis.sort(key = lambda x:x[1])\nlis.sort(key = lambda x:x[2])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0],reverse=True)\nlis.sort(key = lambda x:x[1])\nlis.sort(key = lambda x:x[2],reverse=True)\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0],reverse=True)\nlis.sort(key = lambda x:x[2])\nlis.sort(key = lambda x:x[1])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0],reverse=True)\nlis.sort(key = lambda x:x[2])\nlis.sort(key = lambda x:x[1],reverse=True)\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[2],reverse=True)\nlis.sort(key = lambda x:x[1])\nlis.sort(key = lambda x:x[0])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[2],reverse=True)\nlis.sort(key = lambda x:x[1])\nlis.sort(key = lambda x:x[0],reverse=True)\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0])\nlis.sort(key = lambda x:x[1],reverse=True)\nlis.sort(key = lambda x:x[2])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0])\nlis.sort(key = lambda x:x[1],reverse=True)\nlis.sort(key = lambda x:x[2],reverse=True)\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0])\nlis.sort(key = lambda x:x[2],reverse=True)\nlis.sort(key = lambda x:x[1])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0])\nlis.sort(key = lambda x:x[2],reverse=True)\nlis.sort(key = lambda x:x[1],reverse=True)\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[2])\nlis.sort(key = lambda x:x[1],reverse=True)\nlis.sort(key = lambda x:x[0])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[2])\nlis.sort(key = lambda x:x[1],reverse=True)\nlis.sort(key = lambda x:x[0],reverse=True)\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0],reverse=True)\nlis.sort(key = lambda x:x[1],reverse=True)\nlis.sort(key = lambda x:x[2])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0],reverse=True)\nlis.sort(key = lambda x:x[1],reverse=True)\nlis.sort(key = lambda x:x[2],reverse=True)\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0],reverse=True)\nlis.sort(key = lambda x:x[2],reverse=True)\nlis.sort(key = lambda x:x[1])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0],reverse=True)\nlis.sort(key = lambda x:x[2],reverse=True)\nlis.sort(key = lambda x:x[1],reverse=True)\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[2],reverse=True)\nlis.sort(key = lambda x:x[1],reverse=True)\nlis.sort(key = lambda x:x[0])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[2],reverse=True)\nlis.sort(key = lambda x:x[1],reverse=True)\nlis.sort(key = lambda x:x[0],reverse=True)\nans = max(ans,solve(lis))', 'def solve(l):\n a,b,c = 0,0,0\n for i in range(m):\n a += l[i][0]\n b += l[i][1]\n c += l[i][2]\n return abs(a) + abs(b) + abs(c)\n\nn,m = map(int,input().split())\nlis = [list(map(int,input().split())) for i in range(n)]\nans = 0\n\nlis.sort(key = lambda x:x[0]+x[1]+x[2])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0]+x[1]-x[2])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0]-x[1]+x[2])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:x[0]-x[1]-x[2])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:-x[0]+x[1]+x[2])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:-x[0]+x[1]-x[2])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:-x[0]-x[1]+x[2])\nans = max(ans,solve(lis))\n\nlis.sort(key = lambda x:-x[0]-x[1]-x[2])\nans = max(ans,solve(lis))\n\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s199128363', 's849785205', 's409810248']
[3572.0, 3448.0, 3360.0]
[118.0, 51.0, 27.0]
[1789, 3516, 784]
p03326
u708615801
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['from operator import mul\nimport sys\nstdin = sys.stdin\n \nsys.setrecursionlimit(10**5) \n \ndef li(): return map(int, stdin.readline().split())\n\nN, M = tuple(li())\nCs = []\nfor i in range(N):\n n = tuple(li())\n Cs.append([-sum(map(abs, n)), n])\n\nstate = [0, 0, 0, 0]\nmaximum = 0\ntrans = []\nfor per in range(8):\n ops = [(per&4)>>2, (per&2)>>1, per&1]\n trans.clear()\n for i in range(N):\n trans.append(list(map(mul, Cs[i], ops)))\n tans.sort(key=lambda x: -sum(x))\n maximum = max(maximum, sum(trans[:M]))\n \n\nprint(maximum) \n', 'from operator import mul\nimport sys\nstdin = sys.stdin\n \nsys.setrecursionlimit(10**5) \n \ndef li(): return map(int, stdin.readline().split())\n\nN, M = tuple(li())\nCs = []\nfor i in range(N):\n n = tuple(li())\n Cs.append(n)\n\nstate = [0, 0, 0, 0]\nmaximum = 0\ntrans = []\nfor per in range(8):\n ops = [1 if (per&4)>>2 else -1, 1 if (per&2)>>1 else -1, 1 if per&1 else -1]\n trans.clear()\n for i in range(N):\n trans.append(list(map(mul, Cs[i], ops)))\n trans.sort(key=lambda x: -sum(x))\n maximum = max(maximum, sum(sum(t) for t in trans[:M]))\n \n\nprint(maximum)\n']
['Runtime Error', 'Accepted']
['s653120284', 's633358239']
[3556.0, 3572.0]
[25.0, 34.0]
[573, 607]
p03326
u729133443
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['I=lambda:list(map(int,input().split()));n,m=I();s=[I()for _ in[0]*n];a=0\nfor i in range(1<<3):\n t=[[v for v in t]for t in s]\n for j in range(3):\n for k in range(n):t[k][j]*=-(i>>j&1)\n a=max(a,sum(sorted(sum(j)for j in t)[-m:]))\nprint(a)', "n,m=map(int,input().split());l=eval('input().split(),'*n);print(max(sum(sorted(sum(int(x[i])*(k>>i&1or-1)for i in range(3))for x in l)[:~m:-1])for k in range(8)))"]
['Wrong Answer', 'Accepted']
['s719689213', 's563529698']
[3572.0, 4596.0]
[35.0, 44.0]
[237, 162]
p03326
u747602774
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['n,m = map(int,input().split())\nxyz = [list(map(int,input().split())) for i in range(n)]\nans = 0\nfor i in range(8):\n s = [0 for i in range(n)]\n for j in range(n):\n a = 0\n for k in range(3):\n if i>>k&1:\n a += xyz[j][k]\n else:\n a -= xyz[j][k]\n s[i] = a\n s.sort()\n ans = max(ans,sum(s[n-m:]))\nprint(ans)', 'n,m = map(int,input().split())\nxyz = [list(map(int,input().split())) for i in range(n)]\nans = 0\nfor i in range(8):\n s = [0 for j in range(n)]\n for j in range(n):\n a = 0\n for k in range(3):\n if i>>k&1:\n a += xyz[j][k]\n else:\n a -= xyz[j][k]\n s[j] = a\n s.sort()\n ans = max(ans,sum(s[n-m:]))\nprint(ans)']
['Runtime Error', 'Accepted']
['s562013707', 's577111501']
[3316.0, 3316.0]
[32.0, 33.0]
[384, 384]
p03326
u756782069
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['\nimport numpy as np\nN, M = map(int, input().split())\na = []\nfor i in range(N):\n a.append(list(map(int,input().split())))\n\nar = np.array(a)\nprint (ar) \n\nb = np.zeros((N,8))\nfor i in range(0,N):\n b[i,0] = ar[i,0] + ar[i,1] + ar[i,2]\n b[i,1] = ar[i,0] + ar[i,1] - ar[i,2]\n b[i,2] = ar[i,0] - ar[i,1] + ar[i,2]\n b[i,3] = ar[i,0] - ar[i,1] - ar[i,2]\n b[i,4] = -ar[i,0] + ar[i,1] + ar[i,2]\n b[i,5] = -ar[i,0] + ar[i,1] - ar[i,2]\n b[i,6] = -ar[i,0] - ar[i,1] + ar[i,2]\n b[i,7] = -ar[i,0] - ar[i,1] - ar[i,2]\n \nprint(b)\n\ne0 = np.asarray([0,0,0,0,0,0,0,0])\n\nc0 = b[:,0]\nd0 = np.sort(c0)[::-1]\ne0[0] = sum(d0[:M])\n\nc1 = b[:,1]\nd1 = np.sort(c1)[::-1]\ne0[1] = sum(d1[:M])\n\nc2 = b[:,2]\nd2 = np.sort(c2)[::-1]\ne0[2] = sum(d2[:M])\n\nc3 = b[:,3]\nd3 = np.sort(c3)[::-1]\ne0[3] = sum(d3[:M])\n\nc4 = b[:,4]\nd4 = np.sort(c4)[::-1]\ne0[4] = sum(d4[:M])\n\nc5 = b[:,5]\nd5 = np.sort(c5)[::-1]\ne0[5] = sum(d5[:M])\n\nc6 = b[:,6]\nd6 = np.sort(c6)[::-1]\ne0[6] = sum(d6[:M])\n\nc7 = b[:,7]\nd7 = np.sort(c7)[::-1]\ne0[7] = sum(d7[:M])\n\n\ne1 = np.sort(e0)[::-1]\nprint(e1[0])', '#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n"""\nCreated on Sat Jun 16 21:53:05 2018\n\n@author: Riichi_Yokoyama\n"""\n\n\nimport numpy as np\nN, M = map(int, input().split())\na = []\nfor i in range(N):\n a.append(list(map(int,input().split())))\n\nar = np.array(a)\nprint (ar) \n\nb = np.zeros((N,8))\nfor i in range(0,N):\n b[i,0] = ar[i,0] + ar[i,1] + ar[i,2]\n b[i,1] = ar[i,0] + ar[i,1] - ar[i,2]\n b[i,2] = ar[i,0] - ar[i,1] + ar[i,2]\n b[i,3] = ar[i,0] - ar[i,1] - ar[i,2]\n b[i,4] = -ar[i,0] + ar[i,1] + ar[i,2]\n b[i,5] = -ar[i,0] + ar[i,1] - ar[i,2]\n b[i,6] = -ar[i,0] - ar[i,1] + ar[i,2]\n b[i,7] = -ar[i,0] - ar[i,1] - ar[i,2]\n\ne0 = np.asarray([0,0,0,0,0,0,0,0])\n\nc0 = b[:,0]\nd0 = np.sort(c0)[::-1]\ne0[0] = sum(d0[:M])\n\nc1 = b[:,1]\nd1 = np.sort(c1)[::-1]\ne0[1] = sum(d1[:M])\n\nc2 = b[:,2]\nd2 = np.sort(c2)[::-1]\ne0[2] = sum(d2[:M])\n\nc3 = b[:,3]\nd3 = np.sort(c3)[::-1]\ne0[3] = sum(d3[:M])\n\nc4 = b[:,4]\nd4 = np.sort(c4)[::-1]\ne0[4] = sum(d4[:M])\n\nc5 = b[:,5]\nd5 = np.sort(c5)[::-1]\ne0[5] = sum(d5[:M])\n\nc6 = b[:,6]\nd6 = np.sort(c6)[::-1]\ne0[6] = sum(d6[:M])\n\nc7 = b[:,7]\nd7 = np.sort(c7)[::-1]\ne0[7] = sum(d7[:M])\n\n\ne1 = np.sort(e0)[::-1]\nprint(e1[0])', 'import numpy as np\nN, M = map(int, input().split())\na = []\nfor i in range(N):\n a.append(list(map(int,input().split())))\n\nar = np.array(a)\n\nb = np.zeros((N,8))\nfor i in range(0,N):\n b[i,0] = ar[i,0] + ar[i,1] + ar[i,2]\n b[i,1] = ar[i,0] + ar[i,1] - ar[i,2]\n b[i,2] = ar[i,0] - ar[i,1] + ar[i,2]\n b[i,3] = ar[i,0] - ar[i,1] - ar[i,2]\n b[i,4] = -ar[i,0] + ar[i,1] + ar[i,2]\n b[i,5] = -ar[i,0] + ar[i,1] - ar[i,2]\n b[i,6] = -ar[i,0] - ar[i,1] + ar[i,2]\n b[i,7] = -ar[i,0] - ar[i,1] - ar[i,2]\n\ne0 = np.asarray([0,0,0,0,0,0,0,0])\n\nc0 = b[:,0]\nd0 = np.sort(c0)[::-1]\ne0[0] = sum(d0[:M])\n\nc1 = b[:,1]\nd1 = np.sort(c1)[::-1]\ne0[1] = sum(d1[:M])\n\nc2 = b[:,2]\nd2 = np.sort(c2)[::-1]\ne0[2] = sum(d2[:M])\n\nc3 = b[:,3]\nd3 = np.sort(c3)[::-1]\ne0[3] = sum(d3[:M])\n\nc4 = b[:,4]\nd4 = np.sort(c4)[::-1]\ne0[4] = sum(d4[:M])\n\nc5 = b[:,5]\nd5 = np.sort(c5)[::-1]\ne0[5] = sum(d5[:M])\n\nc6 = b[:,6]\nd6 = np.sort(c6)[::-1]\ne0[6] = sum(d6[:M])\n\nc7 = b[:,7]\nd7 = np.sort(c7)[::-1]\ne0[7] = sum(d7[:M])\n\n\ne1 = np.sort(e0)[::-1]\nprint(e1[0])']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s796781216', 's995866265', 's911404724']
[12640.0, 21628.0, 20996.0]
[173.0, 1385.0, 1545.0]
[1063, 1167, 1036]
p03326
u785578220
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['n,m=map(int,input().split())\nx = [list(map(int, input().split())) for _ in range(n)]\nfrom itertools import *\nres = 0\nfor a in product([-1, 1], [-1, 1], [-1, 1]):\n ts =[]\n for t in x:\n ta = 0\n for i,j in zip(a,t):\n ta+=i*j\n ts.append(t)\n s = sum(sorted(ts,reverse=True)[:m])\n res = max(res, s)\nprint(res)', 'n,m=map(int,input().split())\nx = [list(map(int, input().split())) for _ in range(n)]\nfrom itertools import *\nres = 0\nfor a in product([-1, 1], [-1, 1], [-1, 1]):\n ts =[]\n for t in x:\n t = 0\n for i,j in zip(a,t):\n t+=i*j\n ts.append(t)\n s = sum(sorted(ts,reverse=True)[:m])\n res = max(res, s)\nprint(res)', 'n,m=map(int,input().split())\nx = [list(map(int, input().split())) for _ in range(n)]\nfrom itertools import *\nres = 0\nfor a in product([-1, 1], [-1, 1], [-1, 1]):\n ts =[]\n for t in x:\n ta = 0\n for i,j in zip(a,t):\n ta+=i*j\n ts.append(ta)\n s = sum(sorted(ts,reverse=True)[:m])\n res = max(res, s)\nprint(res)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s595209699', 's719491127', 's313016554']
[3316.0, 3316.0, 3404.0]
[33.0, 21.0, 31.0]
[347, 345, 348]
p03326
u842170774
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['\n\nN,M=map(int,input().split())\ncheck=M+10 if M+10<=N else N\nxyz_list,x_list,y_list,z_list=[],[],[],[]\nfor i in range(N):\n xyz_list.append(input().split())\n \nvar_list=[x for x in itl.product([-1,1],repeat=3)]\nsum_list=[]\nfor i in var_list:\n print(i,xyz_list)\n sort_list=[0,]*N\n for j in range(N):\n sort_list[j]=int(xyz_list[j][0])*i[0]+ int(xyz_list[j][1])*i[1]+ int(xyz_list[j][2])*i[2]\n sort_list.sort(reverse=True)\n sum_=0\n print(sort_list)\n for j in range(M):\n sum_+=sort_list[j]\n sum_list.append(sum_)\n \nsum_list.sort(reverse=True)\nprint(sum_list[0])', '\nimport itertools as itl\n\nN,M=map(int,input().split())\ncheck=M+10 if M+10<=N else N\nxyz_list,x_list,y_list,z_list=[],[],[],[]\nfor i in range(N):\n xyz_list.append(input().split())\n \nvar_list=[x for x in itl.product([-1,1],repeat=3)]\nsum_list=[]\nfor i in var_list:\n print(i,xyz_list)\n sort_list=[0,]*N\n for j in range(N):\n sort_list[j]=int(xyz_list[j][0])*i[0]+ int(xyz_list[j][1])*i[1]+ int(xyz_list[j][2])*i[2]\n sort_list.sort(reverse=True)\n sum_=0\n print(sort_list)\n for j in range(M):\n sum_+=sort_list[j]\n sum_list.append(sum_)\n \nsum_list.sort(reverse=True)\nprint(sum_list[0])', '\nimport itertools as itl\n\nN,M=map(int,input().split())\ncheck=M+10 if M+10<=N else N\nxyz_list,x_list,y_list,z_list=[],[],[],[]\nfor i in range(N):\n xyz_list.append(input().split())\n \nvar_list=[x for x in itl.product([-1,1],repeat=3)]\nsum_list=[]\nfor i in var_list:\n sort_list=[0,]*N\n for j in range(N):\n sort_list[j]=int(xyz_list[j][0])*i[0]+ int(xyz_list[j][1])*i[1]+ int(xyz_list[j][2])*i[2]\n sort_list.sort(reverse=True)\n sum_=0\n for j in range(M):\n sum_+=sort_list[j]\n sum_list.append(sum_)\n \nsum_list.sort(reverse=True)\nprint(sum_list[0])']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s003715305', 's927094814', 's385408182']
[3440.0, 4092.0, 3444.0]
[19.0, 38.0, 32.0]
[631, 655, 612]
p03326
u847867174
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['N, M = map(int, input().split())\nfeatures = list()\nfor _ in range(N):\n f = map(int, input().split())\n features.append(list(f))\n\nmaximum = 0\nindex = list(itertools.combinations(range(0, N), M))\nfor i in index:\n s1, s2, s3 = 0, 0, 0\n for j in i:\n s1 += features[j][0]\n s2 += features[j][1]\n s3 += features[j][2]\n s = abs(s1) + abs(s2) + abs(s3)\n if s > maximum:\n maximum = s\nprint(maximum)', 'N, M = map(int, input().split())\nppp, ppm, pmp, pmm, mpp, mpm, mmp, mmm = list(), list(), list(), list(), list(), list(), list(), list()\nfor _ in range(N):\n x, y, z = map(int, input().split())\n ppp.append(x + y + z)\n ppm.append(x + y - z)\n pmp.append(x - y + z)\n pmm.append(x - y - z)\n mpp.append(- x + y + z)\n mpm.append(- x + y - z)\n mmp.append(- x - y + z)\n mmm.append(- x - y - z)\ntmp = [sum(sorted(ppp, reverse=True)[:M]), sum(sorted(ppm, reverse=True)[:M]), sum(sorted(pmp, reverse=True)[:M]), sum(sorted(pmm, reverse=True)[:M]),\n sum(sorted(mpp, reverse=True)[:M]), sum(sorted(mpm, reverse=True)[:M]), sum(sorted(mmp, reverse=True)[:M]), sum(sorted(mmm, reverse=True)[:M])]\nout = max(tmp)\nprint(out)']
['Runtime Error', 'Accepted']
['s465130458', 's685033964']
[3188.0, 3316.0]
[21.0, 24.0]
[433, 739]
p03326
u860546679
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
["N,M=input().split(' ')\nN=int(N)\nM=int(M)\n\nx_arr=[]\ny_arr=[]\nz_arr=[]\nfor i in range(N):\n\tx,y,z=input().split(' ')\n\tx=int(x)\n\ty=int(y)\n\tz=int(z)\n\tx_arr.append(x)\n\ty_arr.append(y)\n\tz_arr.append(z)\n\nans_x=0\nans_y=0\nans_z=0\nfor i in range(M):\n\tkari_arr=[]\n\tfor j in range(N-i):\n\t\tans_x1=ans_x+x_arr[j]\n\t\tans_y1=ans_y+y_arr[j]\n\t\tans_z1=ans_z+z_arr[j]\n\t\tkari_arr.append(abs(ans_x1)+abs(ans_y1)+abs(ans_z1))\n\tprint(kari_arr)\n\tindex=kari_arr.index(max(kari_arr))\n\tans_x=ans_x+x_arr[index]\n\tans_y=ans_y+y_arr[index]\n\tans_z=ans_z+z_arr[index]\n\tdel x_arr[index]\n\tdel y_arr[index]\n\tdel z_arr[index]\n\tans=abs(ans_x)+abs(ans_y)+abs(ans_z)\nprint(ans)\n", "import numpy as np\n\nN,M=input().split(' ')\nN=int(N)\nM=int(M)\n\nx_arr=[]\ny_arr=[]\nz_arr=[]\nfor i in range(N):\n\tx,y,z=input().split(' ')\n\tx=int(x)\n\ty=int(y)\n\tz=int(z)\n\tx_arr.append(x)\n\ty_arr.append(y)\n\tz_arr.append(z)\n\nx_arr=np.array(x_arr)\ny_arr=np.array(y_arr)\nz_arr=np.array(z_arr)\n\nxyz1=x_arr+y_arr+z_arr\nxyz1=np.sort(xyz1)[::-1]\nxyz1_sum=np.sum(xyz1[:M:])\n\nxyz2=x_arr+y_arr-z_arr\nxyz2=np.sort(xyz2)[::-1]\nxyz2_sum=np.sum(xyz2[:M:])\n\nxyz3=x_arr-y_arr-z_arr\nxyz3=np.sort(xyz3)[::-1]\nxyz3_sum=np.sum(xyz3[:M:])\n\nxyz4=x_arr-y_arr+z_arr\nxyz4=np.sort(xyz4)[::-1]\nxyz4_sum=np.sum(xyz4[:M:])\n\nxyz5=-x_arr-y_arr+z_arr\nxyz5=np.sort(xyz5)[::-1]\nxyz5_sum=np.sum(xyz5[:M:])\n\nxyz6=-x_arr+y_arr+z_arr\nxyz6=np.sort(xyz6)[::-1]\nxyz6_sum=np.sum(xyz6[:M:])\n\nxyz7=-x_arr+y_arr-z_arr\nxyz7=np.sort(xyz7)[::-1]\nxyz7_sum=np.sum(xyz7[:M:])\n\nxyz8=-x_arr-y_arr-z_arr\nxyz8=np.sort(xyz8)[::-1]\nxyz8_sum=np.sum(xyz8[:M:])\n\na=[xyz1_sum,xyz2_sum,xyz3_sum,xyz4_sum,xyz5_sum,xyz6_sum,xyz7_sum,xyz8_sum]\nprint(max(a))\n"]
['Runtime Error', 'Accepted']
['s752473439', 's026267260']
[10740.0, 12436.0]
[472.0, 150.0]
[636, 985]
p03326
u891635666
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['import bisect\nimport collections\n\ns = input().rstrip()\nt = input().rstrip()\n\ncounter_s = collections.Counter(s)\ncounter_t = collections.Counter(t)\nfor c in counter_t.keys():\n if c not in counter_s.keys():\n print(-1)\n exit()\n\ns_indices = collections.defaultdict(list)\nfor i, c in enumerate(s):\n if c in counter_t.keys():\n s_indices[c].append(i)\n\nindex = 0\ncount = 0\noffset = 0\nwhile index < len(t):\n c = t[index]\n i = bisect.bisect_left(s_indices[c], offset)\n if i == len(s_indices[c]):\n count += 1\n offset = 0\n else:\n offset = s_indices[c][i]\n index += 1\nprint(len(s) * count + offset + 1)', 'import itertools\nimport sys\n\ninput = sys.stdin.readline\n\nri = lambda: int(input())\nrs = lambda: input().rstrip()\nril = lambda: list(map(int, input().split()))\nrsl = lambda: input().rstrip().split()\nris = lambda n: [ri() for _ in range(n)]\nrss = lambda n: [rs() for _ in range(n)]\nrils = lambda n: [ril() for _ in range(n)]\nrsls = lambda n: [rsl() for _ in range(n)]\n\nn, m = ril()\nls = rils(n)\n\nres = 0\nfor sx, sy, sz in itertools.product([-1, 1], repeat=3):\n values = []\n for x, y, z in ls:\n values.append(sx * x + sy * y + sz * z)\n values.sort(reverse=True)\n res = max(res, sum(values[:m]))\nprint(res)']
['Wrong Answer', 'Accepted']
['s148276156', 's743531558']
[3436.0, 3408.0]
[22.0, 26.0]
[656, 621]
p03326
u905582793
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['n,m=map(int,input().split())\na=[list(map(int,input().split())) for i in range(n)]\nans=[]\nfor i in range(8):\n binstr=bin(i)[2:]\n binstr.zfill(3)\n b=[]\n for j in range(n):\n c=0\n for k in range(3):\n if binstr[k]=="1":\n c+=a[j][k]\n else:\n c+=-a[j][k]\n b.append(c)\n b.sort()\n ans.append(sum(b[:m]))\nprint(max(ans))', 'n,m=map(int,input().split())\na=[list(map(int,input().split())) for i in range(n)]\nans=[]\nfor i in range(8):\n binstr=format(i,"b").zfill(3)\n b=[]\n for j in range(n):\n c=0\n for k in range(3):\n if binstr[k]=="1":\n c+=a[j][k]\n else:\n c+=-a[j][k]\n b.append(c)\n b.sort(reverse=True)\n ans.append(sum(b[:m]))\nprint(max(ans))']
['Runtime Error', 'Accepted']
['s891950692', 's705702942']
[3316.0, 3316.0]
[21.0, 33.0]
[348, 354]
p03326
u930705402
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['N,M=map(int,input().split())\nc=[list(map(int,input().split())) for i in range(N)]\n\nbit=[[] for i in range(2**3)]\nfor k in range(N):\n for i in range(2**3):\n t=c[k].copy()\n for j in range(3):\n if(i>>j&1):\n t[j]*=-1\n bit[i].append(t)\nfor i in range(2**3):\n bit[i].sort(key=lambda x:(x[0],x[1],x[2]),reverse=True)\nres=0\nfor i in range(2**3):\n p=[1,1,1]\n for j in range(3):\n if(i>>j&1):\n p[j]*=-1\n z,o,t=0,0,0\n for k in range(M):\n z+=bit[i][k][0]*p[0]\n o+=bit[i][k][1]*p[1]\n t+=bit[i][k][2]*p[2]\n res=max(res,abs(z)+abs(o)+abs(t))\nprint(res)', 'N,M=map(int,input().split())\nc=[list(map(int,input().split())) for i in range(N)]\n\nbit=[[] for i in range(2**3)]\nfor k in range(N):\n for i in range(2**3):\n t=c[k].copy()\n for j in range(3):\n if(i>>j&1):\n t[j]*=-1\n bit[i].append(t)\nfor i in range(2**3):\n bit[i].sort(key=lambda x:(x[0]+x[1]+x[2]),reverse=True)\nres=0\nfor i in range(2**3):\n p=[1,1,1]\n for j in range(3):\n if(i>>j&1):\n p[j]*=-1\n z,o,t=0,0,0\n for k in range(M):\n z+=bit[i][k][0]*p[0]\n o+=bit[i][k][1]*p[1]\n t+=bit[i][k][2]*p[2]\n res=max(res,abs(z)+abs(o)+abs(t))\nprint(res)']
['Wrong Answer', 'Accepted']
['s469584546', 's094099016']
[4596.0, 4596.0]
[45.0, 44.0]
[643, 643]
p03326
u941753895
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
["import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\n\ndef LI(): return list(map(int,input().split()))\ndef II(): return int(input())\ndef LS(): return input().split()\ndef S(): return input()\n\ndef main():\n N,M=LI()\n l1=[]\n l2=[]\n l3=[]\n l4=[]\n l5=[]\n l6=[]\n l7=[]\n l8=[]\n for _ in range(N):\n _l=LI()\n if N==5 and M==3 and ' '.join(str(x) for x in _l)=='3 1 4':\n exit()\n\n l1.append(sum([_l[0],_l[1],_l[2]]))\n l2.append(sum([_l[0],_l[1],-_l[2]]))\n l3.append(sum([_l[0],-_l[1],_l[2]]))\n l4.append(sum([_l[0],-_l[1],-_l[2]]))\n l5.append(sum([-_l[0],_l[1],_l[2]]))\n l6.append(sum([-_l[0],_l[1],-_l[2]]))\n l7.append(sum([-_l[0],-_l[1],_l[2]]))\n l8.append(sum([-_l[0],-_l[1],-_l[2]]))\n\n l1=sorted(l1,key=lambda x:x,reverse=True)\n l2=sorted(l2,key=lambda x:x,reverse=True)\n l3=sorted(l3,key=lambda x:x,reverse=True)\n l4=sorted(l4,key=lambda x:x,reverse=True)\n l5=sorted(l5,key=lambda x:x,reverse=True)\n l6=sorted(l6,key=lambda x:x,reverse=True)\n l7=sorted(l7,key=lambda x:x,reverse=True)\n l8=sorted(l8,key=lambda x:x,reverse=True)\n\n x1=sum(l1[:M])\n x2=sum(l2[:M])\n x3=sum(l3[:M])\n x4=sum(l4[:M])\n x5=sum(l5[:M])\n x6=sum(l6[:M])\n x7=sum(l7[:M])\n x8=sum(l8[:M])\n\n return max(x1,x2,x3,x4,x5,x6,x7,x8)\n\n# main()\nprint(main())\n", 'import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\n\ndef LI(): return list(map(int,input().split()))\ndef II(): return int(input())\ndef LS(): return input().split()\ndef S(): return input()\n\ndef main():\n N,M=LI()\n l1=[]\n l2=[]\n l3=[]\n l4=[]\n l5=[]\n l6=[]\n l7=[]\n l8=[]\n for _ in range(N):\n _l=LI()\n\n l1.append(sum([_l[0],_l[1],_l[2]]))\n l2.append(sum([_l[0],_l[1],-_l[2]]))\n l3.append(sum([_l[0],-_l[1],_l[2]]))\n l4.append(sum([_l[0],-_l[1],-_l[2]]))\n l5.append(sum([-_l[0],_l[1],_l[2]]))\n l6.append(sum([-_l[0],_l[1],-_l[2]]))\n l7.append(sum([-_l[0],-_l[1],_l[2]]))\n l8.append(sum([-_l[0],-_l[1],-_l[2]]))\n\n l1=sorted(l1,key=lambda x:x,reverse=True)\n l2=sorted(l2,key=lambda x:x,reverse=True)\n l3=sorted(l3,key=lambda x:x,reverse=True)\n l4=sorted(l4,key=lambda x:x,reverse=True)\n l5=sorted(l5,key=lambda x:x,reverse=True)\n l6=sorted(l6,key=lambda x:x,reverse=True)\n l7=sorted(l7,key=lambda x:x,reverse=True)\n l8=sorted(l8,key=lambda x:x,reverse=True)\n\n x1=sum(l1[:M])\n x2=sum(l2[:M])\n x3=sum(l3[:M])\n x4=sum(l4[:M])\n x5=sum(l5[:M])\n x6=sum(l6[:M])\n x7=sum(l7[:M])\n x8=sum(l8[:M])\n\n return max(x1,x2,x3,x4,x5,x6,x7,x8)\n\n# main()\nprint(main())\n']
['Wrong Answer', 'Accepted']
['s757600920', 's023483902']
[6604.0, 6992.0]
[65.0, 71.0]
[1362, 1285]
p03326
u947750088
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['10 5\n10 -80 21\n23 8 38\n-94 28 11\n-26 -2 18\n-69 72 79\n-26 -86 -54\n-72 -50 59\n21 65 -32\n40 -94 87\n-62 18 82', 'a, b = map(int, input().split())\nsum0 = []\nsum1 = []\nsum2 = []\nsum3 = []\nsum4 = []\nsum5 = []\nsum6 = []\nsum7 = []\n\nfor i in range(a):\n x, y, z = map(int, input().split())\n sum0.append((x + y + z))\n sum1.append((x + y - z))\n sum2.append((x - y + z))\n sum3.append((x - y - z))\n sum4.append((- x + y + z))\n sum5.append((- x + y - z))\n sum6.append((- x - y + z))\n sum7.append((- x - y - z))\n\nsum0 = sum(sorted(sum0, reverse=True)[:b])\nsum1 = sum(sorted(sum1, reverse=True)[:b])\nsum2 = sum(sorted(sum2, reverse=True)[:b])\nsum3 = sum(sorted(sum3, reverse=True)[:b])\nsum4 = sum(sorted(sum4, reverse=True)[:b])\nsum5 = sum(sorted(sum5, reverse=True)[:b])\nsum6 = sum(sorted(sum6, reverse=True)[:b])\nsum7 = sum(sorted(sum7, reverse=True)[:b])\n\n\nprint(max([sum0,sum1,sum2,sum3,sum4,sum5,sum6,sum7]))']
['Runtime Error', 'Accepted']
['s632495800', 's936283136']
[2940.0, 3440.0]
[17.0, 27.0]
[105, 795]
p03326
u961595602
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['import numpy as np\n\nN, M = map(int, input().split())\n\nif M == 0:\n print(0)\n exit()\n\ncakes = np.zeros((N, 3))\nfor i in range(N):\n cakes[i, :] = list(map(int, input().split()))\n\nCalc = []\ntemp = np.zeros((N, 3))\ntot = np.zeros(N)\nfor i in range(2):\n temp[:, 0] = cakes[:, 0] * (-1) ** i\n for j in range(2):\n temp[:, 1] = cakes[:, 1] * (-1) ** j\n for k in range(2):\n temp[:, 2] = cakes[:, 2] * (-1) ** k\n tot = np.sort(temp.sum(axis = 1))[::-1]\n print(tot)\n Calc.append(tot[:M].sum())\n\nprint(int(max(Calc)))', 'import numpy as np\n\nN, M = map(int, input().split())\n\nif M == 0:\n print(0)\n exit()\n\ncakes = np.zeros((N, 3))\nfor i in range(N):\n cakes[i, :] = list(map(int, input().split()))\n\nCalc = []\ntemp = np.zeros((N, 3))\ntot = np.zeros(N)\nfor i in range(2):\n temp[:, 0] = cakes[:, 0] * (-1) ** i\n for j in range(2):\n temp[:, 1] = cakes[:, 1] * (-1) ** j\n for k in range(2):\n temp[:, 2] = cakes[:, 2] * (-1) ** k\n tot = np.sort(temp.sum(axis = 1))[::-1]\n Calc.append(tot[:M].sum())\n\nprint(int(max(Calc)))']
['Wrong Answer', 'Accepted']
['s990140882', 's810769801']
[14408.0, 22172.0]
[333.0, 333.0]
[577, 554]
p03326
u978313283
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['def total(x):\n x=[abs(i) for i in x]\n return sum(x)\n\nN,M=map(int,input().split())\nx=[0 for i in range(N)]\ny=[0 for i in range(N)]\nz=[0 for i in range(N)]\nfor i in range(N):\n x[i],y[i],z[i]=map(int,input().split())\ndp=[[[0,0,0] for i in range(M+1)] for j in range(N+1)]\nfor i in range(N):\n for j in range(M):\n if i>j:\n D=dp[i][j]\n XYZ=[D[0]+x[i],D[1]+y[i],D[2]+z[i]]\n if total(XYZ)>=total(dp[i][j+1]):\n dp[i+1][j+1]=[X,Y,Z]\n else:\n dp[i+1][j+1]=dp[i][j+1]\n elif i==j:\n dp[i+1][j+1]=[a+b for a,b in zip(dp[i][j],[x[i],y[i],z[i]])]\nprint(total(dp[N][M]))\n\n', 'import numpy as np\nN,M=map(int,input().split())\nx=[0 for i in range(N)]\ny=[0 for i in range(N)]\nz=[0 for i in range(N)]\nfor i in range(N):\n x[i],y[i],z[i]=map(int,input().split())\nx=np.array(x)\ny=np.array(y)\nz=np.array(z)\nxyz=np.array([x,y,z])\nd=[]\nfor i in range(8):\n buf=np.zeros(N)\n for j in range(3):\n if i & (1<<j):\n buf=buf+-1*xyz[j]\n continue\n buf=buf+xyz[j]\n buf.sort()\n d.append(sum(buf[N-M:]))\nprint(int(max(d)))\n']
['Runtime Error', 'Accepted']
['s135266632', 's701305823']
[106996.0, 14288.0]
[696.0, 189.0]
[664, 474]
p03326
u988402778
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['n,m = [int(i) for i in input().split()]\na = [[int(i) for i in input().split()] for j in range(n)]\n\nc = [0,1]\nans = 0\nfor l,j,k in itertools.product(c,repeat=3):\n ans = max(ans,sum(sorted([a[i][0]*(-1)**l+a[i][1]*(-1)**j+a[i][2]*(-1)**k for i in range(n)])[n-m:]))\n\nprint(ans)', 'n,m = [int(i) for i in input().split()]\na = [[int(i) for i in input().split()] for j in range(n)]\n\nans = 0\nfor i,j,k in itertools.combinations(range(n),m):\n u = 0\n for l in range(3):\n u += abs(a[i][l] + a[j][l] + a[k][l])\n ans = max(ans,u)\n\nprint(ans)\n', 'from itertools import product as p\nn,m = [int(i) for i in input().split()]\na = [[int(i) for i in input().split()] for j in range(n)]\nc = [1,-1]\nans = 0\nfor l,j,k in p(c,repeat=3):\n ans = max(ans,sum(sorted([a[i][0]*l+a[i][1]*j+a[i][2]*k for i in range(n)])[n-m:])) \nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s112530641', 's937105707', 's777237813']
[3188.0, 3188.0, 3328.0]
[21.0, 22.0, 26.0]
[278, 268, 279]
p03326
u989345508
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['n,m=map(int,input().split())\nprint(max([sum(sorted([i*l[0]+j*l[1]+k*l[2] for l in [list(map(int,input().split())) for i in range(n)]],reverse=True)[:m]) for i in [-1,1] for j in [-1,1] for k in [-1,1]]))', 'from itertools import product\nn,m=map(int,input().split())\nxyz=[list(map(int,input().split())) for i in range(n)]\nprint(max([sum(sorted([i[0]*l[0]+i[1]*l[1]+i[2]*l[2] for l in xyz],reverse=True)[:m]) for i in product([-1,1],[-1,1],[-1,1])]))']
['Runtime Error', 'Accepted']
['s500662352', 's454814290']
[3316.0, 3396.0]
[21.0, 26.0]
[203, 241]
p03326
u997641430
2,000
1,024,000
Takahashi became a pastry chef and opened a shop _La Confiserie d'ABC_ to celebrate AtCoder Beginner Contest 100. The shop sells N kinds of cakes. Each kind of cake has three parameters "beauty", "tastiness" and "popularity". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i. These values may be zero or negative. Ringo has decided to have M pieces of cakes here. He will choose the set of cakes as follows: * Do not have two or more pieces of the same kind of cake. * Under the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity). Find the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.
['N,M=map(int,input().split())\nxyz=[list(map(int,input().split())) for i in range(N)]\nMAX=0\nfor index in [[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]:\n LIST=sorted([sum([p[a]*index[a] for a in range(3)]) for p in xyz])[::-1]\n print(LIST)\n if sum(LIST[0:M])>MAX:\n MAX=sum(LIST[0:M])\nprint(MAX)', 'N,M=map(int,input().split())\nxyz=[list(map(int,input().split())) for i in range(N)]\nMAX=0\nfor index in [[1,1,1],[1,1,-1],[1,-1,1],[1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1],[-1,-1,-1]]:\n LIST=sorted([sum([p[a]*index[a] for a in range(3)]) for p in xyz])[::-1]\n if sum(LIST[0:M])>MAX:\n MAX=sum(LIST[0:M])\nprint(MAX)']
['Wrong Answer', 'Accepted']
['s169512068', 's765696821']
[3444.0, 3316.0]
[33.0, 32.0]
[339, 323]
p03327
u003501233
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['N=int(input())\n\nif N < 1000:\n print("ABC"+str(N))\nelse:\n print("ABD"+str(N))', 'N=int(input())\n\nif N <= 999:\n print("ABC"+str(N))\nelse:\n print("ABD"+str(N))', 'N=int(input())\n\nif N < 1000:\n print("ABC"+N)\nelse:\n print("ABD"+N)', 'N=int(input())\n\nif N < 1000:\n print("ABC")\nelse:\n print("ABD")']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s284363261', 's554837961', 's702038051', 's135109442']
[2940.0, 2940.0, 3060.0, 2940.0]
[17.0, 17.0, 19.0, 17.0]
[78, 78, 68, 64]
p03327
u003873207
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["N = int(input())\nif N >= 1000:\n hya = str(N - 999).rjust(3, '0')\n print('ABD' + hya)\nelse:\n hya = str(N).rjust(3, '0')\n print('ABC' + hya)\n", "N = int(input())\nif N >= 1000:\n hya = str(N - 999)\n print('ABD' + hya)\nelse:\n hya = str(N)\n print('ABC' + hya)\n", "N = int(input())\nif N >= 1000:\n print('ABD')\nelse:\n print('ABC')\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s281588327', 's463407127', 's904283302']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[151, 123, 71]
p03327
u007550226
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["N = int(input())\nif N >=1000:\n print('ABD'+str(N%1000+1).zfill(3))\nelse:\n print('ABC'+str(N).zfill(3))", "N = int(input())\nif N >=1000:\n print('ABD'\nelse:\n print('ABC')", "N = int(input())\nif N >=1000:\n print('ABD')\nelse:\n print('ABC')"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s494883614', 's635296943', 's001099264']
[3188.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[104, 64, 65]
p03327
u012694084
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['N = int(input())\n\nc_or_d = ["C", "D"][N // 1000]\nif N >= 1000:\n N += 1\n\nprint("AB{}{:03}".format(c_or_d, N % 1000))\n', 'N = int(input())\n\nprint("AB{}".format(["C", "D"][N // 1000]))\n']
['Wrong Answer', 'Accepted']
['s346602495', 's490720785']
[2940.0, 3064.0]
[18.0, 43.0]
[119, 62]
p03327
u013582384
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['# -*- coding: utf-8 -*\na_b = input().split()\na = int(a_b[0])\nb = int(a_b[1])\nn = b - a\n\nh = (n - 1) * n / 2 - a\n\nprint(int(h))\n', '# -*- coding: utf-8 -*-\nn = int(input())\n\nif n < 1000:\n print(ABC)\nelse:\n print(ABD)', "# -*- coding: utf-8 -*-\nn = int(input())\n\nif n < 1000:\n print('ABC')\nelse:\n print('ABD')\n"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s242597794', 's455336034', 's601860899']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[127, 90, 95]
p03327
u016182925
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['N=int(input())\nif N < 1000 :\n print(f"ABC{N}")\nelse :\n n = N - 999\n print(f"ABD{n})', 'N=int(input())\nif N <= 999 :\n print("ABC")\nelse :\n print("ABD")']
['Runtime Error', 'Accepted']
['s105108672', 's653578845']
[2940.0, 2940.0]
[17.0, 17.0]
[86, 65]
p03327
u023077142
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["N = int(input())\n\nif N < 1000:\n print('ABC{:03}'.format(N))\nelse:\n print('ABD{:03}'.format(N - 999))", "N = int(input())\n\nif N < 1000:\n print(f'ABC{N:03}')\nelse:\n print(f'ABD{N-999:03}')", "N = int(input())\n\nif N < 1000:\n print('ABC')\nelse:\n print('ABD')"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s251451177', 's429605423', 's035855884']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[106, 88, 70]
p03327
u023229441
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['n=int(input())\nif n<=999:\n print("ABC{}".format(n))\nelse:\n print("ABD{}".format(n-999))', 'print("ABC{}".format(int(input())%999))', 'n=int(input())\nif n<=999:\n print("ABC")\nelse:\n print("ABD")\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s703130747', 's888834202', 's595703033']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[89, 39, 62]
p03327
u025363805
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['n = input()\nif n >= 1000:\n print("ABD")\nelse:\n print("ABC")', 'n = int(input())\nif n >= 1000:\n print("ABD")\nelse:\n print("ABC")\n']
['Runtime Error', 'Accepted']
['s756741824', 's524186501']
[2940.0, 2940.0]
[17.0, 18.0]
[65, 71]
p03327
u026686258
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['#def poll_height(n):\n# if n:\n# return n + poll_height(n - 1)\n# else:\n# return 1 \n\ndef poll_height(n):\n rtn = 0 \n for i in range(n + 1): \n rtn += i\n return rtn \n\na, b = map(int, input().split())\n\ndifference_a_b = b - a \nprint(poll_height(difference_a_b) - b)', 'import sys\nsys.setrecursionlimit(10000)\n\ndef poll_height(n):\n if n:\n return n + poll_height(n - 1)\n else:\n return 1\n\na, b = map(int, input().split())\n\ndifference_a_b = b - a\nprint(poll_height(difference_a_b) - b)', 'a, b = map(int, input().split())\n\ndifference = b - a\nrtn = sum(range(1, difference + 1))\nprint(rtn - b)', 'a, b = map(int, input().split())\n\ndifference_a_b = b - a\nrtn = 0\nfor i in range(difference_a_b):\n rtn += i+1\nprint(rtn - b)', 'def poll_height(n):\n rtn = 0 \n for i in range(n + 1): \n rtn += i\n return rtn \n\na, b = map(int, input().split())\n\ndifference_a_b = b - a \nprint(poll_height(difference_a_b) - b)', '# -*- coding: utf-8 -*-\ndef margin0(n):\n if n < 10:\n return "00{}".format(n)\n elif n < 100:\n return "0{}".format(n)\n elif n < 1000:\n return "".format(n%1000)\n else:\n return "{}".format(n%1000 - 1)\nn = int(input())\n# print(n)\nname = ""\nif n < 1000:\n name = "ABC{}".format(margin0(n))\nelse:\n name = "ABD{}".format(margin0(n))\nprint(name[:3])']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s328429530', 's422463739', 's724272947', 's729096785', 's839257884', 's073509078']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[293, 232, 103, 126, 191, 385]
p03327
u029234056
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['N=int(input())\nif N<1000:\n print("ABC"+str(N).zfill(3))\nelse:\n print("ABD"+str(N+1).zfill(3))', 'N=int(input())\nif N<1000:\n print("ABC"+str(N-1).zfill(3))\nelse:\n print("ABD"+str(N-1).zfill(3))\n ', 'N=int(input())\nif N<1000:\n print("ABC"+str(N).zfill(3))\nelse:\n print("ABD"+str(N-1000+1).zfill(3))', 'N=int(input())\nif N<1000:\n print("ABC")\nelse:\n print("ABD")']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s301183051', 's419257085', 's838145810', 's773528039']
[2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 17.0, 18.0, 18.0]
[95, 100, 100, 61]
p03327
u031157253
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["n=int(input())\nif n - 999 > 0:\n print('ABD')\nelif:\n print('ABC')", "n=int(input())\nif n - 999 > 0:\n print('ABD')\nelse:\n print('ABC')"]
['Runtime Error', 'Accepted']
['s949155360', 's665540500']
[2940.0, 2940.0]
[17.0, 17.0]
[66, 66]
p03327
u035218301
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['a,b = [int(i) for i in input().split()]\n\nstep = 2\ntowers = [1]\ni = 1\nwhile True:\n towers.append(towers[i-1] + step)\n \n if towers[i] >= 499500:\n break\n i += 1\n step += 1\n\n\ndepth = towers[(b-a)-1] - b\nprint(depth)\n\n', 'N = int(input())\n\nif N < 1000:\n print("ABC")\nelse:\n print("ABD")\n \n']
['Runtime Error', 'Accepted']
['s861111616', 's419123971']
[3060.0, 2940.0]
[18.0, 17.0]
[235, 73]
p03327
u039623862
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["n = int(input())\nif n >= 1000:\n print('ABD' + ('00' + str(n-999))[-3:])\nelse:\n print('ABC' + ('00' + str(n))[-3:])\n", "n = int(input())\nif n >= 1000:\n print('ABD')\nelse:\n print('ABC')"]
['Wrong Answer', 'Accepted']
['s491425034', 's377127812']
[2940.0, 2940.0]
[17.0, 17.0]
[121, 70]
p03327
u046187684
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nn = int(input())\nif n < 1000:\n print("ABC" + str(n))\nelse:\n print("ABD" + str(n - 999))', '#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nn = int(input())\nif n < 1000:\n print("ABC")\nelse:\n print("ABD")\n']
['Wrong Answer', 'Accepted']
['s967310952', 's425443428']
[2940.0, 2940.0]
[17.0, 17.0]
[141, 118]
p03327
u047023156
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["import math, sys\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, defaultdict, deque\nfrom copy import deepcopy\nfrom functools import lru_cache\nfrom heapq import heapify, heappop, heappush\nfrom itertools import accumulate, combinations, permutations\ninput = sys.stdin.readline\nmod = 10**9 + 7\nns = lambda: input().strip()\nni = lambda: int(input().strip())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\n\nn = ni()\n\nif n < 999:\n print('ABC')\nelse:\n print('ABD')", "import math, sys\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, defaultdict, deque\nfrom copy import deepcopy\nfrom functools import lru_cache\nfrom heapq import heapify, heappop, heappush\nfrom itertools import accumulate, combinations, permutations\ninput = sys.stdin.readline\nmod = 10**9 + 7\nns = lambda: input().strip()\nni = lambda: int(input().strip())\nnm = lambda: map(int, input().split())\nnl = lambda: list(map(int, input().split()))\n\nn = ni()\n\nif n < 1000:\n print('ABC')\nelse:\n print('ABD')"]
['Wrong Answer', 'Accepted']
['s912885349', 's385841988']
[3696.0, 3696.0]
[25.0, 24.0]
[530, 531]
p03327
u047668580
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['N,C = list(map(int,input().split()))\nD = [ list(map(int,input().split())) for i in range(C)]\nc = [ list(map(int,input().split())) for i in range(N)]\n\nsep = {0:[0 for i in range(C)],1:[0 for i in range(C)],2:[0 for i in range(C)]}\nfor i,cx in enumerate(c):\n for j,cy in enumerate(cx):\n if len(c) == 2 and (i + j) % 3 == 2:\n sep[(i + j) % 3 - 1][cy -1] += 1\n else:\n sep[(i + j) % 3][cy - 1] += 1\nminimums = [[],[],[]]\nfor key,values in sep.items():\n for i in range(C):\n m0 = 0\n am0 = 0\n m1 = 0\n am1 = 1\n deposit = 0\n for j,value in enumerate(values):\n deposit += D[j][i] * valuea\n sep[key].append(deposit)\nmin0 = min(sep[0])\nmin1 = min(sep[1])\nmin2 = min(sep[2])\n\nprint(min1 + min2 + min0)\n', 'N = int(input()) \nif N > 999: \n print("ABD") \nelse: \n pritn("ABC") \n', 'N = int(input()) \nif N > 999: \n print("ABD") \nelse: \n print("ABC") ']
['Runtime Error', 'Runtime Error', 'Accepted']
['s698528056', 's841769103', 's883578488']
[3064.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[792, 145, 133]
p03327
u048867491
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['N=int(input())\nN=1000\nif N>=1000:\n print("ABD")\nelse:\n print("ABC")', 'N=int(input())\nif N>=1000:\n print("ABD")\nelse:\n print("ABC")']
['Wrong Answer', 'Accepted']
['s330232640', 's014498279']
[2940.0, 2940.0]
[18.0, 18.0]
[69, 62]
p03327
u050121913
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['x = list(map(int,input().split( )))\nz = x[1]-x[0]\nt = 0\nfor s in range(z+2):\n t += s\n \nprint(t-x[1])', "x = int(input())\n\nif x > 999:\n print('ABD')\n \nelse:\n print('ABC')"]
['Runtime Error', 'Accepted']
['s474673664', 's857057426']
[2940.0, 2940.0]
[17.0, 17.0]
[106, 74]
p03327
u050698451
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["N = int(input())\nif N < 1000:\n\tprint('ABC%03d' % N)\nelse:\n\tprint('ABD%03d' %(N-999))", "N = int(input())\nif N < 1000:\n\tprint('ABC')\nelse:\n\tprint('ABD')"]
['Wrong Answer', 'Accepted']
['s300568042', 's420013094']
[2940.0, 3068.0]
[17.0, 18.0]
[84, 63]
p03327
u055687574
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['a, b = map(int, input().split())\n\nprint(((b-a)+1)*(b-a)//2-b)\n', 'n = int(input())\n\nif n <= 999:\n print("ABC")\nelse:\n print("ABD")\n']
['Runtime Error', 'Accepted']
['s002016254', 's364378154']
[2940.0, 2940.0]
[18.0, 20.0]
[62, 71]
p03327
u059210959
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['#encoding utf-8\n\n\nn = int(input())\n\nif n >= 999:\n print("ABD")\n\nelse:\n print("ABC")\n', '#encoding utf-8\n\n\nn = input()\n\nif n > 999:\n print("ABD")\n\nelse:\n print("ABC")', '#encoding utf-8\n\n\nn = int(input())\n\nif n > 999:\n print("ABD")\n\nelse:\n print("ABC")\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s148932150', 's761019044', 's929912055']
[2940.0, 3060.0, 2940.0]
[17.0, 18.0, 17.0]
[90, 83, 89]
p03327
u067901008
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["def con_n(N):\n if N <= 1000:\n return 'ABC'\n elif N > 1000:\n return 'ABD'", "n = int(input())\ndef con_n(n):\n if n <= 1000:\n return 'ABC'\n elif n > 1000:\n return 'ABD'\n \ncon_n(n)", "n = int(input())\ndef con_n(n):\n if n < 1000:\n return 'ABC'\n elif n => 1000:\n return 'ABD'\n \nprint(con_n(n))", 'k, l=[int(i) for i in input().split()]\n\nimport numpy as np\nn = np.zeros(999)\nfor i in range(1000):\n if i != 0:\n n[i-1] = i\n\n\ndef snowh(k, l):\n for i in range(1000):\n if l-k == n[i-1]:\n return n[i-2]*(n[i-2]+1)*0.5 - k\n \nprint(snowh(k, l))', "n = int(input())\ndef con_n(n):\n if n <= 1000:\n return 'ABC'\n elif n > 1000:\n return 'ABD'", "n = int(input())\ndef con_n(n):\n if N <= 1000:\n return 'ABC'\n elif N > 1000:\n return 'ABD'", "n = int(input())\ndef con_n(n):\n if n < 1000:\n return 'ABC'\n elif n => 1000:\n return 'ABD'\n \nprint(con_n(n))", "n = int(input())\ndef con_n(n):\n if n < 1000:\n return 'ABC'\n elif n >= 1000:\n return 'ABD'\n \nprint(con_n(n))"]
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s176862601', 's386027801', 's387995262', 's554532551', 's685084455', 's830644145', 's968133461', 's736054565']
[2940.0, 2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[92, 123, 130, 276, 109, 109, 130, 130]
p03327
u068862866
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['N = int(input())\n\nprint("ABD{:04}".format(N)) if N//1000!=1 else print("ABD{:04}".format(N%1000 + N//1000))', 'N = int(input())\n\nnum = N%1000 + N//1000\n\nprint("ABD"+str(num))', 'N = input()\n\nprint("ABD"+N)', 'N = int(input())\n\nprint("ABC{:03}".format(N)) if N//1000!=1 else print("ABD{:03}".format(N%1000 + N//1000))', 'N = int(input())\n\nprint("ABC") if N//1000!=1 else print("ABD")']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s242122898', 's410950018', 's447463601', 's491530714', 's210846564']
[9132.0, 9124.0, 9012.0, 9152.0, 9020.0]
[23.0, 26.0, 24.0, 28.0, 25.0]
[107, 63, 27, 107, 62]
p03327
u069838609
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["from itertools import permutations\n\nN, C = [int(elem) for elem in input().split(' ')]\nD_matrix = [[int(elem) for elem in input().split(' ')] for _ in range(C)]\nassert len(D_matrix) == C\nassert len(D_matrix[0]) == C\nc_matrix = [[int(elem) for elem in input().split(' ')] for _ in range(N)]\nassert len(c_matrix) == N\nassert len(c_matrix[0]) == N\n\n# grouping\n# O(N^2)\nmod_list = [[] for _ in range(3)]\nfor i in range(N):\n for j in range(N):\n mod_list[(i + j) % 3].append((i, j))\n\n# O(N^2)\nmod_color_list = [[0] * C for _ in range(3)]\nfor k, mod in enumerate(mod_list):\n for i, j in mod:\n mod_color_list[k][c_matrix[i][j] - 1] += 1\n\n# O(C^3 * N^2) -> O(C^4)\nmin_cost = float('inf')\nfor colors in permutations(range(C), 3):\n total_cost = 0\n for color, mod_color in zip(colors, mod_color_list):\n total_cost += sum([D_matrix[X][color] * mod_color[X] for X in range(C)])\n min_cost = min(min_cost, total_cost)\n\nprint(min_cost)\n", 'N = int(input())\n\nif N < 1000:\n print("ABC")\nelse:\n print("ABD")\n']
['Runtime Error', 'Accepted']
['s316958542', 's126762495']
[3064.0, 2940.0]
[18.0, 17.0]
[954, 71]
p03327
u080364835
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["n = int(input())\nif n <= 999:\n ans = 'ABC' + str(n).zfill(3)\nelse:\n ans = 'ABD' + str(n-1000+1).zfill(3)\n\nprint(ans)", "n = int(input())\nprint('ABC' if n <= 999 else 'ABD')"]
['Wrong Answer', 'Accepted']
['s681130991', 's367131103']
[9164.0, 9156.0]
[26.0, 28.0]
[122, 52]
p03327
u086503932
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['return "ABC" if int(input()) < 1000 else "ABD"', "print('ABC') if int(input()) < 1000 else print('ABD')"]
['Runtime Error', 'Accepted']
['s509521288', 's558097342']
[2940.0, 2940.0]
[17.0, 17.0]
[46, 53]
p03327
u087373960
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["X = int(input())\n\nif X < 1000:\n print('ABC' + f'{X:03}')\nelse:\n X = X % 999\n print('ABD' + f'{X:03}')", "X = int(input())\n\nif X < 1000:\n print('ABC' + str(X).zfill(3))\nelse:\n X = X % 999\n print('ABD' + str(X).zfill(3))", "X = int(input())\n\nif X < 1000:\n print('ABC')\nelse:\n print('ABD')"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s398318837', 's549479458', 's632934694']
[9168.0, 9080.0, 9144.0]
[28.0, 28.0, 27.0]
[104, 116, 66]
p03327
u095969144
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['a = input()\n\nif a < 1000 :\n print("ABC")\nelse :\n print("ABD")', 'a = int(input())\n\nif a < 1000 :\n print("ABC")\nelse :\n print("ABD")']
['Runtime Error', 'Accepted']
['s331449481', 's888087592']
[2940.0, 2940.0]
[17.0, 17.0]
[67, 72]
p03327
u102461423
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["N = int(input())\noffset = 'ABC' if N < 1000 else 'ABC'\nprint(offset + str(N%1000))", "N = int(input())\noffset = 'ABC' if N < 999 else 'ABD'\nprint(offset)# + str(N%999))", "N = int(input())\noffset = 'ABC' if N < 999 else 'ABC'\nprint(offset + str(N%999))", "N = int(input())\noffset = 'ABC' if N <= 999 else 'ABD'\nprint(offset)# + str(N%999))\n"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s345388029', 's350737229', 's951392938', 's168127072']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[82, 82, 80, 84]
p03327
u102960641
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['n = int(input()) % 999\n\nif n <=9:\n print("ABC00"+str(n))\nelif n <= 99:\n print("ABC0"+str(n))\nelse:\n print("ABC"+str(n))\n', 'n = int(input())\n\nif n <=999:\n print("ABC")\nelse:\n print("ABD"))', 'n = int(input())\nprint("ABC"+str(n%1000))', 'n = int(input())\n\nif n <=9:\n print("ABC00"+str(n))\nelif n <= 99:\n print("ABC0"+str(n))\nelif n <= 999:\n print("ABC"+str(n))\nelif n <= 1008:\n print("ABD00"+str(n%999))\nelif n <= 1098:\n print("ABD0"+str(n%999))\nelse:\n print("ABD"+str(n%999))', 'n = int(input())\nif n <=999:\n print("ABC")\nelse:\n print("ABD")']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s154453709', 's444957907', 's540333616', 's928731287', 's447283141']
[2940.0, 2940.0, 2940.0, 3060.0, 2940.0]
[18.0, 17.0, 17.0, 17.0, 18.0]
[123, 66, 41, 244, 64]
p03327
u103539599
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['N = int(input())\n\nif N < 100: print("ABC")\nelse: print("ABD")', 'N = int(input())\n\nif N < 1000: print("ABC")\nelse: print("ABD")']
['Wrong Answer', 'Accepted']
['s498269705', 's038347175']
[2940.0, 2940.0]
[17.0, 17.0]
[61, 62]
p03327
u103902792
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["n = int(input())\nans = 'AB'\nif n <= 999:\n ans += 'C'\nelse:\n ans += 'D'\n n -= 999\nprint(ans+'{:03}'.format(n))\n\n", "n = int(input())\nans = 'AB'\nif n <= 999:\n ans += 'C'\nelse:\n ans += 'D'\n n -= 999\nprint(ans+'{03}'.format(n))", "n = int(input())\nans = 'AB'\nif n <= 999:\n ans += 'C'\nelse:\n ans += 'D'\nprint(ans)\n"]
['Wrong Answer', 'Runtime Error', 'Accepted']
['s102434560', 's489191078', 's658426383']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[114, 111, 84]
p03327
u110943895
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['n = int(input())\nprint("ABC{0:03d}".format(n) if n<1000 else "ABD{0:03d}".format(n-999))', 'n = int(input())\nprint("ABC" if n<1000 else "ABD")']
['Wrong Answer', 'Accepted']
['s323072202', 's286374404']
[2940.0, 2940.0]
[17.0, 17.0]
[88, 50]
p03327
u114954806
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['N = input()\nif 1 <= N <= 999:\n print("ABC")\nelse:\n print("ABD")', 'print("ABC" if 1<=int(input())<=999 else "ABD")']
['Runtime Error', 'Accepted']
['s715289168', 's684294188']
[2940.0, 3064.0]
[17.0, 17.0]
[69, 47]
p03327
u116233709
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['n=int(input())\nimport math\nansa=[0]\nansb=[0]\nans=[]\ncnt=0\nx=0\ny=0\nfor i in range(1,n+1):\n while 9**(x+1)<=i:\n x+=1\n for j in range(x,-1,-1):\n z=(math.floor(i/(9**j))%9)\n i-=(9**j)*z\n cnt+=z\n ansa.append(cnt)\n cnt=0 \n \nfor i in range(1,n+1):\n while 6**(y+1)<=i:\n y+=1\n for j in range(y,-1,-1):\n z=(math.floor(i/(6**j))%6)\n i-=(6**j)*z\n cnt+=z\n ansb.append(cnt)\n cnt=0\n \nfor i in range(n+1):\n ans.append(ansa[i]+ansb[n-i])\n \nprint(min(ans)) \n\n', 'n=int(input())\nif n<1000:\n print("ABC")\nelse:\n print("ABD") \n ']
['Wrong Answer', 'Accepted']
['s804987907', 's843375331']
[3064.0, 2940.0]
[34.0, 17.0]
[538, 74]
p03327
u118211443
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['N=int(input())\nprint("ABC" if N-999<0 else "ABD")', 'N=int(input())\nprint("ABC" if N-1000<0 else "ABD")']
['Wrong Answer', 'Accepted']
['s002778361', 's000352474']
[2940.0, 2940.0]
[19.0, 17.0]
[49, 50]
p03327
u123745130
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['print(["ABD","ABC][len(input())==3])', 'print(["ABC","ABD"][len(input())==4])']
['Runtime Error', 'Accepted']
['s586423574', 's712501770']
[3064.0, 2940.0]
[18.0, 17.0]
[36, 37]
p03327
u125205981
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["def main():\n N = int(input())\n\n if N > 999:\n print('ABC')\n else:\n print('ABD')\n\nmain()\n", "def main():\n N = int(input())\n\n if N < 1000:\n print('ABC')\n else:\n print('ABD')\n\nmain()\n"]
['Wrong Answer', 'Accepted']
['s051962376', 's965286487']
[2940.0, 2940.0]
[18.0, 18.0]
[110, 111]
p03327
u127856129
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['a=int(input())\nif a>999:\n print("ABC"+a)\nelse:\n print("ABD"+a%999)', 'a=int(input())\nif 1<=a<=999:\n print("ABC")\nelse:\n print("ABD")']
['Runtime Error', 'Accepted']
['s202764772', 's540816548']
[2940.0, 2940.0]
[18.0, 18.0]
[68, 64]
p03327
u131264627
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["n = int(input())\nprint('ABC' + n if n < 1000 else 'ABD' + n)", "n = int(input())\nprint('ABC' if n < 1000 else 'ABD')"]
['Runtime Error', 'Accepted']
['s532577190', 's438854049']
[3316.0, 2940.0]
[21.0, 17.0]
[60, 52]
p03327
u133583235
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['N = int(input())\nif N < 1000:\n print("ABC"+ str(N))\nelse:\n print("ABD" + str(N))', 'N = int(input())\nif N < 1000:\n print("ABC")\nelse:\n print("ABD")']
['Wrong Answer', 'Accepted']
['s481832454', 's287369602']
[2940.0, 2940.0]
[26.0, 17.0]
[82, 65]
p03327
u136090046
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['n = int(input())\nif n <= 999:\n print("ABC{0:03d}".format(n))\nelse:\n print("ABD{0:03d}".format(abs(n-1000+1)))', 'n = int(input())\nif n <= 999:\n print("ABC")\nelse:\n print("ABD")']
['Wrong Answer', 'Accepted']
['s498815574', 's947506338']
[2940.0, 2940.0]
[18.0, 17.0]
[115, 69]
p03327
u138797516
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['contest_num = int(input())\n\nif contest_num >= 1999:\n result_str = \'The contest has not been held\'\n\nelif contest_num < 1000:\n result_str = \'ABC\'\n\nelif contest_num >= 1000:\n result_str = \'ABD\'\n\nprint("result_str")\n\n', "contest_num = int(input())\n\nif contest_num >= 1999:\n result_str = 'The contest has not been held'\n\nelif contest_num < 1000:\n result_str = 'ABC'\n\nelif contest_num >= 1000:\n result_str = 'ABD'\n\nprint(result_str)\n\n"]
['Wrong Answer', 'Accepted']
['s052625917', 's883970784']
[9012.0, 9148.0]
[29.0, 30.0]
[222, 220]
p03327
u139115460
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["num = input()\nif num < 1000:\n print('ABC')\nelse:\n print('ABD')", "num = int(input())\nif num < 1000:\n print('ABC')\nelse:\n print('ABD')"]
['Runtime Error', 'Accepted']
['s040268041', 's155631939']
[2940.0, 2940.0]
[17.0, 17.0]
[64, 71]
p03327
u141786930
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["N = int(input())\nif N <= 999:\n print('ABC' + str(N+1000)[1:])\nelse:\n print('ABD' + str(N+1)[1:])", "N = int(input())\nif N <= 999:\n print('ABC')\nelse:\n print('ABD')"]
['Wrong Answer', 'Accepted']
['s097317773', 's968609998']
[9152.0, 9140.0]
[27.0, 26.0]
[102, 69]
p03327
u143492911
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['n=int(input())\nif n<=99:\n print("ABC")\nelse:\n print("ABD")\n', 'n=int(input())\nif n<=999:\n print("ABC")\nelse:\n print("ABD")\n']
['Wrong Answer', 'Accepted']
['s733527055', 's405049276']
[2940.0, 2940.0]
[17.0, 17.0]
[65, 66]
p03327
u143903328
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["n= int(input())\nif n > 999:\n print('ABD',str(n-999).zfill(3),sep='')\nelse:\n print('ABC',str(n).zfill(3),sep='')", "n= int(input())\nif n > 999:\n print('ABD')\nelse:\n print('ABC')"]
['Wrong Answer', 'Accepted']
['s924094444', 's088323490']
[2940.0, 2940.0]
[17.0, 17.0]
[117, 67]
p03327
u145600939
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["n = int(input())\nif n <= 999:\n print('ABC'+str(n).zfill(3))\nelse:\n print('ABD'+str(n-999).zfill(3))\n", "n = int(input())\nif n <= 999:\n print('ABC'+str(n).zfill(4))\nelse:\n print('ABD'+str(n-999).zfill(4))\n", "n = int(input())\nif n <= 999:\n print('ABC'+str(n))\nelse:\n print('ABD'+str(n-999))", "n = int(input())\nif n <= 999:\n print('ABC')\nelse:\n print('ABD')\n"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s337539076', 's662583962', 's737732482', 's823821295']
[2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 18.0, 17.0, 17.0]
[102, 102, 83, 66]
p03327
u148551245
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['n = input()\nn = str(int(n) - 999)\nans = "ABD" + n.zfill(3)\nprint(ans)', 'n = int(input())\nprint("ABD{}".format(n-999))', 'n = int(input())\nif n > 999:\n print("ABD")\nelse:\n print("ABC")']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s065062910', 's556659087', 's409180104']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[69, 45, 68]
p03327
u150641538
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
['n = int(input())\nprint("%03d" % (n%1000 + n//1000))', 'n = int(input())\nif(n>999):\n print("ABD")\nelse:\n print("ABC")']
['Wrong Answer', 'Accepted']
['s452771006', 's550964401']
[2940.0, 2940.0]
[17.0, 17.0]
[51, 67]
p03327
u151625340
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["N = int(input())\nif N <= 999:\n print('ABC'+str(N).zfill(3))\nelse:\n print('ABD'+str(N-999).zfill(3))", "N = int(input())\nif N <= 999:\n print('ABC'+str(N))\nelse:\n print('ABD'+str(N-999))\n", "N = int(input())\nif N <= 999:\n print('ABC')\nelse:\n print('ABD')\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s070978894', 's510583139', 's669202614']
[2940.0, 2940.0, 2940.0]
[17.0, 18.0, 18.0]
[105, 88, 70]
p03327
u152671129
2,000
262,144
Decades have passed since the beginning of AtCoder Beginner Contest. The contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rounds should be labeled? In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: `ABD001`, `ABD002`, ..., `ABD999`. You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
["n = int(input())\n\nif n > 999:\n print('ABD{}'.format(n - 999))\nelse:\n print('ABC{}'.format(n))", "n = int(input())\n\nif n > 999:\n print('ABD{}'.format(str(n - 999).zfill(3)))\nelse:\n print('ABC{}'.format(n))", "n = int(input())\n\nif n > 999:\n print('ABD)\nelse:\n print('ABC')", "n = int(input())\n \nif n > 999:\n print('ABD')\nelse:\n print('ABC')"]
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s345358726', 's535645522', 's706879297', 's777374957']
[2940.0, 2940.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0, 17.0]
[99, 113, 68, 70]