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 <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

#define vcitr vector<int>::iterator
#define vcsitr vector<string>::iterator
#define mapcitr map<char, int>::iterator
#define mapsitr map<string, int>::iterator

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }


struct Point2D { 
	double x, y;
	Point2D (double a=0, double b=0) { x=a; y=b; }
};

typedef Point2D Vector2D;

double dist2D(const Point2D& a, const Point2D& b) { return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) ); }

Vector2D sub_vector2D(const Vector2D& a, const Vector2D& b) {
	Vector2D ret;
	ret.x = a.x - b.x; ret.y = a.y - b.y;
	return ret;
}

double cross_product(const Vector2D& a, const Vector2D& b) { return a.x*b.y - a.y*b.x; }

double inner_product(const Vector2D& a, const Vector2D& b) { return a.x*b.x + a.y*b.y; }

int main() {
	int n; cin >> n;
	Point2D a, b, c, d;
	Vector2D x, y;
	
	for (int i=0; i<n; i++) {		
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		
		x = sub_vector(b, a); y = sub_vector(d, c);
		
		if (cross_product(x, y)) cout << "NO" << endl;
		else cout << "YES" << endl;
	}
	
	return 0;
}

C++: #include <iostream>

int main() {
    int n;
    std::cin >> n;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    
    for(int i = 0;i < n;i++){
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        double a = (y1-y2)/(x1-x2);
        double b = (y3-y4)/(x3-x4);
         std::cout <<  (a==b ? "YES":"NO") << '\n';
    }
}

C++: #include <cmath>
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <sstream>

using namespace std;

typedef struct{
    double x;
    double y;
}vec;

int main(){
    int n;
    vec p[4],e[2];
    cin >> n;
    while(n--){
        for(int i=0;i<4;i++)
            cin >> p[i].x >> p[i].y;
        e[0].x=p[1].x-p[0].x;
        e[0].y=p[1].y-p[0].y;
        e[1].x=p[3].x-p[2].x;
        e[1].y=p[3].y-p[2].y;
        if(fabs(e[0].x*e[1].y-e[0].y*e[1].x)<(1e-10)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void)
{
    double x[4];
    double y[4];
    int n;
    cin >> n;
    while(n--){
        for(int i=0; i<4; i++){
            cin >> x[i] >> y[i];
        }
        double ll1,ll2;
        ll1 = (y[1]-y[0])/(x[1]-x[0]);
        ll2 = (y[3]-y[2])/(x[3]-x[2]);
        if(ll1 == ll2) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

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

int main(void){
	
	int n;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((int)atan2(y2-y1,x2-x1)*100000==(int)atan2(y4-y3,x4-x3)*100000){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

C++: #include <stdio.h>
#define sqr(a) (a) * (a)

int main(void){
	int n, i;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	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);
		double left = (sqr(x2 - x1) + sqr(y2 - y1)) * (sqr(x4 - x3) + sqr(y4 - y3));
		double right = sqr((x2 - x1) * (x4 - x3) + (y2 - y1) * (y4 - y3));
		if(left == right){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}