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<vector>
#include<iostream>
#include<math.h>
using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
double x1,Y1,x2,y2,x3,y3,x4,y4;
int n;
int main()
{
  cin>>n;
  for(int i = 0;i < n;i++){
    cin>>x1>>Y1>>x2>>y2>>x3>>y3>>x4>>y4;
    double a =(Y1-y2)/(x1-x2);
    double b =(y4-y3)/(x4-x3);
    if(x1-x2==0 && x4-x3==0){
      cout <<"YES"<<endl;
    }
      if(a==b)
      cout <<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
void judge(double,double,double,double,double,double,double,double);

int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;

	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		judge(x1, y1, x2, y2, x3, y3, x4, y4);
	}
	
	return 0;
}

void judge(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
	double abx = x2 - x1;
	double aby = y2 - y1;
	double cdx = x4 - x3;
	double cdy = y4 - y3;
	if (abx * cdy - aby * cdx == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return;

}

C++: #include <cstdio>

int main(int argc, char *argv[]) {
	int dataN;
	scanf("%d", &dataN);
	for (int i = 0; i < dataN; i++) {
		float x1, y1, x2, y2, x3, y3, x4, y4;
		scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		
		float res1 = 1.0f, res2 = 2.0f;
		bool flg1 = false, flg2 = false;
		
		if (x2 > x1) res1 = (y2-y1)/(x2-x1);
		else if (x2 == x1) flg1 = true;
		else res1 = (y1-y2)/(x1-x2);
		
		if (x4 > x3) res2 = (y4-y3)/(x4-x3);
		else if (x4 == x3) flg2 = true;
		else res2 = (y3-y4)/(x3-x4);
		
		if (res1 == res2) {
			puts("YES");
		}
		else {
			if (flg1 && flg2) puts("YES");
			else puts("NO");
		}
	}
	return 0;
}

C++: #include<iostream>
#include<complex>
#include<math.h>
using namespace std;

typedef complex<double> xy_t;
double x[4], y[4];

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

C++: //Parallelism
#include<bits/stdc++.h>
using namespace std;

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

  return 0;
}

C++: #include <iostream>
#include <complex>
using namespace std;
 
typedef complex<double> P;
 
#define EPS 1e-10
#define EQ(a, b) (abs((a)-(b)) < EPS)
 
double cross(P a, P b){
  return (a.real()*b.imag() - a.imag()*b.real());
}
 
int is_parallel(P a1, P a2, P b1, P b2){
  return EQ(cross(a1-a2, b1-b2), 0.0);
}
 
int main(void){
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    P a(x1, y1), b(x2, y2), c(x3, y3), d(x4, y4);
    if(is_parallel(a, b, c, d)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
  return 0;
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  cin >> n;
  rep(i, n) {
    double x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if (x1 == x2 && x3 == x4) {
      cout << "YES" << endl;
      continue;
    }
    if (x1 == x2 || x3 == x4) {
      cout << "NO" << endl;
      continue;
    }
    if ((y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

C++: #include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <cmath>
#include <sstream>
#define F first
#define S second
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define FORI(i,k,n) for(int i=k;i<(int)n;i++)
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int l = 0; l < n; l++) {
		double x[4], y[4];
		for (int i = 0; i < 4; i++)cin >> x[i] >> y[i];
		if (x[0] == x[1] && x[2] == x[3]) {
			cout << "YES" << endl;
			continue;
		} else if ((y[1] - y[0]) / (x[1] - x[0]) == (y[3] - y[2]) / (x[3] - x[2])) {
			cout << "YES" << endl;	
			continue;
		}
		cout << "NO" << endl;
		continue;
	}
	return 0;
}

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

double abs_(double a)
{
	if (a > 0) return a;
	else return -a;
}

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		double x[4], y[4];
		double a, b;
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		a = (x[2] - x[3]) * (y[0] - y[1]);
		b = (x[0] - x[1]) * (y[2] - y[3]);
		bool h = abs_(a - b) < 0.0000001;
		if (h)
		{
			cout << "YES" << endl;
		}
		else
			cout << "NO" << endl;
	}




	return 0;
}