Go: package main

import (
        "fmt"
        "math/big"
)

func main() {
        var x1, x2, x3, x4, y1, y2, y3, y4 big.Float
        var n int
        fmt.Scanf("%d", &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)
                var lx, ly, mx, my, mul1, mul2, sub, zz big.Float
                lx.Sub(&x2, &x1)
                ly.Sub(&y2, &y1)
                mx.Sub(&x4, &x3)
                my.Sub(&y4, &y3)
                mul1.Mul(&lx, &my)
                mul2.Mul(&ly, &mx)
                sub.Sub(&mul1, &mul2)
                zz.SetFloat64(0.0)

                if sub.Cmp(&zz) == 0 {
                        fmt.Println("YES")
                } else {
                        fmt.Println("NO")
                }
        }
}

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;
		double LHS = (y2 - y1) * (x4 - x3);
		double RHS = (y4 - y3) * (x2 - x1);
		//if ( (y2 - y1) * (x4 - x3) == (y4 - y3) * (x2 - x1) ) cout << "YES" << endl;
		if ( LHS == RHS ) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
		
	return 0;
}

C++: #include <iostream>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
 
int main(){
    int n;
    cin >> n;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    REP(i,n){
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        if(x1==x2&&x3==x4)printf("YES\n");
        else{
            if((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4))printf("YES\n");
            else printf("NO\n");
        }
    }
    return 0;
}

C++: #include<iostream>
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;
		if(a==c&&e==g)cout<<(a==c&&e==g?"YES":"NO")<<endl;
		else cout<<((d-b)/(c-a)==(h-f)/(g-e)?"YES":"NO")<<endl;
	}
}

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

using namespace std;

typedef complex<double> xy_t;
double cross(xy_t a,xy_t b);

xy_t P[4];

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

  double x[4],y[4];
  
  for(int i=0;i<n;i++){
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
    for(int j=0;j<4;j++){
      P[j]=xy_t(x[j],y[j]);
    }
    if(abs(cross(P[1]-P[0],P[3]-P[2]))<pow(10,-10)){
      cout << "YES" <<endl;
    }else{
      cout << "NO" <<endl;
    }
    
  }

  

}

double cross(xy_t a,xy_t b){return (conj(a)*b).imag();}

C++: #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
#define range(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) range(i, 0, n)
const ll INF = 1e10;
#define pb push_back
const double eps = 1e-10;

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

C++: #include<iostream>
#include<cmath>
#include<cassert>
#include<cstdlib>
using namespace std;
#define EPS 0.0000001
 
 
main(){
  int tcase;   cin >> tcase;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  for ( int i = 0; i < tcase; i++ ){
      cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
 
   
      if ( abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < EPS ) 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, r;

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

        r = (x2 - x1) * (y3 - y4) - (x3 -x4) * (y2 - y1);
        if (!r){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}

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, &x2, &x3, &x4, &y1, &y2, &y3, &y4);
		double a1 = ((x2 - x1) / (y2 - y1)), a2 = ((x4 - x3) / (y4 - y3));
		if (a1 == a2)
		{
			printf("YES\n");
			continue;
		}
		else
		{
			printf("NO\n");
			continue;
		}
	}
	return 0;
}

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(a==0){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }
  }
}

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

int main()
{
    int n;
    cin>>n;
    while(n--){
        pair<double,double>a[4];
        for(int i=0;i<4;i++){
            cin>>a[i].first>>a[i].second;
        }
        if((a[1].first-a[0].first)*(a[3].second-a[2].second)-(a[3].first-a[2].first)*(a[1].second-a[0].second))
            cout<<"NO"<<endl;
        else
            cout<<"YES"<<endl;
    }
    return 0;
}

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

C++: #include <iostream>
using namespace std;
int n;
double xa,xb,xc,xd,ya,yb,yc,yd,ta,tb,tc,td;
int main(){
	int i;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;
		ta = xa - xb;
		tb = ya - yb;
		tc = xc - xd;
		td = yc - yd;
		if(tc/td == ta/tb) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

typedef struct xyz{
    double x;
    double y;
}XYZ;

int main(void){

    int times;
    cin >> times;

    XYZ a,b,c,d;
    double x1,y1,x2,y2;

    while(times > 0){
        cin >> a.x >> a.y;
        cin >> b.x >> b.y;
        cin >> c.x >> c.y;
        cin >> d.x >> d.y;

        x1 = a.x - b.x;
        y1 = a.y - b.y;
        x2 = c.x - d.x;
        y2 = c.y - d.y;

        if((y1 / x1) ==(y2 == x2)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }

        times--;
    }


    return 0;
}