Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&n)
	for i := 0 ; i < n; i++ {
		fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

Python: import math
import sys

input()
for i in sys.stdin.readlines():
    a = [float(x) for x in i.split()]
    ac = math.sqrt((a[0] - a[4]) ** 2 + (a[1] - a[5]) ** 2)
    bd = math.sqrt((a[2] - a[6]) ** 2 + (a[3] - a[7]) ** 2)
    if ac == bd:
        print('YES')
    else:
        print('NO')

Python: import sys
cases = int(input())
i = 0
while i <= cases:
   #for line in sys.stdin.readlines():
   x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4 = map(float,input().split())
   dy1 = y2 - y1
   dy2 = y4 - y3
   dx1 = x2 - x1
   dx2 = x4 - x3
   k=dy1*dx2
   l=dy2*dx1
   if(k==l):
       print("YES")
   else:
       print("NO")
   i += 1

Python: import sys
import decimal

lines = sys.stdin.readlines()
size = int(lines[0])
data = lines[1:len(lines)]
for line in data:
    line = line.split(" ")
    inp = []
    for i in line:
        inp.append(decimal.Decimal(i))
    x = []
    x.append(inp[0])
    x.append(inp[2])
    x.append(inp[4])
    x.append(inp[6])
    y = []
    y.append(inp[1])
    y.append(inp[3])
    y.append(inp[5])
    y.append(inp[7])
    if x[1]==x[0] and x[3]==x[2]:
        print ("YES")
    elif x[1]==x[0] or x[3]==x[2]:
        print ("NO")
    else:
        tilt1 = (y[1]-y[0])/(x[1]-x[0])
        tilt2 = (y[3]-y[2])/(x[3]-x[2])
        if tilt1==tilt2:
            print ("YES")
        else:
            print ("NO")

Python: from fractions import Fraction
def parallelism(x1, y1, x2, y2, x3, y3, x4, y4):
    a1 = Fraction((y2-y1), (x2-x1)) if (x2-x1) != 0 else float("inf")
    a2 = Fraction((y4-y3), (x4-x3)) if (x4-x3) != 0 else float("inf")
    if a1 == a2:
        return "YES"
    else:
        return "NO"

if __name__ == "__main__":
    assert parallelism(0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 2.0, 1.0) == "YES", "sample1"
    assert parallelism(3.0, 2.0, 9.0, 6.0, 13.0, 5.0, 7.0, 9.0) == "NO", "sample2"
    assert parallelism(3.0, 2.0, 9.0, 2.0, 13.0, 5.0, 7.0, 5.0) == "YES", "horizontal line"
    assert parallelism(3.0, 2.0, 3.0, 6.0, 13.0, 5.0, 13.0, 9.0) == "YES", "vertical line"

    n = int(input())
    for _ in range(n):
        x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
        print(parallelism(x1, y1, x2, y2, x3, y3, x4, y4))

Python: def cross_product(a,b):
    return (a.conjugate()*b).imag
N = int(input().strip())
for _ in range(N):
    P = list(map(float,input().strip().split()))
    for i in range(len(P)):
        P[i] = int(P[i]*1000000.0)
    z = complex(P[0]-P[2],P[1]-P[3])
    w = complex(P[4]-P[6],P[5]-P[7])
    if abs(cross_product(z,w)) < 1:
        print("YES")
    else:
        print("NO")

Python: N = input()
 
for n in range(N):
    data = map(float,input().split( ))
    slopes = []
    for i in range(2):
        _x1 = data.pop(0)
        _y1 = data.pop(0)
        _x2 = data.pop(0)
        _y2 = data.pop(0)
         
        if _x1 != _x2:
            slopes.append((_y1 - _y2)/(_x1 - _x2))
     
    if len(slopes) == 0:
        print("YES")
    elif len(slopes) == 1:
        print("NO")
    elif abs(slopes[0] - slopes[1]) < 1e-10:
        print("YES")
    else:
        print("NO")

Python: n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    print('YES' if abs((x2 - x1)*(y4 - y3) - (x4 - x3)*(y2 - y1)) < 1e-10 else 'NO')

Python: for i in range(int(input())):
    l = list(map(float,input().split()))
    a,b,c,d = l[2]-l[0],l[3]-l[1],l[6]-l[4],l[7]-l[5]
    if b==0 or d==0: next
    if a/b==c/d: print('YES')
    else: print('NO')

Python: # -*- coding:utf-8 -*-

def main():
    n=int(input())

    for i in range(n):
        x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split())
        a=(y2-y1)/(x2-x1)
        b=(y4-y3)/(x4-x3)

        if a==b:
            print("YES")
        else:
            print("NO")
    
        
