Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&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)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("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;
}

C++: #include <stdio.h>

int main(){
    int n,i,j;
    double x[5],y[5];
    long X[5],Y[5];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        for(j=1;j<=4;j++){
            scanf("%lf %lf",&x[i],&y[i]);
            X[i] = (int)(x[i]*100000);
            Y[i] = (int)(y[i]*100000);
        }
        if((X[2]-X[1])*(Y[4]-Y[3])-(X[4]-X[3])*(Y[2]-Y[1])){
            printf("NO\n");
        }else{
            printf("YES\n");
        }
    }
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-11
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<double,double> P;
static const int INF=1<<24;

int main(){
	double x[5],y[5];
	int n;
	cin>>n;
	rep(i,n){
		rep(j,4){
			cin>>x[j];
			cin>>y[j];
			//cout<<j<<" = "<<x[j]<<" "<<y[j]<<endl;
		}
		//P a=P( x[0]-x[1] ,y[0]-y[1]), b=P( x[2]-x[3] ,y[2]-y[3]);
		if((x[0]-x[1])*(y[2]-y[3])==(x[2]-x[3])*(y[0]-y[1])) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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


int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4,value1,value2;
	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);
		value1 = (y2-y1)/(x2-x1);
		value2 = (y4-y3)/(x4-x3);

		if(value1 == value2){
			printf("YES\n");
		}else{
			printf("NO\n");
		}

	}
    return 0;
}