Problem:
 Score : 200 points    Problem Statement 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.      Constraints  |x_1|,|y_1|,|x_2|,|y_2| \leq 100  (x_1,y_1) ≠ (x_2,y_2)  All values in input are integers.         Input Input is given from Standard Input in the following format:  x_1  y_1  x_2  y_2       Output Print x_3,y_3,x_4 and y_4 as integers, in this order.        Sample Input 1 0 0 0 1      Sample Output 1 -1 1 -1 0  (0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-clockwise order.
Note that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as the vertices are in clockwise order.       Sample Input 2 2 3 6 6      Sample Output 2 3 10 -1 7       Sample Input 3 31 -41 -59 26      Sample Output 3 -126 -64 -36 -131

Solution (Python):
a,b,c,d=map(int,input().split(" "))
if abs(a-c)>abs(b-d):
    if a>c:
        if b>d:
            print(c+(b-d),d-(a-c),a+(b-d),b-(a-c))
        else:
            print(c-(d-b),d-(a-c),a-(d-b),b-(a-c))
    else:
        if b>d:
            print(c+(b-d),d+(c-a),a+(b-d),b+(c-a))
        else:
            print(c-(d-b),d+(c-a),a-(d-b),b+(c-a))
else:
    if b>d:
        if a>c:
            print(c+(b-d),d-(a-c),a+(b-d),b-(a-c))
        else:
            print(c+(b-d),d+(c-a),a+(b-d),b+(c-a))
    else:
        if a>c:
            print(c-(d-b),d-(a-c),a-(d-b),b-(a-c))
        else:
            print(c-(d-b),d+(c-a),a-(d-b),b+(c-a))

Solution (Python):
x1, y1, x2, y2 = map(int, input().split())
diffX = x2 - x1
diffY = y2 - y1
x3 = 0
y3 = 0
x4 = 0
y4 = 0
if diffX >= 0 & diffY >= 0:
    x3 = x2 + diffY * -1
    y3 = y2 + diffX
    x4 = x3 + diffX * -1
    y4 = y3 + diffY * -1
elif diffX >= 0 & diffY <= 0:
    x3 = x2 + diffY * -1
    y3 = y2 + diffX
    x4 = x3 + diffX
    y4 = y3 + diffY
elif diffX <= 0 & diffY >= 0:
    x3 = x2 + diffY * -1
    y3 = y2 + diffX
    x4 = x3 + diffX * -1
    y4 = y3 + diffY * -1
elif diffX <= 0 & diffY <= 0:
    x3 = x2 + diffY
    y3 = y2 + diffX * -1
    x4 = x3 + diffX
    y4 = y3 + diffY
print(x3, y3, x4, y4)

Solution (Python):
from sys import stdin, stdout

input = lambda: stdin.readline()
write = stdout.write

def main():
    X1, Y1, X2, Y2 = map(int, input().split())

    l1 = abs(max(X1, X2) - min(X1, X2))
    l2 = abs(max(Y1, Y2) - min(Y1, Y2))
    if X1 <= X2 and Y1 <= Y2:
        x3 = X2 - l2
        y3 = Y2 + l1
        x4 = x3 - l1
        y4 = y3 - l2
    elif X1 > X2 and Y1 < Y2:
        x3 = X2 - l2
        y3 = Y2 - l1
        x4 = x3 + l1
        y4 = y3 - l2
    elif X1 >= X2 and Y1 >= Y2:
        x3 = X2 + l2
        y3 = Y2 - l1
        x4 = x3 + l1
        y4 = y3 + l2
    elif X1 < X2 and Y1 > Y2:
        x3 = X2 + l1
        y3 = Y2 + l2
        x4 = x3 - l2
        y4 = y3 + l1
    print(x3, y3, x4, y4)

main()

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

print(str(x3)+ ' ' + str(y3)+ ' ' + str(x4) +  ' ' + str(y4))

Solution (Python):
x1,y1,x2,y2 = list(map(int,input().split()))

dx = x2 - x1
dy = y2 - y1

x3,y3,x4,y4 = [0,0,0,0]

if dx > 0 and dy > 0:
    x3 = x2 - abs(dy)
    y3 = y2 + abs(dx)
    x4 = x3 - abs(dx)
    y4 = y3 - abs(dy)
elif dx < 0 and dy > 0:
    x3 = x2 - abs(dy)
    y3 = y2 - abs(dx)
    x4 = x3 + abs(dx)
    y4 = y3 - abs(dy)
elif dx < 0 and dy < 0:
    x3 = x2 + abs(dy)
    y3 = y2 - abs(dx)
    x4 = x3 + abs(dx)
    y4 = y3 + abs(dy)
elif dx > 0 and dy < 0:
    x3 = x2 + abs(dy)
    y3 = y2 + abs(dx)
    x4 = x3 - abs(dx)
    y4 = y3 + abs(dy)
elif dx == 0:
    if dy > 0:
        x3 = x2 - abs(dy)
        y3 = y2
        x4 = x3
        y4 = y1
    else:
        x3 = x2 + abs(dy)
        y3 = y2
        x4 = x3
        y4 = y1
elif dy == 0:
    if dx > 0:
        x3 = x2
        y3 = y2 + abs(dx)
        x4 = x1
        y4 = y3
    else:
        x3 = x2
        y3 = y2 - abs(dx)
        x4 = x1
        y4 = x3
else:
    print("e")
    exit()

print(x3,y3,x4,y4)

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

ll = (x2-x1)**2 + (y2-y1)**2
if (x1>=x2):
    if (y1>=y2):
        l=x1-x2
        s=y1-y2
        x3=x2+s
        x4=x1+s
        y3=y2-l
        y4=y1-l
    else:
        l=y2-y1
        s=x1-x2
        x3=x2-l
        x4=x1-l
        y3=y2-s
        y4=y1-s
else:
    if (y1<=y2):
        l=x2-x1
        s=y2-y1
        x3=x2-s
        x4=x1-s
        y3=y2+l
        y4=y1+l
    else:
        l=y1-y2
        s=x2-x1
        x3=x2+l
        x4=x1+l
        y3=y2+s
        y4=y1+s
        


print(x3, y3, x4, y4)

Solution (Python):



def main():
    x1, y1, x2, y2 = map(int, raw_input().split())
    if x1 <= x2 and y1 >= y2:
        a = abs(y1 - y2)
        b = abs(x1 - x2)
        y3 = y2 + b
        x3 = x2 + a
        y4 = y3 + a
        x4 = x3 - b
    elif x1 <= x2 and y1 <= y2:
        a = abs(x1 - x2)
        b = abs(y1 - y2)
        y3 = y2 + a
        x3 = x2 - b
        y4 = y3 - b
        x4 = x3 - a
    elif x1 >= x2 and y1 >= y2:
        b = abs(y1 - y2)
        a = abs(x1 - x2)
        y3 = y2 - a
        x3 = x2 + b
        y4 = y3 + b
        x4 = x3 + a
    elif x1 >= x2 and y1 <= y2:
        a = abs(y1 - y2)
        b = abs(x1 - x2)
        y3 = y2 - b
        x3 = x2 - a
        y4 = y3 - a
        x4 = x3 + b

    print("%s %s %s %s " % (x3, y3, x4, y4))


if __name__ == "__main__":
    main()

Solution (Python):
import math
l = input().split()

x1 = int(l[0])
y1 = int(l[1])
x2 = int(l[2])
y2 = int(l[3])

yoko = x2-x1
tate = y2-y1

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

  
print(str(x3)+' '+str(y3)+' '+str(x4)+' '+str(y4))

Solution (Python):
import numpy as np

def get_rotation_matrix(rad):
    rot = np.array([[np.cos(rad), -np.sin(rad)],
                  [np.sin(rad), np.cos(rad)]])
    return rot

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

vec1=np.array([x1,y1])
vec2=np.array([x2,y2])

vec2to1=vec1-vec2
vec2to3=np.dot(get_rotation_matrix(np.pi*3/2),vec2to1)

vec1to2=vec2-vec1
vec1to4=np.dot(get_rotation_matrix(np.pi/2),vec1to2)

vec3=vec2+vec2to3
vec4=vec1+vec1to4

print(
  int(round(vec3[0],0)),
  int(round(vec3[1],0)),
  int(round(vec4[0],0)),
  int(round(vec4[1],0)))

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

v = (x2-x1, y2-y1)
print('%d %d %d %d' % (x2-v[1], y2+v[0], x1-v[1], y1+v[0]))

Solution (Python):
def solve(x1, y1, x2, y2):

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

    return " ".join(str(i) for i in [x3, y3, x4, y4])

if __name__ == "__main__":
    l = input()
    x1, y1, x2, y2 = int(l.split()[0]),int(l.split()[1]), int(l.split()[2]), int(l.split()[3])
    print(solve(x1, y1, x2, y2))

Solution (Python):
import numpy as np
import math

line = input().split()
x1 = int(line[0])
y1 = int(line[1])
x2 = int(line[2])
y2 = int(line[3])

a = x2-x1
b = y2-y1
r = math.sqrt(a*a + b*b)


x3 = x2 - b
y3 = y2 + a
x4 = x3 - a
y4 = y3 - b

print("{} {} {} {}".format(x3, y3, x4, y4))

Solution (Python):
def next(x1,y1,x2,y2):
  xd = x2 - x1
  yd = y2 - y1
  nyd = xd
  nxd = -yd
  return [x2+nxd,y2+nyd]

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

Solution (Python):
x1, y1, x2, y2 = list(map(int, input().split()))
diff_x = x2 - x1
diff_y = y2 - y1
if diff_x > 0:
  if diff_y > 0:
    x3 = x2 - diff_y
    y3 = y2 + diff_x
    x4 = x3 - diff_x
    y4 = y3 - diff_y
  if diff_y == 0:
    x3 = x2
    y3 = y2 + diff_x
    x4 = x3
    y4 = y1
  if diff_y < 0:
    x3 = x2 - diff_y
    y3 = y2 + diff_x
    x4 = x3 - diff_x
    y4 = y3 - diff_y
if diff_x == 0:
    x3 = x2 - diff_y
    y3 = y2
    x4 = x3
    y4 = y1
if diff_x < 0:
  if diff_y > 0:
    x3 = x2 - diff_y
    y3 = y2 + diff_x
    x4 = x3 - diff_x
    y4 = y3 - diff_y
  if diff_y == 0:
    x3 = x2
    y3 = y2 + diff_x
    x4 = x1
    y4 = y3
  if diff_y < 0:
    x3 = x2 - diff_y
    y3 = y2 + diff_x
    x4 = x3 - diff_x
    y4 = y3 - diff_y
print("{} {} {} {}".format(x3, y3, x4, y4))

Solution (Python):




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

    dx, dy = abs(x2-x1), abs(y2-y1)
    if x2 < x1:
        if y1 < y2:
            x3, y3 = x2 - dy, y2 - dx
            x4, y4 = x1 - dy, y1 - dx
        else:
            x3, y3 = x2 + dy, y2 - dx
            x4, y4 = x1 + dy, y1 - dx

    else:
        if y1 < y2:
            x3, y3 = x2 - dy, y2 + dx
            x4, y4 = x1 - dy, y1 + dx
        else:
            x3, y3 = x2 + dy, y2 + dx
            x4, y4 = x1 + dy, y1 + dx

    print(x3, y3, x4, y4)


if __name__ == '__main__':
    main()

Solution (Python):
x1,y1,x2,y2 = map(int,input().split())
x3 = y1 - y2 + x2
y3 = x2 - x1 + y2
x4 = x1 + y1 - y2
y4 = y1 + x2 - x1
print("%d %d %d %d" %(x3,y3,x4,y4))

Solution (Python):


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

X = x2 - x1
Y = y2 - y1

if X > 0 and Y > 0:
    x3 = x2 - abs(Y)
    y3 = y2 + abs(X)
    x4 = x3 - abs(X)
    y4 = y3 - abs(Y)

elif X > 0 and Y < 0:
    x3 = x2 + abs(Y)
    y3 = y2 + abs(X)
    x4 = x3 - abs(X)
    y4 = y3 + abs(Y)
    
elif X < 0 and Y > 0:
    x3 = x2 - abs(Y)
    y3 = y2 - abs(X)
    x4 = x3 + abs(X)
    y4 = y3 - abs(Y)

elif X < 0 and Y < 0:
    x3 = x2 + abs(Y)
    y3 = y2 - abs(X)
    x4 = x3 + abs(X)
    y4 = y3 + abs(Y)

elif X > 0 and Y == 0:
    x3 = x2
    y3 = y2 + abs(X)
    x4 = x3 - abs(X)
    y4 = y3

elif X == 0 and Y > 0:
    x3 = x2 - abs(Y)
    y3 = y2
    x4 = x3
    y4 = y3 - abs(Y)

elif X < 0 and Y == 0:
    x3 = x2
    y3 = y2 - abs(X)
    x4 = x3 + abs(X)
    y4 = y3

elif X == 0 and Y < 0:
    x3 = x2 + abs(Y)
    y3 = y2
    x4 = x3
    y4 = y3 + abs(Y)

print(str(x3) + ' ' + str(y3) + ' ' + str(x4) + ' ' + str(y4))

Solution (Python):
x1, y1, x2, y2 = list(map(int, input().split()))

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

print(x3, y3, x4, y4)

Solution (Python):
def dis( x1,y1,x2,y2):

	dist = (x1-x2)**2 + (y1-y2)**2
	return dist;

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

if y1!=y2:

	if y1>y2:
		dire = 1;
	else:
		dire=-1;

	num = ( x1-x2 )
	den = ( y2 - y1 )

	L = x2;
	R = 99999999999999;
	flag=0;
	while ( R-L > 1):

		mid = ( L + R )//2;

		x3 = mid;
		y3 = ( num*( x3 - x2 ) + y2*den )//den;

		
		b = dis( x2,y2,x3,y3)

		if b==temp:
			flag=1;
			break;
		elif b > temp:
			R = mid-1;
		else:
			L = mid+1;
	
	if flag==0:
		mid = L;
		x3 = mid;
		y3 = ( num*( x3 - x2 ) + y2*den )//den;

		b = dis( x2,y2,x3,y3)

		if b==temp:
			x3 = L;
		else:
			x3 = R;
	
	
	y3 = ( num*( x3 - x2 ) + y2*den )//den;
	

	if dire == -1:

		x3 = x2 - ( x3-x2)
	y3 = ( num*( x3 - x2 ) + y2*den )//den;
	x4 = x1+x3-x2;
	y4 = y1+y3-y2;

	print( x3,y3,x4,y4);
else:

	x3 = x2;
	if x1>x2:
		dire=-1;
	else:
		dire=1;

	L = y2;
	R = 9999999999999;

	while ( R-L > 1):

		mid = ( L + R )//2;

		y3 = mid;

		b = dis( x2,y2,x3,y3)

		if b==temp:
			flag=1;
			break;
		elif b > temp:
			R = mid-1;
		else:
			L = mid+1;
	
	if flag==0:
		mid = L;
		y3 = mid;

		b = dis( x2,y2,x3,y3)

		if b==temp:
			y3 = L;
		else:
			y3 = R;

	if dire == -1:
		y3 = y2 - (y3-y2);
			
	x4 = x1+x3-x2;
	y4 = y1+y3-y2;

	print( x3,y3,x4,y4);

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

Solution (Python):
A, B, C, D = (int(i) for i in input().split())
if D > B and A > C:
    E = (C - (D - B))
    F = D - (A - C)
    G = (A - (D - B))
    H = B - (A - C)
    print(E, F, G, H)
elif A > C and B > D:
    E = C + (B - D)
    F = D - (A - C)
    G = A + (B - D)
    H = B - (A - C)
    print(E, F, G, H)
elif B > D and C > A:
    E = (C + (B - D))
    F = D + (C - A)
    G = (A + (B - D))
    H = B + (C - A)
    print(E, F, G, H)
else:
    E = C - (D - B)
    F = D + (C - A)
    G = A - (D - B)
    H = B + (C - A)
    print(E, F, G, H)

Solution (Python):
x1, y1, x2, y2 = list(map(int, input().split()))

edge = [x2-x1, y2-y1]

if edge[0] >= 0  and edge[1] >= 0:
    x3, y3 = x2  - abs(edge[1]), y2 + abs(edge[0])
    x4, y4 = x3  - abs(edge[0]), y3 - abs(edge[1])
elif edge[0] >= 0 and edge[1] < 0:
    x3, y3 = x2  + abs(edge[1]), y2 + abs(edge[0])
    x4, y4 = x3  - abs(edge[0]), y3 + abs(edge[1])
elif edge[0] < 0 and edge[1] >=0:
    x3, y3 = x2  - abs(edge[1]), y2 - abs(edge[0])
    x4, y4 = x3  + abs(edge[0]), y3 - abs(edge[1])
else:
    x3, y3 = x2  + abs(edge[1]), y2 - abs(edge[0])
    x4, y4 = x3  + abs(edge[0]), y3 + abs(edge[1])
    
print(x3, y3, x4, y4)

Solution (Python):



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

if x1 > x2:
    if y1 > y2:
        x3 = x2 + del_y
        y3 = y2 - del_x
        x4 = x3 + del_x
        y4 = y3 + del_y
    else:
        x3 = x2 - del_y
        y3 = y2 - del_x
        x4 = x3 + del_x
        y4 = y3 - del_y
else:
    if y1 > y2:
        x3 = x2 + del_y
        y3 = y2 + del_x
        x4 = x3 - del_x
        y4 = y3 + del_y
    else:
        x3 = x2 - del_y
        y3 = y2 + del_x
        x4 = x3 - del_x
        y4 = y3 - del_y


print(str(x3) + " " + str(y3) + " " + str(x4) + " " + str(y4))

Solution (Python):
x1,y1,x2,y2=map(int,input().split())
print(x2-y2+y1,y2+x2-x1,x1-y2+y1,y1+x2-x1)

Solution (Python):
import numpy as np

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

X1 = np.array([x1, y1])
X2 = np.array([x2, y2])

A = np.array([[0, -1], [1, 0]])
X3 = X2 + np.dot(A, X2 - X1)
X4 = X3 + np.dot(A, X3 - X2)

print(X3[0], X3[1], X4[0], X4[1])

Solution (Python):


 
def main():
	n = list(map(int, input().split()))
	x = abs(n[0] - n[2])
	y = abs(n[1] - n[3])
	if n[0] < n[2]:
		if n[1] < n[3]:
			print(n[2]-y,n[3]+x,n[0]-y,n[1]+x)
		else:
			print(n[2]+y,n[3]+x,n[0]+y,n[1]+x)
	else:
		if n[1] > n[3]:
			print(n[2]+y,n[3]-x,n[0]+y,n[1]-x)
		else:
			print(n[2]-y,n[3]-x,n[0]-y,n[1]-x)


if __name__ == '__main__':
	main()

Solution (Python):


pos = [[0,0],[0,0],[0,0],[0,0]]

pos[0][0],pos[0][1],pos[1][0],pos[1][1] = map(int,raw_input().split())

vect = [pos[1][0] - pos[0][0], pos[1][1] - pos[0][1]]

vect_2 = [-vect[1], vect[0]]

pos[2] = [pos[1][0] + vect_2[0], pos[1][1] + vect_2[1]]
pos[3] = [pos[0][0] + vect_2[0], pos[0][1] + vect_2[1]]

print str(pos[2][0]) + " " + str(pos[2][1]) + " " + str(pos[3][0]) + " " + str(pos[3][1])

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

abx,aby=x2-x1,y2-y1
x3,y3=x2-aby,y2+abx
x4,y4=x3-abx,y3-aby
print(x3,y3,x4,y4)

Solution (Python):
x1, y1, x2, y2 = map(int, input().split())
sa = [x2-x1, y2-y1]
x3, y3 = x2-sa[1], y2+sa[0]
x4, y4 = x1-sa[1], y1+sa[0]
print(x3, y3, x4, y4)

Solution (Python):

p = list(map(int, input().split()))

x1 = p[0]
y1 = p[1]
x2 = p[2]
y2 = p[3]

X = int(x2 - x1)
Y = int(y2 - y1)

x3 = x2 - Y
y3 = y2 + X

x4 = x1 - Y
y4 = y1 + X

print(x3,y3,x4,y4)

Solution (Python):
a, b, c, d = map(int, input().split())
e = c - a
f = d - b
g = c - f
h = d + e
i = a - f
j = b + e
str(g)
str(h)
str(i)
str(j)
print(g, h, i, j)

Solution (Python):
x1, y1, x2, y2 = list(map(int, input().split()))

xx = x2 - x1
yy = y2 - y1

x3 = x2 - yy
y3 = y2 + xx
x4 = x3 - xx
y4 = y3 - yy

print(x3, y3, x4, y4)

Solution (Python):
a = list(map(int, input().split()))
vec = [a[2] - a[0], a[3] - a[1]]
res = [0,0,0,0]
res[2] = a[0] - vec[1]
res[3] = a[1] + vec[0]

res[0] = res[2] + vec[0]
res[1] = res[3] + vec[1]

print(res[0], res[1], res[2], res[3])

Solution (Python):
xa,ya,xb,yb=map(int,input().split())
dx,dy=xa-xb,ya-yb
if dx>0:
	if dy>0:
		x3,y3=xb+dy,yb-dx
		x4,y4=xa+dy,ya-dx
	else:
		x3,y3=xb+dy,yb-dx
		x4,y4=xa+dy,ya-dx
else:
	if dy>0:
		x3,y3=xb+dy,yb-dx
		x4,y4=xa+dy,ya-dx
	else:
		x3,y3=xb+dy,yb-dx
		x4,y4=xa+dy,ya-dx


print('{0} {1} {2} {3}'.format(x3,y3,x4,y4))

Solution (Python):
x_1,y_1,x_2,y_2 =map(int, input().split())
X = x_2-x_1
Y = y_2-y_1

x_4 = -Y + x_1
y_4 = X + y_1

x_3 = x_4 - x_1 +  x_2
y_3 = y_4 - y_1  + y_2

print(x_3,y_3,x_4,y_4)

Solution (Python):
a, b, c, d = map(int, input().split())
e = a-c
f = b-d
print(c + f, d-e, a+f, b-e)

Solution (Python):
import numpy as np
x1, y1, x2, y2 = map(int, input().split())

R = np.array([[0,-1],[1,0]])

r1 = np.array([x2-x1, y2-y1])
r2 = np.dot(R, r1)
x3, y3 = r2 + np.array([x2, y2])
r3 = np.dot(R, r2)
x4, y4 = r3 + np.array([x3, y3])

print(x3, y3, x4, y4)

Solution (Python):
xy = list(map(int,input().split()))

if xy[2] - xy[0] == 0:
    if xy[3] > xy[1]:
        x3 = xy[2] - (xy[3]-xy[1])
        y3 = xy[3] - (xy[2]-xy[0])
        x4 = xy[0] - (xy[3]-xy[1])
        y4 = xy[1] - (xy[2]-xy[0])
    else:
        x3 = xy[2] + (xy[1]-xy[3])
        y3 = xy[3] - (xy[0]-xy[2])
        x4 = xy[0] + (xy[1]-xy[3])
        y4 = xy[1] - (xy[0]-xy[2])
else:
    if xy[2] > xy[0]:
        x3 = xy[2] + (xy[1]-xy[3])
        y3 = xy[3] + (xy[2]-xy[0])
        x4 = xy[0] + (xy[1]-xy[3])
        y4 = xy[1] + (xy[2]-xy[0])
    else:
        x3 = xy[2] - (xy[3]-xy[1])
        y3 = xy[3] + (xy[2]-xy[0])
        x4 = xy[0] - (xy[3]-xy[1])
        y4 = xy[1] + (xy[2]-xy[0])

print(x3,y3,x4,y4)

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

h=[x2-x1,y2-y1]

print(x2-h[1],y2+h[0],x1-h[1],y1+h[0])

Solution (Python):
inputto = input().split()
x1 = int(inputto[0])
y1 = int(inputto[1])
x2 = int(inputto[2])
y2 = int(inputto[3])
x3=str(x2-(y2-y1))
y3=str(y2-(x1-x2))
x4=str(int(x3)+(x1-x2))
y4=str(int(y3)-(y2-y1))
print(x3+" "+y3+" "+x4+" "+y4)

Solution (Python):

x1,y1,x2,y2=map(int,input().split())
X1=[x1,y1]
d=[x2-x1,y2-y1]
dT=[-d[1],d[0]]
P3,P4=X1+dT,X1+dT+d
x3=x1+dT[0]+d[0]
y3=y1+dT[1]+d[1]
x4=x1+dT[0]
y4=y1+dT[1]
print(x3,y3,x4,y4)

Solution (Python):
x1,y1,x2,y2 = (int(i) for i in input().split())
x3 = x2 + (y1-y2)
y3 = y2 + (x2-x1)
x4 = x3 + (x1-x2)
y4 = y3 + (y1-y2)
print(x3,y3,x4,y4)

Solution (Python):
x1, y1, x2, y2 = map(int, raw_input().split())
vx = - x1 + x2
vy = - y1 + y2
ux = - vy
uy = vx
x3 = x2 + ux
y3 = y2 + uy
x4 = x3 - vx
y4 = y3 - vy

print x3, y3, x4, y4

Solution (Python):

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

xdiff = x2-x1
ydiff = y2-y1

x3 = x2 - ydiff
y3 = y2 + xdiff
x4 = x3 - xdiff
y4 = y3 - ydiff

ans = str(x3) + " " + str(y3) + " " + str(x4) + " " + str(y4) 
print(ans)

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

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

print(str(x3) + " " + str(y3) + " " + str(x4) + " " + str(y4))

Solution (Python):
x1,y1,x2,y2 = (int(i) for i in input().split())
if (x2-x1) > 0 and (y2-y1) >=0 :
    x3 = x2 - abs((y2 - y1))
    y3 = y2 + abs((x2 - x1))
    x4 = x3 - abs((y3 - y2))
    y4 = y3 - abs((x3 - x2))
    print(x3,y3,x4,y4)


elif (x2-x1) <= 0 and (y2-y1) >=0 :
    x3 = x2 - abs((y2 - y1))
    y3 = y2 - abs((x2 - x1))
    x4 = x3 + abs((y3 - y2))
    y4 = y3 - abs((x3 - x2))
    print(x3,y3,x4,y4)

elif (x2-x1) <= 0 and (y2-y1) < 0 :
    x3 = x2 + abs((y2 - y1))
    y3 = y2 - abs((x2 - x1))
    x4 = x3 + abs((y3 - y2))
    y4 = y3 + abs((x3 - x2))
    print(x3,y3,x4,y4)


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

Solution (Python):
x1,y1,x2,y2 = map(int, input().split())
x=x2-x1
y=y2-y1
x3=x2-y
y3=y2+x
x4=x3-x
y4=y3-y
print(str(x3) + ' ' + str(y3) + ' ' + str(x4)  + ' ' + str(y4) )

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

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

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

print(x3, y3, x4, y4)

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

def solve1(a,b,x,y):
    return -y + b + a, x - a + b

def solve2(a,b,x,y):    
    return y - b + a, -x + a + b

x3,y3 = solve2(x2,y2,x1,y1)
x4,y4 = solve1(x1,y1,x2,y2)
print(x3,y3,x4,y4)

Solution (Python):
x1,y1,x2,y2 = [int(i) for i in input().split()]
x3 = x2-(y2-y1)
y3 = y2+(x2-x1)
x4 = x1-(y2-y1)
y4 = y1+(x2-x1)
print(*[x3,y3,x4,y4])

Solution (Python):
xy = list(map(int,input().split() ))
vx12 = xy[2] - xy[0]
vy12 = xy[3] - xy[1]
vx3 = (-1)*vy12
vy3 = vx12
vx4 = (-1)*vy3
vy4 = vx3
print(xy[2]+vx3,xy[3]+vy3,xy[2]+vx3+vx4,xy[3]+vy3+vy4)

Solution (Python):
import numpy as np
listA=list(map(int,input().split()))
x1=listA[0]
y1=listA[1]
x2=listA[2]
y2=listA[3]
A=np.array([x1,y1])
B=np.array([x2,y2])
C=B+np.dot(B-A,np.array([[0,1],[-1,0]]))
D=C+np.dot(C-B,np.array([[0,1],[-1,0]]))
print(C[0],C[1],D[0],D[1])

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

Solution (Python):
x1, y1, x2, y2 = list(map(int, input().split()))

if x1 > x2 and y1 == y2:
    x3 = x2
    y3 = y2 - (x1 - x2)
    x4 = x1
    y4 = y3
elif x1 == x2 and y1 > y2:
    x3 = x2 + (y1 - y2)
    y3 = y2
    x4 = x3
    y4 = y1
elif x1 < x1 and y1 == y2:
    x3 = x2
    y3 = y2 + (x2 - x1)
    x4 = x1
    y4 = y3
elif x1 == x2 and y1 < y2:
    x3 = x2 - (y2 - y1)
    y3 = y2
    x4 = x3
    y4 = y1
elif x1 > x2 and y1 < y2:
    subx = x1 - x2
    suby = y2 - y1
    x3 = x2 - suby
    y3 = y2 - subx
    x4 = x3 + subx
    y4 = y3 - suby
elif x1 > x2 and y1 > y2:
    subx = x1 - x2
    suby = y1 - y2
    x3 = x2 + suby
    y3 = y2 - subx
    x4 = x3 + subx
    y4 = y3 + suby
elif x1 < x2 and y1 > y2:
    subx = x2 - x1
    suby = y1 - y2
    x3 = x2 + suby
    y3 = y2 + subx
    x4 = x3 - subx
    y4 = y3 + suby
else:
    subx = x2 - x1
    suby = y2 - y1
    x3 = x2 - suby
    y3 = y2 + subx
    x4 = x3 - subx
    y4 = y3 - suby

print("{} {} {} {}".format(x3, y3, x4, y4))

Solution (Python):
import numpy as np
a = [int(i) for i in input().split()]
x_1 = np.array(a[:2])
x_2 = np.array(a[2:])
v_1 = x_2-x_1
v_2 = np.array([-v_1[1],v_1[0]])
print(*np.concatenate((x_2+v_2,x_1+v_2), axis=None))

Solution (Python):
import math
x1, y1, x2, y2 = list(map(lambda x : int(x),input().split()))

c1 = x1 + y1 * 1j
c2 = x2 + y2 * 1j

c3 = (c1 - c2) * -1j + c2
c4 = (c2 -c3) * -1j + c3
print(int(c3.real),int(c3.imag),int(c4.real),int(c4.imag))

Solution (Python):
x1,y1,x2,y2 = map(int,input().split())
x = abs(x2-x1)
y = abs(y2-y1)
if x1>x2:
    if y1>=y2:
        print(x2+y,y2-x,x1+y,y1-x)
    elif y1<y2:
        print(x2-y,y2-x,x1-y,y1-x)
elif x1==x2:
    if y1>y2:
        print(x2+y,y2+x,x1+y,y1+x)
    elif y1<y2:
        print(x2-y,y2-x,x1-y,y1-x)
elif x1<x2:
    if y1>=y2:
        print(x2+y,y2+x,x1+y,y1+x)
    elif y1<y2:
        print(x2-y,y2+x,x1-y,y1+x)

Solution (Python):

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

sx = x2 - x1
sy = y2 - y1

x3 = x2 - sy
y3 = y2 + sx
x4 = x3 - sx
y4 = y3 - sy

print(x3,y3,x4,y4)

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

dx = x2-x1
dy = y2-y1


x3 = x2 - dy
y3 = y2 + dx

x4 = x3 - dx
y4 = y3 - dy

print('{} {} {} {}'.format(x3, y3, x4, y4))

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


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

print(x3, y3, x4, y4)

Solution (Python):
import numpy as np


def run(p1, p4):
    v = p4 - p1
    A = np.array([[v[0], v[1]], [v[1], -v[0]]])
    b = np.array([0, np.dot(v, v)])
    x = np.dot(np.linalg.inv(A), b)
    return x + p1


l = list(map(int, input().split()))
p1 = np.array([l[0], l[1]])
p2 = np.array([l[2], l[3]])

p3 = run(p2, p1).astype(np.int64)
p4 = run(p3, p2).astype(np.int64)

print("{} {} {} {}".format(p3[0], p3[1], p4[0], p4[1]))

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

d1 = x2 - x1
d2 = y2 - y1

x3 = x2 - d2
y3 = y2 + d1

x4 = x3 - d1
y4 = y3 - d2

print('{} {} {} {}'.format(x3, y3, x4, y4))

Solution (Python):


def next_point(x1, y1, x2, y2):
    dx = x2 - x1
    dy = y2 - y1
    return x2 - dy, y2 + dx

def restore(x1, y1, x2, y2):
    x3, y3 = next_point(x1, y1, x2, y2)
    x4, y4 = next_point(x2, y2, x3, y3)
    return x3, y3, x4, y4

def main():
    x1, y1, x2, y2 = map(int, input().split())
    x3, y3, x4, y4 = restore(x1, y1, x2, y2)
    print(x3, y3, x4, y4)

main()

Solution (Python):
import math
x1, y1, x2, y2 = [int(i) for i in input().split()]
if x1 >= x2 and y1 <= y2:
    x3 = x2 - abs(y1 - y2)
    x4 = x1 - abs(y1 - y2)
    y3 = y2 - abs(x1 - x2)
    y4 = y1 - abs(x1 - x2)
elif x1 <= x2 and y1 <= y2:
    x3 = x2 - abs(y1 - y2)
    x4 = x1 - abs(y1 - y2)
    y3 = y2 + abs(x1 - x2)
    y4 = y1 + abs(x1 - x2)
elif x1 >= x2 and y1 >= y2:
    x3 = x2 + abs(y1 - y2)
    x4 = x1 + abs(y1 - y2)
    y3 = y2 - abs(x1 - x2)
    y4 = y1 - abs(x1 - x2)
elif x1 <= x2 and y1 >= y2:
    x3 = x2 + abs(y1 - y2)
    x4 = x1 + abs(y1 - y2)
    y3 = y2 + abs(x1 - x2)
    y4 = y1 + abs(x1 - x2)
print(x3, y3, x4, y4)

Solution (Python):
def solve():
  x1, y1, x2, y2 = map(int, input().split())

  dx = abs(x2 - x1)
  dy = abs(y2 - y1)
  x3, y3, x4, y4 = 0, 0, 0, 0

  if (x1 <= x2) and (y1 <= y2):
    x3, y3 = x2 - dy, y2 + dx
    x4, y4 = x1 - dy, y1 + dx
  elif (x1 <= x2) and (y1 >= y2):
    x3, y3 = x2 + dy, y2 + dx
    x4, y4 = x1 + dy, y1 + dx

  elif (x1 >= x2) and (y1 <= y2):
    x3, y3 = x2 - dy, y2 - dx
    x4, y4 = x1 - dy, y1 - dx

  elif (x1 >= x2) and (y1 >= y2):
    x3, y3 = x2 + dy, y2 - dx
    x4, y4 = x1 + dy, y1 - dx
  
  print(x3, y3, x4, y4)

solve()

Solution (Python):
nums = list(map(int, input().split()))
x1 = nums[0]
y1 = nums[1]
x2 = nums[2]
y2 = nums[3]
if x2 > x1:
    if y2 > y1:
        x3 = x2 - (y2 - y1)
        y3 = y2 + (x2 - x1)
        x4 = x1 - (y2 - y1)
        y4 = y1 + (x2 - x1)
    elif y2 < y1:
        x3 = x2 + (y1 - y2)
        y3 = y2 + (x2 - x1)
        x4 = x1 + (x3 - x2)
        y4 = y1 + (y3 - y2)
    else:
        x3 = x2
        y3 = y2 + (x2 - x1)
        x4 = x1
        y4 = y3
elif x2 < x1:
    if y2 > y1:
        x3 = x2 - (y2 - y1)
        y3 = y2 - (x1 - x2)
        x4 = x1 - (x2 - x3)
        y4 = y1 - (y2 - y3)
    elif y2 < y1:
        x3 = x2 + (y1 - y2)
        y3 = y2 - (x1 - x2)
        x4 = x1 + (x3 - x2)
        y4 = y1 - (y2 - y3)
    else:
        x3 = x2
        y3 = y2 - (x1 - x2)
        x4 = x1
        y4 = y3
else:
    if y2>y1:
        x3 = x2 - (y2 - y1)
        y3 = y2
        x4 = x3
        y4 = y1
    else:
        x3 = x2 + (y1 - y2)
        y3 = y2
        x4 = x3
        y4 = y1
print(x3,y3,x4,y4)

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

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

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

print (x3,y3,x4,y4)

Solution (Python):
import math
x1, y1, x2, y2 = map(int, input().split())

diffx = x1 - x2
diffy = y1 - y2

len_of_v = int((diffx ** 2 + diffy ** 2) ** 0.5)

if diffx == 0:
    x3 = x2 + diffy
    x4 = x1 + diffy
    y3 = y2
    y4 = y1
elif diffy == 0:
    x3 = x2
    x4 = x1
    y3 = y2 - diffx
    y4 = y1 - diffx
else:
    grad = diffy / diffx
    counter_grad = -1 / grad

    x3 = x2 + diffy
    y3 = y2 + diffy * counter_grad

    x4 = x1 + diffy
    y4 = y1 + diffy * counter_grad

print(round(x3), round(y3), round(x4), round(y4))

Solution (Python):
x1,y1,x2,y2=map(int,input().split())
mx = x2 - x1
my = y2 - y1
print("{} {} {} {}".format(x2-my,y2+mx,x2-my-mx,y2+mx-my))

Solution (Python):
p = [int(i) for i in input().split (' ')]
x1 = p[0]
y1 = p[1]
x2 = p[2]
y2 = p[3]


if x2-x1 > 0 and y2-y1 > 0:
    lx, ly = x2 - x1, y2 - y1
    x3, y3 = x2 - ly, y2 + lx
    x4, y4 = x3 - lx, y3 - ly
    
elif x2-x1 > 0 and y2-y1 < 0:
    lx, ly = x2 - x1, y1 - y2
    x3, y3 = x2 + ly, y2 + lx
    x4, y4 = x3 - lx, y3 + ly
    
elif x2-x1 < 0 and y2-y1 > 0:
    lx, ly = x1 - x2, y2 - y1
    x3, y3 = x2 - ly, y2 - lx
    x4, y4 = x3 + lx, y3 - ly
else:
    lx, ly = x1 - x2, y1 - y2
    x3, y3 = x2 + ly, y2 - lx
    x4, y4 = x3 + lx, y3 + ly
print(x3,y3,x4,y4)

Solution (Python):
l = input().split(" ")
p = [int(l[0]),int(l[1])]
q = [int(l[2]),int(l[3])]
r = [0,0]
s = [0,0]
if p[0]==q[0]:
    m = q[1]-p[1]
    r[0] = q[0]-m
    r[1] = q[1]
    s[0] = p[0]-m
    s[1] = p[1]
else:
    v = [q[1]-p[1],q[0]-p[0]]
    r[0]= q[0]-v[0]
    r[1]=q[1]+v[1]
    s[0]=p[0]-v[0]
    s[1]=p[1]+v[1]
print(str(r[0])+" "+str(r[1])+" "+str(s[0])+" "+str(s[1]))

Solution (Python):
def inpl(): return list(map(int, input().split()))
x1,y1,x2,y2 = inpl()
dx,dy = x2-x1, y2-y1
x3,y3 = x2-dy, y2+dx
x4,y4 = x3-dx, y3-dy

print(x3,y3,x4,y4)

Solution (Python):
x1,y1,x2,y2=map(int, input().split())
xm,ym=(x1+x2)/2,(y1+y2)/2
xa,ya=(x2-x1),(y2-y1)
xmn,ymn=xm-ya,ym+xa
print(int(xmn+xa/2),int(ymn+ya/2),int(xmn-xa/2),int(ymn-ya/2))

Solution (Python):
x1,y1,x2,y2=(int(i) for i in input().split())
x3=x2-(y2-y1)
y3=y2+(x2-x1)
x4=x1-(y2-y1)
y4=y1+(x2-x1)

print(x3,y3,x4,y4)

Solution (Python):
X, Y, x, y = map(int, input().split())
a= x - y + Y
b= y + x - X
c= X - y + Y
d= Y + x - X
print(a, b, c, d)

Solution (Python):
input = input().split()
x1 = int(input[0])
y1 = int(input[1])
x2 = int(input[2])
y2 = int(input[3])
x3 = 0
y3 = 0
x4 = 0
y4 = 0


if x1 < x2 :
    if y1 < y2 :
        x3 = x2 - (y2 - y1)
        y3 = y2 + (x2 - x1)
        x4 = x3 - (x2 - x1)
        y4 = y3 - (y2 - y1)
    else:
        x3 = x2 + (y1 - y2)
        y3 = y2 + (x2 - x1)
        x4 = x3 - (x2 - x1)
        y4 = y3 + (y1 - y2)
else:
    if y1 < y2 :
        x3 = x2 - (y2 - y1)
        y3 = y2 - (x1 - x2)
        x4 = x3 + (x1 - x2)
        y4 = y3 - (y2 - y1)
    else:
        x3 = x2 + (y1 - y2)
        y3 = y2 - (x1 - x2)
        x4 = x3 + (x1 - x2)
        y4 = y3 + (y1 - y2)


print(str(x3)+" "+str(y3)+" "+str(x4)+" "+str(y4))

Solution (Python):


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

dx = x2 - x1
dy = y2 - y1

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

Solution (Python):
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]


