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 <complex>
#include <cmath>
#include <cstdio>
using namespace std;
typedef complex<double> xy_t;
const double eps = 1e-11;

double dot_product(xy_t a, xy_t b) { return (conj(a) * b).real(); }
double cross_product(xy_t a, xy_t b) { return (conj(a) * b).imag(); }
xy_t projection(xy_t p, xy_t b) { return b * dot_product(p, b) / norm(b); }

int main()
{
    int n = 0;
    double x, y;
    xy_t P[4];
    double sum = 0.0;
    cin >> n;
    bool answer[n] = {};
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < 4; j++)
        {
            cin >> x >> y;
            P[j] = xy_t(x, y);
        }
        xy_t a[2] = {P[1] - P[0], P[3] - P[2]};
        if (abs(cross_product(a[0], a[1])) < eps)
        {
            answer[i] = 1;
        }
    }
    for (int i = 0; i < n; i++)
    {
        if (answer[i])
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <complex>
#include <cmath>
using namespace std;
 
double cross(complex<double> z1, complex<double> z2) {
    return (z1.real()*z2.imag() - z1.imag()*z2.real());
}
 
int main(int argc, char** argv) {
    static const double EPS = 1e-10;
    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];
        }
        complex<double> ab(x[1]-x[0], y[1]-y[0]);
        complex<double> cd(x[3]-x[2], y[3]-y[2]);
        if(abs(cross(ab, cd)) < EPS) { // ?????????0????????????
            cout << "YES" << endl;
        }else {
            cout << "NO" << endl;
        }
    }
}

C++: #include <iostream>

using namespace std;
 
int main(){
  double a,b,c,d,e,f,g,h;
  int t;
  
  cin >> t;
  while(t--){
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    cout << ((d-b)/(c-a) == (h-f)/(g-e) ? "Yes" : "No") << endl;
  }
 
  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#define INF 10000000
using namespace std;
typedef pair<int,int> P;

bool check(double x1,double y1,double x2,double y2){
  return (x1*y2-y1*x2)==0;
}

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;
    if(check(x2-x1,y2-y1,x4-x3,y4-y3)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << 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){
		int ans=0;
		double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if(x1==x2||x3==x4){
			if(x1==x2&&x3==x4) ans=1;
		}else{
			m1=(y2-y1)/(x2-x1);
			m2=(y4-y3)/(x4-x3);
			if(fabs(m1-m2)<(1e-10)) ans=1;
		}
		if(ans)	cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;


#define rep(i,n) for(int i=0;i<(n);i++)

const double EPS = 1e-10;
const double INF = 100000000;




int main(){
    int n;
    cin>>n;
    rep(i,n){
        double x[4],y[4],ax,ay,bx,by,ans;
        
        rep(j,4){
            cin>>x[j]>>y[j];
        }
        
        ax=x[1]-x[0];
        ay=y[1]-y[0];
        bx=x[3]-x[2];
        by=y[3]-y[2];
        
        ans=ax*by-bx*ay;
        if(fabs(ans)<=EPS)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
        
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

struct Vector
{
	double x;
	double y;
};

istream& operator>>(istream& stream, Vector& p)
{
	return stream >> p.x >> p.y;
}

double slope(Vector p1, Vector p2)
{
	return (p2.y - p1.y) / (p2.x - p1.x);
}

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

	while(length-- > 0)
	{
		Vector a, b, c, d;
		cin >> a >> b >> c >> d;

		if( slope(a, b) == slope(c, d) )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}