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
p03265
u835732324
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['x1,y1,x2,y2=map(int,input().split())\nprint(x2+y1-y2,y2+x2-x1,x3+y2-y3,y3+x3-x2)', 'x1,y1,x2,y2=map(int,input().split())\nx3=x2+y1-y2\ny3=y2+x2-x1\nx4=x3+y2-y3\ny4=y3+x3-x2\nprint(x3,y3,x4,y4)']
['Runtime Error', 'Accepted']
['s843869056', 's725777253']
[2940.0, 3060.0]
[17.0, 19.0]
[79, 103]
p03265
u844646164
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['import math\nx1, y1, x2, y2 = map(int, input().split())\nx2 -= x1\ny2 -= y1\nprint(x2, y2)\nif x2 != 0:\n theta = math.atan2(y2,x2)\nelse:\n if y2 > 0:\n theta = math.pi / 2\n else:\n theta = 3 * math.pi / 2\nif y2 == 0:\n if x2 < 0:\n theta = math.pi\n else:\n theta = 0\n\nif theta < 0:\n theta += 2 * math.pi\n\nl = math.sqrt(x2**2 + y2**2)\n\nx3 = math.cos(theta+math.radians(45))*l*math.sqrt(2)+x1\ny3 = math.sin(theta+math.radians(45))*l*math.sqrt(2)+y1\n\nx4 = math.cos(theta+math.radians(90))*l+x1\ny4 = math.sin(theta+math.radians(90))*l+y1\nprint(round(x3), round(y3), round(x4), round(y4))', 'x1, y1, x2, y2 = list(map(int, input().split()))\nA = x2 - x1\nB = y2 - y1\nprint(A, B)\nx3 = x2 - B\nif x1 >= y2:\n y3 = y2 - A\nelse:\n y3 = y2 + A\nx4 = x3 - A\n\ny4 = y3 - B\nprint(x3, y3, x4, y4)', '\nimport math\nx1, y1, x2, y2 = map(int, input().split())\nx2 -= x1\ny2 -= y1\nif x2 != 0:\n theta = math.atan2(y2,x2)\nelse:\n if y2 > 0:\n theta = math.pi / 2\n else:\n theta = 3 * math.pi / 2\nif y2 == 0:\n if x2 < 0:\n theta = math.pi\n else:\n theta = 0\n\nif theta < 0:\n theta += 2 * math.pi\n#theta = theta % (2 * math.pi)\n\nl = math.sqrt(x2**2 + y2**2)\n\nx3 = math.cos(theta+math.radians(45))*l*math.sqrt(2)+x1\ny3 = math.sin(theta+math.radians(45))*l*math.sqrt(2)+y1\n\nx4 = math.cos(theta+math.radians(90))*l+x1\ny4 = math.sin(theta+math.radians(90))*l+y1\nprint(round(x3), round(y3), round(x4), round(y4))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s002040179', 's371691891', 's067927709']
[3316.0, 3060.0, 3444.0]
[22.0, 18.0, 21.0]
[618, 194, 636]
p03265
u844895214
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
["import sys\nfrom collections import deque\nimport math\n\ndef S(): return sys.stdin.readline().rstrip()\ndef SL(): return map(str,sys.stdin.readline().rstrip().split())\ndef I(): return int(sys.stdin.readline().rstrip())\ndef IL(): return map(int,sys.stdin.readline().rstrip().split())\ndef array(n,val=0):\n return [val]*n\ndef matrix(row,columns,val):\n return [[val]*columns for _ in range(row)]\n\ndef solve():\n x1,y1,x2,y2 = IL()\n points = sorted([[x1,y1],[x2,y2]], key=lambda x: x[1])\n print(points)\n dx = points[0][0]-points[1][0]\n dy = points[0][1]-points[1][1]\n x3 = points[1][0] + dy\n y3 = points[1][1] - dx\n x4 = points[0][0] + dy\n y4 = points[0][1] - dx\n print(x3,y3,x4,y4)\n return\n\nif __name__=='__main__':\n solve()", "import sys\nfrom collections import deque\nimport math\n\ndef S(): return sys.stdin.readline().rstrip()\ndef SL(): return map(str,sys.stdin.readline().rstrip().split())\ndef I(): return int(sys.stdin.readline().rstrip())\ndef IL(): return map(int,sys.stdin.readline().rstrip().split())\ndef array(n,val=0):\n return [val]*n\ndef matrix(row,columns,val):\n return [[val]*columns for _ in range(row)]\n\ndef solve():\n dx = x2-x1\n dy = y2-y1\n x3 = x2-dy\n y3 = y2+dy\n x4 = x1-dy\n y4 = y1+dx\n print(x3,y3,x4,y4)\n return\n\nif __name__=='__main__':\n x1,y1,x2,y2 = IL()\n solve()", "import sys\nfrom collections import deque\nimport math\n\ndef S(): return sys.stdin.readline().rstrip()\ndef SL(): return map(str,sys.stdin.readline().rstrip().split())\ndef I(): return int(sys.stdin.readline().rstrip())\ndef IL(): return map(int,sys.stdin.readline().rstrip().split())\ndef array(n,val=0):\n return [val]*n\ndef matrix(row,columns,val):\n return [[val]*columns for _ in range(row)]\n\ndef solve():\n points = sorted(a, key=lambda x: (x[1],-x[0]))\n dx = points[0][0]-points[1][0]\n dy = points[0][1]-points[1][1]\n x3 = points[1][0] + dy\n y3 = points[1][1] - dx\n x4 = points[0][0] + dy\n y4 = points[0][1] - dx\n print(points,a)\n if points != a:\n x3,x4,y3,y4 = x4,x3,y4,y3\n print(x3,y3,x4,y4)\n return\n\nif __name__=='__main__':\n x1,y1,x2,y2 = IL()\n a = [[x1,y1],[x2,y2]]\n solve()", "import sys\nfrom collections import deque\nimport math\n\ndef S(): return sys.stdin.readline().rstrip()\ndef SL(): return map(str,sys.stdin.readline().rstrip().split())\ndef I(): return int(sys.stdin.readline().rstrip())\ndef IL(): return map(int,sys.stdin.readline().rstrip().split())\ndef array(n,val=0):\n return [val]*n\ndef matrix(row,columns,val):\n return [[val]*columns for _ in range(row)]\n\ndef solve():\n dx = x2-x1\n dy = y2-y1\n\n x3 = x2 - dy\n y3 = y2 + dx\n x4 = x1 - dy\n y4 = y1 + dx\n print(x3,y3,x4,y4)\n return\n\nif __name__=='__main__':\n x1,y1,x2,y2 = IL()\n solve()"]
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s148467647', 's370362569', 's869585610', 's014579392']
[9420.0, 9444.0, 9380.0, 9288.0]
[29.0, 27.0, 27.0, 28.0]
[786, 621, 860, 630]
p03265
u845427284
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['x1,y1,x2,y2 = map(int, input().split())\nlen = abs(x1 - x2)\n\nx4 = x1 - len\nx3 = x2 - len\ny4 = y1 - len\ny3 = y2 - len\n\nprint(x3 + " " + y3 + " " + x4 + " " + y4) ', 'x1,y1,x2,y2 = map(int, input().split())\nylen = y2 - y1\nxlen = x2 - x1\n\nx3 = x2 - ylen\ny3 = y2 + xlen\nx4 = x3 - xlen\ny4 = y3 - ylen\n\nprint(str(x3) + " " + str(y3) + " " + str(x4) + " " + str(y4))']
['Runtime Error', 'Accepted']
['s080659964', 's146922746']
[3060.0, 3060.0]
[17.0, 18.0]
[160, 194]
p03265
u846150137
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['a,b,c,d=map(int,input().split())\nx=a-c\ny=b-d\nprint(c+y,d+x,a-y,b-x)', 'a,b,c,d=map(int,input().split())\nx=c-a\ny=d-b\nprint(c+y,d-x,a+y,b-x)', 'a,b,c,d=map(int,input().split())\nx=c-a\ny=d-b\nprint(c-y,d+x,a-y,b+x)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s585756847', 's848218280', 's540273905']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[67, 67, 67]
p03265
u854685063
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['import sys\nimport math\ndef I():return int(sys.stdin.readline().replace("\\n",""))\ndef I2():return map(int,sys.stdin.readline().replace("\\n","").split())\ndef S():return str(sys.stdin.readline().replace("\\n",""))\ndef L():return list(sys.stdin.readline().replace("\\n",""))\ndef intl():return [int(k) for k in sys.stdin.readline().replace("\\n","").split()]\ndef Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\\n","").split()))\n\nif __name__ == "__main__":\n x1,y1,x2,y2 = I2()\n v = x2 - x1#x\n w = y2 - y1#y\n print(x2-w,y2+v,x1-w,y2+v)', 'import sys\nimport math\ndef I():return int(sys.stdin.readline().replace("\\n",""))\ndef I2():return map(int,sys.stdin.readline().replace("\\n","").split())\ndef S():return str(sys.stdin.readline().replace("\\n",""))\ndef L():return list(sys.stdin.readline().replace("\\n",""))\ndef intl():return [int(k) for k in sys.stdin.readline().replace("\\n","").split()]\ndef Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\\n","").split()))\n\nif __name__ == "__main__":\n x1,y1,x2,y2 = I2()\n v = x2 - x1#x\n w = y2 - y1#y\n print(x2-w,y2+v,x1-w,y1+v)']
['Wrong Answer', 'Accepted']
['s139268075', 's570585029']
[3064.0, 3064.0]
[17.0, 18.0]
[561, 561]
p03265
u857070771
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['x1,x2,x3,x4=map(int,input().split())\ndx=abs(x1-x2)\ndy=abs(y1-y2)\nif x1<x2 and y1<=y2:\n x3=x2-dy\n y3=y2+dx\n x4=x3-dx\n y4=y3-dy\n #ok\nelif x1>=x2 and y1<y2:\n x3=x2-dy\n y3=y2-dx\n x4=x3+dx\n y4=y3-dy\n #ok\nelif x1>x2 and y1>=y2:\n x3=x2+dy\n y3=y2-dx\n x4=x3+dx\n y4=y3+dy\nelif x1<=x2 and y1>y2:\n x3=x2+dy\n y3=y2+dx\n x4=x3-dx\n y4=y3+dy\nelse:\n print("NA")\nprint(x3,y3,x4,y4)', 'x1,y1,x2,y2=map(int,input().split())\ndx=abs(x1-x2)\ndy=abs(y1-y2)\nif x1<x2 and y1<=y2:\n x3=x2-dy\n y3=y2+dx\n x4=x3-dx\n y4=y3-dy\nelif x1>=x2 and y1<y2:\n x3=x2-dy\n y3=y2-dx\n x4=x3+dx\n y4=y3-dy\nelif x1>x2 and y1>=y2:\n x3=x2+dy\n y3=y2-dx\n x4=x3+dx\n y4=y3+dy\nelif x1<=x2 and y1>y2:\n x3=x2+dy\n y3=y2+dx\n x4=x3-dx\n y4=y3+dy\nelse:\n print("NA")\nprint(x3,y3,x4,y4)']
['Runtime Error', 'Accepted']
['s674858346', 's438270620']
[3064.0, 3064.0]
[17.0, 17.0]
[419, 403]
p03265
u875361824
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['def main():\n x1, y1, x2, y2 = map(int, input().split())\n\n ans = editorial(x1, y1, x2, y2)\n assert ans == twi(x1, y1, x2, y2)\n print(*ans)\n\n\ndef twi(x1, y1, x2, y2):\n """\n https://twitter.com/akensho/status/1035924165205716992\n https://twitter.com/hogeover30/status/1035903937830764545\n """\n import math\n cos90 = int(math.cos(math.pi / 2))\n sin90 = int(math.cos(math.pi / 2))\n\n x = x2 - x1\n y = y2 - y1\n x4 = x * cos90 - y * sin90 + x1\n y4 = x * sin90 + y * cos90 + y1\n\n x = x1 - x4\n y = y1 - y4\n x3 = x * cos90 - y * sin90 + x4\n y3 = x * sin90 + y * cos90 + y4\n\n return x3, y3, x4, y4\n\n\ndef editorial(x1, y1, x2, y2):\n x = x2 - x1\n y = y2 - y1\n\n x3 = x2 - y\n y3 = y2 + x\n x4 = x1 - y\n y4 = y1 + x\n\n return x3, y3, x4, y4\n\n\nif __name__ == \'__main__\':\n main()\n', 'def main():\n x1, y1, x2, y2 = map(int, input().split())\n\n ans = editorial(x1, y1, x2, y2)\n \n print(*ans)\n\n\ndef twi(x1, y1, x2, y2):\n """\n https://twitter.com/akensho/status/1035924165205716992\n https://twitter.com/hogeover30/status/1035903937830764545\n """\n import math\n cos90 = int(math.cos(math.pi / 2))\n sin90 = int(math.cos(math.pi / 2))\n\n x = x2 - x1\n y = y2 - y1\n x4 = x * cos90 - y * sin90 + x1\n y4 = x * sin90 + y * cos90 + y1\n\n x = x1 - x4\n y = y1 - y4\n x3 = x * cos90 - y * sin90 + x4\n y3 = x * sin90 + y * cos90 + y4\n\n return x3, y3, x4, y4\n\n\ndef editorial(x1, y1, x2, y2):\n x = x2 - x1\n y = y2 - y1\n\n x3 = x2 - y\n y3 = y2 + x\n x4 = x1 - y\n y4 = y1 + x\n\n return x3, y3, x4, y4\n\n\nif __name__ == \'__main__\':\n main()\n']
['Runtime Error', 'Accepted']
['s326655945', 's694635624']
[3184.0, 3064.0]
[19.0, 17.0]
[842, 844]
p03265
u875769753
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['x1,y1,x2,y2 = map(int,input().split())\nx3 = x2 - y2 + y1\ny3 = x2 - y2 + x1\nx4 = x1 - y2 + y1\ny4 = y1 - x1 + x2\nprint(x3,y3,x4,y4)', 'x1,y1,x2,y2 = map(int,input().split())\nx3 = x2 - y2 + y1\ny3 = y2 + x2 - x1\nx4 = x1 - y2 + y1\ny4 = y1 - x1 + x2\nprint(x3,y3,x4,y4)']
['Wrong Answer', 'Accepted']
['s683127533', 's030622401']
[9124.0, 9100.0]
[25.0, 27.0]
[129, 129]
p03265
u884323674
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['x1, x2, y1, y2 = map(int, input().split())\n\nif y1 > y2:\n length = abs(x1-x2)\n x3 = x2 + length\n y3 = y2\n x4 = x2 + length\n y4 = y1\nelif x2 > x1:\n length = abs(y1-y2)\n x3 = x2\n y3 = y2 + length\n x4 = x2\n y4 = y1 + length\nelif y2 > y1:\n length = abs(y1-y2)\n x3 = x2 - length\n y3 = y2\n x4 = x2 - length\n y4 = y1\nelse:\n length = abs(x1-x2)\n x3 = x2\n y3 = y2 - length\n x4 = x2\n y4 = y1 - length\nprint(x3, x4, y3, y4)', 'x1, x2, y1, y2 = map(int, input().split())\n\nif y1 > y2:\n length = abs(x1-x2)\n x3 = x2 + length\n y3 = y2\n x4 = x1 + length\n y4 = y1\nelif x2 > x1:\n length = abs(y1-y2)\n x3 = x2\n y3 = y2 + length\n x4 = x1\n y4 = y1 + length\nelif y2 > y1:\n length = abs(y1-y2)\n x3 = x2 - length\n y3 = y2\n x4 = x1 - length\n y4 = y1\nelse:\n length = abs(x1-x2)\n x3 = x2\n y3 = y2 - length\n x4 = x1\n y4 = y1 - length\nprint(x3, x4, y3, y4)', 'x1, y1, x2, y2 = map(int, input().split())\n\ndx = x2 - x1\ndy = y2 - y1\n\nprint(x2-dy, y2+dx, x1-dy, y1+dx)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s739864409', 's991703834', 's775644453']
[3064.0, 3064.0, 2940.0]
[17.0, 17.0, 17.0]
[471, 471, 104]
p03265
u924406834
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['x1,y1,x2,y2 = map(int,input().split())\nxsa = x2 - x1\nysa = y2 - y1\nx3 = x2 - ysa\ny3 = y2 + xsa\nx4 = x1 - ysa\ny4 = y1 + xsa\nprint(x3,end="")\nprint(y3,end="")\nprint(x4,end="")\nprint(y4)', 'x1,y1,x2,y2 = map(int,input().split())\nxsa = x2 - x1\nysa = y2 - y1\nx3 = x2 - ysa\ny3 = y2 + xsa\nx4 = x1 - ysa\ny4 = y1 + xsa\nprint(x3,end=" ")\nprint(y3,end=" ")\nprint(x4,end=" ")\nprint(y4)']
['Wrong Answer', 'Accepted']
['s789358230', 's313103437']
[3064.0, 3060.0]
[17.0, 17.0]
[183, 186]
p03265
u928784113
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['x1,y1,x2,y2 = map(int,input().split())\nx3 = y1 - y2\ny3 = abs(x1 - x2)\nx4 = abs(y2 - y3)\ny4 = abs(x2 - x3)\nprint(x3,y3,x4,y4)', 'x1,y1,x2,y2 = map(int,input().split())\nx3 = x2+ (y1 - y2)\ny3 = y2 + abs(x1 - x2)\nx4 = x3 + abs(y2 - y3)\ny4 = y3 + abs(x2 - x3)\nprint(x3,y3,x4,y4)', 'x1,x2,y1,y2 = map(int,input())\nx3 = x2 + (y1 - y2)\ny3 = y2 + (x2 - x1)\nx4 = y1 + (x2 - x1)\ny4 = x1 + (y1 - y2)\nprint(x3,y3,x4,y4)', 'x1,y1,x2,y2 = map(int,input().split())\nx3 = y1 - y2\ny3 = abs(x1 - x2)\nx4 = abs(y2 - y3)\ny4 = abs(x2 - x3)\nprint(x3,y3,x4,y4)', 'x1,x2,y1,y2 = map(int,input().split())\nx3 = x2 + (y1 - y2)\ny3 = y2 + (x2 - x1)\nx4 = y1 + (x2 - x1)\ny4 = x1 + (y1 - y2)\nprint(x3,y3,x4,y4)', 'x1,x2,y1,y2 = map(int,input().split())\nx3 = x2 + (y1 - y2)\ny3 = y2 + (x2 - x1)\nx4 = x1 + (x2 - x1)\ny4 = y1 + (y1 - y2)\nprint(x3,y3,x4,y4)', 'x1,y1,x2,y2 = map(int,input().split())\nx3 = x2 + (y1 - y2)\ny3 = y2 + (x2 - x1)\nx4 = x1 + (y1 - y2)\ny4 = y1 + (x2 - x1)\nprint(x3,y3,x4,y4)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s215380379', 's461738276', 's502021005', 's506666057', 's756337275', 's775780276', 's157595896']
[2940.0, 3060.0, 2940.0, 2940.0, 3060.0, 2940.0, 2940.0]
[18.0, 18.0, 18.0, 18.0, 17.0, 18.0, 19.0]
[124, 145, 129, 124, 137, 137, 137]
p03265
u930970950
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['from math import sin, cos, acos, pi\nx1, y1, x2, y2 = map(int, input().split())\nr = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5\nt = acos((x2 - x1)/r)\nprint(r, t)\nx3, y3 = x1 + (2 ** 0.5)*r*cos(t + pi/4), y1 + (2 ** 0.5)*r*sin(t + pi/4)\nx4, y4 = x1 + r*cos(t + pi/2), y1 + r*sin(t + pi/2)\nprint(round(x3), round(y3), round(x4), round(y4))', 'x1, y1, x2, y2 = map(int, input().split())\nx3, y3 = x1 + (x2 - x1 - y2 + y1), y1 + (x2 - x1 + y2 - y1)\nx4, y4 = x1 - (y2 - y1), y1 + (x2 - x1)\nprint(x3, y3, x4, y4)']
['Wrong Answer', 'Accepted']
['s131502218', 's862784581']
[3064.0, 2940.0]
[19.0, 18.0]
[333, 164]
p03265
u939585142
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['x1, y1, x2, y2 = map(int,input().split())\n\na, b = x2 - x1, y2 - y1\nx3, y3 = x2 - a, y2 - b\nx4, y4 = x1 - b, y1 - a\n\nprint(x3,y3,x4,y4)', 'x1, y1, x2, y2 = map(int,input().split())\n\na, b = x2 - x1, y2 - y1\nx3, y3 = x2 - a, y2 - b\nx4, y4 = x1 - b, y1 - a\n\nprint(x3, y3, x4, y4)', 'x1, y1, x2, y2 = map(int,input().split())\n\na, b = x2 - x1, y2 - y1\nx3, y3 = x2 - b, y2 + a\nx4, y4 = x3 - a, y3 - b\n\nprint(x3, y3, x4, y4)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s096183813', 's852486317', 's579596954']
[2940.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[134, 137, 137]
p03265
u943657163
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
["x1, y1, x2, y2 = map(int, input().split())\ndis1 = x2 - x1\ndis2 = y2 - y1\nprint('{} {} {} {}').format(x2-dis2, y2+dis1, x1-dis2, y1+dis1)", 'x1, y1, x2, y2 = map(int, input().split())\ndis_x = x2 - x1\ndis_y = y2 - y1\nprint(x2-dis_y, y2+dis_x, x1-dis_y, y1+dis_x)']
['Runtime Error', 'Accepted']
['s726411287', 's733031092']
[2940.0, 2940.0]
[17.0, 17.0]
[136, 120]
p03265
u950708010
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['import heapq\ndef solve():\n x1,y1,x2,y2 = (int(i) for i in input().split())\n \n que = []\n que2 = []\n for i in range(-300,300):\n for j in range(-300,300):\n if (x2-x1)**2+(y2-y1)**2 == (i-x1)**2+(j-y1)**2:\n if (i,j) != (x1,y1) and (i,j) != (x2,y2):\n que.append((i,j))\n if (x2-x1)**2+(y2-y1)**2 == (i-x2)**2+(j-y2)**2:\n if (i,j) != (x1,y1) and (i,j) != (x2,y2):\n que2.append((i,j))\n \n #define x3,y3\n while que2:\n (x3,y3) = heapq.heappop(que2)\n for i in range(len(que)):\n x4,y4 = que[i]\n if (x3-x2)**2+(y3-y2)**2 == (x4-x1)**2+(y4-y1)**2:\n if (x3-x4)**2+(y3-y4)**2 == (x2-x1)**2+(y2-y1)**2:\n if (x3-x1)**2+(y3-y1)**2 == (x2-x4)**2+(y2-y4)**2:\n print(x3,y3,x4,y4)\n exit()\n #print(que)\n #print(que2)\t\t\t\nsolve()', 'import heapq\ndef solve():\n x1,y1,x2,y2 = (int(i) for i in input().split())\n x = x2-x1\n y = y2-y1\n print(x2-y,y2+x,x1-y,y1+x)\n \t\nsolve()']
['Runtime Error', 'Accepted']
['s884073149', 's865962419']
[3064.0, 3060.0]
[18.0, 18.0]
[814, 139]
p03265
u951601135
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
["x1,y1,x2,y2=map(int,input().split())\na=abs(x1-x2)\nb=abs(y1-y2)\nif(y1<=y2):\n if(x1<=x2):\n print(x2-b,y2+a,x1-b,y1+a)\n print('a')\n else:\n print(x2-b,y2-a,x1-b,y1-a)\n print('b')\nelse:\n if(x1<=x2):\n print(x2+a,y2+b,x1+a,y1+b)\n print('c')\n else:\n print(x2+b,y2+a,x1+b,y1-a)\n print('d')", "x1,y1,x2,y2=map(int,input().split())\na=abs(x1-x2)\nb=abs(y1-y2)\nif(y1<=y2):\n if(x1<=x2):\n print(x2-b,y2+a,x1-b,y1+a)\n #print('a')\n else:\n print(x2-b,y2-a,x1-b,y1-a)\n #print('b')\nelse:\n if(x1<=x2):\n print(x2+b,y2+a,x1+b,y1+a)\n #print('c')\n else:\n print(x2+b,y2-a,x1+b,y1-a)\n #print('d')"]
['Wrong Answer', 'Accepted']
['s876688187', 's305752195']
[3064.0, 3064.0]
[17.0, 18.0]
[308, 312]
p03265
u989385104
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['x1, y1, x2, y2 = map(int, input().split())\n\ny3 = y2 + x2- x1\ny4 = x2 - x1 + y1\nx3 = y1 - y2 + x2\nx4 = y1 - y2 + x1\n\nprint(x3 y3 x4 y4)', 'x1, y1, x2, y2 = map(int, input().split())\n\ny3 = y2 + x2- x1\ny4 = x2 - x1 + y1\nx3 = y1 - y2 + x2\nx4 = y1 - y2 + x1\n\nprint(x3, y3, x4, y4)\n']
['Runtime Error', 'Accepted']
['s188443422', 's402237328']
[3064.0, 2940.0]
[17.0, 17.0]
[134, 138]
p03265
u991619971
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['#import numpy as np\nimport math\n#T= str(input())\n#K = int(input())\nx1,y1,x2,y2= map(int,input().split())\n#A = list(map(int,input().split()))\n#B = list(map(int,input().split()))\n#S= str(input())\n\nL=math.sqrt((x1-x2)**2 + (y1-y2)**2)\n\na=abs(x2-x1)\nb=abs(y2-y1)\n\n\nif x1 =< x2 and y1 =< y2:\n x3 = x2 - b\n y3 = y2 + a\n x4 = x1 - b\n y4 = y1 + a\nelif x1 =< x2 and y1 => y2:\n x3 = x2 + b\n y3 = y2 + a\n x4 = x1 + b\n y4 = x1 + a\nelif x1 => x2 and y1 =< y2:\n x3 = x2 - b\n y3 = y2 - a\n x4 = x1 - b\n y4 = y1 - a\nelif x1 => x2 and y1 => y2:\n x3 = x2 + b\n y3 = y2 - a\n x4 = x1 + b\n y4 = x1 - a\n\nprint(x3,y3,x4,y4)', '#import numpy as np\nimport math\n#T= str(input())\n#K = int(input())\nx1,y1,x2,y2= map(int,input().split())\n#A = list(map(int,input().split()))\n#B = list(map(int,input().split()))\n#S= str(input())\n\na=x2-x1\nb=y2-y1\n\nprint(x2-b,y2+a,x1-b,y1+a)\nexit()\n']
['Runtime Error', 'Accepted']
['s799494551', 's272216020']
[2940.0, 2940.0]
[17.0, 18.0]
[646, 246]
p03265
u996434204
2,000
1,048,576
There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.) Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4). Given x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.
['import math\n\nx1,y1,x2,y2=map(int, input().split())\n\n#line = math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))\n\nbuf1=x2-x1\nbuf2=y2-y1\n\nprint(buf1,buf2)\n\nprint(x2-buf2,y2+buf1,x1-buf2,y1+buf1)', 'import math\n\nx1,y1,x2,y2=map(int, input().split())\n\n#line = math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))\n\nbuf1=x2-x1\nbuf2=y2-y1\n\nprint(x2-buf2,y2+buf1,x1-buf2,y1+buf1)']
['Wrong Answer', 'Accepted']
['s437419187', 's353194498']
[2940.0, 2940.0]
[17.0, 17.0]
[177, 159]
p03266
u001024152
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n, k = map(int, input().split())\n\nks = [x for x in range(1, n+1) if x % k == 0]\nk2s = [x for x in range(1, n+1) if x % (k//2) == 0]\n\nif k % 2 == 0: # if even\n print(len(k2s))\nelse:\n print(len(ks))', 'n, k = map(int, input().split())\n\nks = [x for x in range(1, n+1) if x % k == 0]\n\nif k % 2 == 0: # if even\n k2s = [x for x in range(1, n+1) if x % (k//2) == 0 and x % k != 0] \n print(len(ks) ** 3 + len(k2s) ** 3)\nelse:\n print(len(ks) ** 3)']
['Runtime Error', 'Accepted']
['s462554622', 's264085545']
[14880.0, 10968.0]
[71.0, 81.0]
[202, 247]
p03266
u020390084
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n, k = map(int,input().split())\n\nif k%2==0:\n print(2*(n//k)**3)\nelse:\n print((n//k)**3)', "#!/usr/bin/env python3\nimport sys\n\ndef solve(N: int, K: int):\n if K%2 == 1:\n print((N//K)**3)\n else:\n a = 1+ (N-K//2)//K\n b = N//K\n print(a**3+b**3)\n return\n\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n K = int(next(tokens)) # type: int\n solve(N, K)\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s653611860', 's614088616']
[2940.0, 3060.0]
[17.0, 17.0]
[89, 492]
p03266
u020401041
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int, input().split())\n\nif N % 2:\n print(int(N / K))\nelse:\n even = int(N / K)\n odd = int(N / int(K / 2)) - even\n print(pow(even, 2) + pow(odd, 2))', 'N, K = map(int, input().split())\n \nif K % 2:\n print(pow(int(N / K), 3)\nelse:\n even = int(N / K)\n odd = int(N / int(K / 2)) - even\n print(even, odd)\n print(pow(even, 3) + pow(odd, 3))', 'N, K = map(int, input().split())\n \nif K % 2 == 1:\n print(pow(int(N / K), 3))\nelse:\n even = int(N / K)\n odd = int(N / int(K / 2)) - even\n print(pow(even, 3) + pow(odd, 3))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s260889706', 's401890158', 's790635471']
[2940.0, 2940.0, 3060.0]
[18.0, 18.0, 18.0]
[160, 187, 174]
p03266
u037430802
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n, k =map(int, input().split())\n\nans = 0\n\nodd = [i for i in range(k, n+1, k)] \nans += len(odd) ** 3 \n\nif k % 2 == 0:\n \n even = [i ofr i in range(k//2, n+1, k)]\n ans += even\n \nprint(ans)\n', 'n, k =map(int, input().split())\n\nans = 0\n\nodd = [i for i in range(k, n+1, k)] \nans += len(odd) ** 3 \n\nif k % 2 == 0:\n \n even = [i for i in range(k//2, n+1, k)]\n ans += even\n \nprint(ans)\n', '\nN,K = map(int, input().split())\n\na = N // K \nb = 0\nif K % 2 == 0:\n b = a+1 if N - a*K >= K/2 else a\nprint(a**3 + b**3)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s832489418', 's956480734', 's245352399']
[2940.0, 11032.0, 2940.0]
[17.0, 29.0, 18.0]
[375, 375, 123]
p03266
u039189422
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k=map(int,input().split())\n\nif k%2!=0:\n\tprint((n//k)**3)\nelse:\n\tif (n//k)*n+k//2>n:\n\t\tprint((n//k)**3+(n//k)**3)\n\telse:\n\t\tprint((n//k)**3+(n//k+1)**3)', 'n,k=map(int,input().split())\n\nif k%2!=0:\n\tprint((n//k)**3)\nelse:\n\tif (n//k)*k+(k//2)>n:\n\t\tprint((n//k)**3+(n//k)**3)\n\telse:\n\t\tprint((n//k)**3+(n//k+1)**3)']
['Wrong Answer', 'Accepted']
['s449166801', 's784837363']
[3060.0, 3060.0]
[17.0, 17.0]
[152, 154]
p03266
u044635590
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['ddd = list(map(int, input().split()))\nn = ddd[0]\nk = ddd[1]\ncount = 0\n\nfor i in range(n):\n a = i + 1\n if k % 2 == 1:\n if a % k != 0:\n bccount = 0\n else:\n bccount = (n // k) ** 2\n else:\n if a % k == 0:\n bccount = (n // k) ** 2\n elif a % k == k // 2:\n if n % k < k // 2:\n bccount = ((n // (k // 2)) // 2) ** 2\n else:\n bccount = ((n // (k // 2)) // 2 + 1) ** 2\n else:\n bccount = 0\n print(a, bccount)\n count = count + bccount\n\nprint(count)', 'ddd = list(map(int, input().split()))\nn = ddd[0]\nk = ddd[1]\ncount = 0\n\nfor i in range(n):\n a = i + 1\n if k % 2 == 1:\n if a % k != 0:\n bccount = 0\n else:\n bccount = (n // k) ** 2\n else:\n if a % k == 0:\n bccount = (n // k) ** 2\n elif a % k == k // 2:\n if n % k < k // 2:\n bccount = ((n // (k // 2)) // 2) ** 2\n else:\n bccount = ((n // (k // 2)) // 2 + 1) ** 2\n else:\n bccount = 0\n count = count + bccount\n\nprint(count)']
['Wrong Answer', 'Accepted']
['s756875187', 's744086309']
[6736.0, 3064.0]
[449.0, 210.0]
[585, 559]
p03266
u057109575
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int, input().split())\nif K % 2 == 1:\n print(sum(1 for n in range(1, N + 1) if n % K == 0) ** 3)\nelse:\n print(sum(1 for n in range(1, N + 1) if (n % K == 0) or (n % K == K // 2)) ** 3)', "N, K = 35897, 932\nprint('ans: 114191')\n\nif K % 2 == 1:\n print(sum(1 for n in range(1, N + 1) if n % K == 0) ** 3)\nelse:\n print(sum(1 for n in range(1, N + 1) if (n % K == 0) or (n % K == K // 2)) ** 3)", 'from itertools import product\nN, K = map(int, input().split())\nx = list(product(range(1, N + 1), repeat=3))\nprint(0)', 'N, K = map(int, input().split())\nif K % 2 == 1:\n print(sum(1 for n in range(1, N + 1) if n % K == 0) ** 3)\nelse:\n print(sum(1 for n in range(1, N + 1) if n % (K / 2) == 0) ** 3)', 'N, K = map(int, input().split())\nans = (N // K) ** 3\nans += ((N + K // 2) // K) ** 3 if K % 2 == 0 else 0\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s647887378', 's700337966', 's739107708', 's780499732', 's156490739']
[3316.0, 2940.0, 1982744.0, 2940.0, 3316.0]
[61.0, 28.0, 2281.0, 68.0, 26.0]
[200, 207, 116, 183, 116]
p03266
u066620486
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N,K = list(map(int,input().split()))\nprint(int((N//K)**3) if K%2 == 1 else int((N//(K//2))**3))', 'N,K = list(map(int,input().split()))\nprint(int((N//K)**3) if K%2 == 1 else int((N//K)**3)+int((N//(K//2) - N//K)**3))']
['Wrong Answer', 'Accepted']
['s973990302', 's161313297']
[2940.0, 2940.0]
[17.0, 17.0]
[95, 117]
p03266
u067267880
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int, input().split())\n\ncount = 0\n\nfor i in range(1,N):\n a = i\n for j in range(1,N):\n b = j\n\n div_ab = (a + b) % K\n if(div_ab !=0):\n continue\n\n for k in range(1,N):\n c = k\n\n div_bc = (b + c) % K\n div_ca = (c + a) % K\n\n if(div_ab ==0 and div_bc ==0 and div_ca ==0):\n count += 1\n\nprint(count)\n', 'N, K = map(int, input().split())\nif(K%2 != 0):\n odd = (N // K)**3 \n print(int(odd))\nelse:\n c= N//(K/2)\n d= N//K\n e=c-d\n print(int(e**3 + d**3))\n']
['Wrong Answer', 'Accepted']
['s077793218', 's850177390']
[3064.0, 3060.0]
[2104.0, 17.0]
[405, 206]
p03266
u117348081
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k = map(int, input().split())\ncount0 = 0\ncount1 = 0\nfor i in range(1,n+1):\n if i%k==0:\n count0+=1\n if i%k==k/2:\n count+=1\n\nif k%2==0:\n print(count0**3+count1**3)\nelse:\n print(count0**3)', 'n,k = map(int, input().split())\ncount0 = 0\ncount1 = 0\nfor i in range(1,n+1):\n if i%k==0:\n count0 +=1\n if i%k==k/2:\n count1 +=1\n\nif k%2==0:\n print(count0**3+count1**3)\nelse:\n print(count0**3)']
['Runtime Error', 'Accepted']
['s555850108', 's217338575']
[3060.0, 3060.0]
[87.0, 98.0]
[213, 216]
p03266
u123756661
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k=map(int,input().split())\no=n//k\np=0\nif (k%2==0) p=(n+(k//2))//k\nprint(o**3+p**3)\n', 'n,k=map(int,input().split())\no=n//k\np=0\nif (k%2==0): p=(n+(k//2))//k\nprint(o**3+p**3)\n']
['Runtime Error', 'Accepted']
['s069709066', 's656591584']
[2940.0, 2940.0]
[19.0, 17.0]
[85, 86]
p03266
u127499732
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['\n\nusing namespace std;\n\nint main()\n{\n long long n, k;\n cin >> n >> k;\n\n long long a = n / k, b = n / (k / 2) - a;\n long long c = a * a * a, d = b * b * b;\n if (k % 2 == 1)\n cout << c << endl;\n else\n cout << c + d << endl;\n}\n', "def main():\n n, k = map(int, input().split())\n x = sum(2 * i % k == 0 for i in range(1, k))\n a, b = n // k, n % k\n y = sum(2 * i % k == 0 for i in range(k * a + 1, k * a + b + 1))\n c = x * a + y\n ans = (x * a + y) ** 3 + a ** 3\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"]
['Runtime Error', 'Accepted']
['s044870195', 's031395843']
[3064.0, 3060.0]
[17.0, 58.0]
[275, 301]
p03266
u131406572
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k=map(int,input().split())\nif k%2==1:\n print((n//k)**3)\nelse:\n a=k//2\n b=n//a\n print((n//k)**3+(b*b*(n//k)))', 'n,k=map(int,input().split())\nif k%2==1:\n print((n//k)**3)\nelse:\n a=k//2\n b=n//a-n//k\n print((n//k)**3+(b**3))']
['Wrong Answer', 'Accepted']
['s086761812', 's013980760']
[2940.0, 2940.0]
[19.0, 17.0]
[122, 121]
p03266
u155828990
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k=map(int,input().split())\nans=0\nfor i in range(1,n+1):\n if(i%k==0 or (i%k==k//2 and k%2==0)):ans+=1\nprint(ans**3)\n ', 'n,k=map(int,input().split())\nans=0\nans2=0\nfor i in range(1,n+1):\n if(i%k==0):ans+=1\n if(i%k==k//2 and k%2==0):ans2+=1\nprint(ans**3+ans2**3)\n ']
['Wrong Answer', 'Accepted']
['s169348358', 's991873098']
[3316.0, 2940.0]
[79.0, 91.0]
[124, 150]
p03266
u175590965
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k = map(int,input().split())\nif k % 2 == 0:\n print(((n//k)**3)+(((n+(k//2)//k)**3)))\nelse:\n print((n//k)**3)', 'n,k = map(int,input().split())\nif k % 2 == 0:\n print(((n//k)**3)+(((n+(k//2))//k**3)))\nelse:\n print((n//k)**3)', 'n,k = map(int,input().split())\nif k % 2 == 0:\n print(((n//k)**3)+((((n+(k//2))//k)**3)))\nelse:\n print((n//k)**3)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s914770707', 's980558577', 's932257689']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0]
[116, 116, 118]
p03266
u177411511
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['import sys\n\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nn, k = na()\nct1 = 0\nct2 = 0\nfor i in range(1, n + 1):\n if i % k == 0:\n ct1 += 1\nif k % 2 == 1:\n print(ct1 ** 3)\nelse:\n for i in range(1, n):\n if i % k == (k // 2):\n ct2 += 1\n print(ct1 ** 3 + ct2 ** 3)\n', 'import sys\n\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nn, k = na()\nct1 = 0\nct2 = 0\nfor i in range(1, n + 1):\n if i % k == 0:\n ct1 += 1\nif k % 2 == 1:\n print(ct1 ** 3)\nelse:\n for i in range(1, n + 1):\n if i % k == (k // 2):\n ct2 += 1\n print(ct1 ** 3 + ct2 ** 3)\n']
['Wrong Answer', 'Accepted']
['s775476826', 's300396795']
[3064.0, 3064.0]
[85.0, 88.0]
[413, 417]
p03266
u185325486
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
["import math\n\ndef permutations_count(n, r):\n return math.factorial(n) // math.factorial(n - r)\n\ndef check():\n a = []\n b = []\n count = 0\n bDict = {}\n bDict2 = {}\n removeList = []\n N, K = [int(i) for i in input().split(' ')]\n for i in range(1,N+1):\n if (2*i)%K == 0:\n a.append(i)\n count += len(a)\n\n while a != []:\n temp = a[0]\n for i in a:\n #print(i)\n if (temp+i)%K == 0:\n removeList.append(i)\n if str(temp) not in bDict2:\n bDict2[str(temp)] = 1\n else:\n bDict2[str(temp)] += 1 \n \n for i in removeList:\n a.remove(i)\n removeList.clear()\n #print(bDict2)\n \n for i in bDict2:\n if bDict2[i] > 1:\n print(bDict2[i])\n count += 3*permutations_count(bDict2[i], 2)\n if bDict2[i] > 2:\n count += permutations_count(bDict2[i], 3)\n\n print(count)\ncheck()", 'N, K = map(int, input().split())\ncnt1,cnt2 = 0,0\n\nfor i in range(1,N+1):\n if i%K == 0:\n cnt1 += 1\n elif i%K == K/2:\n cnt2 += 1\ntotal = cnt1 if K % 2!=0 else cnt1+cnt2\nprint(total**3)', "import math\n\ndef permutations_count(n, r):\n return math.factorial(n) // math.factorial(n - r)\n\ndef check():\n a = []\n b = []\n count = 0\n bDict = {}\n bDict2 = {}\n removeList = []\n N, K = [int(i) for i in input().split(' ')]\n for i in range(1,N+1):\n if (2*i)%K == 0:\n a.append(i)\n count += len(a)\n \n while a != []:\n temp = a[0]\n for i in a:\n #print(i)\n if (temp+i)%K == 0:\n removeList.append(i)\n if str(temp) not in bDict2:\n bDict2[str(temp)] = 1\n else:\n bDict2[str(temp)] += 1 \n \n for i in removeList:\n a.remove(i)\n removeList.clear()\n \n for i in bDict2:\n count += 3*permutations_count(bDict2[i], 2)\n if bDict2[i] > 2:\n count += permutations_count(bDict2[i], 3)\n\n print(count)\ncheck()", "import math\n\ndef permutations_count(n, r):\n return math.factorial(n) // math.factorial(n - r)\n\ndef check():\n a = []\n b = []\n count = 0\n bDict = {}\n bDict2 = {}\n removeList = []\n N, K = [int(i) for i in input().split(' ')]\n for i in range(1,N+1):\n if (2*i)%K == 0:\n a.append(i)\n count += len(a)\n \n while a != []:\n temp = a[0]\n for i in a:\n #print(i)\n if (temp+i)%K == 0:\n removeList.append(i)\n if str(temp) not in bDict2:\n bDict2[str(temp)] = 1\n else:\n bDict2[str(temp)] += 1 \n \n for i in removeList:\n a.remove(i)\n removeList.clear()\n #print(bDict2)\n \n for i in bDict2:\n if bDict2[i] == 2:\n print(bDict2[i])\n count += 3*permutations_count(bDict2[i], 2)\n if bDict2[i] > 2:\n count += permutations_count(bDict2[i], 3)\n\n print(count)\ncheck()", "def check():\n a = []\n bDict2 = {}\n count = 0\n removeList = []\n N, K = [int(i) for i in input().split(' ')]\n for i in range(1,N+1):\n if (2*i)%K == 0:\n a.append(i)\n\n\n while a != []:\n temp = a[0]\n for i in a:\n if (temp+i)%K == 0:\n removeList.append(i)\n if str(temp) not in bDict2:\n bDict2[str(temp)] = 1\n else:\n bDict2[str(temp)] += 1 \n \n for i in removeList:\n a.remove(i)\n removeList.clear()\n print(bDict2)\n \n for i in bDict2:\n count += bDict2[i]**3\n\n print(count)\n \ncheck()", 'N, K = map(int, input().split())\ncnt1,cnt2 = 0,0\n\nfor i in range(1,N+1):\n if i%K == 0:\n cnt1 += 1\n elif i%K == K/2:\n cnt2 += 1\nprint(cnt1**3+cnt2**3)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s366192308', 's497345439', 's648593832', 's761371664', 's795272205', 's606705447']
[12560.0, 2940.0, 12624.0, 12624.0, 12504.0, 2940.0]
[2104.0, 80.0, 2104.0, 2104.0, 2104.0, 79.0]
[1016, 202, 937, 1021, 694, 169]
p03266
u200030766
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
["N, K = map(int, input().split(' '))\nif K%2==0:\n if N%K <= K//2:\n print(2*(((N//K)+1)**3))\n else:\n print(((N//K)**3)+(((N//K)+1)**3))\nelse:\n print((N//K)**3)\n", "N, K = map(int, input().split(' '))\na=N//K\nif K%2==0:\n b=((N-K//2)//K)+1\n print((a**3) +(b**3))\nelse:\n print(a**3)"]
['Wrong Answer', 'Accepted']
['s214000558', 's736779619']
[2940.0, 3060.0]
[17.0, 17.0]
[180, 123]
p03266
u222207357
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N,K = map(int,input().split())\n\ndiv = N//K\n\nif K % 2 == 1:\n ans = div**3\nelse:\n div2 = N//(K/2)\n ans = div**3 + div2**3\n\nprint(ans)', 'N,K = map(int,input().split())\n\ndiv = N//K\n\nif K % 2 == 1:\n ans = div**3\nelse:\n div2 = int(N+K/2)//K\n ans = div**3 + div2**3\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s593212151', 's637998476']
[3060.0, 2940.0]
[17.0, 17.0]
[140, 145]
p03266
u226912938
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int, input().split())\n\nX = [x for x in range(1,N+1)]\nXn = [x for x in X if x % K == 0]\nXn2 = [x for x in X if (x % K == K/2) or (x % K == 0)]\n\nif K % 2 != 0:\n ans = (len(Xn)**len(Xn))\nelse:\n ans = (len(Xn2)**len(Xn2))\nprint(ans)\n', 'N, K = map(int, input().split())\n\nX = [x for x in range(1,N+1)]\nXn = [x for x in X if x % K == 0]\n\nc_odd = 0\nc_even1 = 0\nc_even2 = 0\n\nfor x in X:\n if x % K == 0:\n c_odd += 1\n c_even1 += 1\n elif x % K == K/2:\n c_even2 += 1\n\nif K % 2 != 0:\n ans = c_odd ** 3\nelse:\n ans = c_even1 ** 3 + c_even2 ** 3\n \nprint(ans) ']
['Wrong Answer', 'Accepted']
['s346879882', 's523765215']
[15692.0, 12568.0]
[2104.0, 108.0]
[246, 348]
p03266
u263654061
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n, k = map(int, input().split())\ncnt = 0\nl = n//k\nprint(l)\nfor i in range(k):\n if (i*3)%k == i%k:\n if i==0:\n cnt +=l**3\n elif i%k <= n%k:\n cnt += (l+1)**3\n else:\n cnt += l**3\nprint(cnt)', 'n, k = map(int, input().split())\ncnt = 0\nl = n//k\nfor i in range(k):\n if (i*3)%k == i%k:\n if i==0:\n cnt +=l**3\n elif i%k <= n%k:\n cnt += (l+1)**3\n else:\n cnt += l**3\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s402569269', 's357261767']
[3060.0, 3064.0]
[54.0, 59.0]
[242, 233]
p03266
u268554510
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N,K = map(int,input().split())\nN_d = N*2\nans = 0\nkl = [K*x for x in range(1,N_d//K+1)]\ns=kl[-1]\nt=kl[-2]\nif K%2==1:\n a=s//K\n if a%2==0:\n b = a//2\n ans = pow(b,3)\n \n else:\n b=a//2\n ans = pow(b,3)+3\n \nelse:\n half_K = K//2\n a = s//K\n if a%2==0:\n b = a//2\n ans+=pow(b,3)\n else:\n b=a//2\n ans += pow(b,3)+3\n \n b = t//K\n if b%2==0:\n c = b//2\n ans+=pow(c,3)\n else:\n c=b//2\n ans+=pow(b,3)+3\n \nprint(ans)', 'N,K = map(int,input().split())\nans = 0\nif K%2==1:\n ans = (N//K) ** 3\nelse:\n half_K = K//2\n a = N//K\n b = N//half_K - a\n ans = a**3+b**3\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s389565483', 's145563122']
[18968.0, 2940.0]
[54.0, 17.0]
[450, 152]
p03266
u268793453
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n, k = [int(i) for i in input().split()]\n\nans = [0, 0]\n\nfor i in range(1, n+1):\n if k % 2 == 0 and i % k == d:\n ans[0] += 1\n if i % k == 0:\n ans[1] += 1\n\nprint(ans[0] ** 3 + ans[1] ** 3)', 'n, k = [int(i) for i in input().split()]\n\nans = (n // k) ** 3\nif k % 2 == 0:\n ans += ((n - k // 2) // k + 1) ** 3\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s040706093', 's344978096']
[3060.0, 2940.0]
[63.0, 17.0]
[206, 126]
p03266
u274635633
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k=map(int,input().split())\nans=(n//k)**3\nif k%2==0:\n ans+=(n//(k//2))**3\nprint(ans)', 'n,k=map(int,input().split())\nans=(n//k)**3\nif k%2==0:\n ans+=(n//(k//2)-n//k)**3\nprint(ans)']
['Wrong Answer', 'Accepted']
['s503512637', 's965179701']
[2940.0, 2940.0]
[17.0, 17.0]
[86, 91]
p03266
u284363684
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['# input\nN, K = map(int, input().split())\n\n\nif K % 2 == 0:\n a = N / K\n b = (N + (K / 2)) / K\n print(a ** 3 + b ** 3)\nelse:\n a = N / K\n print(a ** 3)\n ', '# input\nN, K = map(int, input().split())\n\n\nif K % 2 == 0:\n a = N // K\n b = (N + (K // 2)) // K\n print(a ** 3 + b ** 3)\nelse:\n a = N // K\n print(a ** 3)']
['Wrong Answer', 'Accepted']
['s496922083', 's957933881']
[2940.0, 3060.0]
[17.0, 17.0]
[174, 173]
p03266
u288430479
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k = map(int,input().split())\nif k%2!=0:\n x = int(n//k)\n print(x**3)\nelse:\n k1 = k//2\n y = (n-k1)//k\n x = int(n//k)\n print(int(x**3+y**3))', 'n,k = map(int,input().split())\nif k%2!=0:\n x = int(n//k)\n print(x**3)\nelse:\n k1 = k//2\n y = (n+k1)//k\n x = int(n//k)\n print(int(x**3+y**3))']
['Wrong Answer', 'Accepted']
['s106582842', 's528908109']
[2940.0, 3064.0]
[17.0, 18.0]
[145, 145]
p03266
u297109012
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['def solve(N, K):\n ans = 0\n k = len([n for n in range(1, N + 1) if n % K == 0])\n ans += k * k * k\n if K % 2 == 0:\n k = len([n for n in range(1, N + 1) if n % K == K // 2])\n ans += k * k * k\n\n return ans\n\nif __name__ == "__main__":\n N, K = tuple(map(int, input(" ")))\n print(solve(N, K))\n', 'def solve(N, K):\n ans = 0\n k = len([n for n in range(1, N + 1) if n % K == 0])\n ans += k * k * k\n if K % 2 == 0:\n k = len([n for n in range(1, N + 1) if n % K == K // 2])\n ans += k * k * k\n\n return ans\n\nif __name__ == "__main__":\n N, K = tuple(map(int, input().split(" ")))\n print(solve(N, K))\n']
['Runtime Error', 'Accepted']
['s540039769', 's412360803']
[3060.0, 10936.0]
[18.0, 64.0]
[321, 329]
p03266
u309141201
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int, input().split())\ndiv = N // K\nif K % 2 == 1:\n print(div**3)\nelse:\n if div * N + K // 2 <= N:\n print(div**3 + (div + 1)**3)\n else:\n print(2 * div**3)', 'N, K = map(int, input().split())\ndiv = N // K\nif K % 2 == 1:\n print(div**3)\nelse:\n if div * K + K // 2 <= N:\n print(div**3 + (div + 1)**3)\n else:\n print(2 * div**3)']
['Wrong Answer', 'Accepted']
['s566318288', 's818184405']
[2940.0, 2940.0]
[17.0, 18.0]
[187, 187]
p03266
u314089899
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['#108c\nimport math\nN,K = map(int, input().split())\n\n\n\n\n\n#\n#for a in range(1,N+1):\n# if K>a:\n# base = K-a\n# else:\n\n# \n\n# \n# for b in b_list:\n# if K > b:\n# base = K-b\n# else:\n\n#\n\n# \n# for c in c_list:\n# if (a+c)%K == 0:\n# ans += 1\n\n# \n#print(ans)\n\n\n\n#ex\n#31415 9266\n#4633 4633 4633 : 0.5 0.5 0.5\n#4633 4633 13899 : 0.5 0.5 1.5\n#9266 9266 9266 : 1.0 1.0 1.0\n#9266 9266 18532 : 1.0 1.0 2.0\n#9266 9266 27798 : 1.0 1.0 3.0\n\n\n\nif K==1:\n \n print(N*N*N)\n \nelif K%2 == 0:\n \n print([int(i*K/2) for i in range(1,1+2*math.floor(N/K)) if i%2 == 1])\n ans = len([int(i*K/2) for i in range(1,1+2*math.floor(N/K)) if i%2 == 1]) **3\n print([i*K for i in range(1,1+math.floor(N/K))])\n ans += math.floor(N/K)**3\n print(ans)\nelif K%2 == 1:\n print([i*K for i in range(1,1+math.floor(N/K))])\n print((math.floor(N/K)**3))', '#108c\nimport math\nN,K = map(int, input().split())\n\n\n\n\n\n\nif K == 1:\n \n print(pow(N,3))\nelse:\n \n #K*n <= N\n #n <= N/K\n #print("(2)K*n")\n print([i*K for i in range(1,1+int(N/K))])\n ans = pow(int(N/K),3)\n \n if K%2 == 0:\n \n #K/2*(2n+1) <= N\n #K*(2n+1) <= 2N\n #2n+1 <= 2N/K\n #2n <= 2N/K - 1\n #n <= N/K - 1/2\n n_limit = int(N/K - 1/2)\n #print("(1)K/2*(2n+1)")\n if K/2 <= N:\n print([int((K/2)*(1+(2*i))) for i in range(0,n_limit + 1)])\n ans += pow(n_limit + 1,3) \n \n print(ans)', '#108c\nimport math\nN,K = map(int, input().split())\n\n\n\n\n\n\nif K == 1:\n \n print(pow(N,3))\nelse:\n \n #K*n <= N\n #n <= N/K\n #print("(2)K*n")\n \n ans = pow(int(N/K),3)\n \n if K%2 == 0:\n \n #K/2*(2n+1) <= N\n #K*(2n+1) <= 2N\n #2n+1 <= 2N/K\n #2n <= 2N/K - 1\n #n <= N/K - 1/2\n n_limit = int(N/K - 1/2)\n #print("(1)K/2*(2n+1)")\n if K/2 <= N:\n \n ans += pow(n_limit + 1,3) \n \n print(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s326129198', 's330361905', 's598441729']
[10604.0, 10624.0, 3060.0]
[116.0, 73.0, 17.0]
[1453, 872, 874]
p03266
u342563578
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N,K = map(int,input().split())\nif K % 2 == 1:\n print((N // K )**3)', 'N,K = map(int,input().split())\nif K % 2 == 1:\n print((N // K )**3)\nelse:\n print(((N//(K//2))-(N//K))**3 + (N//K)**3)']
['Wrong Answer', 'Accepted']
['s894123473', 's239301311']
[2940.0, 2940.0]
[17.0, 17.0]
[69, 122]
p03266
u344959886
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k=map(int,input().split())\n\nif k % 2 != 0:\n w = n // k\n print(w**3)\nelse:\n w1 = n // k\n w2 = round(n/k)\n print(w1,w2)\n print((w1 ** 3) + (w2 ** 3) )\n', 'n,k=map(int,input().split())\n\nif k % 2 != 0:\n w = n // k\n print(w**3)\nelse:\n w1 = n // k\n w2 = (n + (k//2)) // k\n print(w1,w2)\n print((w1 ** 3) + (w2 ** 3) )\n', 'n,k=map(int,input().split())\n\nif k % 2 != 0:\n w = n // k\n print(w**3)\nelse:\n w1 = n // k\n w2 = (n + (k//2)) // k\n print((w1 ** 3) + (w2 ** 3) )\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s248753030', 's800676354', 's246267881']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[169, 176, 159]
p03266
u359474860
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N,K = map(int,input().split())\nif K % 2 == 0:\n a = N // K \n b = N // (k / 2) - a \n print(a**3 + b ** 3)\nelse:\n a = N // K\n print(a**3)', 'N,K = map(int,input().split())\nif K % 2 == 0:\n a = N // K \n b = N // (K / 2) - a \n print(a**3 + b ** 3)\nelse:\n a = N // K\n print(a**3)', 'N,K = map(int,input().split())\nif K % 2 == 0:\n a = N // K \n b = N // (k / 2) - a \n print(a**3 + b ** 3)\nelse:\n a = N // K\n print(a**3)', 'N,K = map(int,input().split())\nif K % 2 == 0:\n a = int(N // K)\n b = int(N // (K / 2) - a)\n print(a**3 + b**3)\nelse:\n a = int(N // K)\n print(a**3)']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s240056613', 's519854055', 's675391123', 's668485062']
[2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 18.0, 18.0, 17.0]
[149, 149, 149, 160]
p03266
u360515075
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int, input().split())\n\nif K % 2 == 0:\n m = N // K\n if N % K == 0:\n n = m + 1\n else:\n n = m\n print (m ** 3 + n ** 3)\nelse:\n m = N // K\n print (m ** 3)', 'N, K = map(int, input().split())\n\nif K % 2 == 0:\n print ((N // K) ** 3 + ((N+(K//2))//K) ** 3)\nelse:\n print ((N // K) ** 3)']
['Wrong Answer', 'Accepted']
['s093224253', 's951062129']
[3064.0, 2940.0]
[17.0, 17.0]
[172, 125]
p03266
u362560965
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int, input().split())\n\nif K % 2 != 0:\n ans = (N // K)**3\nelse:\n full = []\n for i in range(K, N, K):\n full.append(i)\n ans = len(full) ** 3\n\n half = []\n for i in range(int(K/2), N, int(K/2)):\n half.append(i)\n half = list(set(half) - set(full))\n ans += len(half) ** 3\n\nprint(ans)', 'N, K = map(int, input().split())\n\n# N, K = 3, 2\n\nif K % 2 != 0:\n ans = (N // K)**3\nelse:\n full = []\n half = []\n for i in range(int(K/2), N+1, int(K/2)):\n if i % K == 0:\n full.append(i)\n else:\n half.append(i)\n\n ans += len(half) ** 3 + len(full) ** 3\n\nprint(ans)', 'N, K = map(int, input().split())\n\n# N, K = 3, 2\n\nif K % 2 != 0:\n ans = (N // K)**3\nelse:\n full = []\n for i in range(K, N+1, K):\n full.append(i)\n print(full)\n ans = len(full) ** 3\n\n half = []\n for i in range(int(K/2), N+1, int(K/2)):\n half.append(i)\n half = list(set(half) - set(full))\n print(half)\n ans += len(half) ** 3\n\n\nprint(ans)', 'N, K = map(int, input().split())\n\n# N, K = 3, 2\n\nif K % 2 != 0:\n ans = (N // K)**3\nelse:\n full = []\n half = []\n for i in range(int(K/2), N+1, int(K/2)):\n if i % K == 0:\n full.append(i)\n else:\n half.append(i)\n\n ans = len(half) ** 3 + len(full) ** 3\n\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s206382747', 's542879796', 's810260842', 's854007267']
[13848.0, 10996.0, 14556.0, 11012.0]
[2104.0, 60.0, 2104.0, 64.0]
[337, 311, 381, 310]
p03266
u373295322
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n, k = list(map(int, input().split()))\nres = 0\nif k == 1:\n print(n ** 3)\n exit()\nif k == 2:\n num_odd = n // 2 + n % 2\n res = num_odd ** 3\nnum_baisuu = n // k\nres += num_baisuu ** 3\nif k % 2 == 0:\n nn = n + k / 2\n num_baisuu = nn // k\n res += num_baisuu ** 3\nprint(int(res))', 'n, k = list(map(int, input().split()))\nres = 0\nif k == 1:\n print(n ** 3)\n exit()\nif k == 2:\n num_odd = n // 2 + n % 2\n res = num_odd ** 3\nnum_baisuu = n // k\nres += num_baisuu ** 3\nif k % 2 == 0:\n nn = n + k / 2\n num_baisuu = nn // k\n res += num_baisuu ** 3\nprint(int(res))', 'n, k = list(map(int, input().split()))\nres = 0\nif k == 1:\n print(n ** 3)\n exit()\nnum_baisuu = n // k\nres += num_baisuu ** 3\nif k % 2 == 0:\n nn = n + k / 2\n num_baisuu = nn // k\n res += num_baisuu ** 3\nprint(int(res))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s053441912', 's604283541', 's080053636']
[3064.0, 3060.0, 3064.0]
[17.0, 17.0, 17.0]
[280, 280, 221]
p03266
u375616706
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['import collections\nn,k=list(map(int,input().split()))\nl_n=[(v+1)%k for v in range(n)]\nc = collections.Counter(l_n)\nm = len(c)\nret=0\nif k%2==0:\n for i in range(0,m,k/2):\n for j in range(0,m,k/2):\n if (i+j)%k==0:\n for r in range(0,r,k/2):\n if(i+r)%k==0 and(r+j)%k==0:\n ret+=c[i]*c[j]*c[r]\nelse:\n for i in range(0,m,k):\n for j in range(0,m,k):\n if (i+j)%k==0:\n for r in range(0,m,k):\n if (i+r)%k ==0 and (r+j)%k==0:\n ret+=c[i]*c[j]*c[r]\nprint(ret)\n \n \n', 'n, k = map(int, input().split())\nprint(sum([1 if v % k == 0 else 0 for v in range(1, n+1)])**3 +\n sum([1 if v % k == k/2 else 0 for v in range(1, n+1)])**3)\n']
['Runtime Error', 'Accepted']
['s136868152', 's562086151']
[16620.0, 4680.0]
[60.0, 91.0]
[619, 162]
p03266
u375695365
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k=map(int,input().split())\n\nif k%2==1:\n print((n//k)**3)\n', 'n,k=map(int,input().split())\n\nif k%2==1:\n print((n//k)**3)\n exit()\nans=0\n\n\n\nans+=((n//k)**3)\n\ncount=0\nfor i in range(1,n+1):\n if i%k==k//2:\n count+=1\nans+=count**3\n\nprint(ans)\n\n']
['Wrong Answer', 'Accepted']
['s661540304', 's967353293']
[2940.0, 3064.0]
[17.0, 58.0]
[62, 263]
p03266
u379689547
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
["def is calc(N, K):\n count = 0\n for a in range(1, N):\n for b in range(1, N):\n c = N - a - b\n if c > 0:\n if a + b % N == 0 and b + c % N == 0 and a + c % N == 0:\n count += 1\n return count\n\nif __name__ == '__main__':\n N, K = map(int, input().split())\n print(calc(N, K))", 'N, K = map(int,input().split())\nprint(int(N/K)**3+(K%2)*(int((N+K/2)/K))**3)', 'N, K = map(int,input().split())\nprint(int(N/K)**3+[int((N+K/2)/K)**3,0][K%2])']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s009146008', 's202038544', 's529505994']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[300, 76, 77]
p03266
u416758623
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k = map(int, input().split())\na = n // k\nif k % 2 != 0:\n print(a**3)\nelse:\n b = ((n+k) // 2) // k\n print(a**3 + b**3)', 'n,k = map(int, input().split())\na = n // k\nif k % 2 != 0:\n print(a**3)\nelse:\n b = (n + k // 2) // k\n print(a**3 + b**3)']
['Wrong Answer', 'Accepted']
['s333488258', 's983671295']
[2940.0, 2940.0]
[17.0, 17.0]
[128, 128]
p03266
u423585790
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
["#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\nimport itertools\nsys.setrecursionlimit(10**5)\nstdin = sys.stdin\ndef LI(): return list(map(int, stdin.readline().split()))\ndef LF(): return list(map(float, stdin.readline().split()))\ndef LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))\ndef II(): return int(stdin.readline())\ndef IF(): return float(stdin.readline())\ndef LS(): return list(map(list, stdin.readline().split()))\ndef S(): return list(stdin.readline().rstrip())\ndef IR(n): return [II() for _ in range(n)]\ndef LIR(n): return [LI() for _ in range(n)]\ndef FR(n): return [IF() for _ in range(n)]\ndef LFR(n): return [LI() for _ in range(n)]\ndef LIR_(n): return [LI_() for _ in range(n)]\ndef SR(n): return [S() for _ in range(n)]\ndef LSR(n): return [LS() for _ in range(n)]\nmod = 1000000007\n\n#A\ndef A():\n return\n\n#B\ndef B():\n x1, y1, x2, y2 = LI()\n a = x2 - x1\n b = y2 - y1\n print(x2 - b, y2 + a, x1 - b, y1 + a)\n return\n\n#C\ndef C():\n n, k = LI()\n if k % 2:\n print((n // k)** 3)\n else:\n print((n//k)**3 + ((n-k/2)//k+1)**3)\n \n return\n\n#D\ndef D():\n return\n\n#E\ndef E():\n return\n\n#F\ndef F():\n return\n\n#G\ndef G():\n return\n\n#H\ndef H():\n return\n\n#Solve\nif __name__ == '__main__':\n C()\n", "#!usr/bin/env python3\nfrom collections import defaultdict\nfrom collections import deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\nimport random\nimport itertools\nsys.setrecursionlimit(10**5)\nstdin = sys.stdin\ndef LI(): return list(map(int, stdin.readline().split()))\ndef LF(): return list(map(float, stdin.readline().split()))\ndef LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))\ndef II(): return int(stdin.readline())\ndef IF(): return float(stdin.readline())\ndef LS(): return list(map(list, stdin.readline().split()))\ndef S(): return list(stdin.readline().rstrip())\ndef IR(n): return [II() for _ in range(n)]\ndef LIR(n): return [LI() for _ in range(n)]\ndef FR(n): return [IF() for _ in range(n)]\ndef LFR(n): return [LI() for _ in range(n)]\ndef LIR_(n): return [LI_() for _ in range(n)]\ndef SR(n): return [S() for _ in range(n)]\ndef LSR(n): return [LS() for _ in range(n)]\nmod = 1000000007\n\n#A\ndef A():\n return\n\n#B\ndef B():\n x1, y1, x2, y2 = LI()\n a = x2 - x1\n b = y2 - y1\n print(x2 - b, y2 + a, x1 - b, y1 + a)\n return\n\n#C\ndef C():\n n, k = LI()\n if k % 2:\n print((n // k)** 3)\n else:\n print(int((n//k)**3 + ((n-k/2)//k+1)**3))\n \n return\n\n#D\ndef D():\n return\n\n#E\ndef E():\n return\n\n#F\ndef F():\n return\n\n#G\ndef G():\n return\n\n#H\ndef H():\n return\n\n#Solve\nif __name__ == '__main__':\n C()\n"]
['Wrong Answer', 'Accepted']
['s567185258', 's438874958']
[5608.0, 4208.0]
[52.0, 32.0]
[1398, 1403]
p03266
u426108351
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int, input().split())\nif K % 2 == 0:\n ans = N // K ** 3\n N += K // 2\n ans += N // K ** 3\n \nelse:\n ans = N // K ** 3\nprint(ans)', 'N, K = map(int, input().split())\nif K % 2 == 0:\n ans = (N // K) ** 3\n N += K // 2\n ans += (N // K) ** 3\n \nelse:\n ans = (N // K) ** 3\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s339662909', 's307974799']
[2940.0, 2940.0]
[17.0, 17.0]
[141, 148]
p03266
u427344224
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int, input().split())\n\nif K % 2 != 0:\n num = [i for i in range(1, N+1) if i % K ==0]\n print(len(num)**3)\nelse:\n num = [i for i in range(1, N+1) if i % K == 0]\n half_num = [i for i in range(1, N + 1) if i % (K/2) == 0]\n print((len(num)+len(half_num))**3)', 'N, K = map(int, input().split())\n\nif K % 2 != 0:\n num = [i for i in range(1, N+1) if i % K ==0]\n print(len(num)**3)\nelse:\n num = [i for i in range(1, N+1) if i % K == 0]\n half_num = [i for i in range(1, N+1) if i % K == (K/2)]\n print((len(num))**3 + len(half_num)**3)']
['Wrong Answer', 'Accepted']
['s458520300', 's625113455']
[14952.0, 10936.0]
[89.0, 76.0]
[279, 282]
p03266
u430726059
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k=map(int, input().split())\nif k%2==0:\n cnt1=n//k\n cnt2=(n-k//2)//k\n print(cnt1**3+cnt2**3)\nelse:\n print((n//k)**3)', 'n,k=map(int, input().split())\nif k%2==0:\n cnt1=n//k\n cnt2=n//k\n if n%k>=k//2:\n cnt2+=1\n print(cnt1**3+cnt2**3)\nelse:\n print((n//k)**3)']
['Wrong Answer', 'Accepted']
['s107279175', 's910297419']
[9160.0, 9068.0]
[26.0, 34.0]
[121, 142]
p03266
u431981421
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int, input().split())\n\na = 0\nfor i in range(1, N):\n if i % K == 0:\n a += 1\n\nb = 0\nfor i in range(1, N):\n if i % K == K / 2:\n b += 1\n\nans = a ** 3\nif K % 2 == 0:\n ans += b ** 3\n\nprint(ans)', 'N, K = map(int, input().split())\n\na = 0\nfor i in range(1, N):\n if i % K == 0:\n a += 1\n\nb = 0\nfor i in range(1, N):\n if i % K == K / 2:\n b += 1\n\nans = a ** 3\nif K % 2 == 0:\n ans += b ** 3\n\nprint(ans)', 'N, K = map(int, input().split())\n\na = 0\nfor i in range(1, N+1):\n if i % K == 0:\n a += 1\n\nb = 0\nfor i in range(1, N+1):\n if i % K == K / 2:\n b += 1\n\nans = a ** 3\nif K % 2 == 0:\n ans += b ** 3\n\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s871553725', 's926329640', 's368073780']
[3060.0, 3060.0, 3060.0]
[90.0, 94.0, 91.0]
[207, 207, 211]
p03266
u434872492
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int,input().split())\nans = 0\n\nev = 0\nev2 = 0\nod = 0\nif K % 2 == 1:\n for i in range(N):\n if i % K == 0:\n od += 1\n\n print(od**3)\nelse:\n for i in range(N):\n if i % K == 0:\n ev += 1\n if i % (K/2) == 0:\n ev2 += 1\n if i % K == 0 and i % (K/2) == 0:\n od += 1\n ans = ev**3 + ev2**3\n print(ans)', 'N, K = map(int,input().split())\nans = 0\na = [0]\nb = [0]\nc = [0]\nfor i in range(N):\n a[i] = i+1\n b[i] = i+1\n c[i] = i+1\n\nev = 0\nev2 = 0\nod = 0\nif K % 2 == 1:\n for i in range(N):\n if i % K == 0:\n od += 1\n\n print(od**3)\nelse:\n for i in range(N):\n if i % K == 0:\n ev += 1\n if i % (K/2) == 0:\n ev2 += 1\n if i % K == 0 and i % (K/2) == 0:\n od += 1\n ans = ev**3 + ev2**3 - od**3\n print(ans)\n ', 'N, K = map(int,input().split())\nans = 0\n\nev = 0\nev2 = 0\nod = 0\nif K % 2 == 1:\n print((N//K)**3)\nelse:\n ans = N//K\n for i in range(1,N+1):\n if i % (K//2) == 0:\n ev += 1\n print(ans**3 + ev**3)', 'N, K = map(int,input().split())\nans = 0\n\nev = 0\nev2 = 0\nod = 0\nif K % 2 == 1:\n print((N//K)**3)\nelse:\n ans = N//K\n for i in range(1,N+1):\n if i % (K//2):\n ev += 1\n print(ans**3 + ev**3)', 'N, K = map(int,input().split())\nans = 0\n\nev = 0\nev2 = 0\nod = 0\nif K % 2 == 1:\n for i in range(N):\n if i % K == 0:\n od += 1\n\n print(od**3)\nelse:\n for i in range(N):\n if i % K == 0:\n ev += 1\n if i % (K/2) == 0:\n ev2 += 1\n if i % K == 0 and i % (K/2) == 0:\n od += 1\n ans = ev**3 + ev2**3 - od**3\n print(ans)', 'N, K = map(int,input().split())\nans = 0\n\nev = 0\nev2 = 0\nod = 0\nif K % 2 == 1:\n print((N//K)**3)\nelse:\n ans = N//K\n for i in range(1,N+1):\n if i % (K//2):\n t += 1\n print(ans + t**3)', 'N, K = map(int,input().split())\nans = 0\n\nev = 0\nev2 = 0\nod = 0\nif K % 2 == 1:\n print((N//K)**3)\nelse:\n ans = N//K\n for i in range(1,N+1):\n if i % (K//2):\n ev += 1\n print(ans + ev**3)', 'N, K = map(int,input().split())\nans = 0\n\nev = 0\nev2 = 0\nod = 0\nif K % 2 == 1:\n print((N//K)**3)\nelse:\n ans = N//K\n for i in range(1,N+1):\n if i % K == (K//2):\n ev += 1\n print(ans**3 + ev**3)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s028732341', 's579840232', 's587390966', 's618492377', 's631062935', 's894613496', 's909088547', 's251226617']
[3064.0, 3188.0, 3060.0, 3060.0, 3064.0, 3060.0, 3060.0, 3060.0]
[178.0, 18.0, 62.0, 61.0, 159.0, 48.0, 60.0, 55.0]
[383, 484, 220, 215, 391, 210, 212, 220]
p03266
u455317716
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N,K = map(int,input().split())\n\nif K%2 == 0:\n if N%K < K/2:\n n = 2*(N//K)\n else:\n n = 2*(N//K) +1\n\nelse:\n n = N//K\n\ncount = n + n*(n-1)*3 + n*(n-1)*(n-2)\n\nprint(count)', 'N,K = map(int,input().split())\n\nn_1 = N//K\nif K%2 == 0:\n if N%K < K/2:\n n = (N//K)\n else:\n n = (N//K) +1\n count = n_1 + n_1*(n_1-1)*3 + n_1*(n_1-1)*(n_1-2)\nelse:\n n = N//K\n count = 0\ncount += n + n*(n-1)*3 + n*(n-1)*(n-2)\n\nprint(count)']
['Wrong Answer', 'Accepted']
['s638186392', 's595697558']
[3060.0, 3064.0]
[18.0, 18.0]
[190, 264]
p03266
u466335531
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N,K=map(int,input().split())\nif K%2: print((N//K)**3)\nelse: print((N/K)**3+(N//K+int(N%K>=K/2))**3)', 'N,K=map(int,input().split())\nif K%2: print((N//K)**3)\nelse: print((N/K)**3+(N/K+int(N%K>=K/2))**3)', 'N,K=map(int,input().split())\nprint((N//K)**3+int(K%2==0)*(N//K+int(N%K>=K/2))**3)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s790862290', 's823752785', 's130462545']
[3060.0, 3060.0, 2940.0]
[18.0, 17.0, 18.0]
[99, 98, 81]
p03266
u467041847
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = list(map(int, input().split())) \n\ncount = 0\n\nR = N % K\nif R == 0:\n\tR += K\n\nfor a in range(1, N + 1):\n\tr = a % K\n\tif 2 * r % K == 0:\n\t\tif r == 0:\n\t\t\tr += K\n\t\tif r >= R:\n\t\t\tcount += (N // K) ** 2\n\t\telse:\n\t\t\tcount += (N // K + 1) ** 2\n\nprint(count)', 'N, K = list(map(int, input().split())) \n\ncount = 0\n\nR = N % K\n\nfor a in range(1, N + 1):\n\tr = a % K\n\tif 2 * r % K == 0:\n\t\tif r == 0:\n\t\t\tcount += (N // K) ** 2\n\t\telif R >= r:\n\t\t\tcount += (N // K + 1) ** 2\n\t\telse:\n\t\t\tcount += (N // K) ** 2\n\n\nprint(count)']
['Wrong Answer', 'Accepted']
['s444674437', 's315240193']
[3060.0, 3060.0]
[174.0, 154.0]
[252, 252]
p03266
u474270503
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N,K=map(int,input().split())\nif K%2==1:\n print((N//K)**3)\nelse:\n ct=0\n for i in range(N):\n if i%K==K//2:\n ct+=1\n print((N//K)**3+(ct)**3)', 'N,K=map(int,input().split())\nif K%2==1:\n print((N//K)**3)\nelse:\n print((N//K)**3+(2*N//K-N//K)**3)']
['Wrong Answer', 'Accepted']
['s815863479', 's114574466']
[3060.0, 2940.0]
[57.0, 17.0]
[167, 104]
p03266
u489959379
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n, k = map(int, input().split())\n\n\nnum = [0 for _ in range(k)]\nfor i in range(1, n + 1):\n num[i % k] += 1\nprint(num)\nres = 0\nfor a in range(k):\n b = (k - a) % k\n c = (k - a) % k\n if (b + c) % k != 0:\n continue\n res += num[a] * num[b] * num[c]\n\nprint(res)\n', 'n, k = map(int, input().split())\n\nif k % 2 != 0:\n x = n // k\n print(x ** 3)\nelse:\n x = n // k\n y = 0\n for i in range(1, n + 1):\n if i % k == k // 2:\n y += 1\n print(x ** 3 + y ** 3)\n']
['Wrong Answer', 'Accepted']
['s578164339', 's751008007']
[6424.0, 2940.0]
[118.0, 55.0]
[347, 217]
p03266
u517447467
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = list(map(int, input().split()))\ncount = N // K\nresult = count ** 3\nresult += 0 if K %2 else count+(N%K)//(K//2) ** 3\nprint(result)', 'N, K = list(map(int, input().split()))\ncount = N // K\nif K % 2 == 1:\n print(count**3)\nelse:\n print(count**3 + (count+(N%K)//(K//2)) ** 3)']
['Wrong Answer', 'Accepted']
['s027543612', 's651809155']
[2940.0, 2940.0]
[17.0, 17.0]
[137, 139]
p03266
u547167033
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N=10**6\ndef comb(n, r):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r]\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nn,k=map(int,input().split())\nif k==2:\n print((comb(n//2,3)+comb(n-n//2,3))*6)\nelse:\n print(comb(n//k,3)*6)', 'n,k=map(int,input().split())\ns=n//k\nt=0\nif k%2==0:\n t=(n+k//2)//k\nprint(s*s*s+t*t*t)']
['Runtime Error', 'Accepted']
['s438074090', 's033768934']
[3064.0, 2940.0]
[17.0, 17.0]
[521, 85]
p03266
u564589929
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
["import sys\nsys.setrecursionlimit(10 ** 6)\n# input = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\ndef II(): return int(input())\n\ndef MI(): return map(int, input().split())\ndef MI1(): return map(int1, input().split())\n\ndef LI(): return list(map(int, input().split()))\ndef LI1(): return list(map(int1, input().split()))\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\nINF = float('inf')\n\ndef solve():\n N, K = MI()\n\n ans = 0\n for a in range(1, N+1):\n b = K - a if K - a > 0 else K\n c = b\n # print(a, b, c)\n if (b + c) % K == 0:\n cnt_b = (N - b) // K + 1\n ans += cnt_b ** 2\n print(ans)\n\nif __name__ == '__main__':\n solve()\n", "import sys\nsys.setrecursionlimit(10 ** 6)\n# input = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\ndef II(): return int(input())\n\ndef MI(): return map(int, input().split())\ndef MI1(): return map(int1, input().split())\n\ndef LI(): return list(map(int, input().split()))\ndef LI1(): return list(map(int1, input().split()))\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\nINF = float('inf')\nfrom math import ceil\n\ndef solve():\n N, K = MI()\n\n NmodK = N % K if N % K != 0 else K\n times = ceil(N / K)\n ans = 0\n for a in range(1, K+1):\n b = K - a if K - a > 0 else K\n c = b\n # print(a, b, c)\n if (b + c) % K == 0:\n cnt_b = (N - b) // K + 1\n # print('bbb', cnt_b)\n if a <= NmodK:\n t = times\n else:\n t = times - 1\n # print(cnt_b ** 2, t)\n ans += cnt_b ** 2 * t\n print(ans)\n\n\n\nif __name__ == '__main__':\n solve()\n"]
['Wrong Answer', 'Accepted']
['s001269108', 's599244502']
[3064.0, 3064.0]
[130.0, 60.0]
[710, 971]
p03266
u564902833
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['%%test_input https://abc108.contest.atcoder.jp/tasks/abc108_c\nN, K = map(int, input().split())\nans = sum(((N + a % K) // K)**2 for a in range(1, N + 1) if (2 * a) % K == 0)\nprint(ans)', 'from math import ceil, floor\nN, K = map(int, input().split())\nr = floor((2 * N) / K)\nans = floor(N / K)**3 if K % 2 == 1 \\\n else ceil(r / 2) * (floor((2 * N - K) / (2 * K)) + 1)**2 + floor(r / 2) * floor(N / K)**2\nprint(ans)']
['Runtime Error', 'Accepted']
['s579636360', 's286769022']
[2940.0, 3060.0]
[17.0, 17.0]
[183, 227]
p03266
u572142121
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['def d(n,r):\n return factorial(n)//factorial(r)//factorial(n-r)\n\nif N<K:\n print(0)\nelse: \n a=N//K\n ans=a\n if K%2==1:\n if a>=2:\n ans+=d(a,2)*6\n if a>=3:\n ans+=a*(a-1)*(a-2)\n print(ans)\n else: \n if K*a+K//2<=N:\n b=a+1\n if a>=2:\n ans+=d(a,2)*6\n print(ans)\n if a>=3:\n ans+=a*(a-1)*(a-2)\n if b>=2:\n ans+=b+d(b,2)*6\n if b>=3:\n ans+=b*(b-1)*(b-2)\n\n print(ans)', 'N,K=map(int,input().split())\na=N//K\nif K%2==1:\n print(a**3)\nelse:\n if N>=(a+0.5)*K:\n print(a**3+(a+1)**3)\n else:\n print((a**3)*2)']
['Runtime Error', 'Accepted']
['s002185654', 's466882032']
[3064.0, 2940.0]
[17.0, 17.0]
[428, 138]
p03266
u583010173
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['import itertools\nn, k = [int(x) for x in input().split()]\nlista = []\nlistb = []\nfor i in range(1, n):\n if k % 2 == 0:\n if i % k == 0:\n lista.append(i)\n elif i % k == int(k / 2):\n listb.append(i)\n else:\n if i % k == 0:\n lista.append(i)\n\na = list(itertools.product(lista, repeat=3))\nb = list(itertools.product(listb, repeat=3))\nprint(len(a) + len(b))\n\n', 'n, k = [int(x) for x in input().split()]\ncount = 0\na = int(n / k)\ncount += (a + a * (a-1) * 3 + a * (a-1) * (a-2))\nif k % 2 == 0:\n b = int(n / (int(k / 2))) - a\n count += (b + b * (b-1) * 3 + b * (b-1) * (b-2))\nprint(count)\n']
['Wrong Answer', 'Accepted']
['s525647537', 's724352690']
[1858872.0, 3060.0]
[2226.0, 18.0]
[410, 230]
p03266
u594956556
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['31415 9265', 'N, K = map(int, input().split())\n\namaris = [N//K] * K\nfor i in range(N%K +1):\n amaris[i] += 1\namaris[0] -= 1\n\nif K%2 == 1:\n print(amaris[0]**3)\nelse:\n print(amaris[0]**3 + amaris[K//2]**3)\n']
['Runtime Error', 'Accepted']
['s624322029', 's175291313']
[2940.0, 4596.0]
[17.0, 29.0]
[10, 192]
p03266
u598009172
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N,K = (int(i) for i in input().split())\nans=0\na=(N*2)//K\nfor n in range(1,a+1):\n if (n*K)%2 == 0:\n ans +=1\n for i in range(1,(int((n*K)/2)+1)):\n if ((n*K/2)-K*i)>=1 and ((n*K/2)+K*i) <=N :\n ans +=6\nprint(ans)', 'N,K = (int(i) for i in input().split())\na=0\nb=0\nif K%2 !=0:\n print((N//K)**3)\nelse:\n for i in range (1,N+1):\n if i % K == 0:\n a += 1\n elif i % K == K/2:\n b += 1\n print(a**3+b**3)']
['Wrong Answer', 'Accepted']
['s826395160', 's440385361']
[3064.0, 3060.0]
[2104.0, 85.0]
[251, 223]
p03266
u600402037
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int, input().split())\n\n\n\n\n\nif K == 2:\n print((N//2)**3 + (N+1//2)**3)\nelif K % 2 != 0:\n a = N//K\n print(a**3)\nelse:\n a = N//K\n b = N//(K//2) - N//K\n print(a**3 + b**3)', '# coding: utf-8\nimport sys\n\nsr = lambda: sys.stdin.readline().rstrip()\nir = lambda: int(sr())\nlr = lambda: list(map(int, sr().split()))\n\n\n\n\nN, K = lr()\nexact = N // K\nanswer = pow(exact, 3)\nif K%2 == 0:\n half = N // (K//2) - exact\n answer += pow(half, 3)\nprint(answer)\n# 29']
['Wrong Answer', 'Accepted']
['s988437370', 's419422947']
[3060.0, 3060.0]
[25.0, 17.0]
[368, 391]
p03266
u609061751
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['import sys\nimport numpy as np\ninput = sys.stdin.readline\nN, K = [int(x) for x in input().split()]\nn = (2 * N) // K\nA = []\nfor i in range(n + 1):\n A.append(K * i)\nA = np.array(A)\nA = A[A >= 2]\nans = 0\nfor i in A:\n for j in range(1,min(i,K+1)):\n if i - j <= K and 2 * j % K == 0:\n ans += 1\nprint(ans)', 'import sys\nimport numpy as np\ninput = sys.stdin.readline\nN, K = [int(x) for x in input().split()]\nn = (2 * N) // K\nA = []\nfor i in range(n + 1):\n A.append(K * i)\nA = np.array(A)\nA = A[A >= 2]\nans = 0\nfor i in A:\n for j in range(1,min(i,N+1)):\n if i - j <= N and 2 * j % K == 0:\n a = j\n b = i - j\n if a == b:\n ans += 1\n else:\n ans += 2\nprint(ans)', 'import sys\nimport numpy as np\ninput = sys.stdin.readline\nN, K = [int(x) for x in input().split()]\nans = 0\ndef A(x,N,K):\n p = N // K\n q = N % K\n if x == 0:\n x += K\n if x <= q:\n return p + 1\n else:\n return p\nfor a_mod in range(K):\n b_mod = (K - a_mod) % K\n c_mod = b_mod\n if (b_mod + c_mod) % K == 0:\n ans += A(a_mod,N,K) * A(b_mod,N,K) * A(c_mod,N,K)\n\nprint(ans) ']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s490406403', 's860846950', 's249797901']
[37564.0, 31308.0, 12444.0]
[1635.0, 2109.0, 217.0]
[322, 432, 414]
p03266
u626468554
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k = map(int,input().split())\n\nmm=0\nfor i in range(1,n+1):\n if i%k==0:\n mm1+=1\n if i%k==k//2 and k%2==0:\n mm2+=1\n\nprint(mm1**3+mm2**3)\n', 'n,k = map(int,input().split())\n\nmm=0\nfor i in range(1,n+1):\n if i%k==0:\n mm+=1\n if i%k==k//2 and k%2==0:\n mm+=1\n\nprint(mm**3)\n', 'n,k = map(int,input().split())\n\nmm1=0\nmm2=0\nfor i in range(1,n+1):\n if i%k==0:\n mm1+=1\n if i%k==k//2 and k%2==0:\n mm2+=1\n\nprint(mm1**3+mm2**3)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s697998014', 's965285180', 's880920487']
[2940.0, 3444.0, 2940.0]
[40.0, 93.0, 91.0]
[156, 146, 162]
p03266
u633105820
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
["def run(n, k):\n if k % 2 == 1:\n return (n//k)**3\n else:\n a = (n//k)**3\n b = ((n + k/2)//k)**3\n return a + b\n\n\ndef read_line():\n n, k = map(int, input().split())\n return (n, k)\n\n\ndef main():\n n, k = read_line()\n print(run(n, k))\n\n\nif __name__ == '__main__':\n main()\n", "def run(n, k):\n if k % 2 == 1:\n return (n//k)**3\n else:\n a = (n//k)**3\n b = (((n - k/2)//k)+1)**3\n return a + b\n\n\ndef read_line():\n n, k = map(int, input().split())\n return (n, k)\n\n\ndef main():\n n, k = read_line()\n print(run(n, k))\n\n\nif __name__ == '__main__':\n main()\n", "def run(n, k):\n a = 0\n b = 0\n for i in range(n):\n if (i+1) % k == 0:\n a += 1\n elif (i+1) % k == k/2:\n b += 1\n if k % 2 == 1:\n # return (n//k)**3\n return a**3\n else:\n # a = (n//k)**3\n # b = (((n - k/2)//k)+1)**3\n # return a + b\n return (a**3) + (b**3)\n\n\ndef read_line():\n n, k = map(int, input().split())\n return (n, k)\n\n\ndef main():\n n, k = read_line()\n print(run(n, k))\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s099724808', 's324780163', 's972784907']
[2940.0, 3188.0, 3064.0]
[17.0, 21.0, 77.0]
[314, 318, 516]
p03266
u642528832
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N,K = map(int,input().split())\nif K%2==0:\n d1=n//(k//2)\n d2=n//k\n ans=d2**3+(d1-d2)**3\nelse:\n d=n//k\n ans = d**3\nprint(ans)\n ', 'N,K = map(int,input().split())\nif K%2==1:\n d1=n//(k//2)\n d2=n//k\n ans=d2**3+(d1-d2)**3\nelse:\n d=n//k\n ans = d**3\nprint(ans)\n ', 'N,K = map(int,input().split())\nans = 0\nif K%2==1:\n d1=n//(k//2)\n d2=n//k\n ans=d2**3+(d1-d2)**3\nelse:\n d=n//k\n ans = d**3\nprint(ans)\n ', 'N,K = map(int,input().split())\nans = 0\n\nif K%2==0:\n d1=N//(K//2)\n d2=N//K\n ans=d2**3+(d1-d2)**3\nelse:\n d=N//K\n ans = d**3\n\nprint(ans)\n ']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s240994537', 's821319715', 's913507935', 's438362979']
[9036.0, 9164.0, 9000.0, 9140.0]
[24.0, 25.0, 28.0, 26.0]
[143, 143, 151, 153]
p03266
u652081898
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n, k = map( int, input().split() )\n\np = 0\n\nfor a in range(1, n+1):\n for b in range(a, n+1):\n for c in range(b, n+1):\n if not ((a+b+c)*2)%k == 0:\n pass\n elif (a+b)%k == 0 and (b+c)%k == 0 and (c+a)%k == 0:\n if a == b and b == c:\n p += 1\n elif a == b and not b == c:\n p += 3\n else:\n p += 6\n \nprint( p )', 'n, k = map( int, input().split() )\n\np = 0\n\nfor a in range(1, n+1):\n for b in range(a, n+1):\n for c in range(b, n+1):\n if (a+b)%k == 0 and (b+c)%k == 0 and (c+a)%k == 0:\n if a == b and b == c:\n p += 1\n elif a == b and not b == c:\n p += 3\n else:\n p += 6\n \nprint( p )\n', 'n, k = map( int, input().split() )\nans = int((n//k)**3)\n\nif k%2 == 1:\n print(ans)\nelse:\n ans += int(((n-k//2)//k+1)**3)\n print(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s231787653', 's778926246', 's032135741']
[3064.0, 3060.0, 2940.0]
[2104.0, 2104.0, 17.0]
[462, 401, 140]
p03266
u657994700
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
["from collections import Counter\n\nprint('input >>')\nN, K = map(int, (input().split()))\n\nA = [0] * N\nfor i in range(N):\n A[i] = (i + 1) % K\n\nAcount = Counter(A)\n# print('ACount %s' % Acount)\nans = 0\nfor mod, times in Acount.items():\n mod_anti = K - mod\n if (K - mod) * 2 % K == 0:\n ans += Acount[mod] ** 3\n\n# print('----------output----------')\nprint(ans)", "from collections import Counter\n\n# print('input >>')\nN, K = map(int, (input().split()))\n\nA = [0] * N\nfor i in range(N):\n A[i] = (i + 1) % K\n\nAcount = Counter(A)\n# print('ACount %s' % Acount)\nans = 0\nfor mod, times in Acount.items():\n mod_anti = K - mod\n if (K - mod) * 2 % K == 0:\n ans += Acount[mod] ** 3\n\n# print('----------output----------')\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s784974289', 's074961932']
[16620.0, 16620.0]
[73.0, 78.0]
[369, 371]
p03266
u673217098
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['s = input().split()\nN = int(s[0])\nK = int(s[1])\n\nans = N // K \n\nif K % 2 == 0:\n ans = ans + N//(K%2)\n\nprint(ans**3 ) ', 's = input().split()\nN = int(s[0])\nK = int(s[1])\n\nans = N // K \nans = ans ** 3\n\nans_ev = 0\nif K % 2 == 0:\n ans_ev = (N+(K//2)) // (K)\n ans_ev = ans_ev ** 3\n \n\nprint(ans+ ans_ev ) ']
['Runtime Error', 'Accepted']
['s620695465', 's246597087']
[2940.0, 3060.0]
[17.0, 17.0]
[118, 204]
p03266
u698479721
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N,K=map(int,input().split())\nif K%2 == 1:\n m = N//K\n print(m**3)\nelse:\n m = N//(K//2)\n print((m**3)//4)', 'N,K=map(int,input().split())\nif K%2 == 1:\n m = N//K\n print(m**3)\nelse:\n m1 = N//(K//2)\n m2 = N//K\n m1 = m1-m2\n print((m1**3)+(m2**3))']
['Wrong Answer', 'Accepted']
['s849498325', 's640365858']
[2940.0, 3060.0]
[17.0, 19.0]
[107, 139]
p03266
u722189950
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int, input().split())\ncount = 0\ncount2 = 0\nans = 0\nfor n in range(1,N+1):\n if n % K == 0:\n count += 1\n if K % 2 == 0 and (n // 2) % K == 0:\n count2 += 1 \nif K%2 == 0:\n ans = count2 ** 3 + count ** 3\nelse:\n ans = count ** 3\nprint(ans)', 'N, K = map(int, input().split())\ncount = 0\ncount2 = 0\nans = 0\nf = False\nif K % 2 == 0:\n f = True\nfor n in range(1,N+1):\n if n % K == 0:\n count += 1\n if f and n % K == K//2:\n count2 += 1 \nif f:\n ans = count2 ** 3 + count ** 3\nelse:\n ans = count ** 3\nprint(ans)']
['Wrong Answer', 'Accepted']
['s408714617', 's343251651']
[3064.0, 3064.0]
[98.0, 85.0]
[270, 288]
p03266
u736729525
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['def solve(N, K):\n n = N // K\n answer = n ** 3\n if K % 2 == 0:\n m = K//2\n n = (N - m) // K\n answer += n ** 3\n return answer\n \nN, K = [int(x) for x in input().split()]\nprint(solve(N, K))\n', 'def solve(N, K):\n n = N // K\n #print(n)\n answer = n ** 3\n if K % 2 == 0:\n m = K//2\n n = (N + m) // K\n #print(n)\n answer += n ** 3\n return answer\n \nN, K = [int(x) for x in input().split()]\nprint(solve(N, K))\n']
['Wrong Answer', 'Accepted']
['s120570981', 's409815781']
[2940.0, 2940.0]
[17.0, 17.0]
[225, 257]
p03266
u740284863
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K =map(int, input().split())\ncount = 0\nfor i in range(1,N+1):\n for k in range(1,N+1):\n for j in range(1,N+1):\n if (i+j)% K == 0 and (k+j)% K == 0 and (j+i)% K == 0:\n print(i,j,k)\n count += 1\n\nprint(count)\n', 'n,k = map(int,input().split())\nN = n // k\nif k % 2 == 1:\n ans = N**3\nelse:\n if N * k + k/2 <= n:\n ans = N**3 + (N+1)**3\n else:\n ans = 2 * N**3\nprint(ans)']
['Wrong Answer', 'Accepted']
['s838265766', 's447752158']
[14348.0, 3064.0]
[2104.0, 18.0]
[259, 176]
p03266
u741397536
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n, k = map(int, input().split())\n\n\nbai = 1\nk_arr = []\nwhile bai * k <= n:\n k_arr.append(bai * k)\n bai += 1\n\n\nif k % 2 == 0:\n bai2 = 1\n k_arr2 = []\n while bai2 * k/2 <= n:\n k_arr2.append(bai2 * k/2)\n bai2 += 1\n k_arr2_len = len(k_arr2) - len(k_arr)\n \n print(k_arr2_len)\n print(len(k_arr)*len(k_arr)*len(k_arr) + k_arr2_len*k_arr2_len*k_arr2_len)\n\nelse:\n print(len(k_arr)*len(k_arr)*len(k_arr))\n', 'import sys\nn, k = map(int, input().split())\n\nif k == 1:\n print(0)\n sys.exit()\nif k > n:\n print(0)\n sys.exit()\n\nbai = 1\nk_arr = []\nwhile bai * k <= n:\n k_arr.append(bai * k)\n bai += 1\n\n\nif k % 2 == 0:\n bai2 = 1\n k_arr2 = []\n while bai2 * k/2 <= n:\n k_arr2.append(bai2 * k/2)\n bai2 += 1\n k_arr2_len = len(k_arr2) - len(k_arr)\n \n print(k_arr2_len)\n print(len(k_arr)*len(k_arr)*len(k_arr) + k_arr2_len*k_arr2_len*k_arr2_len)\n\nelse:\n print(len(k_arr)*len(k_arr)*len(k_arr))', 'import sys\nn, k = map(int, input().split())\n\nbai = 1\nk_arr = []\nwhile bai * k <= n:\n k_arr.append(bai * k)\n bai += 1\n\n\nif k % 2 == 0:\n bai2 = 1\n k_arr2 = []\n k_arr2_len = 0 - len(k_arr2)\n while bai2 * k/2 <= n:\n k_arr2.append(bai2 * k/2)\n bai2 += 1\n k_arr2_len = len(k_arr2) - len(k_arr)\n print(len(k_arr)*len(k_arr)*len(k_arr) + k_arr2_len*k_arr2_len*k_arr2_len)\n\nelse:\n print(len(k_arr)*len(k_arr)*len(k_arr))\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s307232320', 's799529188', 's416407601']
[13336.0, 13336.0, 13336.0]
[188.0, 179.0, 193.0]
[445, 532, 457]
p03266
u753803401
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n, k = map(int, input().split())\nmod0 = []\nmod2 = []\nfor i in range(1, n + 1):\n if i % k == 0:d i % k == k // 2:\n mod2.append(i)\nprint(len(mod0) * len(mod0) * len(mod0) + len(mod2) * len(mod2) * len(mod2))\n', 'n, k = map(int, input().split())\nmod0 = []\nmod2 = []\nfor i in range(1, n + 1):\n if i % k == 0:\n mod0.append(i)\n elif k % 2 == 0 and i % k == k // 2:\n mod2.append(i)\nprint(len(mod0) * len(mod0) * len(mod0) + len(mod2) * len(mod2) * len(mod2))\n']
['Runtime Error', 'Accepted']
['s358866107', 's893259746']
[2940.0, 10940.0]
[17.0, 81.0]
[216, 262]
p03266
u780962115
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['import math\n\nn,k=map(int,input().split())\nif k%2!=0:\n nums=math.ceil(n/k)\n print(nums*3)\n \nelse:\n nums1=math.floor(2*n/k)\n print(nums1)\n\n if nums1%2==0:\n a=int(nums1/2)\n b=nums1-a\n print(a**3+b**3)\n \n \n if nums1%2!=0:\n a=int((nums1+1)/2)\n b=nums1-a\n print(a**3+b**3)', 'import math\n\nn,k=map(int,input().split())\nif k%2!=0:\n nums=math.ceil(n/k)\n print(nums*3)\n \nelse:\n nums1=math.ceil(2*n/k)\n if nums1%2==0:\n a=int(nums1/2)\n b=nums1-a\n print(a**3+b**3)\n \n \n elif nums1%2!=0:\n a=int((num-1)/2)\n b=nums1-a\n print(a**3+b**3)\n \n ', 'import math\n\nn,k=map(int,input().split())\nif k%2!=0:\n nums=math.floor(n/k)\n print(nums**3)\n \nelse:\n nums1=math.floor(2*n/k)\n\n if nums1%2==0:\n a=int(nums1/2)\n b=nums1-a\n print(a**3+b**3)\n \n \n if nums1%2!=0:\n a=int((nums1+1)/2)\n b=nums1-a\n print(a**3+b**3)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s024164982', 's727477809', 's696449897']
[3316.0, 3060.0, 3060.0]
[21.0, 17.0, 18.0]
[332, 289, 317]
p03266
u785066634
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
["n,k = map(int,input().split())\nj=0\nm=0\nans = 0\nif k % 2 == 1:\n j= n//k\n print('j',j)\n ans=j*j*j\n\nelse:\n j=n//k\n m=(n-k//2)//k+1\n print('j',j,'m',m)\n ans=m*m*m+j*j*j\n \nprint(ans)", "n,k = map(int,input().split())\nj=0\nm=0\nans = 0\nif k % 2 == 1:\n j= n//k\n #print('j',j)\n ans=j*j*j\n\nelse:\n j=n//k\n m=(n-k//2)//k+1\n #print('j',j,'m',m)\n ans=m*m*m+j*j*j\n \nprint(ans)"]
['Wrong Answer', 'Accepted']
['s551852674', 's065524743']
[3064.0, 3060.0]
[17.0, 18.0]
[198, 200]
p03266
u785578220
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['def a():return input()#s\ndef ai():return int(input())#a,n or k\ndef ma():return map(int, input().split())#a,b,c,d or n,k\ndef ms():return map(str, input().split())#,a,b,c,d\ndef lma():return list(map(int, input().split()))#x or y\ndef lms():return list(map(str, input().split()))#x or y\na,b = ma()\nx = lma()\nans = 10 **18\nfor i in range(a-b+1):\n a0 = x[i]\n ab = x[i+b-1]\n if ab< 0 :\n ans = min(ans,ab)\n elif a0 <=0 and 0 <= ab:\n ans = min(ans, ab-2*a0, 2*ab-a0)\n else:\n ans = min(ans,ab)\nprint(ans)', 'n,k = map(int,input().split())\nif k%2==1:print((n//k)**3)\nelif k%2==0:print((n//k)**3 + (n//(k//2) - n//k)**3 )']
['Runtime Error', 'Accepted']
['s735359846', 's776332898']
[3064.0, 2940.0]
[17.0, 18.0]
[531, 111]
p03266
u787562674
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N, K = map(int, input().split())\n\nans = 0\n\nfor a in range(1, N+1):\n for b in range(1, N+1):\n for c in range(1, N+1):\n if (a + b) % K == 0 and (b + c) % K == 0 and (c + a) % K == 0:\n print(a, b, c)\n ans += 1\nprint(ans)\n', 'N, K = map(int, input().split())\n\nmod = [i for i in range(K, N+1, K)]\nans += len(mod) ** 3\n\nif K % 2 == 0:\n items = [i for i in range(K//2, N+1, K)]\n ans += len(items)\n\nprint(ans)\n', 'N, K = map(int, input().split())\n\nmod = [i for i in range(K, N+1, K)]\nans = len(mod) ** 3\n\nif K % 2 == 0:\n items = [i for i in range(K//2, N+1, K)]\n ans += len(items) ** 3\n\nprint(ans)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s083993293', 's237504343', 's092793764']
[14604.0, 11032.0, 11160.0]
[2108.0, 30.0, 29.0]
[269, 186, 190]
p03266
u788023488
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['n,k =map(int, input().split())\n\n\n\n\nans=0\nodd=0\neven=0\n\n\nodd=n//k\n\n\neven=n//(k/2)-odd\n\nif k%2==0:\n ans+=odd**3+even**3\nelse:\n ans+=odd**3\n\nprint(int(ans),even,odd)', 'n,k =map(int, input().split())\n\n\n\n\nans=0\nodd=0\neven=0\n\n\nodd=n//k\n\n\neven=n//(k/2)-odd\n\nif k%2==0:\n ans+=odd**3+even**3\nelse:\n ans+=odd**3\n\nprint(int(ans))']
['Wrong Answer', 'Accepted']
['s300326123', 's557773987']
[3060.0, 3060.0]
[17.0, 18.0]
[376, 367]
p03266
u797994565
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N,K = map(int,input().split())\nif k % 2 == 1:\n print((n // k) ** 3)\nelse:\n print((n // k) ** 3 + ((n + k // 2) // k) ** 3)', 'N,K = map(int,input().split())\nif K % 2 == 1:\n print((N // K) ** 3)\nelse:\n print((N // K) ** 3 + ((N + K // 2) // K) ** 3)']
['Runtime Error', 'Accepted']
['s861007085', 's000905441']
[2940.0, 2940.0]
[17.0, 17.0]
[128, 128]
p03266
u813102292
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['import math\nN , K = (int(i) for i in input().split())\ncount = 0\na = 0\nb = 0\nc = 0\nk_count = int(math.floor(N/K))\nif N >= K:\n for i in range(1,K+1):\n a = i\n b = a*(-1)\n while b <= N-K:\n b += K\n c = a*(-1)\n if b > 0:\n while c <= N-K:\n c += K\n if c > 0:\n if (b+c)%K==0:\n count += 1\nprint(count*k_count)', 'N, K = map(int, input().split())\nres = 0\nres += (N // K)** 3\nif K % 2 == 0:\n res += ((N-K//2)//K + 1) ** 3\n\nprint(res)']
['Wrong Answer', 'Accepted']
['s235064480', 's314304070']
[3064.0, 2940.0]
[2104.0, 22.0]
[459, 121]
p03266
u829249049
2,000
1,048,576
You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same.
['N,K=map(int,input().split())\nif K%2==0:\n a=N//(K//2)\n ans=a**3\n print(ans)\nelse:\n b=N//K\n ans=b**3\n print(ans)', 'import itertools\nN,K=map(int,input().split())\nL=range(1,N+1)\nT=0\nfor i in itertools.permutations(L, r=3):\n int(a,b,c) for a,b,c in i:\n if a+b%K==0 and b+c%K==0 and c+a%K==0:\n T+=1\nprint(T) ', 'N,K=map(int,input().split())\nif K%2==0:\n a=N//(K//2)\n b=N//K\n c=a-b\n ans=b**3+c**3\n print(ans)\nelse:\n a=N//K\n ans=a**3\n print(ans)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s228219534', 's528367957', 's326291321']
[3064.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0]
[116, 198, 138]