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[4] == fpoints[6] {
			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")
		}
	}
}

C++: #include<iostream>
#include<complex>
#include<map>

#define fs first
#define sc second
using namespace std;

typedef complex<double> P;
typedef pair<P,P> L;

const double EPS = 1e-8;
double cross(P x,P y){return imag(conj(x)*y);}
bool para(L a,L b){return abs(cross(a.fs-a.sc,b.fs-b.sc))<EPS;}

int main(){
  int n;
  P p[4];
  cin >> n;
  for(int i=0;i<n;i++){
    for(int j=0;j<4;j++)cin >> p[j].real() >> p[j].imag();
    cout << (para(L(p[0],p[1]),L(p[2],p[3]))?"YES":"NO") << endl;
  }
}

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

struct point {
    double x;
    double y;
};

bool isparallel(point p1, point p2)
{
    if(p1.x ==0 || p2.x==0 || p1.y == 0 | p2.y == 0) return false;
    if(((p1.x * p2.y) - (p1.y * p2.x)) ==0) return true;
    else return false;
}

int main()
{
    int n;
    double x1, y1, x2, y2, x3, y3, x4, y4;
    point p1, p2;
    cin >> n;
    for(int c=0; c< n; c++)
    {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        p1.x = x2 - x1;
        p2.x = x4 - x3;
        p1.y = y2 - y1;
        p2.y = y4 - y3;
        if(isparallel(p1, p2)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return EXIT_SUCCESS;
}

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

int main(){
    int num;
    int i;
    double x1, y1, x2, y2, x3, y3, x4, y4;
    double cross;

    cin >> num;

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

        cross = (x2 - x1) * (y4 - y3) - (y2 - y1) * (x4 - x3);
        if(cross == 0){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

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

#define eps 0.00001

int main()
{
    int n;
    cin >> n;

    for(int i=0; i<n; i++){
        double x1, y1, x2, y2, x3, y3, x4, y4;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    
        double r1, r2;
        r1 = (y2-y1)/(x2-x1);
        r2 = (y4-y3)/(x4-x3);

        if( r1 == r2 ) cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<cmath>

using namespace std;

#define error 1e-10

int main(){
	double x[5],y[5];
	int n;
	double parallel1,parallel2;

	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=1;j<5;j++)
			cin>> x[j]>> y[j];
		parallel1=(y[2]-y[1])/(x[2]-x[1]);
		parallel2=(y[4]-y[3])/(x[4]-x[3]);
		if(x[2]-x[1] == 0 && x[4]-x[3] == 0)  cout<<"YES"<<endl;
		else (fabs(parallel1-parallel2)<error ) ? cout<<"YES"<<endl : cout<<"NO"<<endl;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<utility>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<list>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
#define F first
#define S second
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
struct XY
{
	int x;
	int y;
};
int in()
{
	int x;
	cin >> x;
	return x;
}

/*
(char)'1' - (int)48 = (int)1;
　1111181
*/
////////////////////////////////////////////////////
int main()
{
	int n;
	cin >> n;
	rep(EEE, n)
	{
		double x1, x2, x3, x4, y1, y2, y3, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if ((x1 - x2)*(y3-y4) == (x3 - x4)*(y1 - y2))cout << "YES" << endl;
		else cout << "NO" << endl;

	}

}

C++: #include <iostream>
#include <cstdio>
#include <complex>

using namespace std;
typedef long long ll;

typedef long double R;
typedef complex<R> P;

const R EPS = 1e-10;
const R PI = acos(-1);
int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}


bool near(P a, P b) {
    return !sgn(abs(a-b));
}

void solve() {
    P p[4];
    for (int i = 0; i < 4; i++) {
        long double x, y;
        cin >> x >> y;
        p[i] = P(x, y);
    }
    long double r1 = arg(p[1]-p[0]);
    long double r2 = arg(p[3]-p[2]);
    if (r1 < 0) r1 += PI;
    if (r2 < 0) r2 += PI;
    if (sgn(r1-r2)) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        solve();
    }
    return 0;
}

C++: #include <cstdio>
#include <complex>
#include <vector>
 
using namespace std;
 
typedef complex<double> P;
struct L : public vector<P> {
    L(const P &a, const P &b) {
        push_back(a);
        push_back(b);
    }
};
 
const double EPS = 1e-8;
 
int cross(P a, P b)
{
    return imag(conj(a) * b);
}
 
bool intersectLL(const L &l, const L &m)
{
    return fabs(cross(l[1]-l[0], m[1]-m[0])) > EPS;
}
 
int main()
{
    int n;
 
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        P p[4];
        double x, y;
 
        scanf("%lf %lf", &x, &y);
        p[0] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[1] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[2] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[3] = P(x, y);
 
        puts(intersectLL(L(p[0], p[1]), L(p[2], p[3])) ? "NO" : "YES");
    }
 
    return 0;
}

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

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


int main() {
  int n;
  cin >> n;
  while (n--) {
    double x[4], y[4];
    for (int i = 0; i < 4; i++) cin >> x[i] >> y[i];
    if (abs((y[1] - y[0]) * (x[3] - x[2]) - (y[3] - y[2]) * (x[1] - x[0])) < 1e-9) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
    
  }
  return 0;
}

C++: #include<stdio.h>
 
int main(){
    int a;
    scanf("%d",&a);
    for(int i=0;i<a;i++){
        double x1,x2,x3,x4,y1,y2,y3,y4;
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        if(x1==x2&&x3==x4)printf("YES\n");
        else{
            if((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4))printf("YES\n");
            else printf("NO\n");
        }
    }
}

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

int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if(x1 - x2 != 0) {
			if((y1-y2)/(x1-x2) == (y3-y4)/(x3-x4)) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else if(x1 - x2 == 0) {
			if(x3 - x4 == 0) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	}
	return 0;
}