Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	for i := 0; i < n; i++ {
		scanner.Scan()
		points := strings.Split(scanner.Text(), " ")
		fpoints := make([]float64, 0)
		for _, v := range points {
			tmp, _ := strconv.ParseFloat(v, 64)
			fpoints = append(fpoints, tmp)
		}
		if fpoints[0] == fpoints[2] && fpoints[1] == fpoints[3] {
			fmt.Println("YES")
			continue
		}
		a := (fpoints[1]-fpoints[3])/(fpoints[0]-fpoints[2])
		b := (fpoints[5]-fpoints[7])/(fpoints[4]-fpoints[6])
		if a == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

using namespace std;

class Vector2D {
  private:
    double x;
    double y;
  public:
    Vector2D(double, double);
    Vector2D operator - (Vector2D vec2) {
      double newX = this->x - vec2.x;
      double newY = this->y - vec2.y;
      Vector2D newvec(newX, newY);
      return newvec;
    }
    double GetX() { return x; };
    double GetY() { return y; };
    bool isParallel(Vector2D);
};

Vector2D::Vector2D(double _x, double _y) {
  x = _x;
  y = _y;
}

bool Vector2D::isParallel(Vector2D vec2) {
  if (abs(vec2.GetY()/this->y) == abs(vec2.GetX()/this->x))
    return true;
  else
    return false;
}

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

  double x1,y1,x2,y2,x3,y3,x4,y4;
  for (int dataset_i = 0; dataset_i < n; dataset_i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    Vector2D vecAB = Vector2D(x2,y2) - Vector2D(x1,y1);
    Vector2D vecCD = Vector2D(x4,y4) - Vector2D(x3,y3);
    cout << (vecAB.isParallel(vecCD) ? "YES" : "NO") << endl;
  }

  return 0;
}

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