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)
		}
		if fpoints[0] == fpoints[2] && fpoints[1] == fpoints[3] {
			fmt.Println("YES")
			continue
		}
		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 <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;

int main(){
    const double EPS = 1e-12;
    double x[5];
    double y[5];
    double s;
    double t;
    double u;
    double v;
    double m;
    int n;
    cin >> n;

    for(int i = 0;i < n;i++){
        cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

        s = x[1] - x[0];
        t = y[1] - y[0];
        u = x[3] - x[2];
        v = y[3] - y[2];

        if(s * v - t * u > 0){
            double m = s * v - t * u;
        }
        else{
            double m = t * u - s * v;
        }

        if(m < EPS){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

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

C++: #include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

void solve(){
    array<double,4> x,y;
    rep(i,4) cin>>x[i]>>y[i];

    double x1 = x[1]-x[0], x2 = x[3]-x[2];
    double y1 = y[1]-y[0], y2 = y[3]-y[2];
    double c = x1 * y2 - x2 * y1;

    if(abs(c) < eps){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

int main(){
    int n;cin>>n;
    rep(i,n){
        solve();
    }
}

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

#define P complex<double>

int main(){
  int n;
  P a,b,c,d;

  cin >> n;
  for( int loop=0;loop<n;loop++ ){
    cin >> a.real() >> a.imag();
    cin >> b.real() >> b.imag();
    cin >> c.real() >> c.imag();
    cin >> d.real() >> d.imag();

    P x=a-b, y=c-d;

    if( abs(x-y) < 1.0e-4  )
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0;i<(n);i++)
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a) * b).imag(); }


const double eps = 1e-12;
double x[4], y[4];
int n;

int main() {
	cin >> n;
	rep(t, n) {
		rep(i, 4) 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]) }; //This is how to make an array.
		bool p = abs(cross_product(a[0],a[1])) < eps; //The calculated area is not exactly 0.
		cout << (p ? "YES" : "NO") << endl; //I've seen this kind of expression for the first time...so intuitive.
	}
	return 0;
}

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

using namespace std;

struct Point {
    double x, y;
};

int main() {
    int n;
    cin >> n;
    while (n--) {
        Point p[4];
        for (int i = 0; i < 4; i++) {
            cin >> p[i].x >> p[i].y;
        }
        double div1 = (p[1].y - p[0].y) / (p[1].x - p[0].x);
        double div2 = (p[3].y - p[2].y) / (p[3].x - p[2].x);
        if (max(div1, div2) - min(div1, div2) > 1e-5) {
            cout << "YES\n";
        }
        else {
            cout << "NO\n";
        }
    }
    
    return 0;
}

C++: #include <iostream>
#include <complex>
#include <cmath>
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]; // x0,y0..x3,y3
    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])/2) < eps;
    cout << (p ? "YES" : "NO") << endl;

} }

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

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

C++: #include<stdio.h>
int main(void) {
	int a, b, c, d;
	double e, f, g, h,x1,x2,x3,x4,y1,y2,y3,y4;
	scanf("%d", &a);
	for (size_t i = 0; i < a; i++)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		e = (y1 - y2) / (x1 - x2);
		f = (y3 - y4) / (x3 - x4);
		if (e==f)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

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

struct Pos {
	double x, y;
}a, b, c, d;

int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i++ ) {
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		Pos e;
		e.x = b.x - a.x;
		e.y = b.y - a.y;
		Pos f;
		f.x = d.x - c.x;
		f.y = d.y - c.y;
		
		double men = e.x * f.y - e.y * f.x;
		double eps = 1e-13;
		if(-eps <= men && men <= eps)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}