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

int main()
{
	int n;
	setprecision(5);
	double x[4], y[4],d1,d2,d3,d4;
	int ans[100];
	cin >> n;
	for (int a = 0; a < n; a++) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		if (x[0] > x[1]) {
			d1 = x[0] - x[1];
			d3 = y[0] - y[1];
		}
		else {
			d1 = x[1] - x[0];
			d3 = y[1] - y[0];
		}
		if (x[2] > x[3]) {
			d2 = x[2] - x[3];
			d4 = y[2] - y[3];
		}
		else {
			d2 = x[3] - x[2];
			d4 = y[3] - y[2];
		}

		if (d3 / d1 == d4 / d2)
			ans[a] = 0;
		else
			ans[a] = 1;
	}
	for (int b = 0; b < n; b++) {
		if (ans[b] == 0)
			cout << "YES" << endl;
		else if (ans[b] == 1)
			cout << "NO" << endl;
	}
}

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

struct Point2D {
    double x, y;

    Point2D() {}
    Point2D(double ax, double ay) {
        x = ax;
        y = ay;
    }
    Point2D operator -(Point2D &p) {
        return Point2D(x - p.x, y - p.y);
    }
    double slope(Point2D &p) {
        double dx = p.x - x;
        return dx ? (p.y - y) / dx : INFINITY;
    }
    double cross(Point2D &p) { // only z
        return x * p.y - y * p.x;
    }
};

namespace std {
    istream &operator>>(istream &is, Point2D &p) {
        is >> p.x >> p.y;
        return is;
    }

    ostream &operator<<(ostream &os, Point2D &p) {
        os << fixed << p.x << " " << p.y;
        return os;
    }
}

int main()
{
    int n;
    cin >> n;
    for (Point2D a, b, c, d; n-- && cin >> a >> b >> c >> d;)
        cout << (a.slope(b) == c.slope(d) ? "YES" : "NO") << endl;

    return 0;
}

C++: #include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl

double a[8];

void solve(){
	double dx1=a[2]-a[0];
	double dx2=a[6]-a[4];
	double dy1=a[3]-a[1];
	double dy2=a[7]-a[5];
	bool ans;
	
	if(dx1==0)ans=(dx2==0);
	else ans=(dx2!=0 && dy1/dx1==dy2/dx2);
	if(ans) puts("YES");
	else puts("NO");
}

int main(){
	li n;
	cin>>n;
	
	rin{
		rep(i,8)cin>>a[i];
		solve();
	}
	
	return 0;
}

C++: #include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
#define  PI 3.141592
int main(void){
    long double x1, x2, x3, x4, y1, y2, y3, y4, tilt_a, tilt_b;
    int n;
    
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        if(x1 == x2){
            if(x3 == x4) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
        else{
            tilt_a = (y2-y1)/(x2-x1);
            tilt_b = (y4-y3)/(x4-x3);
            if(tilt_a == tilt_b){
                cout << "YES" << endl;
            }
            else cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	long double x1,y1,x2,y2,x3,y3,x4,y4;
	int n;
	cin>>n;
	int N[100];
for(int i=0;i<n;i++)
{
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
	if((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4))
	{
	N[i]=1;
	}
	else
	{
	N[i]=0;
	}
}
for(int j=0;j<n;j++)
{
	if(N[j]=1)
	{
		cout<<"YES"<<endl;
	}
	else if(N[j]=0)
	{
		cout<<"NO"<<endl;
	}
}
return 0;
}

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

C++: #include <iostream>
using namespace std;
int main(){
	int n;
	cin >> n;
	while(n--){
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if(x2-x1 == 0 || x3-x4 == 0){
			if((x2-x1 == 0 && y2-y1 == 0) || (x4-x3 == 0 && y4-y3 == 0)) cout << "YES" << endl;	//point and line(point)
			else if(x2-x1 == x3 - x4) cout << "YES" << endl;	//y=a, y=b
			else cout << "NO" << endl;
		}else{
			if((y2-y1)/(x2-x1) == (y4-y3)/(x4-x3)) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	}
	return 0;
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>

using namespace std;

double dot(double x1,double y1,double x2,double y2){return x1*y2 - x2*y1;}

int main(){
	int t;
	cin>>t;
	while(t--){
		double x[4],y[4];
		for (int i = 0; i < 4; i++)
		{
			cin>>x[i]>>y[i];
		}

		double ans = dot(x[1] - x[0],y[1]-y[0],x[3]-x[2],y[3]-y[2]);
		if(-1e-5 <= ans && ans <= 1e-5) puts("YES");
		else puts("NO");
	}

	return 0;
}

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

	cin >> n;

	for(int i = 0;i < n;i++){
		for(int j = 0;j < 4;j++){
			scanf("%lf",&x[j]);
			scanf("%lf",&y[j]);
		}

		double a1 = (y[2]-y[1])/(x[2]-x[1]);
		double a2 = (y[4]-y[3])/(x[4]-x[3]);

		if(a1 == a2){
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}
}

C++: #include<iostream>
#include<cmath>
using namespace std;
#define EPS 1e-10
double x1,y1,x2,y2,x3,y3,x4,y4;
double det(){
	double dx1,dy1,dx2,dy2;
	dx1 = x1-x2;
	dy1 = y1-y2;
	dx2 = x3-x4;
	dy2 = y3-y4;
	return dx1*dy2 - dy1*dx2;
}
int main(){
	int n;
	cin>>n;
	while(n--){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		cout<<(fabs(det())<EPS?"YES":"NO")<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
typedef complex<double> Point;
double cross(const Point& a, const Point& b){
    return (conj(a) * b).imag();
}
int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    Point a[4];
    int N; cin >> N;
    rep(casenum, N){
        rep(i, 4) cin >> a[i].real() >> a[i].imag();
        double sum = cross(a[0] - a[1], a[2] - a[3]) / 2;
        if(abs(sum) < 1.0e-11) cout << "YES" << endl; else cout << "NO" << endl;
    }
    return 0;
}

C++: #include<iostream>

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  const double e = 1e-15;

  std::cin >> n;

  for(int i=0;i<n;i++){
    std::cin >> x1 >> y1
             >> x2 >> y2
             >> x3 >> y3
             >> x4 >> y4;

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