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 <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl

double a[8];

void solve(){
	double dx1=a[2]-a[0];
	double dx2=a[6]-a[4];
	double dy1=a[3]-a[1];
	double dy2=a[7]-a[5];
	bool ans;
	
	if(dx1==0)ans=(dx2==0);
	else ans=(dx2!=0 && dy1/dx1==dy2/dx2);
	if(ans) puts("YES");
	else puts("NO");
}

int main(){
	li n;
	cin>>n;
	
	rin{
		rep(i,8)cin>>a[i];
		solve();
	}
	
	return 0;
}

C++: #include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
#define  PI 3.141592
int main(void){
    long double x1, x2, x3, x4, y1, y2, y3, y4, tilt_a, tilt_b;
    int n;
    
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        if(x1 == x2){
            if(x3 == x4) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
        else{
            tilt_a = (y2-y1)/(x2-x1);
            tilt_b = (y4-y3)/(x4-x3);
            if(tilt_a == tilt_b){
                cout << "YES" << endl;
            }
            else cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	long double x1,y1,x2,y2,x3,y3,x4,y4;
	int n;
	cin>>n;
	int N[100];
for(int i=0;i<n;i++)
{
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
	if((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4))
	{
	N[i]=1;
	}
	else
	{
	N[i]=0;
	}
}
for(int j=0;j<n;j++)
{
	if(N[j]=1)
	{
		cout<<"YES"<<endl;
	}
	else if(N[j]=0)
	{
		cout<<"NO"<<endl;
	}
}
return 0;
}

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

int main(){
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  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;
	cin >> n;
	while(n--){
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if(x2-x1 == 0 || x3-x4 == 0){
			if((x2-x1 == 0 && y2-y1 == 0) || (x4-x3 == 0 && y4-y3 == 0)) cout << "YES" << endl;	//point and line(point)
			else if(x2-x1 == x3 - x4) cout << "YES" << endl;	//y=a, y=b
			else cout << "NO" << endl;
		}else{
			if((y2-y1)/(x2-x1) == (y4-y3)/(x4-x3)) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	}
	return 0;
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>

using namespace std;

double dot(double x1,double y1,double x2,double y2){return x1*y2 - x2*y1;}

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

		double ans = dot(x[1] - x[0],y[1]-y[0],x[3]-x[2],y[3]-y[2]);
		if(-1e-5 <= ans && ans <= 1e-5) puts("YES");
		else puts("NO");
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n;
	double x[4],y[4];

	cin >> n;

	for(int i = 0;i < n;i++){
		for(int j = 0;j < 4;j++){
			scanf("%lf",&x[j]);
			scanf("%lf",&y[j]);
		}

		double a1 = (y[2]-y[1])/(x[2]-x[1]);
		double a2 = (y[4]-y[3])/(x[4]-x[3]);

		if(a1 == a2){
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}
}

C++: #include<iostream>
#include<cmath>
using namespace std;
#define EPS 1e-10
double x1,y1,x2,y2,x3,y3,x4,y4;
double det(){
	double dx1,dy1,dx2,dy2;
	dx1 = x1-x2;
	dy1 = y1-y2;
	dx2 = x3-x4;
	dy2 = y3-y4;
	return dx1*dy2 - dy1*dx2;
}
int main(){
	int n;
	cin>>n;
	while(n--){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		cout<<(fabs(det())<EPS?"YES":"NO")<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
typedef complex<double> Point;
double cross(const Point& a, const Point& b){
    return (conj(a) * b).imag();
}
int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    Point a[4];
    int N; cin >> N;
    rep(casenum, N){
        rep(i, 4) cin >> a[i].real() >> a[i].imag();
        double sum = cross(a[0] - a[1], a[2] - a[3]) / 2;
        if(abs(sum) < 1.0e-11) cout << "YES" << endl; else cout << "NO" << endl;
    }
    return 0;
}

C++: #include<iostream>

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

  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 <cstdio>
#include <bitset>
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
#define EPS 1e-6

using namespace std;
typedef complex<double> coor;

double cross(coor a, coor b)
{
  return a.real() * b.imag() - a.imag() * b.real();
}

double dot(coor a, coor b)
{
  return a.real() * b.real() + a.imag() * b.imag();
}

int main()
{
  int N;
  scanf(" %d ", &N);
  
  for (int i = 0; i < N; i++) {
    coor c[4];
    for (int j = 0; j < 4; j++) {
      double x, y;
      scanf(" %lf %lf ", &x, &y);
      c[j] = coor(x, y);
    }
    
    if (cross(c[1] - c[0], c[3] - c[2]) == 0) {
      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;
	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 ((x2 - x1)*(y4 - y3) - (x4 - x3)*(y2 - y1)==0.0)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

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

int main(void){
  double xa,ya,xb,yb,xc,yc,xd,yd;
  int n;
  cin >> n;
  while( --n >=0){
    cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;

    if( (yb - ya)/(xb - xa) == (yd - yc)/(xd - xc))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
#define rep(i,a,n) for(int i=a; i<n; i++)
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 a1 = x2 - x1;
        double b1 = y2 - y1;
        double a2 = x4 - x3;
        double b2 = y4 - y3;
        
        if(abs(a1 * b2 - a2 * b1) < 1e-10) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}