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 <complex>
#include <cmath>
#include <iostream>
using namespace std;
typedef complex<double> xy_t;

const double eps = 1e-11;
double x[4], y[4];
int N;

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

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

    xy_t a[2] = {
      xy_t(x[0],y[0]) - xy_t(x[1],y[1]), xy_t(x[2],y[2]) - xy_t(x[3],y[3])
    };
    bool p = abs(cross_product(a[0], a[1])) < eps;
    cout << (p ? "YES" : "NO") << endl;
  }
}

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

using namespace std;

int main(int argc, char **argv)
{
	int n;
	float 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;
		x2 -= x1;
		y2 -= y1;
		x4 -= x3;
		y4 -= y3;
		
		if((x2 < 0 && x4 > 0) || (x2 > 0 && x4 < 0) || (y2 < 0 && y4 > 0) || (y2 > 0 && y4 < 0)){
			cout << "NO" << endl;
			continue;
		}
		
		x1 = sqrt(((x2*x2)/(x2*x2+y2*y2)));
		x3 = sqrt(((x4*x4)/(x4*x4+y4*y4)));
		
		if(x1 == x3){
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <iterator>
#include <numeric>
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) {
        return (y - p.y) / (x - p.x);
    }
    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<stdio.h>
 
int main(void){
    double x[4],y[4];
    int n,i;
     
    scanf("%d",&n);
     
    for(i=0;i<n;i++){
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
         
        if(((y[1]-y[0])/(x[1]-x[0])) == ((y[3]-y[2])/(x[3]-x[2])))printf("YES\n");
        else printf("NO\n");
    }
     
    return 0;
}

C++: #include<complex>
#include<iostream>
using namespace std;
int main(){const double E=1e-10;int n;double x1,y1,x2,y2,x3,y3,x4,y4;cin>>n;while(n--{cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;cout<<((abs((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1))<E)?"YES":"NO")<<endl;}}

C++: import java.io.IOException;
import java.util.Locale;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		while (N-- > 0) {
			double x1 = sc.nextDouble();
			double y1 = sc.nextDouble();
			double x2 = sc.nextDouble();
			double y2 = sc.nextDouble();
			double x3 = sc.nextDouble();
			double y3 = sc.nextDouble();
			double x4 = sc.nextDouble();
			double y4 = sc.nextDouble();

			double[] AB = {x2-x1, y2-y1}, CD = {x4-x3, y4-y3};
			double cross = AB[0]*CD[1]-AB[1]*CD[0];

			if (cross < 1e-10) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}

		}

	}
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;

int main(){
  int n;//データ数
  double x[4];
  double y[4];
  cin >> n ;
  while(n--){
  //入力フェイズ
  for(int i=0;i<4;i++){
    cin >> x[i] >> y[i];
  }
  //傾きの求め方 yの増加量/xの増加量
  double AB,CD;
  AB=(y[1]-y[0])/(x[1]-x[0]);
  CD=(y[3]-y[2])/(x[3]-x[2]);
  if(AB==CD)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
}

C++: #include<iostream>

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

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

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

const double EPS = 1e-10;
template<class T>
bool eq(const T& a, const T& b) {return abs(a - b) < EPS;}

/* 点
 *
 * x 座標は p.real()
 * y 座標は p.imag()
 * 足し算，引き算，スカラー倍は定義済み
 */
typedef complex<double> point;
namespace std {
	bool operator<(const point& a, const point& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}

/*
 * 直線・線分
 *
 * 辞書順の比較演算子が定義済み
 * 端点を for で走れる
 * {{x, y}} で初期化
 */
typedef array<point, 2> line;

double cross(const point& a, const point& b) {
	return imag(conj(a)*b);
}


bool is_parallel(const line& s, const line& t) {
	return eq(cross(s[0] - s[1], t[0] - t[1]), 0.0);
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		line s, t;
		for (auto& p : s) {
			double x, y; cin >> x >> y;
			p = point(x, y);
		}
		for (auto& p : t) {
			double x, y; cin >> x >> y;
			p = point(x, y);
		}
		cout << (is_parallel(s, t)?"YES":"NO") << endl;
	}
	return 0;
}

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");
	}
}