TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
a,b,c,d=map(int,input().split())
x=a-c
y=b-d
print(c+y,d+x,a-y,b-x)

a,b,c,d=map(int,input().split())
x=c-a
y=d-b
print(c+y,d-x,a+y,b-x)

a,b,c,d=map(int,input().split())
x=c-a
y=d-b
print(c-y,d+x,a-y,b+x)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    x1,y1,x2,y2 = I2()
    v = x2 - x1#x
    w = y2 - y1#y
    print(x2-w,y2+v,x1-w,y2+v)

import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    x1,y1,x2,y2 = I2()
    v = x2 - x1#x
    w = y2 - y1#y
    print(x2-w,y2+v,x1-w,y1+v)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
x1,x2,x3,x4=map(int,input().split())
dx=abs(x1-x2)
dy=abs(y1-y2)
if x1<x2 and y1<=y2:
    x3=x2-dy
    y3=y2+dx
    x4=x3-dx
    y4=y3-dy
    #ok
elif x1>=x2 and y1<y2:
    x3=x2-dy
    y3=y2-dx
    x4=x3+dx
    y4=y3-dy
    #ok
elif x1>x2 and y1>=y2:
    x3=x2+dy
    y3=y2-dx
    x4=x3+dx
    y4=y3+dy
elif x1<=x2 and y1>y2:
    x3=x2+dy
    y3=y2+dx
    x4=x3-dx
    y4=y3+dy
else:
    print("NA")
print(x3,y3,x4,y4)

x1,y1,x2,y2=map(int,input().split())
dx=abs(x1-x2)
dy=abs(y1-y2)
if x1<x2 and y1<=y2:
    x3=x2-dy
    y3=y2+dx
    x4=x3-dx
    y4=y3-dy
elif x1>=x2 and y1<y2:
    x3=x2-dy
    y3=y2-dx
    x4=x3+dx
    y4=y3-dy
elif x1>x2 and y1>=y2:
    x3=x2+dy
    y3=y2-dx
    x4=x3+dx
    y4=y3+dy
elif x1<=x2 and y1>y2:
    x3=x2+dy
    y3=y2+dx
    x4=x3-dx
    y4=y3+dy
else:
    print("NA")
print(x3,y3,x4,y4)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
def main():
    x1, y1, x2, y2 = map(int, input().split())

    ans = editorial(x1, y1, x2, y2)
    assert ans == twi(x1, y1, x2, y2)
    print(*ans)


def twi(x1, y1, x2, y2):
    """
    https://twitter.com/akensho/status/1035924165205716992
    https://twitter.com/hogeover30/status/1035903937830764545
    """
    import math
    cos90 = int(math.cos(math.pi / 2))
    sin90 = int(math.cos(math.pi / 2))

    x = x2 - x1
    y = y2 - y1
    x4 = x * cos90 - y * sin90 + x1
    y4 = x * sin90 + y * cos90 + y1

    x = x1 - x4
    y = y1 - y4
    x3 = x * cos90 - y * sin90 + x4
    y3 = x * sin90 + y * cos90 + y4

    return x3, y3, x4, y4


def editorial(x1, y1, x2, y2):
    x = x2 - x1
    y = y2 - y1

    x3 = x2 - y
    y3 = y2 + x
    x4 = x1 - y
    y4 = y1 + x

    return x3, y3, x4, y4


if __name__ == '__main__':
    main()


def main():
    x1, y1, x2, y2 = map(int, input().split())

    ans = editorial(x1, y1, x2, y2)
    
    print(*ans)


def twi(x1, y1, x2, y2):
    """
    https://twitter.com/akensho/status/1035924165205716992
    https://twitter.com/hogeover30/status/1035903937830764545
    """
    import math
    cos90 = int(math.cos(math.pi / 2))
    sin90 = int(math.cos(math.pi / 2))

    x = x2 - x1
    y = y2 - y1
    x4 = x * cos90 - y * sin90 + x1
    y4 = x * sin90 + y * cos90 + y1

    x = x1 - x4
    y = y1 - y4
    x3 = x * cos90 - y * sin90 + x4
    y3 = x * sin90 + y * cos90 + y4

    return x3, y3, x4, y4


def editorial(x1, y1, x2, y2):
    x = x2 - x1
    y = y2 - y1

    x3 = x2 - y
    y3 = y2 + x
    x4 = x1 - y
    y4 = y1 + x

    return x3, y3, x4, y4


if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
x1,y1,x2,y2 = map(int,input().split())
x3 = x2 - y2 + y1
y3 = x2 - y2 + x1
x4 = x1 - y2 + y1
y4 = y1 - x1 + x2
print(x3,y3,x4,y4)

x1,y1,x2,y2 = map(int,input().split())
x3 = x2 - y2 + y1
y3 = y2 + x2 - x1
x4 = x1 - y2 + y1
y4 = y1 - x1 + x2
print(x3,y3,x4,y4)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
x1, x2, y1, y2 = map(int, input().split())

