You are given three points a(a1, a2), b(b1, b2) and c(c1, c2) on a page. Find if it’s possible to rotate the page in any direction by any angle, such that the new position of a is same as the old position of b, and the new position of b is same as the old position of c. 
Example 1:
Input: 
a1 = 1, a2 = 1
b1 = 1, b2 = 1
c1 = 1, c2 = 0
Output: 0
Explanation: Not possible.
Example 2:
Input: 
a1 = 0, a2 = 1
b1 = 1, b2 = 1
c1 = 1, c2 = 0
Output: 1
Explanation: Rotate the page by 90 degree.
Your Task:  
You dont need to read input or print anything. Complete the function possibleOrNot() which takes a1, a2, b1, b2, c1 and c2 as input parameters and returns 1 if it is possible to rotate the page or 0 otherwise. 
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
0 ≤ a1, a2, b1, b2, c1, c2 ≤ 100

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3
class Solution:
	def possibleOrNot(self, a1, a2, b1, b2, c1, c2):
		# code here


Solutions:
import math

class Solution:

	def possibleOrNot(self, a1, a2, b1, b2, c1, c2):
		d1 = math.sqrt((b1 - a1) ** 2 + (b2 - a2) ** 2)
		d2 = math.sqrt((b1 - c1) ** 2 + (b2 - c2) ** 2)
		if d1 == d2:
			return 1
		else:
			return 0


class Solution:

	def possibleOrNot(self, a1, a2, b1, b2, c1, c2):
		if (a2 - b2) ** 2 + (a1 - b1) ** 2 == (b1 - c1) ** 2 + (b2 - c2) ** 2:
			return 1
		return 0


class Solution:

	def possibleOrNot(self, a1, a2, b1, b2, c1, c2):
		d1 = pow(b1 - a1, 2) + pow(b2 - a2, 2)
		d2 = pow(c1 - b1, 2) + pow(c2 - b2, 2)
		if d1 == d2:
			return 1
		else:
			return 0
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		(a1, a2, b1, b2, c1, c2) = input().split()
		a1 = int(a1)
		a2 = int(a2)
		b1 = int(b1)
		b2 = int(b2)
		c1 = int(c1)
		c2 = int(c2)
		ob = Solution()
		print(ob.possibleOrNot(a1, a2, b1, b2, c1, c2))


class Solution:

	def possibleOrNot(self, a1, a2, b1, b2, c1, c2):
		v1 = pow(b1 - a1, 2) + pow(b2 - a2, 2)
		v2 = pow(c1 - b1, 2) + pow(c2 - b2, 2)
		if v1 != v2:
			return 0
		else:
			return 1


class Solution:

	def possibleOrNot(self, a1, a2, b1, b2, c1, c2):
		dis1 = pow(b1 - a1, 2) + pow(b2 - a2, 2)
		dis2 = pow(c1 - b1, 2) + pow(c2 - b2, 2)
		if dis1 != dis2:
			return 0
		else:
			return 1


class Solution:

	def possibleOrNot(self, a1, a2, b1, b2, c1, c2):
		distance1 = pow(a1 - b1, 2) + pow(a2 - b2, 2)
		distance2 = pow(b1 - c1, 2) + pow(b2 - c2, 2)
		if distance1 != distance2:
			return 0
		if b1 == a1 + c1 // 2 and b2 == a2 + c2 // 2:
			return 0
		else:
			return 1