x1, y1, x2, y2 = LI()
res = map(str, [y1-y2+x2, x2-x1+y2, y1-y2+x1, x2-x1+y1])

print(' '.join(res))

Solution (Python):
import math

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

edge = math.sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2),2))

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

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


print(x3, y3, x4, y4)

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

Solution (Python):

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

def rtcc2(x,y,z):
    z = z*1j
    a,b = (x+z.real),y+z.imag
    z = z*1j
    c,d = (a+z.real),(b+z.imag)
    return(int(a),int(b),int(c),int(d))

vector = x2-x1 + (y2-y1)*1j
a,b,c,d = rtcc2(x2,y2,vector)
    
print(a,b,c,d)

Solution (Python):
import numpy as np

input_values = input().split(" ")

p1 = np.array([int(input_values[0]),int(input_values[1])])
p2 = np.array([int(input_values[2]),int(input_values[3])])

v1 = p2-p1
v2 = np.array([-v1[1],v1[0]])

p3 = p2+v2

v3 = np.array([-v2[1],v2[0]])
p4 = v3+p3

print(p3[0],p3[1],p4[0],p4[1])

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

Solution (Python):
x1,y1,x2,y2 = map(int, input().split())
dx,dy = x1-x2,y1-y2
print(x2+dy,y2-dx,x1+dy,y1-dx)

Solution (Python):
input = input().split()
num = []
x3 = 0
y3 = 0
x4 = 0
y4 = 0
for i in range(len(input)):
    num.append(int(input[i]))

a1 = num[2]-num[0]
a2 = num[3]-num[1]

x3 = num[2] - a2
y3 = num[3] + a1
x4 = x3 - a1
y4 = y3 - a2

print(x3, end="")
print(" ", end="")
print(y3, end="")
print(" ", end="")
print(x4, end="")
print(" ", end="")
print(y4, end="")
print()

Solution (Python):
x1, y1, x2, y2 = [int(i) for i in input().split()]

dx = x2 - x1
dy = y2 - y1

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