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++: #include <iostream>
using namespace std;


class vec{
public:
	double x;
	double y;

	vec(){}
	vec(double x1, double y1, double x2, double y2) : x(x2 - x1), y(y2 - y1){}

	double sarrus(const vec v){
		return x*v.y - y*v.x;
	}
};


int main(){
	int n;
	double x1, y1, x2, y2;
	vec v1, v2;
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> x1 >> y1 >> x2 >> y2;
		v1 = vec(x1, y1, x2, y2);
		cin >> x1 >> y1 >> x2 >> y2;
		v2 = vec(x1, y1, x2, y2);

		if(v1.sarrus(v2) == 0) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <complex>
using namespace std;
typedef complex<double> P;
const double EPS = 1e-9;
int main(){
	int N;
	cin >> N;
	while(N--){
		P a,b,c,d;
		cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag() >> d.real() >> d.imag();
		P one = b-a;
		P two = d-c;
		cout << (one.imag()/one.real() == two.imag()/two.real()?"YES":"NO") << endl;	
	}
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> n;
	for (int z = 0; z < n; z++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if(((x2 - x1)*(y4 - y3))-((x4 - x3)*(y2 - y1))==0) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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

using namespace std;

int N;
double X[4], Y[4];

string parallel_judge(){
	if ((X[1] * 100000 - X[0] * 100000)*(Y[3] * 100000 - Y[2] * 100000) == (Y[1] * 100000 - Y[0] * 100000)*(X[3] * 100000 - X[2] * 100000)){
		return "YES";
	}
	else{
		return "NO";
	}
}

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++){
		for (int j = 0; j < 4; j++){
			cin >> X[j] >> Y[j];
		}
		cout << parallel_judge() << endl;
	}
}

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

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

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
	int n;
	double 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;


    double a,b;
    a=(y2-y1)/(x2-x1);
    b=(y4-y3)/(x4-x3);
    (a==b)? cout<<"YES"<<endl : cout<<"NO"<<endl;
	}
	return 0;
}

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

using namespace std;

int main() {

	int n;
	double x[4] = { 0 }, y[4] = { 0 }, ans[2] = { 0 };

	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> x[j] >> y[j];
		}
		ans[0] = (y[1] - y[0]) / (x[1] - x[0]);
		ans[1] = (y[3] - y[2]) / (x[3] - x[2]);

		if (ans[0] == ans[1])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
		ans[0] = ans[1] = 0;
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
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++){

		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

		double a1,a2;
		a1 = (y2-y1)/(x2-x1);
		a2 = (y4-y3)/(x4-x3);

		if(a1 == a2){
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}
}

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