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 <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

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

int main(){
	cin >> n;
	REP(i, n){
		REP(j, 4) cin >> x[j] >> y[j];
		double a = (x[1] - x[0])*(y[3] - y[2]), b = (x[3] - x[2])*(y[1] - y[0]);
		if (a == b){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
}

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

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

    cin >> n;
    while(n--){
        cin >>x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

        ab = (y1 - y2) / (x1 - x2);
        cd = (y3 - y4) / (x3 - x4);

        if (ab == cd){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}

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

int main(){
	int n;
	double x[4], y[4];
	int xi[4], yi[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]);

		for(int i = 0; i < 4; i++){
			xi[i] = (int)(x[i] * 100000);
			yi[i] = (int)(y[i] * 100000);
		}
		
		if((yi[0] - yi[1])*(xi[2] - xi[3]) == (xi[0] - xi[1])*(yi[2] - yi[3])){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

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


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

			if(fabs(value1-value2) < 0.0000001){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}
	}
    return 0;
}

C++: /* AOJ 0021 Parallelism */

#include <iostream>
#include <cmath>

using namespace std;

const double EPS = 1e-9;

int
main()
{
    int n;
    double x1, y1, x2, y2, x3, y3, x4, y4;
    double dx12, dy12, dx34, dy34;

    cin >> n;

    while (n--) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        dx12 = x2 - x1;
        dy12 = y2 - y1;
        dx34 = x4 - x3;
        dy34 = y4 - y3;

        if (fabs(dx12 * dy34 - dx34 * dy12) < EPS)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }

    return 0;
}

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

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

C++: #include<cstdio>
#include<iostream>
using namespace std;
main(){
  double x1,x2,x3,x4,y1,y2,y3,y4,a1,a2;
  int n,i;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    a1=(y1-y2)/(x1-x2);
    a2=(y3-y4)/(x3-x4);
    if(a1==a2){
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
}

C++: #include <stdio.h>

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

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    for(j = 0; j < 4; j++){
      scanf("%lf%lf", &x[j], &y[j]);
    }
    d[0] = x[1]-x[0];
    d[1] = y[1]-y[0];
    d[2] = x[3]-x[2];
    d[3] = y[3]-y[2];
    if(d[0]*d[3] == d[1]*d[2]){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
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;
        int ax = x1 * 100000 - x2 * 100000;
        int ay = y1 * 100000 - y2 * 100000;
        int bx = x3 * 100000 - x4 * 100000;
        int by = y3 * 100000 - y4 * 100000;
        cout << (ax * by == ay * bx ? "YES" : "NO") << endl;
    }
    return 0;
}

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

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

  cin >> n;

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

  return 0;
}

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

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

using namespace std;

struct Point {
    double x, y;
};

int main() {
    int n;
    cin >> n;
    while (n--) {
        Point p[4];
        for (int i = 0; i < 4; i++) {
            cin >> p[i].x >> p[i].y;
        }
        double div1 = (p[1].y - p[0].y) / (p[1].x - p[0].x);
        double div2 = (p[3].y - p[2].y) / (p[3].x - p[2].x);
        if (div1 == div2) {
            cout << "YES\n";
        }
        else {
            cout << "NO\n";
        }
    }
    
    return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n;cin>>n;
	for(;n--;)
	{
		double a,b,c,d,e,f,g,h;cin>>a>>b>>c>>d>>e>>f>>g>>h;
		cout<<(fabs((d-b)*(g-e)-(h-f)*(c-a))<1e-6?"YES":"NO")<<endl;
	}
}

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 && b1 != b2)
			printf("YES");
		else
			printf("NO");
	}
}

C++: #include <iostream>
using namespace std;
int main()
{
	int n; cin >> n ;
	double x[4],y[4];
	while(n--)
	{
		for(int i=0;i<4;i++) cin >> x[i] >> y[i] ;
		double vx[2],vy[2];
		for(int i=0;i<2;i++) vx[i]=x[2*i+1]-x[2*i], vy[i]=y[2*i+1]-y[2*i];
		bool failed=false;
		for(int i=0;i<2;i++) if(!vx[i] && !vy[i]) failed=true;
		if(failed) cout << "NO" << '\n';
		else if(vx[0]*vy[1]==vy[0]*vx[1]) cout << "YES" << '\n' ;
		else cout << "NO" << '\n' ;
	}
}