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-6;

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++: /* AOJ 0021 Parallelism */

#include <iostream>
#include <cmath>

using namespace std;

const double EPS = 1e-10;

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

    cin >> n;

    while (n--) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

        if (fabs((x2 - x1) * (y4 - y3) - (x4 - x3) * (y2 - y1)) < EPS)
            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;

double EPS = 1e-12;

//誤差を考慮して足し算を行う
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);
	}
	double dot(P p) {	//　内積
		return add(x * p.x, y * p.y);
	}
	double det(P p) {	//　外積
		return add(x * p.y, -y * p.x);
	}
};

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

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


int main() {
	int n;

	cin >> n;

	P p, q, r, s;

	for(int i = 0; i < n; i++) {
		cin >> p.x >> p.y >> q.x >> q.y >> r.x >> r.y >> s.x >> s.y;
		if( (q - p).det(s - r) == 0) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}

}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)

double x[4], y[4];
int main(void){
    double eps = 1e-10;
    int n;
    cin >> n;
    rep(data, n) {
        rep(i, 4) cin >> x[i] >> y[i];
        if(x[1]==x[0] && x[3]==x[2]) {
            if(y[1]!=y[0] && y[3]!=y[2]) cout << "YES" << endl;
            else cout << "NO" << endl;
        } else if(x[1]==x[0] && x[3]==x[2]) cout << "NO" << endl;
        else if(abs((y[1]-y[0])/(x[1]-x[0]) - (y[3]-y[2])/(x[3]-x[2])) < eps) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <complex>
using namespace std;
int main() {
	double x[4],y[4];
	int n;
	cin >> n;
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < 4;j++) {
				cin >> x[j] >> y[i];
		}
		double X1, Y1, X2, Y2;
		X1 = x[1] - x[0];
		X2 = x[3] - x[1];
		Y1 = y[1] - y[0];
		Y2 = y[3] - y[2];
		if (X1*Y2 == X2*Y1) {
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>

typedef long long ll;
using namespace std;

int main()
{
	int T;
	scanf("%d",&T);

	for(int t=0;t<T;t++){
		double pos[8];
		double eps = 10e-9;
		for(int i=0;i<8;i++){
			scanf("%lf",pos+i);
		}

		if(!(pos[0] == pos[0+4] && pos[1] == pos[1+4] || pos[2] == pos[2+4] && pos[3] == pos[3+4])
			&& abs((pos[1]-pos[3])/(pos[0]-pos[2])-(pos[1+4]-pos[3+4])/(pos[0+4]-pos[2+4]))<eps
			){
			cout << "YES" << endl;
		}else
		{
			cout << "NO" << endl;	
		}
	}
}

C++: #include <iostream>
#include <cstdio>
#include <complex>

using namespace std;
typedef long long ll;

typedef double R;
typedef complex<R> P;

const R EPS = 1e-9;
const R PI = acos(-1);
int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}


bool near(P a, P b) {
    return !sgn(abs(a-b));
}

void solve() {
    P p[4];
    for (int i = 0; i < 4; i++) {
        double x, y;
        cin >> x >> y;
        p[i] = P(x, y);
    }
    double r1 = arg(p[0]-p[1]);
    double r2 = arg(p[2]-p[3]);
    if (r1 < 0) r1 += PI;
    if (r2 < 0) r2 += PI;
    if (sgn(r1-r2)) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        solve();
    }
    return 0;
}

C++: #include<stdio.h>

int main(void)
{
	double x[4]={0},y[4]={0},x1,x2,y1,y2;
	int i;
	scanf("%d",&i);

	while(i!=0)
	{
		scanf("%f %f %f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
		x1 = x[2]-x[1];   y1 = y[2]-y[1];
		x2 = x[4]-x[3];   y2 = y[4]-y[3];
		if(x1==0 && x2==0)
			printf("YES\n");
		else if((x1==0 && x2!=0) ||(x1!=0&& x2==0))
			printf("NO\n");
		else if(y1/x1 == y2/x2)
			printf("YES\n");
		else 
			printf("NO\n");

		i-=1;
	}
 return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4,lI,lII;
  cin >> n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    lI=(y2-y1)/(x2-x1);
    lII=(y4-y3)/(x4-x3);
    cout << (lI==lII ? "YES" : "NO") << endl;
  }
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
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;
    double a=(x2-x1)/(y2-y1);
    double b=(x4-x3)/(y4-y3);
    
        if(a==b){cout<<"YES"<<endl;
        }else{ cout<<"NO"<<endl;}
    
}
    
    
    
}