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<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;

int main()
{
  double x1,x2,x3,x4,y1,y2,y3,y4;
  double dx1,dy1,dx2,dy2;
  int n;
  int i;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    dx1=x2-x1;
    dy1=y2-y1;
    dx2=x4-x3;
    dy2=y4-y3;

    if(dx1==0 && dx2==0)
      cout<<"YES"<<endl;
    else if(dx1==0 || dx2==0)
      cout<<"NO"<<endl;
    else if(max(dy1/dx1-dy2/dx2,dy1/dx1-dy2/dx2) < 0.00001)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

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

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-9

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

  scanf("%d", &n);
  while(n--){
    scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
    ab = (y2-y1) / (x2-x1);
    cd = (y4-y3) / (x4-x3);

    if(abs(ab - cd) < EPS) printf("YES\n");
    else printf("NO\n");
  }

  return 0;
}

C++: #include<string>
#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<stack>
#include<set>
#include<cmath>

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

#define EPS 1e-6

using namespace std;

int main(){

	int n;
	double x1,y1,x2,y2,x3,y3,x4,y4;

	cin >> n;

	rep(i,n){

	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

	double a=y2-y1; double b=x2-x1; double c=y1*b-x1*a;
	double d=y4-y3; double e=x4-x3; double f=y3*e-x3*d;

	if(a*e-d*b==0 && e*c-b*f!=0) cout << "YES" << endl;
	else cout << "NO" << endl;

	}

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#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;
        if(x1==x2&&x3==x4)printf("YES\n");
        else{
            if((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4))printf("YES\n");
            else printf("NO\n");
        }
    }
    return 0;
}

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

const double eps=1e-9;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    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(fabs((x2-x1)*(y4-y3)-(y2-y1)*(x4-x3))<eps) cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}

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

typedef complex<double> P;

// ティツィツアテ・ツョツケテ」ツ?凖」ツつ凝ィツェツ、テ・ツキツョテ篠オ
#define EPS (1e-10)
// 2テ」ツ?、テ」ツ?ョテ」ツつケテ」ツつォテ」ツδゥテ」ツδシテ」ツ?古ァツュツ嘉」ツ?療」ツ??」ツ?凝」ツ?ゥテ」ツ??」ツ??
#define EQ(a,b) (abs((a)-(b)) < EPS)

// テ・ツ、ツ姪ァツゥツ?(cross product) : aテδ傭 = |a||b|sinテ篠?
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

// 2テァツ崢エテァツキツ堙」ツ?ョテ・ツケツウティツ。ツ古・ツ按、テ・ツョツ?: a//b <=> cross(a, b) = 0
int is_parallel(P a1, P a2, P b1, P b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}

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

	cin >> n;
	for(int i=0 ; i<n ; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		P a(x1,y1), b(x2,y2), c(x3,y3), d(x4,y4);
		if( is_parallel(a,b,c,d) ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
}

C++: #include<stdio.h>
int main(){
  int n;
  double x[4],y[4];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    
    for(int j=0;j<4;j++)
      scanf("%lf %lf",&x[j],&y[j]);

    if(x[0] == x[1] || x[2] == x[3])
      if(y[0] == y[1] && y[2] == y[3]) puts("YES");
      else puts( (x[0] == x[1] && x[2] == x[3])?"YES":"NO");
    else if(y[0] == y[1] || y[2] == y[3])
      puts( (y[0] == y[1] && y[2] == y[3])?"YES":"NO");
    else
      puts((y[0]-y[1])/(x[0]-x[1]) == (y[2]-y[3])/(x[2]-x[3])?"YES":"NO");
    
  }
  return (0);
}

C++: #include <iostream>
#include <cmath>
 
using namespace std;
 
int main()
{
    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];
        if(abs((x[3]-x[2])*(y[1]-y[0])-(x[1]-x[0])*(y[3]-y[2]))<1e-10)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
     
    return 0;
}

C++: #include<iostream>

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  const double e = 1e-4;

  std::cin >> n;

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

    if((x1*y3+x2*y4+y2*x3+y1*x4)-(x2*y3+x1*y4+y1*x3+y2*x4)<e){
      std::cout << "YES" << std::endl;
    }else{
      std::cout << "NO" << std::endl;
    }
  }
}

C++: #include <stdio.h>
#define EPSIRON (1.0e-10)
#define ABS(X) ((X)<0.0 ? -(X):(X))

int main(void){
    int n;
    double x1, x2, x3, x4, dx1, dx2;
    double y1, y2, y3, y4, dy1, dy2;
    double cp; // cross product
    
    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;
        cp = dx1 * dy2 - dy1 * dx2;
        printf("%s\n", ABS(cp) < EPSIRON ? "YES" : "NO");
    }
    
    return 0;
}

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

int main(){

  int num;
  cin >> num;

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

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

      i++;
  }

  return 0;
}

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

double abs_(double a)
{
	if (a > 0) return a;
	else return -a;
}

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

C++: #include<stdio.h>
int main(void)
{
	int n;
	int i,j;
	double x[5],y[5];
	double xx,yy;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		for(j=0;j<4;j++){
			scanf("%lf %lf",&x[j],&y[j]);
		}
		xx=(y[0]-y[1])/(x[0]-x[1]);
		yy=(y[2]-y[3])/(x[2]-x[3]);
		if(xx==yy){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int n,i;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((x2-x1)*(y4-y3)-(x4-x3)*(y2-y1)){
			cout<<"NO\n";
		}else{
			cout<<"YES\n";
		}
	}
}

C++: #include<stdio.h>

int main(void)
{
	double x[4]={0},y[4]={0},x1,x2,y1,y2;
	int i;
	scanf("%d",&i);

	while(i!=0)
	{
		scanf("%f %f %f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
		x1 = x[1]-x[0];   y1 = y[1]-y[0];
		x2 = x[3]-x[2];   y2 = y[3]-y[2];
		if(x1==0 && x2==0)
			printf("YES\n");
		else if(x1==0 || x2==0)
			printf("NO\n");
		else if(y1/x1 == y2/x2)
			printf("YES\n");
		else 
			printf("NO\n");

		i-=1;
	}
 return 0;
}