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++: #include <bits/stdc++.h>
using namespace std;

#define x() real()
#define y() imag()
#define EPS (1e-4)
#define INF (1e12)
#define SQ(a) ((a) * (a))
#define EQ(a, b) (abs((a) - (b)) < EPS)
#define EQV(a, b) (EQ((a).x(), (b).x()) && EQ((a).y(), (b).y()))
#define MP make_pair
const int COUNTER_CLOCKWISE = 1;
const int CLOCKWISE = -1;
const int ONLINE_BACK = 2;
const int ONLINE_FRONT = -2;
const int ON_SEGMENT = 0;
enum {OUT, ON, IN};

typedef double D;
typedef complex<D> P;
typedef P V;
namespace std {
	bool operator < (const P& a, const P& b){
		if (a.x() != b.x()) return a.x() < b.x();
		return a.y() < b.y();
	}
}
struct S{
	P p1, p2;
	S(){}
	S(P p1, P p2): p1(p1), p2(p2){}
};
typedef S L;
typedef S PP;
struct C{
	P p;
	D r;
	C(){}
	C(P p, D r): p(p), r(r){}
};
typedef vector<P> G;

D norm(P a){
	return SQ(a.x()) * SQ(a.y());
}
D dot(P a, P b){
	return a.x() * b.x() + a.y() * b.y();
}
D cross(P a, P b){
	return a.x() * b.y() - a.y() * b.x();
}
bool orthogonal(L a, L b){
	return EQ( dot(a.p1 - a.p2, b.p1 - b.p2), 0.0 );
}
bool parallel(L a, L b){
	return EQ( cross(a.p1 - a.p2, b.p1 - b.p2), 0.0 );
}
bool PonL(L l, P p){
	return EQ( cross(l.p1 - l.p2, p - l.p2), 0.0 );
}
bool PonS(S s, P p){
	return EQ( cross(s.p1 - s.p2, p - s.p2), 0.0 ) &&
		(dot(s.p1 - s.p2, p - s.p2) > -EPS) &&
		(dot(s.p2 - s.p1, p - s.p1) > -EPS);
}
int ccw(P p0, P p1, P p2){
	P a = p1 - p0;
	P b = p2 - p0;
	if (cross(a, b) > EPS) return COUNTER_CLOCKWISE;
	if (cross(a, b) < -EPS) return CLOCKWISE;
	if (dot(a, b) < -EPS) return ONLINE_BACK;
	if (norm(a) < norm(b)) return ONLINE_FRONT;
	return ON_SEGMENT;
}
bool intersect(S s1, S s2){
	return ccw(s1.p1, s1.p2, s2.p1) * ccw(s1.p1, s1.p2, s2.p2) <= 0 &&
		ccw(s2.p1, s2.p2, s1.p1) * ccw(s2.p1, s2.p2, s1.p2) <= 0;
}
bool intersect(C c1, C c2){
	return abs(c1.p - c1.p) - (c1.r + c2.r) < EPS;
}
bool intersect(G g1, G g2){
	for (int i = 0; i < g1.size(); i++){
		for (int j = 0; j < g2.size(); j++){
			S s1(g1[i], g1[(i + 1) % g1.size()]);
			S s2(g2[j], g2[(j + 1) % g2.size()]);
			if (intersect(s1, s2)) return true;
		}
	}
	return false;
}
P project(S s, P p){
	V base = s.p2 - s.p1;
	D r = dot(p - s.p1, base) / norm(base);
	return s.p1 + base * r;
}
P reflect(S s, P p){
	return p + (project(s, p) - p) * 2.0;
}
P crossP(S s1, S s2){
	assert(intersect(s1, s2));
	P base = s2.p2 - s2.p1;
	D d1 = abs(cross(base, s1.p1 - s2.p1));
	D d2 = abs(cross(base, s1.p2 - s2.p1));
	D t = d1 / (d1 + d2);
	return s1.p1 + (s1.p2 - s1.p1) * t;
}
PP crossPP(C c, L l){
	P pr = project(l, c.p);
	P e = (l.p2 - l.p1) / abs(l.p2 - l.p1);
	D base = sqrt( SQ(c.r) - norm(pr - c.p) );
	return PP(pr + e * base, pr - e * base);
}
PP crossPP(C c1, C c2){
	D d = abs(c1.p - c2.p);
	D a = acos( SQ(c1.r) + SQ(d) - SQ(c2.r) ) / (2 * c2.r * d);
	D t = arg(c2.p - c1.p);
	return PP( c1.p + polar(c1.r, t + a), c1.p + polar(c1.r, t - a) );
}
int contains(G g, P p){
	int n = g.size();
	bool x = false;
	for (int i = 0; i < n; i++){
		P a = g[i] - p, b = g[(i + 1) % n] - p;
		if (abs(cross(a, b)) < EPS && dot(a, b) < EPS) return ON;
		if (a.y() > b.y()) swap(a, b);
		if (a.y() < EPS && EPS < b.y() && cross(a, b) > EPS) x != x;
	}
	return x ? IN : OUT;
}
G convexHull(G s){
	if (s.size() < 3) return s;
	G u, l;
	sort(s.begin(), s.end());
	u.push_back(s[0]);
	u.push_back(s[1]);
	l.push_back(s[s.size() - 1]);
	l.push_back(s[s.size() - 2]);
	for (int i = 2; i < s.size(); i++){
		for (int n = u.size(); n >= 2 && ccw(u[n - 2], u[n - 1], s[i]) != CLOCKWISE; n--){
			u.pop_back();
		}
		u.push_back(s[i]);
	}
	for (int i = s.size() - 3; i >= 0; i--){
		for (int n = l.size(); n >= 2 && ccw(l[n - 2], l[n - 1], s[i]) != CLOCKWISE; n--){
			l.pop_back();
		}
		l.push_back(s[i]);
	}
	reverse(l.begin(), l.end());
	for (int i = u.size() - 2; i >= 1; i--){
		l.push_back(u[i]);
	}
	return l;
}

