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;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-11

template<class T> T add(T x, T y){ if(abs(x+y) < EPS*(abs(x)+abs(y))) return 0; return x + y; }
template<class T> inline bool semieq(T x, T y){ return abs(x - y) < EPS; }
template<class T> inline bool semige(T x, T y){ return x - y > -EPS; }
template<class T> inline bool semile(T x, T y){ return y - x > -EPS; }

template<class Type> struct Line;

template<class Type>
struct P
{
  friend struct Line<Type>;
private:
  Type x, y;

public:
  P(const Type x = 0, const Type y = 0) : x(x), y(y) {}
  void setter(Type x, Type y) { this->x = x;  this->y = y;  return ; }
  Type getX(){ return x; }
  Type getY(){ return y; }
  inline double getSlope(){ return semieq(x, (Type)0) ? INF : 1.0 * y / x; }
  inline double getSlope(P p){ return (this - p).getSlope(); }
  P  operator +  (const P p){ return P(add(x,  p.x), add(y,  p.y)); }
  P  operator -  (const P p){ return P(add(x, -p.x), add(y, -p.y)); }
  P  operator *  (const Type d){ return P(x * d, y * d); }
  P& operator += (const P p){ x = add(x,  p.x);  y = add(y,  p.y);  return *this; }
  P& operator -= (const P p){ x = add(x, -p.x);  y = add(y, -p.y);  return *this; }
  P& operator *= (const Type d){ x *= d;  y *= d;  return *this; }
  bool operator == (const P p){ return  semieq(x, p.x) &&  semieq(y, p.y); }
  bool operator != (const P p){ return !semieq(x, p.x) || !semieq(y, p.y); }
  Type operator * (const P p){ return add(x * p.x,  y * p.y); }
  Type operator / (const P p){ return add(x * p.y, -y * p.x); }
};

template<class Type>
struct Line
{
private:
  P<Type> S, T;

public:
  Line(const Type sx, const Type sy, const Type tx, const Type ty) : S(sx, sy), T(tx, ty) {}
  Line(const P<Type> S, const P<Type> T) : S(S), T(T) {}
  inline P<Type> getS(){ return S; }
  inline P<Type> getT(){ return T; }
  inline double getSlope(){ return S.getSlope(T); }
  inline bool isParallel(Line<Type> L){ return semieq((S.x-T.x)*(L.S.y-L.T.y), (L.S.x-L.T.x)*(S.y-T.y));}
  inline bool isVertical(Line<Type> L){ return semieq((S.x-T.x)*(L.S.x-L.T.x), (L.T.y-L.S.y)*(S.y-T.y));}
};

typedef long double Point;

int n;
P<Point> A[4];
Point x, y;

int main()
{
  cin >> n;

  while(n--){
    rep(i, 4){
      cin >> x >> y;
      A[i].setter(x, y);
    }
    Line<Point> AB(A[0], A[1]);
    Line<Point> CD(A[2], A[3]);
    puts(AB.isParallel(CD) ? "YES" : "NO");
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  double xa,ya,xb,yb,xc,yc,xd,yd,a2,a1;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>xa>>ya>>xb>>yb>>xc>>yc>>xd>>yd;
    a1=(yb-ya)/(xb-xa);
    a2=(yd-yc)/(xd-xc);
    if(a1==a2)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
  }
}

C++: #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <climits>
#include <utility>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()

typedef long long ll;

using namespace std;

int nextInt() { int n = -1; cin >> n; return n; }
double nextDouble() { double d = -1; cin >> d; return d; }
ll nextll() { ll n = -1; cin >> n; return n; }
string nextString() { string str; cin >> str; return str; }

int INF = 9999999;

// BEGIN //////////////////////////////////////////////////////////////


int main() {
	int N;
	cin >> N;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	REP(i, N) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

		if (x2 - x1 == 0 || x4 - x3 == 0) {
			if (y2 - y1 == 0 && y4 - y3 == 0) {
				PRINT("YES");
			} else {
				PRINT("NO");
			}
		} else {
			if ((y2 - y1) / (x2 - x1) - (y4 - y3) / (x4 - x3) < 1e-8) {
				PRINT("YES");
			} else {
				PRINT("NO");
			}
		}
	}

	return 0;
}

// END   //////////////////////////////////////////////////////////////

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
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;
	rep(i,0,n){
		rep(j,0,4){
			cin>>x[j]>>y[j];
		}
		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]))<eps;
		cout<<(p?"YES":"NO")<<endl;
	}
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double eps = 0.0000000001;
	while (n--){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double s1 = x2 - x1,
			   t1 = y2 - y1,
			   s2 = x4 - x3,
			   t2 = y4 - y3;
		double v = fabs(s1 * t2 - s2 * t1);
		if (v < eps) cout << "YES\n";
		else         cout << "NO\n";
	}
	return 0;
}

C++: #include <complex>
#include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
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;
    complex<double> c1(x1, y1);
    complex<double> c2(x2, y2);
    complex<double> c3(x3, y3);
    complex<double> c4(x4, y4);
    double a = arg(c2 - c1) - arg(c4 - c3);
    cout << ((a == 0 || a == M_PI || a == -M_PI) ? "YES" : "NO") << endl;
  }
}

C++: #include <cstdio>
#include <complex>
#include <vector>

using namespace std;

typedef complex<double> P;
struct L : public vector<P> {
    L(const P &a, const P &b) {
        push_back(a);
        push_back(b);
    }
};

const double EPS = 1e-10;

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

bool intersectLL(const L &l, const L &m)
{
    return fabs(cross(l[1]-l[0], m[1]-m[0])) > EPS;
}

int main()
{
    int n;

    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        P p[4];
        double x, y;

        scanf("%lf %lf", &x, &y);
        p[0] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[1] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[2] = P(x, y);
        scanf("%lf %lf", &x, &y);
        p[3] = P(x, y);

        puts(intersectLL(L(p[0], p[1]), L(p[2], p[3])) ? "NO" : "YES");
    }

    return 0;
}