Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	for i := 0; i < n; i++ {
		scanner.Scan()
		points := strings.Split(scanner.Text(), " ")
		fpoints := make([]float64, 0)
		for _, v := range points {
			tmp, _ := strconv.ParseFloat(v, 64)
			fpoints = append(fpoints, tmp)
		}
		if fpoints[0] == fpoints[2] && fpoints[1] == fpoints[3] {
			fmt.Println("YES")
			continue
		}
		a := (fpoints[1]-fpoints[3])/(fpoints[0]-fpoints[2])
		b := (fpoints[5]-fpoints[7])/(fpoints[4]-fpoints[6])
		if a == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

Python: N = int(input())
EPS = 1e-6
for i in range(N):
    x1,y1,x2,y2,x3,y3,x4,y4 = map(float,input().split())
    if x2 == x1 and x4 == x3:
        print('YES')
        continue
    elif x2 == x1 or x4 == x3:
        print('NO')
        continue
    f = abs((y2 - y1) / (x2 - x1))
    g = abs((y4 - y3) / (x4 - x3))
    if g - EPS <= f <= g + EPS:
        print('YES')
    else:
        print('NO')

Python: n = int(input())
ans = []
for _ in range(n):
    ax, ay, bx, by, cx, cy, dx, dy = map(float, input().split())
    a1 = (ay-by)/(ax-bx)
    a2 = (cy-dy)/(cy-dy)
    if a1 == a2:
        ans.append("YES")
    else:
        ans.append("NO")
print(*ans, sep="\n")

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__)

# input = [6, 6, 6, 15, 15, 15,20,3]


# A,B,C,D = (Point(input[i],input[i+1]) for i in range(0,len(input),2))
# tmp = B - A
# tmp2 = C - D
# tmp3 = (tmp.x * tmp2.y) - (tmp.y * tmp2.x)

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:
      print("YES")
    else:
      print("NO")

Python: n=int(input())

for i in range(n):
    xy=list(map(float,input().split(" ")))
    X1=xy[2]-xy[0]
    Y1=xy[3]-xy[1]
    X2=xy[6]-xy[4]
    Y2=xy[7]-xy[5]
    area=X1*X2-Y1*Y2
    if abs(area)<=1e-10:
        print("YES")
    else:
        print("NO")

Python: p = map( float, raw_input().split() )
flag = ( p[ 1 ] - p[ 0 ] ) * ( p[ 7 ] - p[ 6 ] ) == ( p[ 3 ] - p[ 2 ] ) * ( p[ 5 ] - p[ 4 ] )
print ( flag and 'YES' ) or '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")