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<cmath>
//#define e 0.00000000001
using namespace std;
int main(){
  double a[2],b[2],c[2],d[2];
  double e = 0.00001;
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a[0] >> a[1] >> b[0] >> b[1] >> c[0] >> c[1] >> d[0] >> d[1];
    if(abs((b[1]-a[1])*(d[0]-c[0])-(d[1]-c[1])*(b[0]-a[0]))<e) cout << "YES" << endl;
    else cout << "NO" << endl;
  }   
  return 0;
}

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

int main(){

	typedef struct{
		double x, y;
	}_td;

	int n;
	_td p1, p2, p3, p4;
	double r_ab, r_cd;
	
	cin >> n;
	
	for(int i=0; i<n; i++){
		cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y;
		
		if(p1.x - p2.x != 0 && p3.x - p4.x != 0){
			r_ab = (p1.y - p2.y) / (p1.x - p2.x);
			r_cd = (p3.y - p4.y) / (p3.x - p4.x);
			if(r_ab == r_cd) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else if(p1.x - p2.x == 0 && p3.x - p4.x == 0){
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}

	return 0;

}

C++: #include <stdio.h>

#define ABS(X) ((X)<0 ? -(X) : (X))
int main(){
    int n;
    double x1, y1, x2, y2;
    double x3, y3, x4, y4;
    double dx1, dy1, dx2, dy2;
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
        scanf("%lf %lf %lf %lf", &x3, &y3, &x4, &y4);
        dx1 = x2 - x1;
        dy1 = y2 - y1;
        dx2 = x4 - x3;
        dy2 = y4 - y3;
        if (ABS(dx1*dy2 - dx2*dy1) < 0.01){
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }

    return 0;
}

C++: #include<cstdio>

main(){
  double a,b,c,d,w,x,y,z;
  int i;
  scanf("%d",&i);
  for(;i--;)
    {
      scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a,&w,&b,&x,&c,&y,&d,&z);
	if(((b-a)*(x-w))==((d-c)*(z-y)))
	  puts("YES");
	else
	  puts("NO");
    }
  return 0;
}

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

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

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

struct Point
{
    double x;
    double y;
};
struct Line
{
    Line(const Point& a, const Point& b)
    : p1(a), p2(b) {}
    Point p1;
    Point p2;
};
double GetSlope(const Line& line)
{
    return
    (line.p2.y - line.p1.y) /
    (line.p2.x - line.p1.x);
}
bool IsParallel(const Line& l1, const Line&l2)
{
    // std::cerr << GetSlope(l1) << std::endl;
    // std::cerr << GetSlope(l2) << std::endl;
    const double gosa = 0;
    double Slope1 = GetSlope(l1);
    double Slope2 = GetSlope(l2);
    return std::fabs(Slope1 - Slope2) < gosa;
}
bool IsParallel(const std::vector<Point>& points)
{
    assert(points.size() == 4);
    return IsParallel(Line(points[0], points[1]), Line(points[2], points[3]));
}
std::vector<Point> Input(std::istream& is)
{
    std::vector<Point> points(4);
    for(int i = 0; i < points.size(); ++i){
        is >> points[i].x >> points[i].y;
    }
    return points;
}
int main()
{
    int n;
    std::cin >> n;
    for(int i = 0; i < n; ++i) {
        std::vector<Point> points = Input(std::cin);
        std::cout << (IsParallel(points) ? "YES" : "NO") << std::endl; 
    }
    return 0;
}

C++: #include <iostream>
#include <complex>
#include <cmath>
#include <vector>
using namespace std;
 
typedef complex<double> P;
const double eps = 1e-8;
 
bool cross(P a, P b) {
  return a.real()*b.imag() - a.imag()*b.real();
}
 
int main() {
  int Tc;
  cin >> Tc;
  while(Tc--) {
    vector<P> ps(4);
    for(int i = 0; i < 4; ++i) {
      cin >> ps[i].real() >> ps[i].imag();
    }
    if(abs(cross(ps[1]-ps[0], ps[3]-ps[2])) < eps) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cmath>
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;
		cout<<(fabs((d-b)*(g-e)-(h-f)*(c-a))<1e-7?"YES":"NO")<<endl;
	}
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int n;
int main() {
    cin>>n;
    double x1,y1;
    double x2,y2;
    double x3,y3;
    double x4,y4;
    rep(i,n) {
        cin>>x1>>y1;
        cin>>x2>>y2;
        cin>>x3>>y3;
        cin>>x4>>y4;
        double tx1 = x1-x2;
        double ty1 = y1-y2;
        double tx2 = x3-x4;
        double ty2 = y3-y4;

        if(tx1*ty2==tx2*ty1) {
            cout<<"YES"<<endl;
        }
        else {
            cout<<"NO"<<endl;
        }

    }
    return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;

	double x[4];
	double y[4];

	while(n > 0){
		for(int i = 0; i < 4; ++i){
			cin >> x[i] >> y[i];
		}

		double m1 = (y[0] - y[1]) / (x[0] - x[1]);
		double m2 = (y[2] - y[3]) / (x[2] - x[3]);

		cout << (m1 == m2 ? "YES" : "NO") << endl;

		--n;
	}

	return 0;
}

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

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        double A[2], B[2], C[2], D[2];
        cin >> A[0] >> A[1] >> B[0] >> B[1] >> C[0] >> C[1] >> D[0] >> D[1];
        double AB[2] = {A[0] - B[0], A[1] - B[1], };
        double CD[2] = {C[0] - D[0], C[1] - D[1], };
        double outerProduct = AB[0] * CD[1] - AB[1] * CD[0];
        if (outerProduct == 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

C++: #include<iostream>

using namespace std;

int main(void){
    int n;
    double x[4],y[4];
    double ansx[2],ansy[2];
    cin>>n;
    for(int i = 0 ; i < n ;  i ++){	
      for(int j = 0 ; j < 4 ; j ++)cin>>x[i]>>y[i];
      for(int j = 0 ; j < 4 ; j +=2){
	ansx[i]=ansx[i]-ansx[i+1];
	ansy[i]=ansy[i]-ansy[i+1];
      }
      if(ansx[0]*ansy[1]-ansx[1]*ansy[0])
	cout<<"NO"<<endl;
      else
	cout<<"YES"<<endl;

    }
}

C++: #include<iostream>

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

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

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ( (a).real() , (b).real() ) && EQ( (a).imag(), (b).imag() ) )

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  cin>>n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if( (y2-y1)/abs(x2-x1) - (y4-y3)/abs(y4-y3) <= EPS ){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}