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 <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;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

		double AB = (y2-y1) / (x2-x1);
		double CD = (y4-y3) / (x4-x3);

		if(y2-y1 == 0) AB = 0;
		if(y4-y3 == 0) CD = 0;

		if(AB - CD < 0.0000000001){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}

	}
	return 0;
}

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

int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
  int n;
  cin>>n;
  while(n--){
    m1=0;
    m2=0;
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if(x1==x2)x2+=1;
      m1 =(y2-y1)/(x2-x1);
    
    if(x3==x4)x4+=1;
      m2 =(y4-y3)/(x4-x3);

    if(m1==m2&&m1!=0&&m2!=0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}
  return 0;
}

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

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

	scanf("%d", &n);

	for (int 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((x[1]-x[0])*(y[3]-y[2]) == (y[1]-y[0])*(x[3]-x[2])) printf("YES\n");
		else printf("NO\n");
	}

	return 0;
}

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

double calc(double dx1, double dy1, double dx2, double dy2) {
    dx1 = (dx1 == -0.0? 0.0: dx1);
    dy1 = (dy1 == -0.0? 0.0: dy1);
    dx2 = (dx2 == -0.0? 0.0: dx2);
    dy2 = (dy2 == -0.0? 0.0: dy2);
    dx1 *= 100000.0;
    dy1 *= 100000.0;
    dx2 *= 100000.0;
    dy2 *= 100000.0;
    if(dx1 == 0.0 || dx2 == 0.0) {
        return dx1 == dx2 || (dx1 == 0.0 && dy1 == 0.0) || (dx2 == 0.0 && dy2 == 0.0);
    }
    return (dy1/dx1) == (dy2/dx2);
}

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

    scanf("%d", &n);
    for(i=0; i<n; ++i) {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
              &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
        if(calc(x2-x1, y2-y1, x4-x3, y4-y3)) {
            printf("YES\n");
        }else {
            printf("NO\n");
        }
    }

    return 0;
}

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

const double EPS = 1e-10;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}

bool isParallel(const P &a, const P &b){
    return abs(cross(a,b)) < EPS;
}
int main(){
	int n;
	cin >> n;
	for(int rep=0; rep<n; rep++){
		VP v(4);
		for(int i=0; i<4; i++){
			double x,y;
			cin >> x >> y;
			v[i] = P(x, y);
		}
		if(isParallel(v[1]-v[0], v[3]-v[2])){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
int main()
{
	int n;
	std::cin >> n;
	std::vector<bool>result(n);
	for (int i = 0; i < n; i++)
	{
		double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		result[i] = x1 == x2 && x3 == x4 || (y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4);
	}
	for (auto i : result)
	{
		std::cout << (i ? "YES" : "NO") << std::endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(void) {
  int n, i, j;
  scanf("%d",&n);
  for(i = 0; i < n; ++i) {
    double a[8];
    for(j = 0; j < 8; ++j) scanf("%lf", &a[j]);
    a[3] -= a[1], a[2] -= a[0], a[6] -= a[4], a[7] -= a[5];
    if(a[3] / a[2] == a[7] / a[6]) printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

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

using namespace std;

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  cin >> n;
  while(n--){
  cin >>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if((y1 == y2 && y3 == y4)
       ||(x1 == x2 && x3 == x4)){
      cout << "YES" << endl;
      continue;
    } else if(x1 == x2 || x3 == x4 || y1 == y2 || y3 == y4){
      cout << "NO" << endl;
      continue;
    }
    if((y1-y2)*(x3-x4) == (x1-x2)*(y3-y4)){
      cout << "YES" << endl;
    }else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;

int main(){
    double EPS = 1e-12;
    double x[4];
    double y[4];
    double s;
    double t;
    double u;
    double v;
    int n;
    cin >> n;

    for (int t = 0;t < n;++t) {
        for (int i = 0;i < 4;++i){
            cin >> x[i] >> y[i]; 
        }
    }
    s = x[1] - x[0];
    t = y[1] - y[0];
    u = x[3] - x[2];
    v = y[3] - y[2];


    cout << "NO" << endl;
}

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

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int ans[100]={0};
	int n,i;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		
		if(((y1-y2)/(x1-x2)-(y3-y4)/(x3-x4))==0.0)printf("YES\n");
		else if(((x1-x2)==0) && ((x3-x4)==0))printf("YES\n");
		else printf("NO\n");
	}	
return 0;
}

C++: #include<iostream>

using namespace std;

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

	cin >> n;

	for(i = 0; i < n; i ++){
		for(j = 0; j < 4; j ++){
			cin >> x[j] >> y[j];
		}
		x[1] -= x[0];
		y[1] -= y[0];
		x[3] -= x[2];
		y[3] -= y[2];

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

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

int main(){
	int n;
	double 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;
		P a(x1,y1), b(x2,y2), c(x3,y3), d(x4,y4);
		if( is_parallel(a,b,c,d) ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
}

C++: #include <iostream>

using namespace std;

int main()
{
	double x1[100], y1[100], x2[100], y2[100], x3[100], y3[100], x4[100], y4[100]; int n;

	cin >> n;

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

	for (int i = 0; i < n; i++)
	{
		if ((x2[i] - x1[i]) / (y2[i] - y1[i]) == (x4[i] - x3[i]) / (y4[i] - y3[i]))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include <iostream>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b){ return (conj(a)*b).imag();}
const double eps = 1e-11;
double x[4],y[4];
int N;
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;
	}
	return 0;
}