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 <bits/stdc++.h>
/* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
/* cpp template {{{*/
using namespace std;

#define endl '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;
typedef long long ll;
typedef long double lb;
typedef complex<D> P;
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y,int x,int H,int W){return(y>=0&&x>=0&&y<H&&x<W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}
/* }}} */
/* ?????° {{{*/
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-5;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
/* }}} */

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n = in();
  D x[4], y[4];

  while(n--){
    REP(i, 4) cin >> x[i] >> y[i];
    double l1, l2;
    l1 = (y[1] - y[0]) / (x[1] - x[0]);
    l2 = (y[3] - y[2]) / (x[3] - x[2]);
    if ((l1 - l2) < EPS * l1){
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return (0);
}

C++: #include<cstdio>
int main(){
    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)) printf("YES\n");
        else printf("NO\n");
    }
}

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

using namespace std;

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

typedef complex<double> P;
struct Line : public vector<P>
{
  Line(P a=P(), P b=P()) {
    push_back(a); push_back(b);
  }
  P vector() {
    return back() - front();
  }
};

double cross(P const& a, P const& b) {
  return imag(conj(a)*b);
}

bool is_parallel(Line const& s, Line const& t) {
  return abs(cross(s[1]-s[0], t[1]-t[0])) < 1e-8;
}

int main() {
  int N; cin >> N;
  rep(tc, 2) {
    P ps[4]; rep(i, 4) cin >> ps[i].real() >> ps[i].imag();
    cout << (is_parallel(Line(ps[0], ps[1]), Line(ps[2], ps[3])) ? "YES\n" : "NO\n");
  }
}

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

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
double x1,y1,x2,y2,x3,y3,x4,y4;
int n;
int main()
{
  cin>>n;
  for(int i = 0;i < n;i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    double a =(y1-y2)/(x1-x2);
    double b =(y4-y3)/(x4-x3);
      if(a==b)
	cout <<"YES"<<endl;
      else
	cout<<"NO"<<endl;
  }
  return 0;
}

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

typedef complex<double> Point;

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ( (a).real() , (b).real() ) && EQ( (a).imag(), (b).imag() ) )

//OÏ a~b
double cross(Point a,Point b) {
  return (a.real()*b.imag() - a.imag()*b.real());
}

//¼üÌ½s»è
int is_parallel(Point a1,Point a2,Point b1,Point b2){
  return EQ( cross(a1-a2,b1-b2) , 0.0 );
}

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;
    Point p1(x1,y1),p2(x2,y2),p3(x3,y3),p4(x4,y4);
    if( is_parallel(p1,p2,p3,p4)){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}

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

double x[4];
double y[4];

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

C++: #include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pf push_front
#define pb push_back
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

signed 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 AB=(y2-y1)/(x2-x1);
  double CD=(y4-y3)/(x4-x3);

  AB*=10000;
  AB/=10000.0;
  CD*=10000;
  CD/=10000.0;

  cout<<(AB==CD?"YES":"NO")<<endl;
  n--;
  }
  return 0;
}

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


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

C++: #include<iostream>
#include<cmath>
#include<cassert>
#include<cstdlib>
using namespace std;
#define EPS 0.00001


main(){
  int tcase;   cin >> tcase;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  for ( int i = 0; i < tcase; i++ ){
      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++: //Parallelism
#include<bits/stdc++.h>
using namespace std;

const double EPS=1E-12;

int main(){
  int n;
  cin>>n;
  complex<double> a, b, c, d;
  while(n--){
    cin>>a.real()>>a.imag()>>b.real()>>b.imag()>>c.real()>>c.imag()>>d.real()>>d.imag();
    a=a-b;
    c=c-d;
    cout<<(fabs(a.real()*c.imag()-a.imag()*c.real())<=EPS?"YES":"NO")<<endl;
  }

  return 0;
}

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

int main(){
	int n;
	double x[4], y[4];
	cin >> n;
	while (n-- != 0){
		for (int i = 0; i < 4; i++)
			cin >> x[i] >> y[i];
		if ((x[0] - x[1]) * (y[2] - y[3]) == (x[2] - x[3]) * (y[0] - y[1]))
			cout << "YES" << endl;
		else if (x[0] == x[1] && x[2] == x[3])
			cout << "YES" << endl;
		else if (y[0] == y[1] && y[2] == y[3])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}