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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-11

template<class T> T add(T x, T y){ if(abs(x+y) < EPS*(abs(x)+abs(y))) return 0; return x + y; }
template<class T> inline bool semieq(T x, T y){ return abs(x - y) < EPS; }
template<class T> inline bool semige(T x, T y){ return x - y > -EPS; }
template<class T> inline bool semile(T x, T y){ return y - x > -EPS; }

template<class Type> struct Line;

template<class Type>
struct P
{
  friend struct Line<Type>;
private:
  Type x, y;

public:
  P(const Type x = 0, const Type y = 0) : x(x), y(y) {}
  void setter(Type x, Type y) { this->x = x;  this->y = y;  return ; }
  Type getX(){ return x; }
  Type getY(){ return y; }
  inline double getSlope(){ return semieq(x, (Type)0) ? INF : 1.0 * y / x; }
  inline double getSlope(P p){ return (this - p).getSlope(); }
  P  operator +  (const P p){ return P(add(x,  p.x), add(y,  p.y)); }
  P  operator -  (const P p){ return P(add(x, -p.x), add(y, -p.y)); }
  P  operator *  (const Type d){ return P(x * d, y * d); }
  P& operator += (const P p){ x = add(x,  p.x);  y = add(y,  p.y);  return *this; }
  P& operator -= (const P p){ x = add(x, -p.x);  y = add(y, -p.y);  return *this; }
  P& operator *= (const Type d){ x *= d;  y *= d;  return *this; }
  bool operator == (const P p){ return  semieq(x, p.x) &&  semieq(y, p.y); }
  bool operator != (const P p){ return !semieq(x, p.x) || !semieq(y, p.y); }
  Type operator * (const P p){ return add(x * p.x,  y * p.y); }
  Type operator / (const P p){ return add(x * p.y, -y * p.x); }
};

template<class Type>
struct Line
{
private:
  P<Type> S, T;

public:
  Line(const Type sx, const Type sy, const Type tx, const Type ty) : S(sx, sy), T(tx, ty) {}
  Line(const P<Type> S, const P<Type> T) : S(S), T(T) {}
  inline P<Type> getS(){ return S; }
  inline P<Type> getT(){ return T; }
  inline double getSlope(){ return S.getSlope(T); }
  inline bool isParallel(Line<Type> L){ return semieq((S.x-T.x)*(L.S.y-L.T.y), (L.S.x-L.T.x)*(S.y-T.y));}
  inline bool isVertical(Line<Type> L){ return semieq((S.x-T.x)*(L.S.x-L.T.x), (L.T.y-L.S.y)*(S.y-T.y));}
};

typedef long double Point;

int n;
P<Point> A[4];
Point x, y;

int main()
{
  cin >> n;

  while(n--){
    rep(i, 4){
      cin >> x >> y;
      A[i].setter(x, y);
    }
    Line<Point> AB(A[0], A[1]);
    Line<Point> CD(A[2], A[3]);
    puts(AB.isParallel(CD) ? "YES" : "NO");
  }

  return 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

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

C++: #include <iostream>
#include <complex>
#include <cmath>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>

#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()) )

using namespace std;

typedef complex<double> P;

int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int n;
  P a,b;
  cin>>n;
  for(;n>0;n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    a = P(x2-x1,y2-y1);
    b = P(x4-x3,y4-y3);
    if (EQV(a/abs(a),b/abs(b)))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

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

  cin >> n;

  for ( int i = 0; i < n; 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;
  }
  return 0;
}

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

int main(){
	double N,X[5],Y[5];
	cin>>N;
	for(int j=1;j<=N;j++){
		for(int i=1;i<=4;i++){
			cin>>X[i]>>Y[i];
		}
		if(abs((X[2]-X[1])*(Y[4]-Y[3])-(X[4]-X[3])*(Y[2]-Y[1]))<VLN){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

C++: 
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
using namespace std;
 
int main(){
    int n;
    long double t[100][8];
    long double ab, cd;
    cin >> n;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 8; j++){
            cin >> t[i][j];
        }
    }
    for(int i = 0; i < n; i++){
        ab = (t[i][1]-t[i][3])*(t[i][4]-t[i][6]);
        cd = (t[i][5]-t[i][7])*(t[i][0]-t[i][2]);
        if(t[i][0] == t[i][2]){
            if(t[i][4] == t[i][6]){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
        }
        else if(t[i][1] == t[i][3]){
            if(t[i][5] == t[i][7]){
                cout << "YES" << endl;
            }
            else{
                cout << "NO" << endl;
            }
        }
        else if(ab == cd){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
}

C++: 
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <cmath>
#include <utility>
#include <queue>
#include <stdio.h>
#include <string>
#include <map>
#include <stack>
#include <complex>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000007
using namespace std;
typedef long long int ll;
typedef complex<double> xy;

int main(){
    int n;
    cin >> n;
    for (int j=0; j<n; j++) {
        vector<xy> inp;
        double x,y,z,w;
        for (int i=0; i<2; i++) {
            cin >> x >> y >> z >> w;
            inp.push_back(xy(x-z,y-w));
        }
        double ans;
        ans =((conj(inp[0])*inp[1]).imag());
        if(ans==0){
            cout << "YES"<<endl;
        }else{
            cout << "NO"<<endl;
        }
    }
}

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#define range(s,n) for(int i = s; i < n; i++)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

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

	cin >> n;
		range(0,n){
			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;
	
}