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>
using namespace std;

const double EPS = 1e-10;

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b)))
		return 0;
	return a + b;
}

struct P {
	double x, y;
	P() {};
	P(double x, double y) : x(x), y(y) {
	}

	P operator + (P p) {
		return P(add(x, p.x), add(y, p.y));
	}

	P operator - (P p) {
		return P(add(x, -p.x), add(y, -p.y));
	}

	P operator * (double d) {
		return P(x * d, y * d);
	}

	P operator / (double d) {
		return P(x / d, y / d);
	}

	// 内積
	double dot(P p) {
		return add(x * p.x, y * p.y);
	}

	// 外積
	double det(P p) {
		return add(x * p.y, -y * p.x);
	}
};

// 線分上に点があるか
bool on_seg(P p1, P p2, P q) {
	return (p1 - q).det(p2 - q) == 0 && (p1 - q).dot(p2 - q) <= 0;
}

// 直線と直線の交点
P intersection(P p1, P p2, P q1, P q2) {
	return p1 + (p2 - p1) * ((q2 - q1).det(q1 - p1) / (q2 - q1).det(p2 - p1));
}

// 2直線の直行判定
bool line_orth(P a1, P a2, P b1, P b2) {
	return fabs((a1 - a2).dot(b1 - b2)) < EPS;
}

// 2直線の平行判定
bool line_paral(P a1, P a2, P b1, P b2) {
	return fabs((a1 - a2).det(b1 - b2)) < EPS;
}

int main(void) {
	int N;
	P p[4];
	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> p[j].x >> p[j].y;
		}
		cout << (line_paral(p[0], p[1], p[2], p[3]) ? "YES" : "NO") << endl;
	}
}

C++: #include <iostream>
#include <cmath>
using namespace std;
 
const double EPS= 1e-12;
 
struct zahyo{
    double x;
    double y;
};
 
 
int main(){
    zahyo a , b , c , d , ab , cd;
    int n;
    std::cin >> n;
    for(int i=0 ; i<n ; ++i){
        std::cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
        ab.x=b.x-a.x;
        ab.y=b.y-a.y;
        cd.x=d.x-c.x;
        cd.y=d.y-c.y;
        if (abs(ab.x*cd.y-ab.y*cd.x)<EPS){ //gaiseki
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }           
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
	int n;
	cin >> n;

	double x1, y1, x2, y2, x3, y3, x4, y4;

	while (n--){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		cout << (((y2 - y1) / (x2 - x1) - (y4 - y3) / (x4 - x3) == 0) ? "YES\n" : "NO\n");
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	double vx1, vy1, vx2, vy2;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		vx1 = x2 - x1;
		vy1 = y2 - y1;
		vx2 = x4 - x3;
		vy2 = y4 - y3;
		if ((vx1 != 0 && vy1 != 0) || (vx2 != 0 && vy2 != 0)){
			if (vy1*vx2 == vx1*vy2) cout << "YES\n";
			else cout << "NO\n";
		}
		else cout << "NO\n";
	}
}

C++: #include <iostream>

using namespace std;

int main()
{
    double x1, y1, x2, y2, x3, y3, x4, y4, n;
    
    cin >> n;
    
    for(int i = 0; i < n; i++)
    {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        
        double ax = x2 - x1;
        double ay = y2 - y1;
        double bx = x4 - x3;
        double by = y4 - y3;
        
        cout << (ax * by == ay * bx ? "YES" : "NO") << endl;
    }
    
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(void)
{
  int n;
  double x[4],y[4];
  double degree[2];
  
  cin >> n;

  for(int i = n ; i > 0 ; i--){
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
    degree[0] = (y[1] - y[0]) / (x[1] - x[0]);
    degree[1] = (y[3] - y[2]) / (x[3] - x[2]);

    if(degree[0] == degree[1]) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	double ax[100],ay[100],bx[100],by[100],cx[100],cy[100],dx[100],dy[100];
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>ax[i]>>ay[i]>>bx[i]>>by[i]>>cx[i]>>cy[i]>>dx[i]>>dy[i];
	}
	for(int i=0;i<n;i++){
		double A=0,B=0;
		A=(by[i]-ay[i])/(bx[i]-ax[i]);
		B=(dy[i]-cy[i])/(dx[i]-cx[i]);
		if(A==B){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

typedef complex<double> P;
struct Line : public vector<P>
{
  Line(P a=P(), P b=P()) {
    push_back(a); push_back(b);
  }
};

double cross(P const& a, P const& b) {
  return imag(conj(a)*b);
}

bool is_parallel(Line const& s, Line const& t) {
  return abs(cross(s[1]-s[0], t[1]-t[0])) < 1e-9;
}

int main() {
  int N; cin >> N;
  rep(tc, 2) {
    P ps[4]; rep(i, 4) cin >> ps[i].real() >> ps[i].imag();
    cout << (is_parallel(Line(ps[0], ps[1]), Line(ps[2], ps[3])) ? "YES\n" : "NO\n");
  }
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> n;
	for (int z = 0; z < n; z++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double a = 99999, b = 99999;
		if((x2 - x1)*(y4 - y3)==(x4 - x3)*(y2 - y1)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}