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 <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
	int n;
	cin>>n;
	while (n--){
		vector<pair<double, double>> pos(4);
		REP(i, 4){
			cin >> pos[i].first >> pos[i].second;
		}

		if (abs((pos[1].first - pos[0].first)*(pos[3].second - pos[2].second) - (pos[1].second - pos[0].second)*(pos[3].first - pos[2].first))<=0.0001)
			cout << "YES"<<endl;
		else
			cout << "NO"<<endl;
		
	}
}

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

using namespace std;

typedef complex<double> P;

#define EPS (1e-7)

double cross(P const& a, P const& b) {
  return imag(conj(a)*b);
}

bool is_parallel(P const& a1, P const& a2, P const& b1, P const& b2)
{ return abs(cross(a2-a1, b2-b1)) <= EPS; }

int main() {
  
  int N; cin >> N;
  for(int i=0; i<N; i++) {
    P ps[4];
    for(int i=0; i<4; i++)
      cin >> ps[i].real() >> ps[i].imag();
    printf("%s\n", (is_parallel(ps[0], ps[1], ps[2], ps[3]) ? "YES" : "NO" ));
  }
  
  return 0;
}

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

using namespace std;

typedef complex<double> Point;

bool parallel(const Point &v1, const Point &v2) {
    return abs(v1.real()*v2.imag() - v1.imag()*v2.real()) < 1e-6;
}

int main() {
    int N;
    cin >> N;
    while(N--) {
        Point ps[4];
        for(int i = 0; i < 4; ++i) cin >> ps[i].real() >> ps[i].imag();
        Point v1 = ps[1]-ps[0], v2 = ps[3]-ps[2];

        if(parallel(v1, v2)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <string>
#include <complex>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
#define repd(i,s,e) for(int i=s; i>=e; i--)

typedef long long ll;
typedef vector<int> vi;

// geometry library start

const double EPS = 1.0e-10;

class P {
public:
	double x, y;
	P() {}
	P(int x_, int y_) : x(x_), y(y_) {}
	P(double x_, double y_) : x(x_), y(y_) {}
	P(const P& p) : x(p.x), y(p.y) {}
	P operator+(const P& p) const { return P(x+p.x, y+p.y); } 
	P operator-(const P& p) const { return P(x-p.x, y-p.y); }
	P operator-() const { return P(-x, -y); }
	P operator*(double s) const { return P(x*s, y*s); }
	P operator/(double s) const { return P(x/s, y/s); }
	P& operator=(const P& p) { x=p.x; y=p.y; return (*this); }
	double dot(const P& p) const { return x*p.x + y*p.y; }
	double det(const P& p) const { return x*p.y - y*p.x; }
	double norm() const { return sqrt(x*x + y*y); }
	double norm2() const { return x*x + y*y; }
	P proj(const P& p) const { double k=det(p)/norm2(); return P(x*k, y*k); }
};

double tri(P a, P b, P c) { return (b - a).det(c - a); }
int sign(double r) { return r < -EPS ? -1 : r > EPS ? 1 : 0; }

class L {
public:
	P s, t;
	L() {}
	L(P s_, P t_) : s(s_), t(t_) {}
	L(const L& l) : s(l.s), t(l.t) {}
	L& operator=(const L& l) { s=l.s; t=l.t; return (*this); }
	double length() { return (s - t).norm(); }
	P vec() const { return t - s; }
	P proj(const P& p) { return s + vec().proj(p - s); }
	int iLL(const L& l) const {
		if(sign(vec().det(l.vec()))) return 1;
		if(sign(vec().det(l.s - s))) return 0;
		return -1;
	}
	bool iLS(const L& l) const { return sign(tri(s, t, l.s)) * sign(tri(s, t, l.t)) <= 0; } 
	bool iSS(const L& l) const { return iLS(l) && l.iLS(*this); }
	P pLL(const L& l) const { return s + vec() * (l.s - s).det(l.vec()) / vec().det(l.vec()); }
	double dLP(const P& p) const { return abs(tri(s, t, p)) / vec().norm(); }
	double dSP(const P& p) const {
		if(sign(vec().dot(p - s)) <= 0) return (p - s).norm();
		if(sign(vec().dot(p - t)) >= 0) return (p - t).norm();
		return dLP(p);
	}
};

class C {
public:
	P p;
	double r;
	C() {}
	C(P p_, double r_) : p(p_), r(r_) {}
	C(const C& c) : p(c.p), r(c.r) {}
	C& operator=(const C& c) { p=c.p; r=c.r; return (*this); }
};

// geometry library end

int main() {
	int n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	scanf("%d", &n);
	rep(i,n) {
		scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		P p1(x1,y1);
		P p2(x2,y2);
		P p3(x3,y3);
		P p4(x4,y4);
		if(sign((p2-p1).det(p4-p3)) == 0) {
			printf("YES\n");
		} else {
			printf("NO\n");
		}
	}
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>
 
using namespace std;
 
inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}
 
typedef long long ll;
 
int main()
{
    int num;
    double sx1, sy1, sx2, sy2;
    double ex1, ey1, ex2, ey2;
 
    cin >> num;
 
    for(int i = 0; i < num; i++)
    {
        cin >> sx1 >> sy1 >> sx2 >> sy2 >> ex1 >> ey1 >> ex2 >> ey2;
 
        if( (sy2-sy1)/(sx2 - sx1) == (ey2-ey1)/(ex2-ex1))
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
}