Go: package main

import (
        "fmt"
        "math/big"
)

func main() {
        var x1, x2, x3, x4, y1, y2, y3, y4 big.Float
        var n int
        fmt.Scanf("%d", &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)
                var lx, ly, mx, my, mul1, mul2, sub, zz big.Float
                lx.Sub(&x2, &x1)
                ly.Sub(&y2, &y1)
                mx.Sub(&x4, &x3)
                my.Sub(&y4, &y3)
                mul1.Mul(&lx, &my)
                mul2.Mul(&ly, &mx)
                sub.Sub(&mul1, &mul2)
                zz.SetFloat64(0.0)

                if sub.Cmp(&zz) == 0 {
                        fmt.Println("YES")
                } else {
                        fmt.Println("NO")
                }
        }
}

C++: #include<iostream>
int main(){
	int n;
	double x1,y1,x2,y2,x3,y3,x4,y4,a,b;
	std::cin>>n;
	while(n>0){
		std::cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		//y=ax+b
		//y1=a*x1+b
		//y2=a*x2+b
		//a(x1-x2)=y1-y2
		//a=(y1-y2)/(x1-x2)
		a=(y1-y2)/(x1-x2);
		b=(y3-y4)/(x3-x4);
		if(a==b)std::cout<<"YES"<<std::endl;
		else std::cout<<"NO"<<std::endl;
		n--;
	}
}

C++: #include<iostream>
using namespace std;
 
