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)
		}
		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 <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;

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

C++: #include<iostream>
#include<vector>
using namespace std;
struct Coordinate {
	long double x;
	long double y;
};
int main() {
	short int n;
	cin >> n;
	vector<bool>l;
	for (int i = 0; i < n; i++){
		Coordinate A, B, C, D;
		cin >> A.x >> A.y >> B.x >> B.y;
		long double Inclination_of_AB = (B.y - A.y) / (B.x - A.x);
		cin >> C.x >> C.y >> D.x >> D.y;
		long double Inclination_of_CD = (D.y - C.y) / (D.x - C.x);
		l.push_back(Inclination_of_AB == Inclination_of_CD);
	}
	for (bool i : l) {
		if (i) cout << "YES";
		else cout << "NO";
		cout << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
	double x1[100], y1[100], x2[100], y2[100], x3[100], y3[100], x4[100], y4[100]; int n;

	cin >> n;

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

	for (int i = 0; i < n; i++)
	{
		if ((x2[i] - x1[i]) / (y2[i] - y1[i]) == (x4[i] - x3[i]) / (y4[i] - y3[i]))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	double zhyoxy[4], line1, line2;
	char hantei[2];
	int time;
	cin >> time;
	for (int i = 0; i < time; ++i) {
		for (int i = 0; i < 4; ++i) {
			cin >> zhyoxy[i];
		}
		if (zhyoxy[3] == zhyoxy[1]) {
			hantei[0] = 'y';
		}
		else if (zhyoxy[2] == zhyoxy[0]) {
			hantei[0] = 'x';
		}
		line1 = (zhyoxy[3] - zhyoxy[1]) / (zhyoxy[2] - zhyoxy[0]);
		for (int i = 0; i < 4; ++i) {
			cin >> zhyoxy[i];
		}
		if (zhyoxy[3] == zhyoxy[1]) {
			hantei[1] = 'y';
		}
		else if (zhyoxy[2] == zhyoxy[0]) {
			hantei[1] = 'x';
		}
		line2 = (zhyoxy[3] - zhyoxy[1]) / (zhyoxy[2] - zhyoxy[0]);
		if ((line1 == line2||zhyoxy[0]==zhyoxy[1])&&line1!=0&&line2!=0) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int N;
	cin >> N;
	
	for (int i=0; i<N; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		
		if ( ( (x1==x2) && (y1==y2) ) || ( (x3==x4) && (y3==y4) ) ) {
			cout << "NO" << endl;
			continue;
		}
		
		double LHS = 100000.0 * (y2 - y1) * (x4 - x3);
		double RHS = 100000.0 * (y4 - y3) * (x2 - x1);
		//cout << LHS << " " << RHS << endl;
		//if ( (y2 - y1) * (x4 - x3) == (y4 - y3) * (x2 - x1) ) cout << "YES" << endl;
		if ( LHS == RHS ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
		
	return 0;
}

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])==0){
cout<<"YES"<<endl;
}else{
cout<<"NO"<<endl;
}
}
return 0;
}

C++: #include <stdio.h>

int main() {
    double x1, y1, x2, y2, x3, y3, x4, y4;
    int i, n;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
        
        if( ((x1-x2)*(y3-y4) == (y1-y2)*(x3-x4)) ) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }
    
    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <complex>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b){
  return (conj(a)*b).imag();
}

const double eps = 1e-11;
double x[4], y[4];
int N;
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 <string>

class Point
{
public:
	double m_X;
	double m_Y;
	Point(double x, double y)
		: m_X( x )
		, m_Y( y )
	{}
};

class LineSegment
{
private:
	Point m_Start;
	Point m_End;
public:
	LineSegment(Point start, Point end)
		: m_Start( start )
		, m_End( end )
	{}
	double CalcSlope()
	{
		return((m_End.m_Y - m_Start.m_Y) / (m_End.m_X - m_Start.m_X));
	}
};

int main()
{
	int n = 0;
	double x1 = 0;
	double y1 = 0;
	double x2 = 0;
	double y2 = 0;
	double x3 = 0;
	double y3 = 0;
	double x4 = 0;
	double y4 = 0;

	std::cin >> n;

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

		Point start1{ x1, y1 };
		Point end1{ x2, y2 };
		Point start2{ x3, y3 };
		Point end2{ x4, y4 };

		LineSegment line1{ start1, end1 };
		double line1_slope = line1.CalcSlope();

		LineSegment line2{ start2, end2 };
		double line2_slope = line2.CalcSlope();

		if (line1_slope == line2_slope)
		{
			std::cout << "YES" << std::endl;
		}
		else
		{
			std::cout << "NO" << std::endl;
		}
	}

	return 0;
}

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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);

  for (int c = 0; c < n; ++c) {
    double input[8];
    for (int i = 0; i < 8; ++i) {
      scanf("%lf", &input[i]);
    }
    pair<double, double> vec_a(input[2] - input[0], input[3] - input[1]);
    pair<double, double> vec_b(input[6] - input[4], input[7] - input[5]);
    double d_a = sqrt(pow(vec_a.first, 2.0) + pow(vec_a.second, 2.0));
    double d_b = sqrt(pow(vec_b.first, 2.0) + pow(vec_b.second, 2.0));
    double ip = vec_a.first * vec_b.first + vec_a.second * vec_b.second;
    
    if (abs(abs(ip) - d_a * d_b) < 0.0000001) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

C++: #include<iostream>
#include<cmath>
#include<cassert>
#include<cstdlib>
using namespace std;
#define EPS 0.0000001 
main(){
  int tcase;   cin >> tcase;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  for ( int i = 0; i < tcase; i++ ){
      cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
      if ( abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < EPS ) cout << "YES" << endl;
      else cout << "NO" << endl;
  }
}