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
from collections import deque
import math

def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())
def array(n,val=0):
    return [val]*n
def matrix(row,columns,val):
    return [[val]*columns for _ in range(row)]

def solve():
    x1,y1,x2,y2 = IL()
    points = sorted([[x1,y1],[x2,y2]], key=lambda x: x[1])
    print(points)
    dx = points[0][0]-points[1][0]
    dy = points[0][1]-points[1][1]
    x3 = points[1][0] + dy
    y3 = points[1][1] - dx
    x4 = points[0][0] + dy
    y4 = points[0][1] - dx
    print(x3,y3,x4,y4)
    return

if __name__=='__main__':
    solve()

import sys
from collections import deque
import math

def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())
def array(n,val=0):
    return [val]*n
def matrix(row,columns,val):
    return [[val]*columns for _ in range(row)]

def solve():
    dx = x2-x1
    dy = y2-y1
    x3 = x2-dy
    y3 = y2+dy
    x4 = x1-dy
    y4 = y1+dx
    print(x3,y3,x4,y4)
    return

if __name__=='__main__':
    x1,y1,x2,y2 = IL()
    solve()

import sys
from collections import deque
import math

def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())
def array(n,val=0):
    return [val]*n
def matrix(row,columns,val):
    return [[val]*columns for _ in range(row)]

def solve():
    points = sorted(a, key=lambda x: (x[1],-x[0]))
    dx = points[0][0]-points[1][0]
    dy = points[0][1]-points[1][1]
    x3 = points[1][0] + dy
    y3 = points[1][1] - dx
    x4 = points[0][0] + dy
    y4 = points[0][1] - dx
    print(points,a)
    if points != a:
        x3,x4,y3,y4 = x4,x3,y4,y3
    print(x3,y3,x4,y4)
    return

if __name__=='__main__':
    x1,y1,x2,y2 = IL()
    a = [[x1,y1],[x2,y2]]
    solve()

import sys
from collections import deque
import math

def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())
def array(n,val=0):
    return [val]*n
def matrix(row,columns,val):
    return [[val]*columns for _ in range(row)]

def solve():
    dx = x2-x1
    dy = y2-y1

    x3 = x2 - dy
    y3 = y2 + dx
    x4 = x1 - dy
    y4 = y1 + dx
    print(x3,y3,x4,y4)
    return

if __name__=='__main__':
    x1,y1,x2,y2 = IL()
    solve()

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted