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<iostream>
#include<cmath>
#define EPS 0.000000000001
using namespace std;

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

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

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

using namespace std;

#define EPS 1e-5

int main(){
  double a,b,c,d,e,f,g,h;
  int t;

  cin >> t;
  while(t--){
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    
    c -= a,d -= b,g -= e,h -= f;
    
    cout << (fabs(c*g-d*h) > EPS ? "NO" : "YES") << endl;
  }
  
  return 0;
}

C++: #include <cassert>
#include <cmath>
#include <iostream>
#include <vector>

struct Point
{
    double x;
    double y;
};
struct Line
{
    Line(const Point& a, const Point& b)
    : p1(a), p2(b) {}
    Point p1;
    Point p2;
};
double GetSlope(const Line& line)
{
    return
    (line.p2.y - line.p1.y) /
    (line.p2.x - line.p1.x);
}
bool IsParallel(const Line& l1, const Line&l2)
{
    // std::cerr << GetSlope(l1) << std::endl;
    // std::cerr << GetSlope(l2) << std::endl;
    return std::fabs(GetSlope(l1) - GetSlope(l2)) < 0.00001;
}
bool IsParallel(const std::vector<Point>& points)
{
    assert(points.size() == 4);
    return IsParallel(Line(points[0], points[1]), Line(points[2], points[3]));
}
std::vector<Point> Input(std::istream& is)
{
    std::vector<Point> points(4);
    for(int i = 0; i < points.size(); ++i){
        is >> points[i].x >> points[i].y;
    }
    return points;
}
int main()
{
    int n;
    std::cin >> n;
    for(int i = 0; i < n; ++i) {
        std::vector<Point> points = Input(std::cin);
        std::cout << (IsParallel(points) ? "YES" : "NO") << std::endl; 
    }
    return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld =long double;
const ld eps = 1e-9;

enum R_Way {
	R_Left,
	R_Front,
	R_Right,
	R_Back,

	R_Dummy,
};

struct Dice {
	int tp;
	int bo;
	int no;
	int so;
	int ea;
	int we;
	Dice(int tp_, int bo_, int no_, int so_, int ea_, int we_) :
		tp(tp_), bo(bo_), no(no_), so(so_), ea(ea_), we(we_) {

	}
	Dice(vector<int>pips_) {

	}

	Dice() {
		tp = 1;
		/*bo = 6;
		no = 2;
		so = 5;
		ea = 3;
		we = 4;*/
	}

	int rotate(const R_Way way) {
		switch (way) {
		case R_Right: {
			int c = tp;
			tp = we;
			we = bo;
			bo = ea;
			ea = c;
		}
					  break;
		case R_Back: {
			int c = tp;
			tp = so;
			so = bo;
			bo = no;
			no = c;
		}
					 break;
		case R_Left: {
			int c = tp;
			tp = ea;
			ea = bo;
			bo = we;
			we = c;
		}
					 break;
		case R_Front: {
			int c = tp;
			tp = no;
			no = bo;
			bo = so;
			so = c;
		}
					  break;
		default:
			assert(false);
		}
		return tp;
	}
	int rotate(const int way) {
		return rotate(static_cast<R_Way>(way));
	}
	void spin(const int  clockwise) {
		if (!clockwise) {

			rotate(R_Way::R_Left);
			rotate(R_Way::R_Back);
			rotate(R_Way::R_Right);
		}
		else {

			rotate(R_Way::R_Left);
			rotate(R_Way::R_Front);
			rotate(R_Way::R_Right);
		}
	}
	int hash()const {
		return tp + we * 6 + no * 36;
	}
};
int geteast(int top, int south) {
	map<pair<int, int>, int>mp;
	mp[make_pair(1, 2)] = 3;
	mp[make_pair(1, 3)] = 5;
	mp[make_pair(2, 3)] = 1;
	mp[make_pair(2, 4)] = 6;
	bool rev = false;
	if (top >= 4) {
		rev = !rev; top = 7 - top;
	}
	if (south >= 4) {
		rev = !rev; south = 7 - south;
	}
	if (top > south) {
		rev = !rev; swap(top, south);
	}
	return mp[make_pair(top, south)];
}

bool connect(char a, char b) {
	return abs(a-b)==abs('A'-'a');
}

bool solve(bitset<8>&used, const int now, vector<Dice>&dices) {
	if(now==8)return true;
	else {
		for (int i = 0; i < 8; ++i) {
			if(used[i])continue;
			else {
				for (int tp = 1; tp <= 6; ++tp) {
					for (int so = 1; so <= 6; ++so) {
						if(tp==so||tp+so==7)continue;
						int le=geteast(tp,so);

						vector<int>perms(6);
						perms[0]=tp-1;
						//perms[1]=
					}
				}
			}
		}
	}
}

int main()
{
	int N;cin>>N;
	for (int i = 0; i < N; ++i) {
		vector<ld>v(8);
		for(int j=0;j<8;++j)cin>>v[j];

		ld ax=v[2]-v[0];
		ld ay=v[3]-v[1];

		ld bx=v[6]-v[4];
		ld by=v[7]-v[5];

		bool ok=abs(ax*by-bx*ay)<eps/1000;

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