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>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int n; cin >> n;
  while (n--) {
    vector<pair<f80, f80>> xy(4);
    rep(i, 4) cin >> xy[i];
    f80 k0 = (xy[1].second - xy[0].second) / (xy[1].first - xy[0].first);
    f80 k1 = (xy[3].second - xy[2].second) / (xy[3].first - xy[2].first);
    if (k0 == k1) {
      cout << "YES" << '\n';
    } else {
      cout << "NO" << '\n';
    }
  }
}

C++: #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double pi = acos(-1);
const double EPS = 1e-10;

double cross(pair<double,double> c,pair<double,double> d){
  return c.first * d.second - d.first * c.first;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<pair<double,double>> a(4);
  int n;
  pair<double,double> lineab, linecd;
  cin >> n;
  REP(i,n){
    REP(j,4){
      cin >> a[j].first >> a[j].second;
    }
    lineab.first = a[1].first - a[0].first;
    linecd.first = a[3].first - a[2].first;
    lineab.second = a[1].second - a[0].second;
    linecd.second = a[3].second - a[2].second;
    if (fabs(cross(lineab,linecd)) < EPS) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  
  
  return 0;
}

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

C++: #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
signed main(){
        int n;
        scanf("%lld",&n);
        for(int i=0;i<n;i++){
                double x1, y1, x2, y2, x3, y3, x4, y4;
                scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
                double c1 = (y2-y1)/(x2-x1);
                double c2 = (y4-y3)/(x4-x3);
                if((x2-x1==0 && x4-x3==0) || fabs(c1-c2) <= 1E-10) printf("YES\n");
                else printf("NO\n");
        }
        return 0;
}

C++: #include <stdio.h>
 
#include <math.h>
 
int hantei(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4);
 
int main(){
     
    double x1,x2,x3,x4,y1,y2,y3,y4;
     
    int result=0,i,n;
     
    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);
         
        result= hantei(x1,y1,x2,y2,x3,y3,x4,y4);
         
        if(result==1){
             
            puts("YES");
             
        }else puts("NO");
         
    }
     
     
     
     
     
    return 0;
     
}
 
int hantei(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4){
     
    double kata1,kata2;
     
    kata1=(y1-y2)/(x1-x2);
     
    kata2=(y3-y4)/(x3-x4);
     
    if(kata1==kata2){
         
        return 1;
         
    }else{
         
        return 0;
         
    }  
     
}

C++: 
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
using namespace std;

int main(void){
    int n;
    double x[4],y[4],a,b,c,d,det;
    cin >> n;
    rep(j,n) {

    
    //入力を多少簡略化
    for(int i=0;i<4;i++) {
        cin >> x[i];
        cin >> y[i];
    }
    //(x1,y1)(x2,y2)を結ぶax+by=p の係数
    a = y[0]-y[1];  b = x[1]-x[0];
    //(x3,y3)(x4,y4)を結ぶcx+dy=q の係数
    c = y[2]-y[3];  d = x[3]-x[2];
    //係数についての行列式
    det = a*d-c*b;
    if(fabs(det) < 0.00001) cout << "YES" << endl;
    else cout << "NO" << endl;
    }
}

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

using namespace std;

typedef complex<double> Point;

bool parallel(const Point &v1, const Point &v2) {
    double dot = v1.real()*v2.real() + v1.imag()*v2.imag();
    double n = norm(v1) * norm(v2);
    return abs(dot*dot - n) < 1e-4;
}

int main() {
    int N;
    cin >> N;
    while(N--) {
        Point ps[4];
        for(int i = 0; i < 4; ++i) cin >> ps[i].real() >> ps[i].imag();
        Point v1 = ps[1]-ps[0], v2 = ps[3]-ps[2];

        if(parallel(v1, v2) && !parallel(v1, ps[2]-ps[1])) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}