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>
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++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>

using namespace std;

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;
		
		double t1 = (y1-y2)*(x3-x4);
		double t2 = (y3-y4)*(x1-x2);

		if( (x1-x2)==0 && (x3-x4)==0 ){
			cout << "YES" << endl;
		}else if( (x1-x2)==0 || (x3-x4)==0 ){
			cout << "NO" << endl;
		}else if( t1==t2 ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

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

int main(){

  double ax,ay,bx,by,cx,cy,dx,dy;
  double n,s,t;

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;

    s = (ay - by) / (ax - bx);
    t = (cy - dy) / (cx - dx);

    if(s == t) cout << "YES" << endl;
    else cout << "NO" << endl;

  }
}

C++: #include <iostream>

using namespace std;

int main()
{
	int n;
	double x[4], y[4], a, b;
	
	cin >> n;
	while(n--){
		for(int i = 0; i < 4; i++){
			cin >> x[i] >> y[i];
		}
		
		if(x[0]-x[1] == 0){
			if(x[2]-x[3] == 0){
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		} else {
			a = (y[0]-y[1])/(x[0]-x[1]);
			b = (y[2]-y[3])/(x[2]-x[3]);
			if(a == b){
				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;
		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 <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){
		 scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		//cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((y1-y2)*(x3-x4) == (x1-x2)*(y3-y4) ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<complex>
#include<cmath>
#include<string>
#include<queue>
using namespace std;
int main()
{
  int n;
  double x,y;
  queue<string> qs;
  cin >> n;
  for( int i = 0; i < n; ++i){
    complex<double> p[4];
    for( int j = 0; j < 4; ++j){
      cin >> x >> y;
      p[i] = complex<double>(x,y);
    }
    int S =(conj(p[1] - p[2])*(p[3] - p[4])).imag();
    if( S == 0) qs.push("YES");
    else qs.push("NO");
  }
  while(!qs.empty()){
    cout << qs.front() << endl;
    qs.pop();
  }
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define PI 3.141592653

int main(){
    int n;
    double x_1,y_1,x_2,y_2,x_3,y_3,x_4,y_4,slope_1,slope_2;
    scanf("%d",&n);
    
    for(int i=0;i<n;i++){
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x_1,&y_1,&x_2,&y_2,&x_3,&y_3,&x_4,&y_4);
        
        if(x_1==x_2){
            
            if(x_3==x_4)
                puts("YES");
            else
                puts("NO");
            
            continue;
        }
        
        slope_1=(y_1-y_2)/(x_1-x_2);
        slope_2=(y_3-y_4)/(x_3-x_4);
        
        if(abs(slope_1-slope_2)<1e-7)
            puts("YES");
        else
            puts("NO");
    }
    
    return 0;
}

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

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

typedef complex<double> P;
typedef vector<P> VP;
const double EPF = 1e-5;

#define X real()
#define Y imag()
#define EQ(x,y) (abs(x-y) < EPF)

double dot(P a, P b) {
  return (conj(a)*b).X;
}
double cross(P a, P b) {
  return (conj(a)*b).Y;
}
double distPP(P a, P b) {
  return sqrt(dot(a-b,a-b));
}
P crosspoint(P a, P b, P c, P d) {//ac , bd
  double d1 = cross(d-b,b-a);
  double d2 = cross(d-b,c-a);
  if(EQ(d1,0) & EQ(d2,0)) return a;
  if(EQ(d2,0)) return a;
  return a + (c-a)*d1/d2;
}
P normal_vector(P a) {
  P b(-a.Y, a.X);
  return b;
}
P polar(double r, double theta) {
  P a(r*cos(theta),r*sin(theta));
  return a;
}

int main() {
  int n;
  scanf("%d",&n);
  REP(i,n) {
    double x,y;
    P a,b,c,d;
    scanf("%lf %lf", &x, &y);
    a = P(x,y);
    scanf("%lf %lf", &x, &y);
    b = P(x,y);
    scanf("%lf %lf", &x, &y);
    c = P(x,y);
    scanf("%lf %lf", &x, &y);
    d = P(x,y);
    
    if(EQ(cross(a-b, c-d),0))printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

C++: #include <bits/stdc++.h>

//const static double	de_PI	= 3.14159265358979323846;
//const static int	de_MOD	= 1000000007;
//const static int	de_MAX	= 999999999;
//const static int	de_MIN = -999999999;

inline double RoundOff(double a, const int n) {

	for (int i = 0; i < n - 1; i++) { a *= 10; }

	if (a > 0) { a += 0.5; }
	else { a -= 0.5; }

	a = static_cast<int>(a);

	for (int i = 0; i < n - 1; i++) { a /= 10; }

	return a;
}

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());

	int n = 0;
	std::cin >> n;

	double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
	double slope1 = 0, slope2 = 0;
	std::vector<std::string> ans(n);

	for (int i = 0; i < n; i++) {
		std::cin >> x1 >> y1 >> x2 >> y2;
		slope1 = RoundOff((y2 - y1) / (x2 - x1), 6);
		std::cin >> x1 >> y1 >> x2 >> y2;
		slope2 = RoundOff((y2 - y1) / (x2 - x1), 6);

		if (slope1 == slope2) {
			ans[i] = "YES";
		}
		else {
			ans[i] = "NO";
		}
	}

	for (int i = 0; i < n; i++) {
		std::cout << ans[i] << std::endl;
	}

}

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

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

    cin >> num;

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

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

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

int main(){

  const double EPS = 1e-10;

  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( 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() {
  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) / (x2 - x1) == (y4 - y3) / (x4 - x3)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}