int main(){
    int n;
    double x[4],y[4];
    cin>>n;
    for(;n--;){
        for(int i=0;i<4;i++){
            cin>>x[i];
            cin>>y[i];
        }
        if((x[0]-x[1])*(y[2]-y[3])==(x[2]-x[3])*(y[0]-y[1])){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
    int n;
    double x1, x2, x3, x4, y1, y2, y3, y4;
    cin >> n;
    for(; n; n--){
        cin >>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        double px[2], py[2];
        px[0] = x2 - x1;
        px[1] = x4 - x3;
        py[0] = y2 - y1;
        py[1] = y4 - y3;
        if(px[0]*py[1] == px[1]*py[0]){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }

    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

const double EPS = 1e-11;

int main() {
	complex<double> p[4], a, b;
	double x, y;
	int n;
	cin >> n;
	for(int i = 0;i < n;++i) {
		for(int j = 0;j < 4;++j) {
			cin >> x >> y;
			p[j].real(x);
			p[j].imag(y);
		}
		a = p[1] - p[0];
		b = p[3] - p[2];
		double dot = real(conj(a) * b);
		if(signbit(dot)) dot *= -1.;
		cout << (abs(dot - (abs(a) * abs(b))) < EPS ? "YES" : "NO") << endl;
	}
	return 0;
}

C++: #include <complex>
#include <cmath>
#include <iostream>
using namespace std;
typedef complex<double> xy_t;

const double eps = 1e-11;
double x[4], y[4];
int N;

double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }

int main() {
  cin >> N;
  for (int t=0; t<N; t++) {
    for (int i=0; i<4; i++) {
      cin >> x[i] >> y[i];
    }

    xy_t a[2] = {
      xy_t(x[0],y[0]) - xy_t(x[1],y[1]), xy_t(x[2],y[2]) - xy_t(x[3],y[3])
    };
    bool p = abs(cross_product(a[0], a[1])) < eps;
    cout << (p ? "YES" : "NO") << endl;
  }
}

C++: #include <iostream>
#include <math.h>

using namespace std;

int main(int argc, char **argv)
{
	int n;
	float x1, x2, x3, x4, y1, y2, y3, y4;
	
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		x2 -= x1;
		y2 -= y1;
		x4 -= x3;
		y4 -= y3;
		
		if((x2 < 0 && x4 > 0) || (x2 > 0 && x4 < 0) || (y2 < 0 && y4 > 0) || (y2 > 0 && y4 < 0)){
			cout << "NO" << endl;
			continue;
		}
		
		x1 = sqrt(((x2*x2)/(x2*x2+y2*y2)));
		x3 = sqrt(((x4*x4)/(x4*x4+y4*y4)));
		
		if(x1 == x3){
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <iterator>
#include <numeric>
using namespace std;

struct Point2D {
    double x, y;

    Point2D() {}
    Point2D(double ax, double ay) {
        x = ax;
        y = ay;
    }
    Point2D operator -(Point2D &p) {
        return Point2D(x - p.x, y - p.y);
    }
    double slope(Point2D &p) {
        return (y - p.y) / (x - p.x);
    }
    double cross(Point2D &p) { // only z
        return x * p.y - y * p.x;
    }
};

namespace std {
    istream &operator>>(istream &is, Point2D &p) {
        is >> p.x >> p.y;
        return is;
    }

    ostream &operator<<(ostream &os, Point2D &p) {
        os << fixed << p.x << " " << p.y;
        return os;
    }
}

int main()
{
    int n;
    cin >> n;
    for (Point2D a, b, c, d; n-- && cin >> a >> b >> c >> d;)
        cout << ((a.slope(b) == c.slope(d)) ? "YES" : "NO") << endl;

    return 0;
}

C++: #include<stdio.h>
 
int main(void){
    double x[4],y[4];
    int n,i;
     
    scanf("%d",&n);
     
    for(i=0;i<n;i++){
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
         
        if(((y[1]-y[0])/(x[1]-x[0])) == ((y[3]-y[2])/(x[3]-x[2])))printf("YES\n");
        else printf("NO\n");
    }
     
    return 0;
}

C++: #include<complex>
#include<iostream>
using namespace std;
int main(){const double E=1e-10;int n;double x1,y1,x2,y2,x3,y3,x4,y4;cin>>n;while(n--{cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;cout<<((abs((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1))<E)?"YES":"NO")<<endl;}}

C++: import java.io.IOException;
import java.util.Locale;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		while (N-- > 0) {
			double x1 = sc.nextDouble();
			double y1 = sc.nextDouble();
			double x2 = sc.nextDouble();
			double y2 = sc.nextDouble();
			double x3 = sc.nextDouble();
			double y3 = sc.nextDouble();
			double x4 = sc.nextDouble();
			double y4 = sc.nextDouble();

			double[] AB = {x2-x1, y2-y1}, CD = {x4-x3, y4-y3};
			double cross = AB[0]*CD[1]-AB[1]*CD[0];

			if (cross < 1e-10) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}

		}

	}
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;

int main(){
  int n;//データ数
  double x[4];
  double y[4];
  cin >> n ;
  while(n--){
  //入力フェイズ
  for(int i=0;i<4;i++){
    cin >> x[i] >> y[i];
  }
  //傾きの求め方 yの増加量/xの増加量
  double AB,CD;
  AB=(y[1]-y[0])/(x[1]-x[0]);
  CD=(y[3]-y[2])/(x[3]-x[2]);
  if(AB==CD)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
}

C++: #include<iostream>

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  const double e = 1e-5;

  std::cin >> n;

  for(int i=0;i<n;i++){
    std::cin >> x1 >> y1
             >> x2 >> y2
             >> x3 >> y3
             >> x4 >> y4;

    if((x1*y3+x2*y4+y2*x3+y1*x4)-(x2*y3+x1*y4+y1*x3+y2*x4)<e){
      std::cout << "YES" << std::endl;
    }else{
      std::cout << "NO" << std::endl;
    }
  }
}

C++: #include <array>
#include <complex>
#include <iostream>
using namespace std;

const double EPS = 1e-10;
template<class T>
bool eq(const T& a, const T& b) {return abs(a - b) < EPS;}

/* 点
 *
 * x 座標は p.real()
 * y 座標は p.imag()
 * 足し算，引き算，スカラー倍は定義済み
 */
typedef complex<double> point;
namespace std {
	bool operator<(const point& a, const point& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}

/*
 * 直線・線分
 *
 * 辞書順の比較演算子が定義済み
 * 端点を for で走れる
 * {{x, y}} で初期化
 */
typedef array<point, 2> line;

double cross(const point& a, const point& b) {
	return imag(conj(a)*b);
}


bool is_parallel(const line& s, const line& t) {
	return eq(cross(s[0] - s[1], t[0] - t[1]), 0.0);
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		line s, t;
		for (auto& p : s) {
			double x, y; cin >> x >> y;
			p = point(x, y);
		}
		for (auto& p : t) {
			double x, y; cin >> x >> y;
			p = point(x, y);
		}
		cout << (is_parallel(s, t)?"YES":"NO") << endl;
	}
	return 0;
}