if y1 > y2:
    length = abs(x1-x2)
    x3 = x2 + length
    y3 = y2
    x4 = x2 + length
    y4 = y1
elif x2 > x1:
    length = abs(y1-y2)
    x3 = x2
    y3 = y2 + length
    x4 = x2
    y4 = y1 + length
elif y2 > y1:
    length = abs(y1-y2)
    x3 = x2 - length
    y3 = y2
    x4 = x2 - length
    y4 = y1
else:
    length = abs(x1-x2)
    x3 = x2
    y3 = y2 - length
    x4 = x2
    y4 = y1 - length
print(x3, x4, y3, y4)

x1, x2, y1, y2 = map(int, input().split())

if y1 > y2:
    length = abs(x1-x2)
    x3 = x2 + length
    y3 = y2
    x4 = x1 + length
    y4 = y1
elif x2 > x1:
    length = abs(y1-y2)
    x3 = x2
    y3 = y2 + length
    x4 = x1
    y4 = y1 + length
elif y2 > y1:
    length = abs(y1-y2)
    x3 = x2 - length
    y3 = y2
    x4 = x1 - length
    y4 = y1
else:
    length = abs(x1-x2)
    x3 = x2
    y3 = y2 - length
    x4 = x1
    y4 = y1 - length
print(x3, x4, y3, y4)

x1, y1, x2, y2 = map(int, input().split())

dx = x2 - x1
dy = y2 - y1

print(x2-dy, y2+dx, x1-dy, y1+dx)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
x1,y1,x2,y2 = map(int,input().split())
xsa = x2 - x1
ysa = y2 - y1
x3 = x2 - ysa
y3 = y2 + xsa
x4 = x1 - ysa
y4 = y1 + xsa
print(x3,end="")
print(y3,end="")
print(x4,end="")
print(y4)

x1,y1,x2,y2 = map(int,input().split())
xsa = x2 - x1
ysa = y2 - y1
x3 = x2 - ysa
y3 = y2 + xsa
x4 = x1 - ysa
y4 = y1 + xsa
print(x3,end=" ")
print(y3,end=" ")
print(x4,end=" ")
print(y4)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
x1,y1,x2,y2 = map(int,input().split())
x3 = y1 - y2
y3 = abs(x1 - x2)
x4 = abs(y2 - y3)
y4 = abs(x2 - x3)
print(x3,y3,x4,y4)

x1,y1,x2,y2 = map(int,input().split())
x3 = x2+ (y1 - y2)
y3 = y2 + abs(x1 - x2)
x4 = x3 + abs(y2 - y3)
y4 = y3 + abs(x2 - x3)
print(x3,y3,x4,y4)

x1,x2,y1,y2 = map(int,input())
x3 = x2 + (y1 - y2)
y3 = y2 + (x2 - x1)
x4 = y1 + (x2 - x1)
y4 = x1 + (y1 - y2)
print(x3,y3,x4,y4)

x1,y1,x2,y2 = map(int,input().split())
x3 = y1 - y2
y3 = abs(x1 - x2)
x4 = abs(y2 - y3)
y4 = abs(x2 - x3)
print(x3,y3,x4,y4)

x1,x2,y1,y2 = map(int,input().split())
x3 = x2 + (y1 - y2)
y3 = y2 + (x2 - x1)
x4 = y1 + (x2 - x1)
y4 = x1 + (y1 - y2)
print(x3,y3,x4,y4)

x1,x2,y1,y2 = map(int,input().split())
x3 = x2 + (y1 - y2)
y3 = y2 + (x2 - x1)
x4 = x1 + (x2 - x1)
y4 = y1 + (y1 - y2)
print(x3,y3,x4,y4)

x1,y1,x2,y2 = map(int,input().split())
x3 = x2 + (y1 - y2)
y3 = y2 + (x2 - x1)
x4 = x1 + (y1 - y2)
y4 = y1 + (x2 - x1)
print(x3,y3,x4,y4)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from math import sin, cos, acos, pi
x1, y1, x2, y2 = map(int, input().split())
r = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
t = acos((x2 - x1)/r)
print(r, t)
x3, y3 = x1 + (2 ** 0.5)*r*cos(t + pi/4), y1 + (2 ** 0.5)*r*sin(t + pi/4)
x4, y4 = x1 + r*cos(t + pi/2), y1 + r*sin(t + pi/2)
print(round(x3), round(y3), round(x4), round(y4))

x1, y1, x2, y2 = map(int, input().split())
x3, y3 = x1 + (x2 - x1 - y2 + y1), y1 + (x2 - x1 + y2 - y1)
x4, y4 = x1 - (y2 - y1), y1 + (x2 - x1)
print(x3, y3, x4, y4)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
x1, y1, x2, y2 = map(int,input().split())

a, b = x2 - x1, y2 - y1
x3, y3 = x2 - a, y2 - b
x4, y4 = x1 - b, y1 - a

