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++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                double x_,y_;
                cin >> x_ >> y_;
                x[i][j] = x_*100000;
                y[i][j] = y_*100000;
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        ll dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}

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

double EPS=1e-10;
double add(double a, double b){
    if(abs(a+b)<EPS*(abs(a)+abs(b))) return 0;
    else return a+b;
}
typedef complex<double> Pt;
double det(Pt a, Pt b){ //外積
    return add(a.real()*b.imag(),-a.imag()*b.real());
}

int main(){
	int n;  cin >> n;
    for(int i=0; i<n; i++){
        vector<Pt> p(4);
        for(int j=0; j<4; j++){
            double x, y;
            cin >> x >> y;
            p[j]={x,y};
        }

        p[1] -= p[0];
        p[3] -= p[2];
        
        cout << (det(p[1],p[3])==0 ? "YES" : "NO") << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)

double x[4], y[4];
int main(void){
    double eps = 1e-6;
    int n;
    cin >> n;
    rep(data, n) {
        rep(i, 4) cin >> x[i] >> y[i];
        if(abs((y[1]-y[0])/(x[1]-x[0]) - (y[3]-y[2])/(x[3]-x[2])) < eps) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

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((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4)){
            cout<<"YES"<<endl;
        }
        else if((x1-x2==0&&x3-x4==0)||(y1-y2==0&&y3-y4==0))cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

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


#define EPSILON 1e-9


class vector_t {
public:
  double x;
  double y;
  double z;

public:
  vector_t(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {};

public:
  vector_t operator^(const vector_t& v) const {
    return vector_t(y * v.z - z * v.y,
                    z * v.x - x * v.z,
                    x * v.y - y * v.x);
  };
};


class point_t {
public:
  double x;
  double y;
  double z;
  double w;

public:
  point_t(double x = 0, double y = 0, double z = 0, double w = 1) : x(x), y(y), z(z), w(w) {};
  
public:
  vector_t operator-(const point_t& p) const {
    return vector_t(x - p.x, y - p.y, z - p.z);
  };
};


int main(int argc, char** argv)
{
  int n;

  std::cin >> n;

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

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

    vector_t AB(point_t(x2, y2) - point_t(x1, y1));
    vector_t CD(point_t(x4, y4) - point_t(x3, y3));

    if (std::abs((AB ^ CD).z) < EPSILON) {
      std::cout << "YES" << std::endl;
    }
    else {
      std::cout << "NO" << std::endl;
    }
  }
}

C++: #include <iostream>

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

C++: #include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n;cin>>n;
	for(;n--;)
	{
		double a,b,c,d,e,f,g,h;cin>>a>>b>>c>>d>>e>>f>>g>>h;
		cout<<(abs((d-b)*(g-e)-(h-f)*(c-a))<1e-8?"YES":"NO")<<endl;
	}
}

C++: #include<stdio.h>
#include<math.h>

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int ans[100]={0};
	int n,i;
	
	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(((y1-y2)*(x3-x4))==((y3-y4)*(x1-x2)))ans[i]=1;
		else ans[i]=0;
	}
	
	for(i=0;i<n;i++){
		if(ans[i]==1)printf("YES\n");
		else printf("NO\n");
	}
	
return 0;
}

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

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define REP(i,n) FOR(i,0,n)

using namespace std;

typedef complex<double> xy_t;
double dot_product(xy_t a, xy_t b){ return (conj(a) * b).real(); }
double cross_product(xy_t a, xy_t b){ return (conj(a) * b).imag(); }

int main(){
    int n;
    xy_t p[4];
    double x,y;
    cin >> n;
    REP(i,n){
        REP(j,4){
            cin >> x >> y;
            p[j] = xy_t (x,y);
        }
        bool ans = !fabs(cross_product(p[0] - p[1], p[2] - p[3]));
        cout << (ans ? "YES" : "NO") << endl;
    }
}

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

int main(){
	int n;
	double x[4], y[4];
	int xi[4], yi[4];
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);

		for(int i = 0; i < 4; i++){
			xi[i] = (int)(x[i] * 100000);
			yi[i] = (int)(y[i] * 100000);
		}

		if(xi[0] - xi[1] == 0){
			if(xi[2] - xi[3] == 0){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}else{
			if((yi[0] - yi[1])*(xi[2] - xi[3]) == (xi[0] - xi[1])*(yi[2] - yi[3])){
				printf("YES\n");
			}else if((yi[0] - yi[1])*(xi[2] - xi[3]) == - (xi[0] - xi[1])*(yi[2] - yi[3])){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}
	}
	return 0;
}

C++: #include <stdio.h>

int main()
{
	int num ;
	double ax, ay, bx, by, cx, cy, dx, dy ;

	scanf("%d",&num) ;
	for( int i = 0 ; i < num ; i ++ )
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &ax , &ay , &bx , &by , &cx , &cy , &dx , &dy ) ;

		if( (by-ay)/(bx-ax) == (dy-cy)/(dx-cx) ) printf("YES\n") ;
		else printf("NO\n") ;
	}
	return 0;
}

C++: #include <cstdio>

int main(void)
{
    float x1, y1, x2, y2, x3, y3, x4, y4;
    float m1, m2;
    
    int n;
    scanf("%d", &n);
    while (n != 0){
        scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
        m1 = (y2 - y1) / (x2 - x1);
        m2 = (y4 - y3) / (x4 - x3);
        (m1 == m2) ? printf("YES\n") : printf("NO\n");
        n--;
    }
    
    return (0);
}