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")
		}
	}
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
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;
		double ABx = x2 - x1,
			ABy = y2 - y1,
			CDx = x4 - x3,
			CDy = y4 - y3;
		if (ABy&&CDy)
			if (ABx / ABy == CDx / CDy)
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		else if (ABx&&CDx)
			if (ABy / ABx == CDy / CDx)
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

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

}

C++: #include <iostream>

using namespace std;


int main(int argc, char *argv[]){
	int n;
	double x1 ,y1 ,x2 ,y2 ,x3 ,y3 ,x4 ,y4;
	cin>>n;
	for (int i = 0; i < n; ++i){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double s1=(y2-y1)/(x2-x1), s2=(y4-y3)/(x4-x3);
		if(s1==s2) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}

    return 0;
}

C++: #include <iostream>
using namespace std;
#define INF 1<<20

int main(){
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int n;
	cin >> n;
	while( n-- ){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double tan1, tan2;
		if( x1 - x2 == 0 ){
			tan1 = INF;
		}else{
			tan1 = (y1-y2) / (x1-x2);//max((x1-x2), -1*(x1-x2));
		}
		if( x3 - x4 == 0 ){
			tan2 = INF;
		}else{
			tan2 = (y3-y4) / (x3-x4);//max((x3-x4), -1*(x3-x4));
		}
		if( tan1 == tan2 ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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

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

C++: #include <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;

int main() {
    cout << eps << endl;
    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 << (fabs((x2-x1)*(y4-y3) - (x4-x3)*(y2-y1)) < eps ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include "bits/stdc++.h"

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1;i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define PI 3.14159265358979

#define _CRT_SECURE_NO_WARNINGS

using namespace std;

//================================================
bool func(vector<double>x, vector<double>y) {
	double A = (y[1] - y[0]) / (x[1] - x[0]);
	double B = (y[3] - y[2]) / (x[3] - x[2]);

	if (A == B) return true;
	else return false;	
}


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int num;
	cin >> num;

	REP(i, num) {
		vector<double>x(4);
		vector<double>y(4);

		REP(i, 4) cin >> x[i] >> y[i];
		cout << (func(x, y) ? "YES" : "NO") << "\n";
	}
	return 0;
}

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

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )

using namespace std;
typedef complex<double> P;
// OÏ (cross product) : a~b = |a||b|sin¦
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int n;
  P a,b;
  for(cin>>n;n>0;n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    a = P(x2-x1,y2-y1);
    b = P(x4-x3,y4-y3);
    if EQ(cross(a,b),0.0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

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

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

using namespace std;
#define eps 1e-10

void solve()
{
	int N;
	cin >> N;
	while(N--)
	{
		double x[4], y[4];
		for(int i = 0; i < 4; ++i)
		{
			cin >> x[i] >> y[i];
		}
		if(x[1] == x[0] && x[3] == x[2])
		{
			if(y[1] == y[0] || y[3] == y[2])
			{
				cout << "NO" << endl;
			}
			else
			{
				cout << "YES" << endl;
			}
		}
		else if(x[1] == x[0] || x[3] == x[2])
		{
			cout << "NO" << endl;
		}
		else if((y[1] - y[0]) / (x[1] - x[0]) == (y[3] - y[2]) / (x[3] - x[2]))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: //Parallelism
#include<bits/stdc++.h>
using namespace std;

const double EPS = 1E-9;

inline bool cmp(double x, double y){
  return abs(x-y) < EPS;
}

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

C++: //Parallelism
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  cin>>n;
  for(int i=0; i<n; i++){
    bool flag=false;
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if(x1==x2 && x3==x4){flag=true;}
    else if(x1==x2 || x3==x4){}
    else if(((y2-y1)*(x4-x3))==((y4-y3)*(x2-x1))){flag=true;}
    if(flag) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}