int main()
{
	int n;
	D x[4], y[4];
	P p[4];
	
	cin >> n;
	while (n--){
		for (int i = 0; i < 4; i++){
			cin >> x[i] >> y[i];
			p[i] = P(x[i], y[i]);
		}
		S s1(p[0], p[1]);
		S s2(p[2], p[3]);
		cout << (parallel(s1, s2) ? "YES" : "NO") << endl;
	}
}

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

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];
		for(int i=0;i<4;i++){ 
			x[i]*=r; y[i]*=r;
		}
		double a1=(y[1]-y[0])/(x[1]-x[0]);
		double a2=(y[3]-y[2])/(x[3]-x[2]);
		if(a1==a2) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
		cout<<a1<<" "<<a2;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>

#define FOR(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
using namespace std;

void solver() {
    int N;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        double x1, x2, x3, x4, y1, y2, y3, y4;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        auto isOK = (y2 - y1) * (x4 - x3) == (y4 - y3) * (x2 - x1);
        if (isOK) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

int main() {
    solver();
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <algorithm>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <queue>
#include <random>
#define INF (1<<21)
#define MAX_N 1000000
#define MAX_LEN 101
#define swap(a,b) {a=a+b; b=a-b; a=a-b;}
#define abs(a) (a > 0 ? a:-a)

using namespace std;


void q21() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		double ax, ay, bx, by, cx, cy, dx, dy;
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
		if (bx - ax == 0 || dx - cx == 0) {
			if (bx - ax == dx - cx) {
				cout << "YES" << endl;
				continue;
			}
		}
		else if (abs((by - ay) / (bx - ax) - (dy - cy) / (dx - cx)) <= 0.001 ){
			cout << "YES" << endl;
			continue;
		}
		cout << "NO" << endl;
	}
}

int main() {
	q21();
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(int argc, char *argv[]) {
  vector<string> result;
  int time;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> time;
  for (int i = 0; i < time; i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

    double ab, cd;
    ab = (y1 - y2) / (x1 - x2);
    cd = (y3 - y4) / (x3 - x4);
    if (ab == cd)
      result.push_back("YES");
    else
      result.push_back("NO");
  }

  for (int i = 0; i < result.size(); i++)
    cout << result[i] << endl;
  return 0;
}

C++: #include<bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

struct vec{
	double x;
	double y;
};

int main(){
	int n;
	cin>>n;
	double x[4],y[4];//0:A 1:B 2:C 3:D
	rep(i,n){
		rep(j,4)cin>>x[j]>>y[j];
		vec ABvec;
		vec CDvec;
		ABvec.x=x[1]-x[0];
		ABvec.y=y[1]-y[0];
		CDvec.x=x[3]-x[2];
		CDvec.y=y[3]-y[2];
		double elmeet=abs(ABvec.x*CDvec.x+ABvec.y*CDvec.y);
		double ABnolme=sqrt(pow(ABvec.x,2)+pow(ABvec.y,2));
		double CDnolme=sqrt(pow(CDvec.x,2)+pow(CDvec.y,2));
		if(abs(ABnolme*CDnolme-elmeet)<1e-10)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}