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

C++: #include<stdio.h>
#include<math.h>

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int ans[100]={0};
	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(((y1-y2)/(x1-x2)-(y3-y4)/(x3-x4))==0.0)ans[i]=1;
		else if((x1-x2)==0 && (x3-x4)==0)ans[i]=1;
		else ans[i]=0;
	}
	
	for(i=0;i<n;i++){
		if(ans[i]==1)printf("YES\n");
		else printf("NO\n");
	}
	
return 0;
}

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){
		double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		m1=(y2-y1)/(x2-x1);
		m2=(y4-y3)/(x4-x3);
		if(m1==m2) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

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

int main(int argc, char const* argv[]) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i += 1) {
    float x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    float AB, CD;
    AB = (y2 - y1) / (x2 - x1);
    CD = (y4 - y3) / (x4 - x3);
    if (AB == CD) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

int main() {

	int n;
	double x[4], y[4],ans[2];

	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> x[j] >> y[j];
		}
		ans[0] = (y[1] - y[0]) / (x[1] - x[0]);
		ans[1] = (y[3] - y[2]) / (x[3] - x[2]);
		if (ans[0] == ans[1])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

bool get_inc( double x1 , double y1 , double x2 , double y2 , double& a );

int main(void)
{
	double x1, x2, x3, x4;
	double y1, y2, y3, y4;

	double a1, a2;

	int n;

	cin >> n;

	for( int i = 0 ; i < n ; i++ )
	{
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

		bool result1 = get_inc( x1 , y1 , x2 , y2 , a1 );
		bool result2 = get_inc( x3 , y3 , x4 , y4 , a2 );

		if( result1 == false && result2 == false )
		{
			cout << "YES" << endl;
		}
		else
		{
			if( a1 - a2 <= 0.0000001 ) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	}


	return 0;
}

bool get_inc( double x1 , double y1 , double x2 , double y2 , double& a )
{
	a = ( y2 - y1 )/( x2 - x1 );
	if( x2 - x1 >= -0.0000001 && x2 - x1 <= 0.0000001 )
	{
		return false;
	}
	return true;
}

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

int main(){
    double x1, y1, x2, y2, x3, y3, x4, y4;

    int n;

    cin >> n;

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

C++: #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#include <bits/stdc++.h>
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(abs((y2-y1)*(x4-x3)-(x2-x1)*(y4-y3))<0.000000000001) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
    
  return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<stack>
#include<cstring>

using namespace std;

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

int main(){
	
	int n;
	cin>>n;
	
	rep(t,n){
		double x[4];
		double y[4];
		
		rep(i,4){
			cin>>x[i]>>y[i];
		}
		
		double dx1 = x[0]-x[1];
		double dx2 = x[2]-x[3];
		
		double dy1 = y[0]-y[1];
		double dy2 = y[2]-y[3];
		
		
		if(dx1==0){
			if(dx2==0)puts("YES");
			else puts("NO");
		}else{
			double a1 = dy1/dx1;
			double a2 = dy2/dx2;
			if(abs(a1-a2)<0.000000001)puts("YES");
			else puts("NO");
		}
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
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;
		double a,b,c,d,e,f;
		a=sqrt(pow(x2-x1,2)+pow(y2-y1,2));
		c=sqrt(pow(x4-x3,2)+pow(y4-y3,2));
		b=pow(abs(x1-x3),2);
		d=pow(abs(x2-x4),2);
		e=pow(abs(y1-y3),2);
		f=pow(abs(y2-y4),2);
		b=sqrt(b*e);
		d=sqrt(d*f);
		if(a==c&&b==d){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
	int n;
	cin >> n;
	for(int i=0;i<n;++i){
		vector<double> a(2),b(2),c(2),d(2);
		double tmp;
		cin>>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1]>>d[0]>>d[1];
		double x1=b[0]-a[0],y1=b[1]-a[1];
		double x2=d[0]-c[0],y2=d[1]-c[1];
		if(x1*y2-x2*y1==0) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <stdio.h>
 
int main() {
    double x1, x2, x3, x4, y1, y2, y3, y4;
    int n;
 
    int 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) - (y2 - y1) * (x4 - x3))
            printf("NO\n");
        else
            printf("YES\n");
    }
 
    return 0;
}

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

int main(){

  int num;
  cin >> num;

  double x[4], y[4];
  int i = 0;

  while( i < num ){
  for( int j = 0; j < 4; j++ ){
    cin >> x[j] >> y[j];
  }
  double comp1 = (y[1]- y[0]) / (x[1] - x[0]) ;
  double comp2 = (y[3] - y[2]) / (x[3] - x[2]);
  if(comp1 == comp2 || comp1 * (-1) == comp2 ){
    cout <<"YES"<< endl;
  }else{
    cout <<"NO"<< endl;
  }
  i++;
  }

 
  return 0;
}

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

typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-12;
double x[4],y[4];
int N;
int main() {
	cin >> N;
	for (int i=0; i<N; ++i) {
		for (int i=0; i<4; ++i) {
			cin >> x[i] >> y[i];
		}
		xy_t a[2] = {
					xy_t(x[0],y[0]) - xy_t(x[1],y[1]),
					xy_t(x[2],y[2]) - xy_t(x[3],y[3])
				};
		bool p = abs(cross_product(a[0],a[1])/2) < eps;
		cout << ( p ? "Yes" : "No") << endl;
	}
}

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;
}