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 <bits/stdc++.h>

using namespace std;

class D3
{
public:
	long double X , Y , Z , EPS;

	D3(long double x_ = 0.0L , long double y_ = 0.0L , long double z_ = 0.0L)
	{
		X = x_;
		Y = y_;
		Z = z_;
		EPS = 1e-9L;
	}

	bool operator== (D3 Partner)
	{
		return abs(X - Partner.X) < EPS&&abs(Y - Partner.Y) < EPS&&abs(Z - Partner.Z) < EPS;
	}

	D3 operator*(long double ld)
	{
		return D3(X*ld , Y*ld , Z*ld);
	}

	D3 operator/(long double ld)
	{
		return  *this*( ld*-1.L );
	}
};

class Point :private D3
{

public:
	Point(long double x_ = 0.0L , long double y_ = 0.0L , long double z_ = 0.0L)
	{
		X = x_;
		Y = y_;
		Z = z_;
	}

	//x??§?¨??????????
	long double getX()
	{
		return X;
	}

	//y??§?¨??????????
	long double getY()
	{
		return Y;
	}

	//z??§?¨??????????
	long double getZ()
	{
		return Z;
	}

	bool operator== (Point Partner)
	{
		return *this == Partner;
	}
};

class Vec
{
private:
	Point SP;//Starting Point
	D3 Direction;

	//??????????????¨?§???????????????????????????????
	Vec(D3 Direction_ , Point SP_)
	{
		Direction = Direction_;
		SP = SP_;
	}
public:

	//?§??????¨???????????????????????????????????????????????????
	Vec(long double x_ = 0.0L , long double y_ = 0.0L , long double z_ = 0.0L , Point SP_ = Point())
	{
		*this = Vec(D3(x_ , y_ , z_) , SP_);
	}

	Vec operator+(Vec Partner)
	{
		return Vec(Direction.X + Partner.Direction.X , Direction.Y + Partner.Direction.Y , Direction.Z + Partner.Direction.Z , SP);
	}

	Vec operator*(Vec Partner)
	{
		return Vec(Direction.X * Partner.Direction.X , Direction.Y * Partner.Direction.Y , Direction.Z * Partner.Direction.Z , SP);
	}

	Vec operator*(long double ld)
	{
		return Vec(Direction*ld , SP);
	}

	Vec operator-(Vec Partner)
	{
		return *this + ( Partner*( -1.L ) );
	}

	Vec operator/(Vec Partner)
	{
		return Vec(Direction.X / Partner.Direction.X , Direction.Y / Partner.Direction.Y , Direction.Z / Partner.Direction.Z , SP);
	}

	Vec operator/(long double ld)
	{
		return *this*( 1.L / ld );
	}

	bool operator== (Vec Partner)
	{
		return Direction == Partner.Direction&&SP == Partner.SP;
	}


	//??????
	Vec Cross_product(Vec partner)
	{
		return Vec(Direction.Y*partner.Direction.Z - Direction.Z*partner.Direction.Y , Direction.Z*partner.Direction.X - Direction.X*partner.Direction.Z , Direction.X*partner.Direction.Y - Direction.Y*partner.Direction.X);
	}

	//??????
	double Inner_product(Vec partner)
	{
		return Direction.X*partner.Direction.X + Direction.Y*partner.Direction.Y + Direction.Z*partner.Direction.Z;
	}


	//???????????????????????????????????????
	Vec(Point A , Point B)
	{
		*this = Vec(A.getX() - B.getX() , A.getY() - B.getY() , A.getZ() - B.getZ() , B);
	}

	//?§?????????????
	Point getSP()
	{
		return SP;
	}

	//???????????????
	Point getGP()
	{
		return Point(SP.getX() + Direction.X , SP.getZ() + Direction.Z , SP.getZ() + Direction.Z);
	}

	//???????????????
	D3 getDirection()
	{
		return Direction;
	}