print(x3,y3,x4,y4)

x1, y1, x2, y2 = map(int,input().split())

a, b = x2 - x1, y2 - y1
x3, y3 = x2 - a, y2 - b
x4, y4 = x1 - b, y1 - a

print(x3, y3, x4, y4)

x1, y1, x2, y2 = map(int,input().split())

a, b = x2 - x1, y2 - y1
x3, y3 = x2 - b, y2 + a
x4, y4 = x3 - a, y3 - b

print(x3, y3, x4, y4)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
x1, y1, x2, y2 = map(int, input().split())
dis1 = x2 - x1
dis2 = y2 - y1
print('{} {} {} {}').format(x2-dis2, y2+dis1, x1-dis2, y1+dis1)

x1, y1, x2, y2 = map(int, input().split())
dis_x = x2 - x1
dis_y = y2 - y1
print(x2-dis_y, y2+dis_x, x1-dis_y, y1+dis_x)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import heapq
def solve():
  x1,y1,x2,y2 = (int(i) for i in input().split())
  
  que = []
  que2 = []
  for i in range(-300,300):
    for j in range(-300,300):
      if (x2-x1)**2+(y2-y1)**2 == (i-x1)**2+(j-y1)**2:
        if (i,j) != (x1,y1) and  (i,j) != (x2,y2):
          que.append((i,j))
      if (x2-x1)**2+(y2-y1)**2 == (i-x2)**2+(j-y2)**2:
        if  (i,j) != (x1,y1) and  (i,j) != (x2,y2):
         que2.append((i,j))
        
  #define x3,y3
  while que2:
    (x3,y3) = heapq.heappop(que2)
    for i in range(len(que)):
      x4,y4 = que[i]
      if (x3-x2)**2+(y3-y2)**2 == (x4-x1)**2+(y4-y1)**2:
       if (x3-x4)**2+(y3-y4)**2 == (x2-x1)**2+(y2-y1)**2:
        if (x3-x1)**2+(y3-y1)**2 == (x2-x4)**2+(y2-y4)**2:
           print(x3,y3,x4,y4)
            exit()
  #print(que)
 #print(que2)			
solve()

import heapq
def solve():
  x1,y1,x2,y2 = (int(i) for i in input().split())
  x = x2-x1
  y = y2-y1
  print(x2-y,y2+x,x1-y,y1+x)
 	
solve()

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
x1,y1,x2,y2=map(int,input().split())
a=abs(x1-x2)
b=abs(y1-y2)
if(y1<=y2):
  if(x1<=x2):
    print(x2-b,y2+a,x1-b,y1+a)
    print('a')
  else:
    print(x2-b,y2-a,x1-b,y1-a)
    print('b')
else:
  if(x1<=x2):
    print(x2+a,y2+b,x1+a,y1+b)
    print('c')
  else:
    print(x2+b,y2+a,x1+b,y1-a)
    print('d')

x1,y1,x2,y2=map(int,input().split())
a=abs(x1-x2)
b=abs(y1-y2)
if(y1<=y2):
  if(x1<=x2):
    print(x2-b,y2+a,x1-b,y1+a)
    #print('a')
  else:
    print(x2-b,y2-a,x1-b,y1-a)
    #print('b')
else:
  if(x1<=x2):
    print(x2+b,y2+a,x1+b,y1+a)
    #print('c')
  else:
    print(x2+b,y2-a,x1+b,y1-a)
    #print('d')

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
x1, y1, x2, y2 = map(int, input().split())

y3 = y2 + x2- x1
y4 = x2 - x1 + y1
x3 = y1 - y2 + x2
x4 = y1 - y2 + x1

print(x3 y3 x4 y4)

x1, y1, x2, y2 = map(int, input().split())

y3 = y2 + x2- x1
y4 = x2 - x1 + y1
x3 = y1 - y2 + x2
x4 = y1 - y2 + x1

print(x3, y3, x4, y4)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
#import numpy as np
import math
#T= str(input())
#K = int(input())
x1,y1,x2,y2= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())

L=math.sqrt((x1-x2)**2 + (y1-y2)**2)

a=abs(x2-x1)
b=abs(y2-y1)


if x1 =< x2 and y1 =< y2:
    x3 = x2 - b
    y3 = y2 + a
    x4 = x1 - b
    y4 = y1 + a
elif x1 =< x2 and y1 => y2:
    x3 = x2 + b
    y3 = y2 + a
    x4 = x1 + b
    y4 = x1 + a
elif x1 => x2 and y1 =< y2:
    x3 = x2 - b
    y3 = y2 - a
    x4 = x1 - b
    y4 = y1 - a
elif x1 => x2 and y1 => y2:
    x3 = x2 + b
    y3 = y2 - a
    x4 = x1 + b
    y4 = x1 - a

print(x3,y3,x4,y4)

#import numpy as np
import math
#T= str(input())
#K = int(input())
x1,y1,x2,y2= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())

