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")
			continue
		}
		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 <cstdio>
#include <cmath>

using namespace std;

int main(void){
	int n, i;
	double x1,y1,x2,y2,x3,y3,x4,y4, vabx, vaby, vcdx, vcdy;
	scanf("%d",&n);
	for(i = 0;i < n;i++){
		scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		vabx = (x1 - x2) / sqrt(pow(x1 - x2,2.0) + pow(y1 - y2,2.0)), vaby = (y1 - y2) / sqrt(pow(x1 - x2,2.0) + pow(y1 - y2,2.0));
		vcdx = (x3 - x4) / sqrt(pow(x3 - x4,2.0) + pow(y3 - y4,2.0)), vcdy = (y3 - y4) / sqrt(pow(x3 - x4,2.0) + pow(y3 - y4,2.0)); 
		if((vabx == vcdx && vaby == vcdy) || (-vabx == vcdx && -vaby == vcdy)){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

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


int main(void) {

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

  return 0;
}

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

typedef complex<double> P;

// ?¨±?????????????????
#define EPS (1e-10)
// 2??????????????????????????????????????????
#define EQ(a,b) (abs((a)-(b)) < EPS)

// ?????? (cross product) : a??b = |a||b|sin??
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

// 2??´?????????????????? : a//b <=> cross(a, b) = 0
int is_parallel(P a1, P a2, P b1, P b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}

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

	cin >> n;
	for(int i=0 ; i<n ; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		P a(x1,y1), b(x2,y2), c(x3,y3), d(x4,y4);
		if( is_parallel(a,b,c,d) ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
using namespace std;
int main() {
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int n;
	int inf = 9999999;
	cin >> n;
	for (int z = 0; z < n; z++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double a = inf, b =inf;
		if(x1!=x2)a = (y1 - y2) / (x1 - x2);
		if(x3!=x4)b = (y3 - y4) / (x3 - x4);
		if (a == b) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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


    cout << "NO" << endl;
}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <math.h>
#include <functional>
#include <algorithm>

typedef long long Int;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
using namespace std;

int main(){
	double p[8];
	int n;
	cin >> n;

	REP(i, n){

		REP(i, 8){
			cin >> p[i];
		}

		string ans = (p[3] - p[1])*(p[6] - p[4]) == (p[7] - p[5])*(p[2] - p[0]) ? "YES" : "NO";


		cout << ans << endl;
	}
	return 0;
}

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

int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double m1 = (y2 - y1) / (x2 - x1);
		double m2 = (y4 - y3) / (x4 - x3);
		if (m1 == m2) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <vector>
#include <iostream>
#include <valarray>
#include <string>
#include <algorithm>
#include <set>
#include <complex>
#include <cmath>
#include <cstdio>
#define fst first
#define snd second
#define rep(i,n) for(ull i = 0;i<(n);i++)
#define rep1(i,n) for(ull i = 1;i<=(n);i++)
#define revrep(i,n) for(ull i = (n-1);i>=0;i--)
#define all(n) (n).begin(),(n).end()
#define show(x) cout << "debug " << #x << ":" << x << endl;
#define showvec(x) cout << endl << "debug " << #x << ";" << endl; \
    for(ull __i = 0;__i < x.size();__i++){ \
        for(ull __j = 0;__j<x[0].size();__j++){ \
            cout << x[__i][__j] << " "; \
        } \
        cout << endl; \
    } \
    cout << endl;
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef complex<double> xy_t;
double dot_product(xy_t a, xy_t b){
	return (conj(a)*b).real();
}

double cross_product(xy_t a, xy_t b){
	return (conj(a)*b).imag();
}

const double eps = 1e-11;
int N;
int main(){
	double x[4],y[4];
	cin >> N;
	rep(_n,N){
		rep(i,4){
			cin >> x[i] >> y[i];
		}
		xy_t a,b;
		a = xy_t(x[0],y[0]) - xy_t(x[1],y[1]);
		b = xy_t(x[2],y[2]) - xy_t(x[3],y[3]);
		cout << ((abs(cross_product(a,b)) < eps) ? "YES" : "NO") << endl;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(void){
	double x[4],y[4];
	int n;
	scanf("%d",&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];
		double z1=(double)(x[0]-x[1])/(y[0]-y[1]);
		double z2=(double)(x[2]-x[3])/(y[2]-y[3]);
		if(x[0]-x[1]==0 && x[2]-x[3]==0 || y[0]-y[1]==0 && y[2]-y[3]==0)printf("YES\n");
		else if(z1==z2)printf("YES\n");
		else printf("NO\n");
	}
    return 0;
}

C++: #include<cstdio>
#include<iostream>
 
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;
        if(y2-y1==0){
            if(y4-y3==0) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
        else if((x2-x1)/(y2-y1)==(x4-x3)/(y4-y3)) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
 
    return 0;
}