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")
		} else {
			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<iostream>
#include<cmath>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int n;
	pair<long double,long double> p[4],vec[2];
	cin>>n;
	rep(j,n){
		rep(i,4)cin>>p[i].first>>p[i].second;
		rep(i,2){
			vec[i].first=p[i*2].first-p[i*2+1].first;
			vec[i].second=p[i*2].second-p[i*2+1].second;
		}
		double check=vec[0].first*vec[1].second-vec[0].second*vec[1].first;
		if(abs(check)<1e-9)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  int n; cin >> n;

  while (n--) {

    Real x1,y1,x2,y2,x3,y3,x4,y4;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;

    if ((x1 - x2) * (y3 - y4) == (y1 - y2) * (x3 - x4)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }

  }

  return 0;
}

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

int main()
{
	int n;
	setprecision(5);
	long double x[4], y[4],d1,d2,d3,d4;
	int ans[100];
	cin >> n;
	for (int a = 0; a < n; a++) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		if (x[0] > x[1]) {
			d1 = x[0] - x[1];
			d3 = y[0] - y[1];
		}
		else {
			d1 = x[1] - x[0];
			d3 = y[1] - y[0];
		}
		if (x[2] > x[3]) {
			d2 = x[2] - x[3];
			d4 = y[2] - y[3];
		}
		else {
			d2 = x[3] - x[2];
			d4 = y[3] - y[2];
		}

		if (d3 / d1 == d4 / d2)
			ans[a] = 0;
		else
			ans[a] = 1;
	}
	for (int b = 0; b < n; b++) {
		if (ans[b] == 0)
			cout << "YES" << endl;
		else if (ans[b] == 1)
			cout << "NO" << endl;
	}
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
    int N;
	cin>>N;
	while(N--){
		double x1,y1,x2,y2,x3,y3,x4,y4;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		(y1-y2)*(x3-x4)==(y3-y4)*(x1-x2)?printf("YES\n"):printf("NO\n");
	}
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
  
int main (void) {
  long double x1, y1, x2, y2, x3, y3, x4, y4;
  int n;
     
  cin >> n;
    
  for(int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    long double t1 = (y1-y2)/(x1-x2);
    long double t2 = (y3-y4)/(x3-x4);
    //cout << t1 << " " << t2 << endl;
    if (t1==t2) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
    
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  double a[2],b[2],c[2],d[2];
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a[0] >> a[1] >> b[0] >> b[1] >> c[0] >> c[1] >> d[0] >> d[1];
    if(b[0]-a[0]==0&&d[1]-c[1]==0) cout << "NO" << endl;
    if(b[1]-a[1]==0&&d[0]-c[0]==0) cout << "NO" << endl;
    if((b[1]-a[1])*(d[0]-c[0])==(d[1]-c[1])*(b[0]-a[0])) cout << "YES" << endl;
    else cout << "NO" << endl;
  }   
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
const double EPS=1e-10;
double x[4],y[4];
int main(){
    int n;
    cin>>n;
    while(n--){
        for(int i=0;i<4;i++)cin>>x[i]>>y[i];
        for(int i=0;i<4;i+=2){
            x[i]-=x[i+1];y[i]-=y[i+1];
        }
        if(fabs(x[0]*y[2]-x[2]*y[0])<EPS)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	double x[4], y[4];
	double ab, cd;
	int n;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		ab = cd = 999999;
		if (x[0] != x[1])
			ab = (y[0] - y[1]) / (x[0] - x[1]);
		if (x[2] != x[3])
			cd = (y[2] - y[3]) / (x[2] - x[3]);
		if (ab == cd)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;

int main(){
    double e = 1e-8;
    double x[4];
    double y[4];
    double s;
    double t;
    double u;
    double v;
    double m;
    int n;
    cin >> n;

    for (int t = 0;t < n;++t) {
        for (int i = 0;i < 4;++i){
            cin >> x[i] >> y[i]; 
        }
    }
    s = x[1] - x[0];
    t = y[1] - y[0];
    u = x[3] - x[2];
    v = y[3] - y[2];

    if(s * v - t * u > 0){
        double m = s * v - t * u;
    }
    else{
        double m = t * u - s * v;
    }

    if(m<e){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

int main(void){
    int n;
    double x[4],y[4];
    double ansx[2],ansy[2];
    cin>>n;
    for(int i = 0 ; i < n ;  i ++){	
      for(int j = 0 ; j < 4 ; j ++)cin>>x[i]>>y[i];
      for(int j = 0 ; j < 4 ; j +=2){
	ansx[i]=ansx[i]-ansx[i+1];
	ansy[i]=ansy[i]-ansy[i+1];
      }
      if(ansx[0]*ansy[1]-ansx[1]*ansy[0])
	cout<<"NO"<<endl;
      else
	cout<<"YES"<<endl;

    }
}

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

int main() {
  int n = 0;
  double d[8];
  cin >> n;

  for(int i = 0; i < n && 0 <= n && n < 100; i++) {
    for(int j = 0; j < 4*2; j++)
      cin >> d[j];
    double tanAB = (d[3]-d[1])/(d[0]-d[2]);
    double tanCD = (d[7]-d[5])/(d[4]-d[6]);
    if(tanAB == tanCD)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
  double x1,x2,x3,x4;
  double y1,y2,y3,y4;
  int n;
  cin >> n;
  while(n--){
    cin >> x1>> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
  if(fabs((y2 - y1)*(x4 - x3) - (x2 - x1)*(y4 - y3)) < 10e-10) cout << "YES"<<endl;
  else cout << "NO" << endl;
}
  return 0;
}

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

int main()
{
	const double EPS = 1e-3;
	const double PI = 4.*atan(1.);

	int n;cin>>n;
	for ( int i=0; i<n; i++ )
	{
		double x1,y1,x2,y2,x3,y3,x4,y4;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		complex<double> A(x1,y1),B(x2,y2),C(x3,y3),D(x4,y4);
		double a = arg((A-B)/(C-D));
		cout << ( abs(a)<EPS || abs(a)>PI-EPS ? "YES" : "NO" ) << endl;
	}
	return 0;
}