if __name__ == '__main__':
    main()

Python: import sys
import math

n = int(input())
for s in range(n):
    pos = list(map(float, input().split()))
    if pos[0] == pos[2] or pos[4] == pos[6]:
        angle1 = 0
        angle2 = 0
    else:
        angle1 = (pos[3]-pos[1])/(pos[2]-pos[0])
        angle2 = (pos[7]-pos[5])/(pos[6]-pos[4])
    if angle1 == angle2 or abs(angle1 - angle2) <= 1e-10:
        print("YES")
    else:
        print("NO")

Python: n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split(" "))
    if (y1 - y2) / (x1 - x2) == (y4 - y3)/ (x4 - x3): print("YES")
    else: print("NO")

Python: def check(lst):
  x1, y1, x2, y2, x3, y3, x4, y4 = lst
  vabx, vaby = x2 - x1, y2 - y1
  vcdx, vcdy = x4 - x3, y4 - y3
  if vabx * vcdy == vcdx * vaby:
    return True
  else:
    return False

n = int(input())
for _ in range(n):
  plst = list(map(float, input().split()))
  print("YES" if check(plst) else "NO")

Python: import math
import cmath
 
def area(x):
    theta = cmath.phase(x[1]-x[0])
    C = (x[3]-x[2])*complex(math.cos(-theta),math.sin(-theta))
    return C.imag

def parallel(P):
    x = []
    for i in range(4):
        x.append(complex(P[i*2],P[i*2+1]))
    return True if abs(area(x))<eps else False

n = int(input())
eps = 0.0000001
for _ in range(n):
    P = list(map(float,input().split()))
    print("YES" if parallel(P) else "NO")

Python: for i in range(int(input())):
  a,b,c,d,e,f,g,h = map(float,input().split())
  if a == c:
    print("YES" if e == g else "NO")
  elif e == g:
    print("NO")
  else:
    print("YES" if (b-d)/(a-c) == (f-h)/(e-g) else "NO")

Python: import sys

args = sys.argv

class Point():
  def __init__(self,x,y):
      self.x = x
      self.y = y

  def __sub__(self,oth):
    self.x = self.x - oth.x
    self.y = self.y - oth.y
    return Point(self.x,self.y)

  def __str__(self):
    return "%s(%r)" %(self.__class__,self.__dict__)

for _ in range(args[0]):
  if _ == 0:
    pass
  else:
    A,B,C,D = ([Point(i,i+1) for i in range(0,8,2)])
    tmp = B - A
    tmp2 = C - D
    tmp3 = (tmp.x * tmp2.y) - (tmp.y * tmp2.x)
    if tmp3 == 0:
      yield "YES"
    else:
      yield "NO"

Python: n=int(input())
for i in range(n):
    x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split())
    if ((y1-y2)/(x1-x2))==((y4-y3)/(x4-x3)) or (y1-y2)/(x1-x2)==((y3-y4)/(x3-x4)):
        print('YES')
    else:
        print('NO')

Python: n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    x2 -= x1
    y2 -= y1
    x4 -= x3
    y4 -= y3
    if x2 == 0 or x4 == 0:
        print("YES" if x2 == x4 == 0 else "NO")
    else:
        print("YES" if x2 / y2 == x4 / y4 else "NO")