Go: package main

import (
        "fmt"
        "math/big"
)

func main() {
        var x1, x2, x3, x4, y1, y2, y3, y4 big.Float
        var n int
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                fmt.Scanf("%f %f %f %f %f %f %f %f",
                        &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
                var lx, ly, mx, my, mul1, mul2, sub, zz big.Float
                lx.Sub(&x2, &x1)
                ly.Sub(&y2, &y1)
                mx.Sub(&x4, &x3)
                my.Sub(&y4, &y3)
                mul1.Mul(&lx, &my)
                mul2.Mul(&ly, &mx)
                sub.Sub(&mul1, &mul2)
                zz.SetFloat64(0.0)

                if sub.Cmp(&zz) == 0 {
                        fmt.Println("YES")
                } else {
                        fmt.Println("NO")
                }
        }
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif
 
int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                double x_,y_;
                cin >> x_ >> y_;
                x[i][j] = x_*100000 + (x_ > 0 ? 1e-6 : -1e-6);
                y[i][j] = y_*100000 + (y_ > 0 ? 1e-6 : -1e-6);
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        ll dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}

C++: #include <cassert>
#include <cmath>
#include <iostream>
#include <vector>
#include <iomanip>

struct Point
{
    double x;
    double y;
};
struct Line
{
    Line(const Point& a, const Point& b)
    : p1(a), p2(b) {}
    Point p1;
    Point p2;
};
double GetSlope(const Line& line)
{
    return
    (line.p2.y - line.p1.y) /
    (line.p2.x - line.p1.x);
}
bool IsParallel(const Line& l1, const Line&l2)
{
    // std::cerr << std::fixed << std::setprecision(100) << GetSlope(l1) << std::endl;
    // std::cerr << std::fixed << std::setprecision(100) << GetSlope(l2) << std::endl;
    return GetSlope(l1) == GetSlope(l2);
    // const double gosa = 1e-10;
    // double Slope1 = GetSlope(l1);
    // double Slope2 = GetSlope(l2);
    // return std::fabs(Slope1 - Slope2) < gosa;
}
bool IsParallel(const std::vector<Point>& points)
{
    assert(points.size() == 4);
    return IsParallel(Line(points[0], points[1]), Line(points[2], points[3]));
}
std::vector<Point> Input(std::istream& is)
{
    std::vector<Point> points(4);
    for(int i = 0; i < points.size(); ++i){
        is >> points[i].x >> points[i].y;
    }
    return points;
}
int main()
{
    int n;
    std::cin >> n;
    for(int i = 0; i < n; ++i) {
        std::vector<Point> p = Input(std::cin);
        // std::cout << (IsParallel(p) ? "YES" : "NO") << std::endl; 
        if((p[1].y-p[0].y)/(p[1].x-p[0].x) == (p[3].y-p[2].y)/(p[3].x-p[2].x)){
            std::cout << "YES";
        }else{
            std::cout << "NO";
        }
        std::cout << std::endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>

using namespace std;

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

typedef long long ll;

int main(){
	int n;
	
	cin >> n;
	
	while (n--){
		double x1, x2, x3, x4;
		double y1, y2, y3, y4;
		
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		
		double dx12, dy12, dx34, dy34;
		double a12, a34;
		
		if (x1 < x2){
			dx12 = x2 - x1;
			dy12 = y2 - y1;
		}
		else {
			dx12 = x1 - x2;
			dy12 = y1 - y2;
		}
		
		if (x3 < x4){
			dx34 = x4 - x3;
			dy34 = y4 - y3;
		}
		else {
			dx34 = x3 - x4;
			dy34 = y3 - y4;
		}
		
		a12 = dy12/dx12;
		a34 = dy34/dx34;
		
		if (a12 == a34) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

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

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

C++: #include <complex>
#include <cmath>
#include <iostream>
using namespace std;
typedef complex<double> xy_t;

double dot_product(xy_t a,xy_t b) {
  return (conj(a)*b).real();
}

double cross_product(xy_t a, xy_t b) {
  return (conj(a)*b).imag();
}

xy_t projection(xy_t p,xy_t b) {
  return b * dot_product(p,b)/norm(b);
}

int N;
xy_t A[4];
double S;
const double eps = 1e-11;

int main() {
  scanf("%d",&N);
  for (int n=0;n<N;n++) {
    double re,im;
    for (int i=0;i<4;i++) {
      scanf("%lf%lf",&re,&im);
      xy_t P(re,im); // カッコ悪い記述だが仕方ない。
      A[i] = P;
    }
    A[1] -= A[0];
    A[3] -= A[2];
    S = cross_product(A[1],A[3]);
    bool p = abs(S) < eps;
    printf(p ? "YES\n" : "NO\n");
  }
}

C++: #include <iostream>
using namespace std;
int main(){
  
  double x1, y1, x2, y2, x3, y3, x4, y4;
  int dataSets;
  cin >> dataSets;
  for(int i=0;i<dataSets;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if((y2-y1)*(x4-x3) - (x2-x1)*(y4-y3) == 0.0){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
    
  }

  return 0;

}

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

using namespace std;

int main (int argc, char const* argv[]){
  int n;
  double x1,x2,x3,x4,y1,y2,y3,y4;
  
  
  cin >> n;
  //座標取得
  while(cin >> x1 >>y1 >>x2 >>y2 >>x3 >>y3 >>x4 >>y4){
    double ax=x2-x1, ay=y2-y1, bx=x4-x3,by=y4-y3;
    double det = ax*by - ay*bx;
    if(det==0) cout << "YES" <<endl;
    else cout << "NO" << endl;
    
  }
  
  
  
  
  return 0;
}

C++: #include <iostream>
#include <float.h>
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;
		if((y2-y1)/(x2-x1) == (y4-y3)/(x4-x3)){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
		
	}
	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(x[0]==x[1] && x[2]==x[3])
      cout<<"YES\n";
  else if( (y[0]-y[1])/(x[0]-x[1]) == (y[2]-y[3])/(x[2]-x[3]) ) 
      cout<<"YES\n";
    else
      cout<<"NO\n";
  }
  return 0;
}

C++: #include <iostream>

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 dx1 = x2-x1,
			   dy1 = y2-y1,
			   dx2 = x4-x3,
			   dy2 = y4-y3;
		
		if (dx2 * dy1 == dx1 * dy2) {
			if (dx1*dy1*dx2*dy2 != 0.0) {
				cout << "YES" << endl;
			} else {
				if (dx2+dy2 == 0.0 || dx1+dy1 == 0.0) {
					cout << "NO" << endl;
				}
			}
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}