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>
using namespace std;
int main(){
	int n;
	double x[4],y[4];
	cin>>n;
	for(int h=0;h<n;h++){
	for(int i=0;i<4;i++)
		cin>>x[i]>>y[i];
	bool t=false;
	if(x[0]-x[1]==0&&x[2]-x[3]==0)
		t=true;
	else if(y[0]-y[1]==0&&y[2]-y[3]==0)
		t=true;
	else if(!(x[0]-x[1]==0||x[2]-x[3]==0||y[0]-y[1]==0||y[2]-y[3]==0)){
		if((y[1]-y[0])/(x[1]-x[0])==(y[3]-y[2])/(y[1]-y[0]))
			t=true;
	}
	if(t==true)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	}
    return 0;
}

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

int main() {
  int n = 0;
  double d[8];
  cin >> n;

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

  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
main(void){
	int T;cin>>T;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	for(int t=1;t<=T;t++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if(x1==x2&&x3==x4)cout<<"No"<<endl;
		if(y1==y2&&y3==y4)cout<<"NO"<<endl;
		else if(abs((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4))<0.0000001)
			cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

C++: #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>

#define FOR(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
typedef long double ld;
using namespace std;

void solver() {
    int N;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        ld x1, x2, x3, x4, y1, y2, y3, y4;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        auto isOK = (y2 - y1) * (x4 - x3) == (y4 - y3) * (x2 - x1);
        if (isOK) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

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

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


int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	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(fabs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < 0.0000001){ //I copied yutaka watabe's code here
			printf("YES\n");
		}else{
			printf("NO\n");
		}

	}
    return 0;
}

C++: #include <iostream>
using namespace std;
 
int main(void){
  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( (y2-y1)/(x2-x1) == (y4-y3)/(x4-x3) ) cout << "YES" << endl;
    else cout << "NO" << endl;
 
  }
 
  return 0;
}

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

int main(){
	int n;cin >> n;
	float a[8];
	float x1, x2, y1, y2, ans;
	while(n--){
		for(int i = 0;i < 8;i++)cin >> a[i];
		y1 = a[3]-a[1];x1 = a[2]-a[0];
		y2 = a[7]-a[5];x2 = a[6]-a[4];
		ans = y1*x2-y2*x1;
		if(ans == 0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0; 
}

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

#define EPS 1e-6

int main(){
  int n;cin>>n;
  for(int i=0;i<n;++i){
    double a,b,c,d,e,f,g,h;cin>>a>>b>>c>>d>>e>>f>>g>>h;
    double dx1,dy1,dx2,dy2;
    dx1 = a - c;
    dy1 = b - d;
    dx2 = e - g;
    dy2 = f - h;
    //cout << dx1 << " " << dy1 << " " << dx2 << " "<<dy2<<endl;
    double det = fabs(dx1*dy2 - dx2*dy1);
    (fabs(det)<EPS) ? cout<<"YES"<<endl : cout<<"NO"<<endl;
  }
  return EXIT_SUCCESS;
}

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

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

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, ans[_MAX] = { 0 };
	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 <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define INF 1e+10

int main(){
  double x[4], y[4];
  int n;
  cin >> n;
  while( n-- ){
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
    double left, right;
    if (x[0] < x[1]) {
      left = (y[1] - y[0]) * abs(x[1] - x[0]);
    } else {
      left = (y[0] - y[1]) * abs(x[0] - x[1]);
    }
    if (x[2] < x[3]) {
      right = (y[3] - y[2]) * abs(x[3] - x[2]);
    } else {
      right = (y[2] - y[3]) * abs(x[2] - x[3]);
    }

    if ( left == right ) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

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

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define RFOR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))

using namespace std;

typedef complex<double> point;
typedef pair<int, int> paii;
typedef long long ll;

double dot(point va, point vb){
	return real(va) * real(vb) + imag(va) * imag(vb);
}

int main()
{
	int n;
	cin >> n;
	
	FOR(i, 0, n)
	{
		double x, y;
		point pt[4];
		
		FOR(j, 0, 4)
		{
			cin >> x >> y;
			pt[j] = point(x, y);
		}
		
		point s = pt[1] - pt[0], t = pt[3] - pt[2];
		
		double dt = dot(s, t);
		
		if( abs(dt - abs(s)*abs(t)) < 0.00000001 )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	
	return 0;
}