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[4] == fpoints[6] {
			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++: #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_ *1000000 + 0.5;
                y[i][j] = y_ *1000000 + 0.5;
            }
        }
        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>
#define rep(i,n) for (int i = 0; i < (n); i ++)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;
constexpr double EPS = 1e-10;
constexpr double PI = 3.14159265358979;

/* geometry libarary */

// a > 0 : +1, a == 0 : 0, a < 0 : -1
int sgn(const double a) {return (a < - EPS ? -1: (a > EPS ? 1: 0));}

/* 2d Point class */
struct Point {
    double x,y;
    constexpr Point(double x = 0.0,double y = 0.0) :x(x),y(y) {}

    Point operator+() const {return *this;}
    Point operator-() const {return Point(-x,-y);}

    constexpr Point &operator+=(const Point &q) {x += q.x;y += q.y;return *this;}
    constexpr Point &operator-=(const Point &q) {x -= q.x;y -= q.y;return *this;}
    constexpr Point &operator*=(double a) {x *= a;y *= a;return *this;}
    constexpr Point &operator/=(double a) {x /= a;y /= a;return *this;}
    
    constexpr Point operator+(const Point &q) const {return Point(*this) += q;}
    constexpr Point operator-(const Point &q) const {return Point(*this) -= q;}
    constexpr Point operator*(double a) const  {return Point(*this) *= a;}
    constexpr Point operator/(double a) const {return Point(*this) /= a;}

    inline bool operator<(const Point&q) const {return (sgn(x - q.x) != 0 ? sgn(x - q.x) < 0 : sgn(y - q.y) < 0);}
    inline bool operator>(const Point&q) const {return (sgn(x - q.x) != 0 ? sgn(x - q.x) > 0 : sgn(y - q.y) > 0);}
    inline bool operator==(const Point&q) const {return (sgn(x - q.x) == 0 && sgn(y - q.y) == 0);}

    friend ostream& operator<<(ostream& os,const Point &p) {return os << '(' << p.x << ", " << p.y << ')';}
    friend istream& operator>>(istream& is,Point &p) {return is >> p.x >> p.y;}
};

constexpr double dot(const Point &p,const Point &q) {return p.x * q.x + p.y * q.y;}
constexpr double cross(const Point &p,const Point &q) {return p.x * q.y - q.x * p.y;}
constexpr double norm(const Point &p) {return dot(p,p);}
inline double length(const Point &p) {return sqrt(norm(p));}
inline double dist(const Point &p,const Point &q) {return length(p - q);}
constexpr double area(const Point &p,const Point &q,const Point &r) {return cross(q - p,r - p)/2.0;}
inline Point normalized(const Point &p) {Point x = p/length(p);return x;}
inline Point rotation(const Point &p,double arg) {return Point(cos(arg) * p.x - sin(arg) * p.y,sin(arg) * p.x + cos(arg) * p.y);}
inline double angle(const Point &p) {return atan2(p.y,p.x);}

/*ab bc __/: +1
  ab bc --\: -1
  abc   ---: +2
  acb   ---: -2
  bac   ---:  0  */
int iSP(const Point &a,const Point &b,const Point &c) { 
    if (sgn(cross(b - a,c - a)) > 0) return 1;
    if (sgn(cross(b - a,c - a)) < 0) return -1;
    if (sgn(dot(b - a,c - b)) > 0) return 2;
    if (sgn(dot(a - b,c - a)) > 0) return -2;
    return 0;
}
//error point: changed depending on the problem
const Point error_point(INF,INF);

/* 2d Line(or Segment or Ray) class */
//2d Line class
struct Line {
    Point P,Q;
    constexpr Line(const Point &P,const Point &Q):P(P),Q(Q) {}
    constexpr Point vec() const {return Q - P;}
};
using Segment = Line;
using Ray = Line;

Point lineIntersection(const Line &l1,const Line &l2) {
    if (sgn(cross(l1.vec(),l2.vec())) == 0) return error_point;
    return l1.P + l1.vec() * abs(cross(l2.Q - l1.P,l2.vec())/cross(l1.vec(),l2.vec()));
}
/*
Point segmenIntersection(const Segment &s1,const Segment &s2) {
}
*/
double distance(const Point &p,const Line &l) {
    return abs(cross(l.vec(),p - l.P)/length(l.vec()));
}

int main() {
    int N; cin >> N;
    rep(i,N) {
        vector<Point> P(4);
        rep(i,4) {
            cin >> P[i];
        }
        if (sgn(cross(P[3] - P[2],P[1] - P[0])) == 0) {
            printf("YES\n");
        }
        else {
            printf("NO\n");
        }
    }
    return 0;
}

C++: #include <stdio.h>

int main(){
    int n,i,j;
    double x[5],y[5];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        for(j=1;j<=4;j++)scanf("%lf %lf",&x[j],&y[j]);
        if((x[2]-x[1])*(y[4]-y[3])-(x[4]-x[3])*(y[2]-y[1])==0){
            if((y[2]-y[1])*(x[3]-x[1])-(x[2]-x[1])*(y[3]-y[1])==0){
                printf("NO\n");
            }else{
                printf("YES\n");
            }
        }else{
            printf("NO\n");
        }
    }
}

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

int main(){
    int n;
    cin >> n;
    while(n--){
        double x[4],y[4],ll,lll;
        for(int i=0;i<4;i++) cin >> x[i] >> y[i];
        ll = (y[0]-y[1])/(x[0]-x[1]);
        lll = (y[2]-y[3])/(x[2]-x[3]);
        cout << ((ll == lll)? "YES" : "NO") << endl;
    }
}

C++: #include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

#define endl '\n'

typedef long long ll;
typedef long double lb;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y, int x, int H, int W)
{ 
  return (y >= 0 && x >= 0 && y < H && x < W);
}

inline int in() {int x; std::cin >> x; return x;}

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  double x1, y1, x2, y2, x3, y3, x4, 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) || (((y2 - y1) / (x2 - x1)) == ((y4 - y3) / (x4 - x3)))) cout << "YES" << endl;

    else cout << "NO" << endl;
  }
  return (0);
}