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 ()
{
	int n;
	cin>>n;
	for(int h=0;h<n;h++)
	{
		double x[4],y[4];
		for(int i=0;i<4;i++)cin>>x[i]>>y[i];
		if(x[0]==x[1]||x[2]==x[3])
		{
			if(x[0]==x[1]&&x[2]==x[3])
			{
				cout<<"YES"<<endl;
			}
			else
			{
				cout<<"NO"<<endl;
			}
		}
		else
		{
			double Z,X;
			Z=(y[1]-y[0])/(x[1]-x[0]);
			X=(y[3]-y[2])/(x[3]-x[2]);
			if(abs(Z-X)<0.0000000001)
			{
				cout<<"YES"<<endl;
			}
			else cout<<"NO"<<endl;
		
		}
	}
	
}

C++: #include <iostream>

using namespace std;

typedef struct myvector{
  double x;
  double y;
}Vector;

Vector sub_vector(Vector& a, Vector& b)
{
  Vector ret;
  ret.x = b.x - a.x;
  ret.y = b.y - a.y;
  return ret;
}

double cross_product(Vector& a, Vector& b)
{
  return a.x * b.y - b.x * a.y;
}

int main()
{
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    Vector A, B, C, D;
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> D.x >> D.y;
    Vector AB = sub_vector(A, B);
    Vector CD = sub_vector(C, D);
    if(cross_product(AB, CD) == 0)
      cout << "YES" << endl;
    else 
      cout << "NO" << endl;
  }
}

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

using namespace std;
typedef pair<double, double> P;

void solve()
{
	int n;
	while(cin >> n)
	{
		while(n--)
		{
			vector<P> p(4);
			for(int i = 0; i < 4; ++i)
			{
				cin >> p[i].first >> p[i].second;
			}
			if((p[0].first == p[1].first && p[0].second == p[1].second) || (p[2].first == p[3].first && p[2].second == p[3].second))
			{
				cout << "NO" << endl;
			}
			else if((p[0].first == p[1].first && p[2].first != p[3].first) || (p[0].first != p[1].first && p[2].first == p[3].first))
			{
				cout << "NO" << endl;
			}
			else if((p[1].second - p[0].second) / (p[1].first - p[0].first) == (p[3].second - p[2].second) / (p[3].first - p[2].first))
			{
				cout << "YES" << endl;
			}
			else
			{
				cout << "NO" << endl;
			}
		}
	}
}

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

C++: #include<stdio.h>
#include<string.h>
#include<iostream>

using namespace std;
double cross(double x1,double y1,double x2,double y2);

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


double cross(double x1,double y1,double x2,double y2){
	return (x1-x2)/(y1-y2);
}

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

int main()
{
  int n;
  float x[2], y[2], a[2];

  scanf("%d", &n);
  for (int i = 0; i < n; i++){
    for (int j = 0; j < 2; j++){
      for (int k = 0; k < 2; k++){
        scanf("%f%f", &x[k], &y[k]);
      }
      a[j] = (y[1] - y[0]) / (x[1] - x[0]);
    }
    if (a[0] == a[1]){
      puts("YES");
    }
    else {
      puts("NO");
    }
  }

  return (0);
}

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

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

int main() {
    int n;
    cin >> n;
    double x1, y1, x2, y2, x3, y3, x4, y4;
    while (n--) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        if (y1 == y2 && y3 == y4) {
            cout << "YES" << endl;
            continue;
        } else if (y1 == y2 || y3 == y4) {
            cout << "NO" << endl;
            continue;
        }
        double a = (x2 - x1) / (y2 - y1);
        double b = (x4 - x3) / (y4 - y3);
        if (abs(a - b) < 1e-8) {
            cout << "YES" << endl;
            continue;
        }
        cout << "NO" << endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int n;
	float s, t, m, a, b, k;
	cin >> n;
	while(n--){
		cin >> a >> b >> s >> t;
		k = 0;
		if(s-a == 0){
			m = 0;
			k = 1;
		} else if(t-b == 0){
			m = 0;
			k = 2;
		} else {
			m = (t-b)/(s-a);
		}
		cin >> a >> b >> s >> t;
		if(s-a == 0){
			if(k == 1){
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		} else if(t-b == 0){
			if(k == 2){
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		} else if(m == (t-b)/(s-a)){
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
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(fabs(x1-x2)<1e-9){
            if(fabs(x3-x4)<1e-9)cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
        else{
            double a=(y1-y2)/(x1-x2);
            double b=(y3-y4)/(x3-x4);
            if(fabs(a-b)<1e-9)cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
    }
     
    return 0;
}

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

  while(n--){
    for(int i = 0 ; i < 4 ; i++ )cin >> x[i] >> y[i];
    y[1]-=y[0];
    x[1]-=x[0];
    y[3]-=y[2];
    x[3]-=x[2];
    if(fabs(y[1]*x[3] - y[3]*x[1]) < 10e-10)cout << "YES";
    else cout << "NO";
    cout << endl;
    }
  return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>

using namespace std;


bool solve(){
	double x[4],y[4];
	for(int i=0;i<4;i++){
		cin>> x[i]>> y[i];
	}
	if(x[1]==x[0] || x[3]==x[2]){
		if(x[1]==x[0] && x[3]==x[2]){
			cout<< "YES"<< endl;
		}else{
			cout<< "NO"<< endl;
		}
		return true;
	}
	double rad1 = atan( (y[1]-y[0]) / (x[1]-x[0]) );
	double rad2 = atan( (y[3]-y[2]) / (x[3]-x[2]) );
	if(rad1 == rad2){
		cout<< "YES"<< endl;
	}else{
		cout<< "NO"<< endl;
	}
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	int n;
	cin>> n;
	for(int i=0;i<n;i++){
		solve();
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}