	//???????????????
	long double length()
	{
		return sqrtl(Direction.X*Direction.X + Direction.Y*Direction.Y + Direction.Z*Direction.Z);
	}

	//??????????????????(??????1)?????????
	Vec Unit_vec()
	{
		return Vec(*this) / ( *this ).length();
	}

	//????????????????????????
	Vec Inverse_vec()
	{
		return ( *this )*-1.L;
	}

	//?????´????????????
	bool Vertical(Vec Partner)
	{
		return ( *this ).Inner_product(Partner) == 0;
	}

	//??????????????????
	bool Parallel(Vec Partner)
	{
		return ( *this ).Unit_vec().getDirection() == Partner.Unit_vec().getDirection() || ( *this ).Unit_vec().Inverse_vec().getDirection() == Partner.Unit_vec().getDirection();
	}

};

int main()
{
	int N;
	cin >> N;
	for(size_t i = 0; i < N; i++)
	{
		long double D[8];
		for(size_t j = 0; j < 8; j++)
		{
			cin >> D[j];
		}
		Vec AB(Point(D[0] , D[1]) , Point(D[2] , D[3])) , CD(Point(D[4] , D[5]) , Point(D[6] , D[7]));
		if(AB.Parallel(CD))
		{
			cout << "YES" << endl;
		} else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main(){
	int n;
	double t[100][8];
	cin >> n;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < 8; j++){
			cin >> t[i][j];
		}
	}
	for(int i = 0; i < n; i++){
		if((t[i][1]-t[i][3])/(t[i][0]-t[i][2]) == (t[i][5]-t[i][7])/(t[i][4]-t[i][6])){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
}

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




main(){

  
  int n;
  
  cin  >> n;
  double x1,y1,x2,y2,x3,y3,x4,y4;

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

      double hoge=(x1-x2)*(y3-y4);//,

      double hoge2=(x3-x4)*(y1-y2);

      if(hoge == hoge2)cout << "YES"<<endl;
      else cout << "NO"<< endl;
      
      
  
    }
  
  return 0;
}

C++: #include<iostream>

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

	return 0;
}

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


int main(){
	int n;
	pair<double, double> a, b, c, d;
	
	cin >> n;
	
	for(int i = 0;i < n;i++){
		cin >> a.first >> a.second;
		cin >> b.first >> b.second;
		cin >> c.first >> c.second;
		cin >> d.first >> d.second;
		
		double x1 = b.first - a. first;
		double y1 = b.second - a.second;
		double x2 = d.first - c.first;
		double y2 = d.second - c.second;
		
		cout << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;
		
		cout << atan2(y1, x1) << ' ' << atan2(y2, x2) << endl;
		
		if(abs((atan2(y1, x1) - atan2(y2, x2))) < 0.0000001) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

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



int main(){

  int num;
  cin >> num;

  double x[4], y[4];
  double xx, yy;
  int i = 0;

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

 
  return 0;
}

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

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

int main(){
	int n;
	double a1,a2,b1,b2,c1,c2,d1,d2;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a1>>a2>>b1>>b2>>c1>>c2>>d1>>d2;
		if(((a2-b2)/(a1-b1))==((c2-d2)/(c1-d1)))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}

}

C++: #include<iostream>
#include<cmath>
#include<string>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	double x[4],y[4],n;
	string ans="";
	cin>>n;
	rep(i,n){
		rep(i,4)cin>>x[i]>>y[i];
		double vx=x[1]-x[0],vy=y[1]-y[0],ux=x[3]-x[2],uy=y[3]-y[2];
		double la=sqrt(vx*vx+vy*vy),lb=sqrt(ux*ux+uy*uy);
		if(abs(abs(vx*ux+vy*uy)-la*lb)<1e-4)ans="YES";
		else ans="NO";
		if(vx==0 && ux==0)ans="YES";
		if(vy==0 && uy==0)ans="YES";
		cout<<ans<<endl;
	}
	return 0;
}