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>
#include<algorithm>

using namespace std;

double ESP = 1e-10;

struct point {
  double x, y;
};

int main() {
  int n;
  point P[4];

  cin >> n;
  while(n--){
    for(int i = 0; i < 4; i++){
      cin >> P[i].x >> P[i].y;
    }
    if(cin.eof()) break;

    if(abs((P[1].y - P[0].y)*(P[3].y - P[2].y) - (P[3].x - P[2].x)*(P[1].x - P[0].x)) < ESP) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }

    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;
int main(){
	int n;
	cin >> n;
	for(int i = 0;i < n;i++){
		double x1,y1,x2,y2,x3,y3,x4,y4;
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		//cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		
		if((x2 - x1)*(y4 - y3) != (x4 - x3)*(y2 - y1)){
			cout << "NO" << endl;
		}
		else{
			cout << "YES" << endl;
		}

	}
	return 0;
}

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

int main(){
	int n=2,ab=0,cd=0;
	double point1[20]={0.0,0.0,1.0,1.0,1.0,0.0,2.0,1.0};
	double point2[20]={3.0,2.0,9.0,6.0,13.0,5.0,7.0,9.0};
	
	ab = ((1.0-0.0)/(1.0-0.0));
	cd = ((1.0-0.0)/(2.0-1.0));

	if( ab = cd) cout << "YES\n" ;
	else cout << "NO\n" ;
	
	ab = ((6.0-2.0)/(9.0-3.0));
	cd = ((9.0-5.0)/(7.0-13.0));

	if( ab = cd) cout << "YES\n" ;
	else cout << "NO\n" ;

    return 0;
}

C++: #include<bits/stdc++.h>
#define EPS (1e-10)
#define equals(a,b)(fabs((a)-(b))<EPS)
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

struct Point {
	double x, y;
	Point(double x = 0, double y = 0) :x(x), y(y) {}
	Point operator*(double a) { return Point(a*x, a*y); }
	Point operator-(Point p) { return Point(x - p.x, y - p.y); }
};
struct Segment {
	Point p1, p2;
};
double cross(Point a, Point b) {
	return a.x*b.y - a.y*b.x;
}
bool isPrallel(Segment s1, Segment s2) {
	return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}
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;
		Segment s1{ {x1,y1},{x2,y2} };
		Segment s2{ {x3,y3},{x4,y4} };
		puts(isPrallel(s1, s2) ? "YES" : "NO");
	}
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			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(){
    const double EPS = 1e-12;
    double x[5];
    double y[5];
    double s;
    double t;
    double u;
    double v;
    double m;
    int n;
    cin >> 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];

        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){
            m = s * v - t * u;
        }
        else{
            m = t * u - s * v;
        }

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

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

int main(int argc, const char * argv[]) {
    std::vector<int> r;
    int num;
    std::cin >> num;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    
    for(int i = 0;i < num;i++){
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        double a = (y1-y2)/(x1-x2);
        double b = (y3-y4)/(x3-x4);
         std::cout <<  (a==b ? "YES":"NO") << '\n';
    }
}

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

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

C++: #include<iostream>
using namespace std;
int main(){
	double a[2],b[2],c[2],d[2];
	int n;
	cin >>n;
	for(int i=0; i<n; i++){
		cin >>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1]>>d[0]>>d[1];
		b[0] = b[0]-a[0];
		b[1] = b[1]-a[1];
		d[0] = d[0]-c[0];
		d[1] = d[1]-c[1];
		if(d[1]*b[0] == b[1]*d[0]){cout<<"YES"<<endl;}
		else{cout<<"NO"<<endl;}
	}
}

C++: #include<iostream>
#include<complex>
#include<cmath>
#include<string>
#include<queue>
using namespace std;
typedef complex<double> xy_t;
int main()
{
  int n;
  double x,y;
  queue<string> qs;
  cin >> n;
  for( int i = 0; i < n; ++i){
    xy_t p[4];
    for( int j = 0; j < 4; ++j){
      cin >> x >> y;
      p[j] = xy_t(x,y);
    }
    double S;
    S =(conj(p[0] - p[1])*(p[2] - p[3])).imag();
    if( S == 0) qs.push("YES");
    else qs.push("NO");
  }
  while(!qs.empty()){
    cout << qs.front() << endl;
    qs.pop();
  }
}

C++: #include <bits/stdc++.h>
using namespace std;

typedef complex<double> P;

P in(){
	double x,y;
	cin >> x >> y;
	return P(x,y);
}
double cross(P a,P b){
	return imag(a*conj(b));
}
int main(){
	int N;
	cin >> N;
	while(N--){
		P a,b,c,d;
		a = in();
		b = in();
		c = in();
		d = in();
		if( abs(cross(a-b,c-d))<1e-9) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
		
}

C++: #include <iostream>

using namespace std;

int main()
{
	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 ( ( (x1==x2) && (y1==y2) ) || ( (x3==x4) && (y3==y4) ) ) {
			cout << "NO" << endl;
			continue;
		}
		
		double LHS = (1000000.0 * (y2 - y1)) * (x4 - x3);
		double RHS = (1000000.0 * (y4 - y3)) * (x2 - x1);
		//cout << LHS << " " << RHS << endl;
		//if ( (y2 - y1) * (x4 - x3) == (y4 - y3) * (x2 - x1) ) cout << "YES" << endl;
		if ( LHS == RHS ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
		
	return 0;
}