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[4] == fpoints[6] {
			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<algorithm>
#include<vector>
#include<cassert>
#include<string>

using namespace std;

long long N, X[4], Y[4];

string parallel_judge(){
	if ((X[1] * 100000 - X[0] * 100000)*(Y[3] * 100000 - Y[2] * 100000) == (Y[1] * 100000 - Y[0] * 100000)*(X[3] * 100000 - X[2] * 100000)){
		return "YES";
	}
	else{
		return "NO";
	}
}

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++){
		for (int j = 0; j < 4; j++){
			cin >> X[j] >> Y[j];
		}
		cout << parallel_judge() << endl;
	}
}

C++: #include <stdio.h>

int main()
{
	int n;
	double x[4], y[4];

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]);

		if((x[1]-x[0])*(y[3]-y[2]) == (y[1]-y[0])*(x[3]-x[2])) printf("YES\n");
		else printf("NO\n");
	}

	return 0;
}

C++: //
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<complex>

using namespace std;

#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef pair<int, int> pii;

// const ll inf = INT_MAX;
const double eps = 1e-5;
const double pi = acos(-1.0);
const int di[][2] = {{1,0},{0,1},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};

int main(){
	int n;
	scanf("%d\n", &n);
	double x[4], y[4];
	rep(i,n){
		rep(j,4){
			scanf("%lf %lf", &x[j], &y[j]);
		}
		double dx[2], dy[2];
		dx[0] = x[1] - x[0];
		dx[1] = x[3] - x[2];
		dy[0] = y[1] - y[0];
		dy[1] = y[3] - y[2];
		if(std::abs(dy[1]*dx[0] - dy[0]*dx[1]) < eps) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <math.h>
#include <complex>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = 1e-9;    // 許容誤差。問題によって変える
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

// 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  // return (conj(a)*b).Y;
  return (a.X*b.Y-a.Y*b.X);
}

bool is_parallel(P a1, P a2, P b1, P b2) {
  return EQ(cross(a1-a2, b1-b2), 0.0);
}

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;
    
    if (is_parallel(P(x1, y1), P(x2, y2), P(x3, y3), P(x4, y4))) {
      std::cout << "YES" << std::endl;
    }else {
      std::cout << "NO" << std::endl;
    }
  }

  
  return 0;
}

C++: #include<iostream>

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

  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 <iostream>
using namespace std;

typedef struct vec{
    double x;
    double y;
}vec_s;

int main(void){
    int n = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        double Point[8];
        for(int j = 0; j < 8; j++){
            Point[j] = 0;
        }
        for(int j = 0; j < 8; j++){
            cin >> Point[j];
        }
        vec_s V0 = {Point[0], Point[1]};
        vec_s V1 = {Point[2], Point[3]};
        vec_s V2 = {Point[4], Point[5]};
        vec_s V3 = {Point[6], Point[7]};
        vec_s a = {(V0.x - V1.x), (V0.y - V1.y)};
	    vec_s b = {(V2.x - V3.x), (V2.y - V3.y)};
	    if ((a.x * b.y - a.y * b.x) == 0){
	    		cout << "YES" << endl;
	    	}
	    	else{
	    		cout << "NO" << endl;
	    	}
    }
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  double x[4],y[4];
  
  cin >> n;
  
  while(n--){
    for(int i=0;i<4;i++){
      cin >> x[i] >> y[i];
    }
    
    double a = (y[0]-y[1])/(x[0]-x[1]);
    double b = (y[2]-y[3])/(y[2]-y[3]);
    
    if(a == b) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  
  return(0);
}

C++: #include <iostream>

#define EPS (1e-10)

using namespace std;

double a[2], b[2], c[2], d[2];

bool isParallel() {
  double ax = b[0] - a[0], ay = b[1] - a[1];
  double bx = d[0] - c[0], by = d[1] - c[1];
  double cross = ax * by - ay * bx;
  if (-EPS < cross && EPS > cross)
    return true;
  else
    return false;
}

int main() {
  int n;
  cin >> n;
  if (n < 1) return -1;
  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 (isParallel()) cout << "YES\n";
    else cout << "NO\n";
  }
  return 0;
}

C++: #include <stdio.h>
#include<cmath>
using namespace std;

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int n;
	scanf("%d",&n);
	for(int i=0; i<n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);

		if(abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < 0.0000001){ //I copied yutaka watabe's code here
			printf("YES\n");
		}else{
			printf("NO\n");
		}

	}
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  

  int dataSets;
  cin >> dataSets;
  for(int i=0;i<dataSets;i++){
    double x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if((y2-y1)*(x4-x3) - (x2-x1)*(y4-y3) < 0.00000001){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
    
  }

  return 0;

}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
    int n;
    cin>>n;
    while(n--){
        float x1, y1, x2, y2, x3, y3, x4, y4;
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        if(((y1-y2)/(x1-x2))==((y3-y4)/(x3-x4)))
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

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

int main(){
	int n;cin >> n;
	double a[8];
	while(n--){
		for(int i = 0;i < 8;i++)cin >> a[i];
		double y1 = a[3]-a[1];double x1 = a[2]-a[0];
		double y2 = a[7]-a[5];double x2 = a[6]-a[4];
		double ans = y1/x1 - y2/x2;
		if(ans == 0.0)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0; 
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main(){
    int mod=1000000007;
    int n;
    scanf("%d",&n);
    for (int i=0;i<n;i++) {
        double x1,y1,x2,y2,x3,y3,x4,y4;
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        if ((y2-y1)/(x2-x1)-(y4-y3)/(x4-x3)<1e-10) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }
    return 0;
}