a=x2-x1
b=y2-y1

print(x2-b,y2+a,x1-b,y1+a)
exit()


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math

x1,y1,x2,y2=map(int, input().split())

#line = math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))

buf1=x2-x1
buf2=y2-y1

print(buf1,buf2)

print(x2-buf2,y2+buf1,x1-buf2,y1+buf1)

import math

x1,y1,x2,y2=map(int, input().split())

#line = math.sqrt(pow(x2-x1,2)+pow(y2-y1,2))

buf1=x2-x1
buf2=y2-y1

print(x2-buf2,y2+buf1,x1-buf2,y1+buf1)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, k = map(int, input().split())

ks = [x for x in range(1, n+1) if x % k == 0]
k2s = [x for x in range(1, n+1) if x % (k//2) == 0]

if k % 2 == 0: # if even
    print(len(k2s))
else:
    print(len(ks))

n, k = map(int, input().split())

ks = [x for x in range(1, n+1) if x % k == 0]

if k % 2 == 0: # if even
    k2s = [x for x in range(1, n+1) if x % (k//2) == 0 and x % k != 0] 
    print(len(ks) ** 3 + len(k2s) ** 3)
else:
    print(len(ks) ** 3)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n, k = map(int,input().split())

if k%2==0:
  print(2*(n//k)**3)
else:
  print((n//k)**3)

#!/usr/bin/env python3
import sys

def solve(N: int, K: int):
    if K%2 == 1:
        print((N//K)**3)
    else:
        a = 1+ (N-K//2)//K
        b = N//K
        print(a**3+b**3)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, K = map(int, input().split())

if N % 2:
  print(int(N / K))
else:
  even = int(N / K)
  odd = int(N / int(K / 2)) - even
  print(pow(even, 2) + pow(odd, 2))

N, K = map(int, input().split())
 
if K % 2:
  print(pow(int(N / K), 3)
else:
  even = int(N / K)
  odd = int(N / int(K / 2)) - even
  print(even, odd)
  print(pow(even, 3) + pow(odd, 3))

N, K = map(int, input().split())
 
if K % 2 == 1:
  print(pow(int(N / K), 3))
else:
  even = int(N / K)
  odd = int(N / int(K / 2)) - even
  print(pow(even, 3) + pow(odd, 3))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n, k  =map(int, input().split())

ans = 0

odd = [i for i in range(k, n+1, k)] 
ans += len(odd) ** 3 

if k % 2 == 0:
  
  even = [i ofr i in range(k//2, n+1, k)]
  ans += even
  
print(ans)


n, k  =map(int, input().split())

ans = 0

odd = [i for i in range(k, n+1, k)] 
ans += len(odd) ** 3 

if k % 2 == 0:
  
  even = [i for i in range(k//2, n+1, k)]
  ans += even
  
print(ans)



N,K = map(int, input().split())

a = N // K 
b = 0
if K % 2 == 0:
    b = a+1 if N - a*K >= K/2 else a
print(a**3 + b**3)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n,k=map(int,input().split())

if k%2!=0:
	print((n//k)**3)
else:
	if (n//k)*n+k//2>n:
		print((n//k)**3+(n//k)**3)
	else:
		print((n//k)**3+(n//k+1)**3)

n,k=map(int,input().split())

if k%2!=0:
	print((n//k)**3)
else:
	if (n//k)*k+(k//2)>n:
		print((n//k)**3+(n//k)**3)
	else:
		print((n//k)**3+(n//k+1)**3)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
ddd = list(map(int, input().split()))
n = ddd[0]
k = ddd[1]
count = 0

for i in range(n):
    a = i + 1
    if k % 2 == 1:
        if a % k != 0:
            bccount = 0
        else:
            bccount = (n // k) ** 2
    else:
        if a % k == 0:
            bccount = (n // k) ** 2
        elif a % k == k // 2:
            if n % k < k // 2:
                bccount = ((n // (k // 2)) // 2) ** 2
            else:
                bccount = ((n // (k // 2)) // 2 + 1) ** 2
        else:
            bccount = 0
        print(a, bccount)
    count = count + bccount

print(count)

ddd = list(map(int, input().split()))
n = ddd[0]
k = ddd[1]
count = 0

for i in range(n):
    a = i + 1
    if k % 2 == 1:
        if a % k != 0:
            bccount = 0
        else:
            bccount = (n // k) ** 2
    else:
        if a % k == 0:
            bccount = (n // k) ** 2
        elif a % k == k // 2:
            if n % k < k // 2:
                bccount = ((n // (k // 2)) // 2) ** 2
            else:
                bccount = ((n // (k // 2)) // 2 + 1) ** 2
        else:
            bccount = 0
    count = count + bccount

print(count)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, K = map(int, input().split())
if K % 2 == 1:
    print(sum(1 for n in range(1, N + 1) if n % K == 0) ** 3)
else:
    print(sum(1 for n in range(1, N + 1) if (n % K == 0) or (n % K == K // 2)) ** 3)

N, K = 35897, 932
print('ans: 114191')

if K % 2 == 1:
    print(sum(1 for n in range(1, N + 1) if n % K == 0) ** 3)
else:
    print(sum(1 for n in range(1, N + 1) if (n % K == 0) or (n % K == K // 2)) ** 3)

from itertools import product
N, K = map(int, input().split())
x = list(product(range(1, N + 1), repeat=3))
print(0)

N, K = map(int, input().split())
if K % 2 == 1:
    print(sum(1 for n in range(1, N + 1) if n % K == 0) ** 3)
else:
    print(sum(1 for n in range(1, N + 1) if n % (K / 2) == 0) ** 3)

N, K = map(int, input().split())
ans = (N // K) ** 3
ans += ((N + K // 2) // K) ** 3 if K % 2 == 0 else 0
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,K = list(map(int,input().split()))
print(int((N//K)**3) if K%2 == 1 else int((N//(K//2))**3))

N,K = list(map(int,input().split()))
print(int((N//K)**3) if K%2 == 1 else int((N//K)**3)+int((N//(K//2) - N//K)**3))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, K = map(int, input().split())

count = 0

for i in range(1,N):
    a = i
    for j in range(1,N):
        b = j

        div_ab = (a + b) % K
        if(div_ab !=0):
            continue

        for k in range(1,N):
            c = k

            div_bc = (b + c) % K
            div_ca = (c + a) % K

            if(div_ab ==0 and div_bc ==0 and div_ca ==0):
                count += 1

print(count)


N, K = map(int, input().split())
if(K%2 != 0):
    odd = (N // K)**3 
    print(int(odd))
else:
    c= N//(K/2)
    d= N//K
    e=c-d
    print(int(e**3 + d**3))


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,k = map(int, input().split())
count0 = 0
count1 = 0
for i in range(1,n+1):
    if i%k==0:
        count0+=1
    if i%k==k/2:
        count+=1

if k%2==0:
    print(count0**3+count1**3)
else:
    print(count0**3)

n,k = map(int, input().split())
count0 = 0
count1 = 0
for i in range(1,n+1):
    if i%k==0:
        count0 +=1
    if i%k==k/2:
        count1 +=1

if k%2==0:
    print(count0**3+count1**3)
else:
    print(count0**3)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n,k=map(int,input().split())
o=n//k
p=0
if (k%2==0) p=(n+(k//2))//k
print(o**3+p**3)


n,k=map(int,input().split())
o=n//k
p=0
if (k%2==0): p=(n+(k//2))//k
print(o**3+p**3)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):


using namespace std;

int main()
{
    long long n, k;
    cin >> n >> k;

    long long a = n / k, b = n / (k / 2) - a;
    long long c = a * a * a, d = b * b * b;
    if (k % 2 == 1)
        cout << c << endl;
    else
        cout << c + d << endl;
}


def main():
    n, k = map(int, input().split())
    x = sum(2 * i % k == 0 for i in range(1, k))
    a, b = n // k, n % k
    y = sum(2 * i % k == 0 for i in range(k * a + 1, k * a + b + 1))
    c = x * a + y
    ans = (x * a + y) ** 3 + a ** 3
    print(ans)


if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n,k=map(int,input().split())
if k%2==1:
    print((n//k)**3)
else:
    a=k//2
    b=n//a
    print((n//k)**3+(b*b*(n//k)))

n,k=map(int,input().split())
if k%2==1:
    print((n//k)**3)
else:
    a=k//2
    b=n//a-n//k
    print((n//k)**3+(b**3))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
    if(i%k==0 or (i%k==k//2 and k%2==0)):ans+=1
print(ans**3)
    

n,k=map(int,input().split())
ans=0
ans2=0
for i in range(1,n+1):
    if(i%k==0):ans+=1
    if(i%k==k//2 and k%2==0):ans2+=1
print(ans**3+ans2**3)
    

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,k = map(int,input().split())
if k % 2 == 0:
    print(((n//k)**3)+(((n+(k//2)//k)**3)))
else:
    print((n//k)**3)

n,k = map(int,input().split())
if k % 2 == 0:
    print(((n//k)**3)+(((n+(k//2))//k**3)))
else:
    print((n//k)**3)

n,k = map(int,input().split())
if k % 2 == 0:
    print(((n//k)**3)+((((n+(k//2))//k)**3)))
else:
    print((n//k)**3)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
ct1 = 0
ct2 = 0
for i in range(1, n + 1):
    if i % k == 0:
        ct1 += 1
if k % 2 == 1:
    print(ct1 ** 3)
else:
    for i in range(1, n):
        if i % k == (k // 2):
            ct2 += 1
    print(ct1 ** 3 + ct2 ** 3)


import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
ct1 = 0
ct2 = 0
for i in range(1, n + 1):
    if i % k == 0:
        ct1 += 1
if k % 2 == 1:
    print(ct1 ** 3)
else:
    for i in range(1, n + 1):
        if i % k == (k // 2):
            ct2 += 1
    print(ct1 ** 3 + ct2 ** 3)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, K = map(int, input().split(' '))
if K%2==0:
    if N%K <= K//2:
        print(2*(((N//K)+1)**3))
    else:
        print(((N//K)**3)+(((N//K)+1)**3))
else:
    print((N//K)**3)


N, K = map(int, input().split(' '))
a=N//K
if K%2==0:
    b=((N-K//2)//K)+1
    print((a**3) +(b**3))
else:
    print(a**3)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,K = map(int,input().split())

div = N//K

if K % 2 == 1:
    ans = div**3
else:
    div2 = N//(K/2)
    ans = div**3 + div2**3

print(ans)

N,K = map(int,input().split())

div = N//K

if K % 2 == 1:
    ans = div**3
else:
    div2 = int(N+K/2)//K
    ans = div**3 + div2**3

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, K = map(int, input().split())

X = [x for x in range(1,N+1)]
Xn = [x for x in X if x % K == 0]
Xn2 = [x for x in X if (x % K == K/2) or (x % K == 0)]

if K % 2 != 0:
    ans = (len(Xn)**len(Xn))
else:
    ans = (len(Xn2)**len(Xn2))
print(ans)


N, K = map(int, input().split())

X = [x for x in range(1,N+1)]
Xn = [x for x in X if x % K == 0]

c_odd = 0
c_even1 = 0
c_even2 = 0

for x in X:
    if x % K == 0:
        c_odd += 1
        c_even1 += 1
    elif x % K == K/2:
        c_even2 += 1

if K % 2 != 0:
    ans = c_odd ** 3
else:
    ans = c_even1 ** 3 + c_even2 ** 3
      
print(ans) 

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, k = map(int, input().split())
cnt = 0
l = n//k
print(l)
for i in range(k):
    if (i*3)%k == i%k:
        if i==0:
            cnt +=l**3
        elif i%k <= n%k:
            cnt += (l+1)**3
        else:
            cnt += l**3
print(cnt)

n, k = map(int, input().split())
cnt = 0
l = n//k
for i in range(k):
    if (i*3)%k == i%k:
        if i==0:
            cnt +=l**3
        elif i%k <= n%k:
            cnt += (l+1)**3
        else:
            cnt += l**3
print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,K = map(int,input().split())
N_d = N*2
ans = 0
kl = [K*x for x in range(1,N_d//K+1)]
s=kl[-1]
t=kl[-2]
if K%2==1:
  a=s//K
  if a%2==0:
    b = a//2
    ans = pow(b,3)
    
  else:
    b=a//2
    ans = pow(b,3)+3
    
else:
  half_K = K//2
  a = s//K
  if a%2==0:
    b = a//2
    ans+=pow(b,3)
  else:
    b=a//2
    ans += pow(b,3)+3
    
  b = t//K
  if b%2==0:
    c = b//2
    ans+=pow(c,3)
  else:
    c=b//2
    ans+=pow(b,3)+3
  
print(ans)

N,K = map(int,input().split())
ans = 0
if K%2==1:
  ans = (N//K) ** 3
else:
  half_K = K//2
  a = N//K
  b = N//half_K - a
  ans = a**3+b**3

print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n, k = [int(i) for i in input().split()]

ans = [0, 0]

for i in range(1, n+1):
    if k % 2 == 0 and i % k == d:
        ans[0] += 1
    if i % k == 0:
        ans[1] += 1

print(ans[0] ** 3 + ans[1] ** 3)

n, k = [int(i) for i in input().split()]

ans = (n // k) ** 3
if k % 2 == 0:
  ans += ((n - k // 2) // k + 1) ** 3

print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n,k=map(int,input().split())
ans=(n//k)**3
if k%2==0:
  ans+=(n//(k//2))**3
print(ans)

n,k=map(int,input().split())
ans=(n//k)**3
if k%2==0:
  ans+=(n//(k//2)-n//k)**3
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
# input
N, K = map(int, input().split())


if K % 2 == 0:
    a = N / K
    b = (N + (K / 2)) / K
    print(a ** 3 + b ** 3)
else:
    a = N / K
    print(a ** 3)
    

# input
N, K = map(int, input().split())


if K % 2 == 0:
    a = N // K
    b = (N + (K // 2)) // K
    print(a ** 3 + b ** 3)
else:
    a = N // K
    print(a ** 3)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,k = map(int,input().split())
if k%2!=0:
  x = int(n//k)
  print(x**3)
else:
  k1 = k//2
  y = (n-k1)//k
  x = int(n//k)
  print(int(x**3+y**3))

n,k = map(int,input().split())
if k%2!=0:
  x = int(n//k)
  print(x**3)
else:
  k1 = k//2
  y = (n+k1)//k
  x = int(n//k)
  print(int(x**3+y**3))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def solve(N, K):
    ans = 0
    k = len([n for n in range(1, N + 1) if n % K == 0])
    ans += k * k * k
    if K % 2 == 0:
        k = len([n for n in range(1, N + 1) if n % K == K // 2])
        ans += k * k * k

    return ans

if __name__ == "__main__":
    N, K = tuple(map(int, input(" ")))
    print(solve(N, K))


def solve(N, K):
    ans = 0
    k = len([n for n in range(1, N + 1) if n % K == 0])
    ans += k * k * k
    if K % 2 == 0:
        k = len([n for n in range(1, N + 1) if n % K == K // 2])
        ans += k * k * k

    return ans

if __name__ == "__main__":
    N, K = tuple(map(int, input().split(" ")))
    print(solve(N, K))


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N, K = map(int, input().split())
div = N // K
if K % 2 == 1:
    print(div**3)
else:
    if div * N + K // 2 <= N:
        print(div**3 + (div + 1)**3)
    else:
        print(2 * div**3)

N, K = map(int, input().split())
div = N // K
if K % 2 == 1:
    print(div**3)
else:
    if div * K + K // 2 <= N:
        print(div**3 + (div + 1)**3)
    else:
        print(2 * div**3)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
#108c
import math
N,K = map(int, input().split())





#
#for a in range(1,N+1):
#    if K>a:
#        base = K-a
#    else:

#    

#   
#    for b in b_list:
#        if K > b:
#            base = K-b
#        else:

#

#        
#        for c in c_list:
#            if (a+c)%K == 0:
#                ans += 1

#                
#print(ans)



#ex
#31415 9266
#4633 4633 4633 : 0.5 0.5 0.5
#4633 4633 13899 : 0.5 0.5 1.5
#9266 9266 9266 : 1.0 1.0 1.0
#9266 9266 18532 : 1.0 1.0 2.0
#9266 9266 27798 : 1.0 1.0 3.0



if K==1:
    
    print(N*N*N)
    
elif K%2 == 0:
    
    print([int(i*K/2) for i in range(1,1+2*math.floor(N/K)) if i%2 == 1])
    ans = len([int(i*K/2) for i in range(1,1+2*math.floor(N/K)) if i%2 == 1]) **3
    print([i*K for i in range(1,1+math.floor(N/K))])
    ans += math.floor(N/K)**3
    print(ans)
elif K%2 == 1:
    print([i*K for i in range(1,1+math.floor(N/K))])
    print((math.floor(N/K)**3))

#108c
import math
N,K = map(int, input().split())






if K == 1:
    
    print(pow(N,3))
else:
    
    #K*n <= N
    #n <= N/K
    #print("(2)K*n")
    print([i*K for i in range(1,1+int(N/K))])
    ans = pow(int(N/K),3)
    
    if K%2 == 0:
        
        #K/2*(2n+1) <= N
        #K*(2n+1) <= 2N
        #2n+1 <= 2N/K
        #2n <= 2N/K - 1
        #n <= N/K - 1/2
        n_limit = int(N/K - 1/2)
        #print("(1)K/2*(2n+1)")
        if K/2 <= N:
            print([int((K/2)*(1+(2*i))) for i in range(0,n_limit + 1)])
            ans += pow(n_limit + 1,3) 
    
    print(ans)

#108c
import math
N,K = map(int, input().split())






if K == 1:
    
    print(pow(N,3))
else:
    
    #K*n <= N
    #n <= N/K
    #print("(2)K*n")
    
    ans = pow(int(N/K),3)
    
    if K%2 == 0:
        
        #K/2*(2n+1) <= N
        #K*(2n+1) <= 2N
        #2n+1 <= 2N/K
        #2n <= 2N/K - 1
        #n <= N/K - 1/2
        n_limit = int(N/K - 1/2)
        #print("(1)K/2*(2n+1)")
        if K/2 <= N:
            
            ans += pow(n_limit + 1,3) 
    
    print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,K = map(int,input().split())
if K % 2 == 1:
    print((N // K )**3)

N,K = map(int,input().split())
if K % 2 == 1:
    print((N // K )**3)
else:
    print(((N//(K//2))-(N//K))**3 + (N//K)**3)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,k=map(int,input().split())

if k % 2 != 0:
    w = n // k
    print(w**3)
else:
    w1 = n // k
    w2 = round(n/k)
    print(w1,w2)
    print((w1 ** 3) + (w2 ** 3) )


n,k=map(int,input().split())

if k % 2 != 0:
    w = n // k
    print(w**3)
else:
    w1 = n // k
    w2 = (n + (k//2)) // k
    print(w1,w2)
    print((w1 ** 3) + (w2 ** 3) )


n,k=map(int,input().split())

if k % 2 != 0:
    w = n // k
    print(w**3)
else:
    w1 = n // k
    w2 = (n + (k//2)) // k
    print((w1 ** 3) + (w2 ** 3) )


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,K = map(int,input().split())
if K % 2 == 0:
    a = N // K 
    b = N // (k / 2) - a 
    print(a**3 + b ** 3)
else:
    a = N // K
    print(a**3)

N,K = map(int,input().split())
if K % 2 == 0:
    a = N // K 
    b = N // (K / 2) - a 
    print(a**3 + b ** 3)
else:
    a = N // K
    print(a**3)

N,K = map(int,input().split())
if K % 2 == 0:
    a = N // K 
    b = N // (k / 2) - a 
    print(a**3 + b ** 3)
else:
    a = N // K
    print(a**3)

N,K = map(int,input().split())
if K % 2 == 0:
    a = int(N // K)
    b = int(N // (K / 2) - a)
    print(a**3 + b**3)
else:
    a = int(N // K)
    print(a**3)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N, K = map(int, input().split())

if K % 2 == 0:
  m = N // K
  if N % K == 0:
    n = m + 1
  else:
    n = m
  print (m ** 3 + n ** 3)
else:
  m = N // K
  print (m ** 3)

N, K = map(int, input().split())

if K % 2 == 0:
  print ((N // K) ** 3 + ((N+(K//2))//K) ** 3)
else:
  print ((N // K) ** 3)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, K = map(int, input().split())

if K % 2 != 0:
    ans = (N // K)**3
else:
    full = []
    for i in range(K, N, K):
        full.append(i)
        ans = len(full) ** 3

    half = []
    for i in range(int(K/2), N, int(K/2)):
        half.append(i)
        half = list(set(half) - set(full))
        ans += len(half) ** 3

print(ans)

N, K = map(int, input().split())

# N, K = 3, 2

if K % 2 != 0:
    ans = (N // K)**3
else:
    full = []
    half = []
    for i in range(int(K/2), N+1, int(K/2)):
        if i % K == 0:
            full.append(i)
        else:
            half.append(i)

    ans += len(half) ** 3 + len(full) ** 3

print(ans)

N, K = map(int, input().split())

# N, K = 3, 2

if K % 2 != 0:
    ans = (N // K)**3
else:
    full = []
    for i in range(K, N+1, K):
        full.append(i)
    print(full)
    ans = len(full) ** 3

    half = []
    for i in range(int(K/2), N+1, int(K/2)):
        half.append(i)
        half = list(set(half) - set(full))
    print(half)
    ans += len(half) ** 3


print(ans)

N, K = map(int, input().split())

# N, K = 3, 2

if K % 2 != 0:
    ans = (N // K)**3
else:
    full = []
    half = []
    for i in range(int(K/2), N+1, int(K/2)):
        if i % K == 0:
            full.append(i)
        else:
            half.append(i)

    ans = len(half) ** 3 + len(full) ** 3

print(ans)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, k = list(map(int, input().split()))
res = 0
if k == 1:
  print(n ** 3)
  exit()
if k == 2:
  num_odd = n // 2 + n % 2
  res = num_odd ** 3
num_baisuu = n // k
res += num_baisuu ** 3
if k % 2 == 0:
  nn = n + k / 2
  num_baisuu = nn // k
  res += num_baisuu ** 3
print(int(res))

n, k = list(map(int, input().split()))
res = 0
if k == 1:
  print(n ** 3)
  exit()
if k == 2:
  num_odd = n // 2 + n % 2
  res = num_odd ** 3
num_baisuu = n // k
res += num_baisuu ** 3
if k % 2 == 0:
  nn = n + k / 2
  num_baisuu = nn // k
  res += num_baisuu ** 3
print(int(res))

n, k = list(map(int, input().split()))
res = 0
if k == 1:
  print(n ** 3)
  exit()
num_baisuu = n // k
res += num_baisuu ** 3
if k % 2 == 0:
  nn = n + k / 2
  num_baisuu = nn // k
  res += num_baisuu ** 3
print(int(res))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import collections
n,k=list(map(int,input().split()))
l_n=[(v+1)%k for v in range(n)]
c = collections.Counter(l_n)
m = len(c)
ret=0
if k%2==0:
    for i in range(0,m,k/2):
        for j in range(0,m,k/2):
            if (i+j)%k==0:
                for r in range(0,r,k/2):
                    if(i+r)%k==0 and(r+j)%k==0:
                        ret+=c[i]*c[j]*c[r]
else:
    for i in range(0,m,k):
        for j in range(0,m,k):
            if (i+j)%k==0:
                for r in range(0,m,k):
                    if (i+r)%k ==0 and (r+j)%k==0:
                        ret+=c[i]*c[j]*c[r]
print(ret)
            
    


n, k = map(int, input().split())
print(sum([1 if v % k == 0 else 0 for v in range(1, n+1)])**3 +
      sum([1 if v % k == k/2 else 0 for v in range(1, n+1)])**3)


Verdicts: Runtime Error

Accepted