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>
/* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
/* cpp template {{{*/
using namespace std;

#define endl '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;
typedef long long ll;
typedef long double lb;
typedef complex<D> P;
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y,int x,int H,int W){return(y>=0&&x>=0&&y<H&&x<W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}
/* }}} */
/* ?????° {{{*/
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
/* }}} */

D dot(P a, P b) {
  return (conj(a)*b).X;
}

D cross(P a, P b) {
  return (conj(a)*b).Y;
}

int ccw(P a, P b, P c) {
  b -= a;  c -= a;
  if (cross(b,c) >  EPS) return +1;  // counter clockwise
  if (cross(b,c) < -EPS) return -1;  // clockwise
  if (dot(b,c)   < -EPS) return +2;  // c--a--b on line
  if (norm(b) < norm(c)) return -2;  // a--b--c on line or a==b
  return 0;                          // a--c--b on line or a==c or b==c
}

bool isecLP(P a1, P a2, P b) {
  return abs(ccw(a1, a2, b)) != 1;  // return EQ(cross(a2-a1, b-a1), 0); ??¨??????
}

bool isecLL(P a1, P a2, P b1, P b2) {
  return !isecLP(a2-a1, b2-b1, 0) || isecLP(a1, b1, b2);
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n = in();
  P xy[4];

  while(n--){
    REP(i, 4) cin >> xy[i].X >> xy[i].Y;
    if (xy[0] == xy[2] && xy[1] == xy[3]){
      cout << "Yes" << endl;
      break;
    }
    if(isecLL(xy[0], xy[1], xy[2], xy[3])){
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
    

  return (0);
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(){

int n;
double x1,x2,x3,x4,y1,y2,y3,y4;
double a1=0,a2=0;
scanf("%d",&n);

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

return 0;
}

C++: #include <iostream>
#include <complex>
using namespace std;
#define REP(i, n)       REPEAT(i, 0, n)
#define REPEAT(i, k, n) for (int i = (k); i < (n); ++i)

#define X real()
#define Y imag()
typedef double D;
typedef complex<D>P;
#define EPS (1e-10)
#define DEQ(p1,p2) (abs((p1)-(p2)) < EPS)
 
inline D outprd(const P &a, const P &b){ return (conj(a) * b).Y; }
bool is_parallel(const P &a, const P &b, const P &c, const P &d){
    return DEQ(outprd(a-b, c-d), 0.0);
}

int main(){
    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;
        P p1(x1,y1), p2(x2,y2), p3(x3,y3), p4(x4,y4);
        if(is_parallel(p1,p2,p3,p4)){
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include<iostream>
#include <string>
#include<stdio.h>

using namespace std;

int main(int argc, char* argv[])
{
	double x1[100], y1[100], x2[100], y2[100], x3[100], y3[100], x4[100], y4[100];
	double tendAB, tendCD;
	int num;
	int pos = 0;

	cin >> num;
	while (num--) {
		cin >> x1[pos] >> y1[pos] >> x2[pos] >> y2[pos] >> x3[pos] >> y3[pos] >> x4[pos] >> y4[pos];
		pos++;
	}
	for (int i = 0; i < pos; i++) {
		tendAB = (y1[i] == y2[1]) ? 0 : (x2[i] - x1[i]) / (y2[i] - y1[i]);
		tendCD = (y3[i] == y4[1]) ? 0 : (x4[i] - x3[i]) / (y4[i] - y3[i]);
		if (tendAB == tendCD) cout << "YES" << endl; else cout << "NO" << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
const long double EPS = 1e-9;
int main() {
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int n;
	double veku1[2];
	double veku2[2];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		veku1[0] = x2 - x1;
		veku1[1] = y2 - y1;
		veku2[0] = x4 - x3;
		veku2[1] = y4 - y3;
		//cout<<fabs(veku1[0]*veku2[1]-veku1[1]*veku2[0])<<endl;
		if (veku1[0]*veku2[1]-veku1[1]*veku2[0] == 0) {
			/*veku1[0] = x3 - x1;
			veku1[1] = y3 - y1;
			veku2[0] = x4 - x1;
			veku2[1] = y4 - y1;
			if (fabs(veku1[0]*veku2[1]-veku1[1]*veku2[0]) <= 0.0000001) {
				cout << "NO" << endl;
			} else {*/
				cout << "YES" << endl;
			//}
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;
int main(){
	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;

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

	}
	return 0;
}