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;

struct Point {
  using P = Point;
  double x;
  double y;
  double z;
  Point(double _x = 0.0, double _y = 0.0, double _z = 0.0)
      : x(_x), y(_y), z(_z) {}

  // NOTICE: if you use 3d vector, change THIS!!
  friend istream& operator>>(istream& input, P& p) {
    return input >> p.x >> p.y, p.z = 0, input;
  }
  friend ostream& operator<<(ostream& output, const P& p) {
    return output << '(' << p.x << ", " << p.y << ')';
  }
  P operator+(const P& p) const { return P(x + p.x, y + p.y, z + p.z); }
  P operator-(const P& p) const { return P(x - p.x, y - p.y, z - p.z); }
  P operator*(const double& k) const { return P(x * k, y * k, z * k); }
  P operator/(const double& k) const { return P(x / k, y / k, z / k); }
  P& operator+=(const P& p) { return *this = *this + p; }
  P& operator-=(const P& p) { return *this = *this - p; }
  P& operator*=(const double& k) { return *this = *this * k; }
  P& operator/=(const double& k) { return *this = *this / k; }
  bool operator<(const P& p) const { return lt(z, p.z); }
  bool operator==(const P& p) const {
    return eq(x, p.x) && eq(y, p.y) && eq(z, p.z);
  }
  bool operator>(const P& p) const { return !(*this < p || *this == p); }
  double abs() const { return sqrt(norm()); }
  double norm() const { return x * x + y * y + z * z; };
  double dot(const P& p) const { return x * p.x + y * p.y + z * p.z; }
  P cross(const P& p) const {
    double a = y * p.z - z * p.y;
    double b = z * p.x - x * p.z;
    double c = x * p.y - y * p.x;
    return P(a, b, c);
  }
  bool isOrthogonal(const P& p) const { return eq(dot(p), 0.0); }
  bool isParallel(const P& p) const { return cross(p) == P(0.0, 0.0, 0.0); }

  static double EPS;
  static bool eq(const double& a, const double& b) {
    return std::abs(a - b) < EPS;
  }
  static bool lt(const double& a, const double& b) { return a - b < -EPS; }
  static bool le(const double& a, const double& b) { return a - b < EPS; }
  static int ccw(P a, P b, P c) {
    b -= a;
    c -= a;
    if (b.cross(c) > P(0.0, 0.0, 0.0)) return +1;  // counter clockwise
    if (b.cross(c) < P(0.0, 0.0, 0.0)) return -1;  // clockwise
    if (lt(b.dot(c), 0.0)) return +2;              // on line back
    if (lt(b.norm(), c.norm())) return -2;         // on line front
    return 0;                                      // on segment
  }
  static bool intersect(const P& a1, const P& a2, const P& b1, const P& b2) {
    return ccw(a1, a2, b1) * ccw(a1, a2, b2) <= 0 &&
           ccw(b1, b2, a1) * ccw(b1, b2, a2) <= 0;
  }
  static vector<P> convexHull(vector<P> ps) {
    int n = ps.size(), k = 0;
    sort(begin(ps), end(ps));
    vector<P> ch(n * 2);
    for (int i = 0; i < n; ch[k++] = ps[i++]) {
      while (k >= 2 && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k;
    }
    for (int i = n - 2, t = k + 1; i >= 0; ch[k++] = ps[i--]) {
      while (k >= t && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k;
    }
    ch.resize(k - 1);
    return ch;
  }
};
double Point::EPS = 1e-10;

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    Point a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << (((b - a).isParallel(d - c)) ? "YES" : "NO") << endl;
  }
}

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

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

  cin >> n;

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

  return 0;
}

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(int i=a; i<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){
        double x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                double x_,y_;
                cin >> x_ >> y_;
                x[i][j] = x_;
                y[i][j] = y_;
            }
        }
        double dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        double 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>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
const double eps=1e-9;
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;

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

C++: #include <iostream>
using namespace std;
int main(){
  
  double x1, y1, x2, y2, x3, y3, x4, y4;
  int dataSets;
  cin >> dataSets;
  for(int i=0;i<dataSets;i++){
    bool flag=false;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if((y2-y1)*(x4-x3) - (x2-x1)*(y4-y3)==0){
      flag = true;
    }

    if(flag){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
    
  }

}

C++: #include <iostream>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(){
	int n;
	cin >> n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	REP(i,n){
		 scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		//cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((y1-y2)*(x3-x4) == (x1-x2)*(y3-y4) ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
typedef pair<double,double> pdd;
int main(){
    pdd no1,no2,no3,no4;
    int n;cin>>n;
    rep(i,n){
        cin>>no1.first>>no1.second>>no2.first>>no2.second>>no3.first>>no3.second>>no4.first>>no4.second;
        double d1=(no2.second-no1.second)/(no2.first-no1.first);
        double d2=(no4.second-no3.second)/(no4.first-no2.first);
        if(d1==d2&&d1!=0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}