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

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

int main() {
  int n = 0;
  cin >> n;

  for(int i = 0; i < n; i++) {
    double d[8];
    for(int j = 0; j < 4*2; j++)
      cin >> d[j];
    if(d[4] + d[0]-d[2] == d[6] && d[5] + d[1]-d[3] == d[7])
      cout << "YES" << endl;
    else if(d[4] - (d[0]-d[2]) == d[6] && d[5] - (d[1]-d[3]) == d[7])
      cout << "YES" << endl;
    else if(d[6] + (d[0]-d[2]) == d[4] && d[7] + (d[1]-d[3]) == d[5])
      cout << "YES" << endl;
    else if(d[6] - (d[0]-d[2]) == d[4] && d[7] - (d[1]-d[3]) == d[5])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

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<iostream>
using namespace std;

struct Pos {
	double x, y;
}a, b, c, d;

int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i++ ) {
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		Pos e;
		e.x = b.x - a.x;
		e.y = b.y - a.y;
		Pos f;
		f.x = d.x - c.x;
		f.y = d.y - c.y;
		
		double men = e.x * f.y - e.y * f.x;
		double eps = 1e-16;
		if(-eps <= men && men <= eps)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
struct point{
double x;
double y;
};
int main(){
point *p = new point[4];
int n;
cin >> n;
for(;n;n--){
cin >> p[0].x >> p[0].y >> p[1].x >> p[1].y >> p[2].x >> p[2].y >> p[3].x >> p[3].y;
if((p[0].y-p[1].y)/(p[0].x-p[1].x)==(p[2].y-p[3].y)/(p[2].x-p[3].x))
cout << "YES" << endl;
else
cout << "NO" << endl;
}
delete []p;
}

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

int main(){
	int n;
	cin >> n;
	long double x1,y1,x2,y2,x3,y3,x4,y4;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4){
		if(abs((y1 - y2)/(x1 - x2) -- (x3 - x4)/(y3 - y4)) < 0.0000000001)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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

int main() {
    double n,xx[4],yy[4],x,y;
    cin >> n;
    for(int i=0;i<n;i++){
        for(int j=0;j<4;j++) cin>>xx[j]>>yy[j];
        x=(yy[1]-yy[0])/(xx[1]-xx[0]),y=(yy[3]-yy[2])/(xx[3]-xx[2]);
        if(x==y)cout << "YES";
        else cout << "NO";
        cout << endl;
    }
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int main(){
	int n;
	cin>>n;
	rep(i,0,n){
		double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		m1=(y2-y1)/(x2-x1);
		m2=(y4-y3)/(x4-x3);
		if(m1==m2){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
}

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

int main()
{
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (x1 == x2 && x3 == x4){
			cout << "YES" << endl;
		}
		else if (x1 == x2 || x3 == x4){
			cout << "NO" << endl;
		}
		else 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;
	double dx1, dy1, dx2, dy2;
	
	cin >> N;
	
	for(int i = 0; i < N; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		dx1 = x2 - x1; dy1 = y2 - y1;
		dx2 = x4 - x3; dy2 = y4 - y3;
		if(dy1 / dx1 == dy2 / dx2) cout << "YES" << endl;
		else cout << "NO" << endl;
		
		//cout << dx1 * dy2 << " " << dx2 * dy1 << endl;
	}
	
	return 0;
}

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

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

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

int main(){
	int n;
	double x[4];
	double y[4];
	double slope[2];
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		slope[0] = (y[1] - y[0])/(x[1] - x[0]);
		slope[1] = (y[3] - y[2])/(x[3] - x[2]);
		if(slope[0] == slope[1]){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
}

C++: #include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
#define INF 0x7FFFFFFF

int main(){
  int n;
  cin>>n;
  while(n){
    n--;
    vector<double> x(4,0);
    vector<double> y(4,0);
    for(int i=0;i<4;i++){
      cin>>x[i]>>y[i];
    }
    double xa,xb,ya,yb;
    xa=x[1]-x[0];
    xb=x[3]-x[2];
    ya=y[1]-y[0];
    yb=y[3]-y[2];
    double a;
    a=xa*yb-xb*ya;
    if(-0.00001<a&&a<0.00001){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }
  }
}

C++: #include <iostream>
#include <cmath>
  
using namespace std;
  
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        double x[4],y[4];
        for(int j=0;j<4;j++)
            cin>>x[j]>>y[j];
        if(abs((x[3]-x[2])*(y[1]-y[0])-(x[1]-x[0])*(y[3]-y[2]))<1e-10)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
      
    return 0;
}

C++: #include <stdio.h>
int main(void)
{
    double x1,y1,x2,y2,x3,y3,x4,y4,AB,CD;
    int n,i;
    
    scanf("%d",&n);
    {
        for(i=0;i<n;i++)
        {
            scanf("%lf",&x1); scanf("%lf",&y1);
            scanf("%lf",&x2); scanf("%lf",&y2);
            scanf("%lf",&x3); scanf("%lf",&y3);
            scanf("%lf",&x4); scanf("%lf",&y4);
            
            AB=(y2-y1)/(x2-x1);
            CD=(y4-y3)/(x4-x3);
            
            if(AB==CD) printf("YES\n");
            else printf("NO\n");
        }
    }
    
    return 0;
}