Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&n)
	for i := 0 ; i < n; i++ {
		fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

double EPS = 1e-17;
// BEGIN //////////////////////////////////////////////////////////////
int main() {
	int N;
	scanf("%d", &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);
	 	double s = x1 - x2, t = y1 - y2, u = x3 - x4, v = y3 - y4;
	 	if (s * v == t * u) {
		 	printf("YES\n");
	 	} else {
		 	printf("NO\n");
	 }
	}

	return 0;
}

// END   //////////////////////////////////////////////////////////////

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second

using namespace std;

double x[10],y[10];
double g1,g2;
int tc;

int main()
{
	scanf("%d",&tc);
	while(tc--)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x[1],&y[1],&x[2],&y[2],&x[3],&y[3],&x[4],&y[4]);
		g1=(y[2]-y[1])/(x[2]-x[1]);
		g2=(y[4]-y[3])/(x[4]-x[3]);
		if(g1==g2)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
		//printf("%.2lf,%.2lf\n",g1,g2);
	}
	return 0;
}

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

#define EPS 0.0000001

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(abs((y2-y1)/(x4-x3)-(y4-y3)/(x2-x1)) <EPS )cout << "YES" << endl;
      else cout << "NO" << endl;
    }


  return 0;
}

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

int main()
{
	int n;
	double x[4], y[4];

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

		double abx = fabs(x[0] - x[1]), cdx = fabs(x[2] - x[3]);
		double aby = y[0] - y[1], cdy = y[2] - y[3];

		if (aby / abx == cdy / cdx){
		   cout << "YES" << endl;
		}

		else {
			cout << "NO" << endl;
		}
	}
	return (0);
}

C++: #include <cassert>
#include <cmath>
#include <iostream>
#include <vector>
#include <iomanip>

struct Point
{
    float x;
    float y;
};
struct Line
{
    Line(const Point& a, const Point& b)
    : p1(a), p2(b) {}
    Point p1;
    Point p2;
};
double GetSlope(const Line& line)
{
    return
    (line.p2.y - line.p1.y) /
    (line.p2.x - line.p1.x);
}
bool IsParallel(const Line& l1, const Line&l2)
{
    // std::cerr << std::fixed << std::setprecision(100) << GetSlope(l1) << std::endl;
    // std::cerr << std::fixed << std::setprecision(100) << GetSlope(l2) << std::endl;
    // return GetSlope(l1) == GetSlope(l2);
    const double gosa = 0;
    double Slope1 = GetSlope(l1);
    double Slope2 = GetSlope(l2);
    return std::fabs(Slope1 - Slope2) <= gosa;
}
bool IsParallel(const std::vector<Point>& points)
{
    assert(points.size() == 4);
    return IsParallel(Line(points[0], points[1]), Line(points[2], points[3]));
}
std::vector<Point> Input(std::istream& is)
{
    std::vector<Point> points(4);
    for(int i = 0; i < points.size(); ++i){
        is >> points[i].x >> points[i].y;
    }
    return points;
}
int main()
{
    int n;
    std::cin >> n;
    for(int i = 0; i < n; ++i) {
        std::vector<Point> p = Input(std::cin);
        std::cout << (IsParallel(p) ? "YES" : "NO") << std::endl; 
        // if((p[1].y-p[0].y)/(p[1].x-p[0].x) == (p[3].y-p[2].y)/(p[3].x-p[2].x)){
        //     std::cout << "YES";
        // }else{
        //     std::cout << "NO";
        // }
        // std::cout << std::endl;
    }
    return 0;
}

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

using namespace std;
#define eps 1e-9

void solve()
{
	int N;
	cin >> N;
	while(N--)
	{
		double x[4], y[4];
		for(int i = 0; i < 4; ++i)
		{
			cin >> x[i] >> y[i];
		}
		if(fabs(x[1] - x[0]) < eps && fabs(x[3] - x[2]) < eps)
		{
			cout << "YES" << endl;
		}
		else if(fabs(x[1] - x[0]) < eps || fabs(x[3] - x[2]) < eps)
		{
			cout << "NO" << endl;
		}
		else if(fabs((y[1] - y[0]) / (x[1] - x[0]) - (y[3] - y[2]) / (x[3] - x[2])) < eps)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <iostream>

enum {X1,Y1,X2,Y2,X3,Y3,X4,Y4};

void calcDistance(int x1, int y1, int x2, int y2, int* dx, int* dy) {
	if(x1 < x2) {
		*dx = x2 - x1;
		*dy = y2 - y1;
	} else {
		*dx = x1 - x2;
		*dy = y1 - y2;
	}
}

int main() {
	int n; std::cin >> n;
	double dp[8];
	int ip[8],dx1,dy1,dx2,dy2;
	for(int i=0; i<n; i++) {
		for(int j=0; j<8; j++) std::cin >> dp[j];
		for(int j=0; j<8; j++) ip[j] = (int)(dp[j] * 1000000);
		if(ip[X1] == ip[X2] || ip[X3] == ip[X4]) {
			if(ip[X1] == ip[X2] && ip[X3] == ip[X4]) {
				std::cout << "YES" << std::endl;
			} else {
				std::cout << "NO" << std::endl;
			}
		} else {
			calcDistance(ip[X1],ip[Y1],ip[X2],ip[Y2],&dx1,&dy1);
			calcDistance(ip[X3],ip[Y3],ip[X4],ip[Y4],&dx2,&dy2);
			if(((long long)dy1 * dx2) == ((long long)dx1 * dy2)) {
				std::cout << "YES" << std::endl;
			} else {
				std::cout << "NO" << std::endl;
			}
		}
	}
	return 0;
}

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

int main() {

  int n;
  cin >> n;

  for ( int i = 0; i < n; i++ ) {

    double x[4],y[4];
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

    if ( x[0] == x[1] || x[2] == x[3] ) {

      if ( x[0] == x[1] && x[2] == x[3] ) {
	cout << "YES" << endl;
      }else {
	cout << "NO" << endl;
      }

    }else {

      if ( ( y[1] - y[0] ) / ( x[1] - x[0] ) == ( y[3] - y[2] ) / ( x[3] - x[2] ) ) {
	cout << "YES" << endl;
      }else {
	cout << "NO" << endl;
      }

    }

  }

  return 0;

}

C++: #include <iostream>
using namespace std;
 
int main(){
    int n;
    long double t[100][8];
    long double ab, cd;
    cin >> n;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 8; j++){
            cin >> t[i][j];
        }
    }
    for(int i = 0; i < n; i++){
        ab = (t[i][1]-t[i][3])*(t[i][4]-t[i][6]);
        cd = (t[i][5]-t[i][7])*(t[i][0]-t[i][2]);
        if(t[i][0] == t[i][2]){
            if(t[i][4] == t[i][6]){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
        }
        else if(t[i][1] == t[i][3]){
            if(t[i][5] == t[i][7]){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
        }
        else if(ab == cd){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
}

C++: #include
 <cstdio>

using
 namespace
 std;

int
 n;
double
 x[4],y[4];

int
 main()
 {
	
scanf("%d"
,&n);
	
for
 (int
 c = 0; c < n; c++)
	
{
		
for
 (int
 i = 0; i < 4; i++)
			
scanf("%lf%lf"
,&x[i],&y[i]);
		
puts((y[1]-y[0])/(x[1]-x[0]) == (y[3]-y[2])/(x[3]-x[2])?"YES"
:"NO"
);
	
}
 }

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

    }
    return 0;
}