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")
		} else {
			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 <complex>
#include <cmath>
#include <vector>
using namespace std;
 
typedef complex<double> P;
const double eps = 1e-8;
 
bool cross(P a, P b) {
  return a.real()*b.imag() - a.imag()*b.real();
}
 
int main() {
  int Tc;
  cin >> Tc;
  while(Tc--) {
    vector<P> ps(4);
    for(int i = 0; i < 4; ++i) {
      cin >> ps[i].real() >> ps[i].imag();
    }
    if(abs(cross(ps[1]-ps[0], ps[3]-ps[2])) < eps) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
double EPS=1e-5;
double add(double a, double b)
{
	if(abs(a+b)<EPS*(abs(a)+abs(b))) return 0;
	return a+b;
}

int main()
{
	int n; cin >> n ;
	double x[4],y[4];
	while(n--)
	{
		for(int i=0;i<4;i++) cin >> x[i] >> y[i] ;
		double vx[2],vy[2];
		for(int i=0;i<2;i++) vx[i]=add(x[2*i+1],-x[2*i]), vy[i]=add(y[2*i+1],-y[2*i]);
		if(!add(vx[0]*vy[1],-vy[0]*vx[1])) cout << "YES" << '\n' ;
		else cout << "NO" << '\n' ;
	}
}

C++: #include <iostream>
#include <string>
#include <cctype>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map> // pair
#include <set>
#include <string>

#define MAXSIZE 200000
#define PI 3.141592653589
using namespace std;

template<typename T>
T add(T a,T b){
  return a+b;
}

namespace A
{
  int f(void){
    return 1;
  }
}


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

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

    if((x1-x2)*(y3-y4)==(x3-x4)*(y1-y2)){
      std::cout << "YES" << '\n';
    }else{
      std::cout << "NO" << '\n';
    }
  }
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <iterator>
#include <queue>
#include <stack>
#include <deque>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <string>
#include <cmath>
#include <complex>
#include <functional>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cstdlib>
#include <cctype>

#define REP(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rp(i,c) rep(i,(int)c.size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(u) (u).rbegin(),(u).rend()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl
#define v_delete(a,b) (a).erase(remove((a).begin(), (a).end(), b), (a).end())
#define v_unique(a) (a).erase(unique((a).begin(), (a).end()), (a).end())
#define VV(T) vector<vector< T > >
#define init(a,b) memset((a), (b), sizeof((a)))
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;


template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}

template <class T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
template <class T> void input(T* a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
typedef pair<int,int> pii;


int main()
{
	int n;
	cin >> n;
	rep(i,n){
		double x1,y1,x2,y2,x3,y3,x4,y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if(pow(abs(x1-x2),2.0)*pow(abs(x2-y2),2.0) == pow(abs(x3-x3),2.0)*pow(abs(x4-y4),2.0)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
}

C++: #include <stdio.h>

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

    if(x2 == 0 || x4 == 0){
      if(x2 == 0 && x4 == 0){
	printf("YES\n");
      }else{
	printf("NO\n");
      }
    }else{
      if(y2/x2 == y4/x4){
	printf("YES\n");
      }else{
	printf("NO\n");
      }
    }
  }
    
  return 0;
}

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

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

    cin >> n;
    while(n--){
        cin >>x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

        ab = (y1 - y2) / (x1 - x2);
        cd = (y3 - y4) / (x3 - x4);
        if (ab == cd){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}

C++: #include <iostream>
#include <stdio.h>
#define EPS 0.00001
using namespace std;

int main(){
	double a[8];
	int n;
	cin >> n;
	while (n--) {
		for (int i = 0; i < 8; i++) cin >> a[i];
		int dx1 = (a[0] - a[2]) / (a[1] - a[3]);
		int dx2 = (a[4] - a[6]) / (a[5] - a[7]);
		if (-EPS <= dx1 - dx2&&dx1 - dx2 <= EPS) printf("YES\n");
		else printf("NO");
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

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;
		double ABx = x2 - x1,
			ABy = y2 - y1,
			CDx = x4 - x3,
			CDy = y4 - y3;
		if (ABx / ABy == abs(CDx / CDy))cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
	int n; cin >> n ;
	double x[4],y[4];
	while(n--)
	{
		for(int i=0;i<4;i++) cin >> x[i] >> y[i] ;
		double vx[2],vy[2];
		for(int i=0;i<2;i++) vx[i]=x[2*i+1]-x[2*i], vy[i]=y[2*i+1]-y[2*i];
		bool failed=false;
		for(int i=0;i<2;i++) if(!vx[i] && !vy[i]) failed=true;
		if(failed) cout << "NO" << '\n';
		else if((long double) vx[0]*vy[1]==(long double) vy[0]*vx[1]) cout << "YES" << '\n' ;
		else cout << "NO" << '\n' ;
	}
}

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

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

  cin >> n;

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

  return 0;
}

C++: #include <iostream>
#include <utility>
#include <complex>
#include <vector>

using namespace std;

typedef complex<double> point;

const double EPS = 1e-9;
double cross(point a,point b){
    return imag(conj(a)*b);
}

bool is_parallel(point a1,point a2,point b1,point b2){
    return abs(cross(a2-a1,b2-b1)) < EPS;
}

int main(){
    int N;
    cin >> N;
    for(int i=0;i<N;i++){
        vector<point> ps(4);
        for(int j=0;j<4;j++){
            cin >> ps[j].real() >> ps[j].imag();
        }
        if(is_parallel(ps[0],ps[1],ps[2],ps[3])){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;
}