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 <iostream>
#include <string>

class Point
{
public:
	double m_X;
	double m_Y;
	Point(double x, double y)
		: m_X( x )
		, m_Y( y )
	{}
};

class LineSegment
{
private:
	Point m_Start;
	Point m_End;
public:
	LineSegment(Point start, Point end)
		: m_Start( start )
		, m_End( end )
	{}
	double CalcSlope()
	{
		return((m_End.m_Y - m_Start.m_Y) / (m_End.m_X - m_Start.m_X));
	}
};

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

	std::cin >> n;

	for (int data_no = 0; data_no < n; ++data_no)
	{
		Point start1{ x1, y1 };
		Point end1{ x2, y2 };
		Point start2{ x3, y3 };
		Point end2{ x4, y4 };

		LineSegment line1{ start1, end1 };
		double line1_slope = line1.CalcSlope();

		LineSegment line2{ start2, end2 };
		double line2_slope = line2.CalcSlope();

		if (line1_slope == line2_slope)
		{
			std::cout << "YES" << std::endl;
		}
		else
		{
			std::cout << "NO" << std::endl;
		}
	}

	return 0;
}

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++){
    for(int j=0;j<2;j++) cin >> a[j] >> b[j] >> c[j] >> d[j];
    if(a[0]-b[0]==0&&c[0]-d[0]==0) cout << "YES" << endl;
    else if(a[1]-b[1]==0&&c[1]-d[1]==0) cout << "YES" << endl;
    else if(a[0]*d[0]+a[1]*d[1]==b[0]*c[0]+b[1]*c[1]) cout << "YES" << endl;
    else cout << "NO" << endl;
  }   
  return 0;
}

C++: #include<iostream>
#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>

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)*(x4 - x3) == (x2 - x1)*(y4 - y3) ) ? "YES\n" : "NO\n");
	}

	return 0;
}

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

int main() {

    int n;
    cin >> n;

    double a, b, c, d, e, f, g, h;
    while(cin >> a >> b >> c >> d >> e >> f >> g >> h) {
        double vx = c - a;
        double vy = d - b;
        double wx = g - e;
        double wy = h - f;

        if(vx * wy - vy * wx == 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
     
    return 0;
}

C++: #include <iostream>
#include <complex>
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 isParallel(P a1, P a2, P b1, P b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}

int main() {
  int n;
  double ax, ay, bx, by, cx, cy, dx, dy;
  cin >> n;

  while(n--) {
    cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
    P a(ax, ay), b(bx, by), c(cx, cy), d(dx, dy);
    cout << (isParallel(a, b, c, d) ? "YES" : "NO") << endl;
  }

  return 0;
}

C++: #include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	int k;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double veku1[2];
	double veku2[2];
	double veku3[2];
	double t;
	double m;
	cin >> k;

	for (int i = 0; i < k; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		veku1[0] = x2 - x1;
		veku1[1] = y2 - y1;
		veku2[0] = x4 - x3;
		veku2[1] = y4 - y3;

		t = veku1[0] * veku2[0] + veku1[1] * veku2[1];

		if (t * t != (veku1[0] * veku1[0] + veku1[1] * veku1[1]) * (veku2[0] * veku2[0] + veku2[1] * veku2[1])) {
			cout << "NO" << endl;
		} else {
			veku3[0] = x3 - x1;
			veku3[1] = y3 - y1;
			m = veku1[0] * veku3[0] + veku1[1] * veku3[1];
			if (m * m != (veku1[0] * veku1[0] + veku1[1] * veku1[1]) * (veku3[0] * veku3[0] + veku3[1] * veku3[1])) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(void){
    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(fabs(x2-x1)<0.0000000001 && fabs(x4-x3)<0.0000000001)   cout << "YES" <<endl;
        else{
            if(fabs((y2-y1)/(x2-x1) - (y4-y3)/(x4-x3))<0.0000000001)  cout << "YES" << endl;
            else cout << "NO" << endl;
        }

    }
    return 0;
}

C++: #include <bits/stdc++.h>
#include <vector>
using namespace std;
double x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4, a, b, x;
double gradien(double x_1, double y_1, double x_2, double_y2){
	double m = 0;
	m = (y_1 - y_2)/(x_1 - x_2);
	
	return m;
}
int main(){
	cin >> x;
	for(int i = 1; i <= x; i++){
		cin >> x_1 >> y_1 >> x_2 >> y_2 >> x_3 >> y_3 >> x_4 >> y_4;
		a = gradien(x_1, y_1, x_2, y_2);
		b = gradien(x_3, y_3, x_4, y_4);
		if(a == b){
			cout << "YES\n";
		}
		else{
			cout << "NO\n";
		}
	}
	return 0;
}

C++: int main()
{

    float line1;
    float line2;
    float x1,x2,x3,x4;
    float y1,y2,y3,y4;

    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

    line1 = (y2-y1)/(x2-x1);
    line2 = (y4-y3)/(x4-x3);

    if (line1 == line2)
        {
        cout << "YES" << endl;
        }
    else
        {
        cout << "NO" << endl;
        }



    return 0;
}

C++: #define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 201
#define _MAX 100
#define ABC 26
int main(void)
{
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4, a1, b1, a2, b2;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		a1 = (y1 - y2) / (x1 - x2);
		b1 = y1 - (x1 * a1);
		a2 = (y3 - y4) / (x3 - x4);
		b2 = y3 - (x3 * a2);
		if (a1 == a2 && b2 != b1)
			printf("YES\n");
		else
			printf("NO\n");
	}
}

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