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)
		}
		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 <stdio.h>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <complex>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = 1e-9;    // 許容誤差。問題によって変える
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

// 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
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
}

/* 交差判定　直線・線分は縮退してはならない。接する場合は交差するとみなす。isecはintersectの略 */

// 直線と点
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);
}

int main() {
  int n;
  cin >> n;
  rep(_,n) {
    VP ps(4);
    rep(i,4) {
      D x,y;
      cin >> x >> y;
      ps[i] = P(x,y);
    }
    cout << (isecLL(ps[0], ps[1], ps[2], ps[3]) ? "NO" : "YES") << endl;
  }
  return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int n;
	int i,j;
	double x[5],y[5];
	double xx,yy;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		for(j=0;j<4;j++){
			scanf("%lf %lf",&x[j],&y[j]);
		}
		if(x[0]-x[1]==0 || x[2]-x[3]==0){
			if(x[0]-x[1]==0 && x[2]-x[3]==0){
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
		else {
			xx=(y[0]-y[1])/(x[0]-x[1]);
			yy=(y[2]-y[3])/(x[2]-x[3]);
	//		printf("%lf %lf\n",xx,yy);
			if(xx==yy){
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
	}	
	return 0;
}

C++: #include<stdio.h>

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

	scanf("%d", &n);

	for (i = 0; i<n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]);

		if (((y[1] - y[0]) / (x[1] - x[0])) == ((y[3] - y[2]) / (x[3] - x[2])))printf("YES\n");
		else printf("NO\n");
	}

	return 0;

}

C++: #include <iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
using namespace std;
int main (void) {
    int n;
    double x1,x2,x3,x4,y1,y2,y3,y4;
    cin >> n;
    while(n--){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        if(x1==x2&&x3==x4||(y1-y2)/(x1-x2)==(y3-y4)/(x3-x4))    cout << "YES\n";
        else    cout << "NO\n";
    }
    return 0;
}

C++: #include <stdio.h>

int main(){
    int n,i,j;
    double X[5],Y[5];
    long x[5],y[5];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        for(j=1;j<=4;j++){
            scanf("%lf %lf",&X[j],&Y[j]);
            x[j] = (long)(X[j]*100000);
            y[j] = (long)(Y[j]*100000);
        }
        if((x[2]-x[1])*(y[4]-y[3])==(x[4]-x[3])*(y[2]-y[1])){
            if((y[2]-y[1])*(x[3]-x[1])==(x[2]-x[1])*(y[3]-y[1])){
                printf("NO\n");
            }else{
                printf("YES\n");
            }
        }else{
            printf("NO\n");
        }
    }
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <cctype>
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <complex>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
const double PI = 3.141592653589793238462643383279502884L;
const int LARGE_PRIME = 1000000007;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i,a,cont,next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i,a,b,s) repfn(i,a,i<b,i+s)
#define repab(i,a,b) repby(i,a,b,1)
#define rep(i,b) repab(i,0,b)
#define pb push_back
#define sz(c) int((c).size())

typedef complex<double> P;

bool EQ(double a, double b)
{
  double prec = 0.000000001;
  return abs(a - b) < prec;
}

bool parallel(P a, P b)
{
  return (EQ(arg(a), arg(b)) || EQ(arg(a), arg(-b)));
}

int main(int argc, char **argv)
{
  vector<P> v(4);
  double x, y;
  int n;
  cin >> n;
  while (n--) {
    rep (i, 4) {
      cin >> x >> y;
      v[i] = P(x, y);
    }
    P p = v[1] - v[0];
    P q = v[3] - v[2];
    if (parallel(v[1] - v[0], v[3] - v[2]))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

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

int main(void) {
  int n;
  cin >> n;
  while (n--) {
    double x1, y1, x2, y2, x3, y3, x4, y4;
    double ang1 = 0.0, ang2 = 0.0;
    bool flag = false;
    cin >> x1 >> y1 >> x2 >> y2
	>> x3 >> y3 >> x4 >> y4;

    if (x1 == x2 || x3 == x4) {
      if (x1 == x2 && x3 == x4) flag = true;
    } else {
      ang1 = (y2 - y1) / (x2 - x1);
      ang2 = (y4 - y3) / (x4 - x3);
      if (ang1 == ang2) flag = true;
    }

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

C++: #include<stdio.h>
double x[4],y[4];
double X[2],Y[2];
double s[2];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
         for(int j=0;j<4;j++)
         {
             scanf("%lf%lf",&x[j],&y[j]);
         }
         for(int j=0;j<2;j++)
         {
             (j==0)?X[j]=x[0]-x[1],Y[j]=y[0]-y[1]:X[j]=x[2]-x[3],Y[j]=y[2]-y[3];
         }
         for(int j=0;j<2;j++)
         {
             (X[j]<0)?X[j]*-1:X[j]*1;
             (Y[j]<0)?Y[j]*-1:Y[j]*1;
             s[j]=X[j]/Y[j];
         }
         (s[0]==s[1])?printf("YES\n"):printf("NO\n");
    }
    return 0;
}

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

#define	EPS		1e-9
#define	pb(a)	push_back(a);

using namespace std;

class Point{
public:
	double x,y;
	Point(){}
	Point(double xx,double yy) : x(xx),y(yy){}
};

Point &operator -=(Point &a,const Point &b)
{
	a.x-=b.x;
	a.y-=b.y;
	return a;
}

Point operator -(const Point &a,const Point &b)
{
	Point c=a;
	c-=b;
	return c;
}

class Line : public vector<Point>{
public:
	Line(const Point &a,const Point &b){
		pb(a);
		pb(b);
	}
};

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

bool parallel(const Line &l,const Line &m)
{
	return abs(cross(l[1]-l[0],m[1]-m[0]))<EPS;
}

int main()
{
	int n;	cin>>n;
	while(n--){
		Point p[4];
		for(int i=0;i<4;i++)	cin>>p[i].x>>p[i].y;
		Line l(p[0],p[1]),m(p[2],p[3]);
		cout<<(parallel(l,m)?"YES":"NO")<<endl;
	}
	return 0;
}