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)
		}
		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 <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;

int main(){
    double EPS = 1e-12;
    double x[4];
    double y[4];
    double s;
    double t;
    double u;
    double v;
    int n;
    cin >> n;

    for (int t = 0;t < n;++t) {
        for (int i = 0;i < 4;++i){
            cin >> x[i] >> y[i]; 
        }
    }
    s = x[1] - x[0];
    t = y[1] - y[0];
    u = x[3] - x[2];
    v = y[3] - y[2];

    if(s * v - t * u > 0){
        double m = s * v - t * u;
    }
    else{
        double m = t * u - s * v;
    }

    if( m < EPS){
//        cout << "YES" << endl;
    }
//    else{
//        cout << "NO" << endl;
//    }
//    return 0;


    cout << "NO" << endl;
}

C++: #include<iostream>
using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ;  i++)
int main(void){
	int n;
	cin>>n;
	rep(k,n){
		double x[4];
		double y[4];
		double ans[2];
		rep(i,4)cin>>x[i]>>y[i];
		rep(i,2)ans[i] = (x[i+2] - x[i]) / (y[i+2]-y[i]);
		if(ans[0]==ans[1])cout<<"YES";
		else cout<<"NO";
		cout<<endl;
	}
}

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

int main(){
	int n;cin >> n;
	double a[8];
	while(n--){
		for(int i = 0;i < 8;i++)cin >> a[i];
		double y1 = a[3]-a[1];double x1 = a[2]-a[0];
		double y2 = a[7]-a[5];double x2 = a[6]-a[4];
		if(!x1 || !x2){
			if(!x1 && !x2)cout << "YES" << endl;
			else cout << "NO";
		}else{
			if(y1/x1 == y2/x2)cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	}
	return 0; 
}

C++: #include <iostream>
#include <complex>
#include <cmath>
using namespace std;
constexpr double eps = 1e-11;
using C = complex<double>;

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    C V[4];
    for(int j=0;j<4;j++){
      double x, y;
      cin >> x >> y;
      V[j] = C(x, y);
    }
    C AB = V[1] - V[0];
    C CD = V[3] - V[2];
    double area = (conj(AB) * CD).imag();
    if(abs(area) < eps)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}

C++: #include <cstdio>
#include <complex>
#include <vector>
#include <cmath>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

typedef complex<double> P;
typedef vector<P> VP;
const double EPF = 1e-2;

#define X real()
#define Y imag()
#define EQ(x,y) (abs(x-y) < EPF)

double dot(P a, P b) {
  return (conj(a)*b).X;
}
double cross(P a, P b) {
  return (conj(a)*b).Y;
}
double distPP(P a, P b) {
  return sqrt(dot(a-b,a-b));
}
P crosspoint(P a, P b, P c, P d) {//ac , bd
  double d1 = cross(d-b,b-a);
  double d2 = cross(d-b,c-a);
  if(EQ(d1,0) & EQ(d2,0)) return a;
  if(EQ(d2,0)) return a;
  return a + (c-a)*d1/d2;
}
P normal_vector(P a) {
  P b(-a.Y, a.X);
  return b;
}
P polar(double r, double theta) {
  P a(r*cos(theta),r*sin(theta));
  return a;
}

int main() {
  int n;
  scanf("%d",&n);
  REP(i,n) {
    double x,y;
    P a,b,c,d;
    scanf("%lf %lf", &x, &y);
    a = P(x,y);
    scanf("%lf %lf", &x, &y);
    b = P(x,y);
    scanf("%lf %lf", &x, &y);
    c = P(x,y);
    scanf("%lf %lf", &x, &y);
    d = P(x,y);
    
    if(EQ(cross(a-b, c-d),0))printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

C++: #define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 201
#define _MAX 100
#define ABC 26
int main(void)
{
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4, a1, b1, a2, b2;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		a1 = (y1 - y2) / (x1 - x2);
		a2 = (y3 - y4) / (x3 - x4);
		if (a1 == a2)
			printf("YES\n");
		else
			printf("NO\n");
	}
}

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

int main ()
{
	int n;
	cin>>n;
	for(int h=0;h<n;h++)
	{
		double x[4],y[4];
		for(int i=0;i<4;i++)cin>>x[i]>>y[i];
		if(x[0]==x[1]||x[2]==x[3])
		{
			if(x[0]==x[1]&&x[2]==x[3])
			{
				cout<<"YES"<<endl;
			}
			else
			{
				cout<<"NO"<<endl;
			}
		}
		else
		{
			double Z,X;
			Z=(y[1]-y[0])/(x[1]-x[0]);
			X=(y[3]-y[2])/(x[3]-x[2]);
			if(abs(Z-X)<0.0000000001)
			{
				cout<<"YES"<<endl;
			}
			else cout<<"NO"<<endl;
		
		}
	}
	
}

C++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <math.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;
		
		double t1 = (y1-y2)*(x3-x4);
		double t2 = (y3-y4)*(x1-x2);

		if( (x1-x2)==0 && (x3-x4)==0 ){
			cout << "YES" << endl;
		}else if( (x1-x2)==0 || (x3-x4)==0 ){
			cout << "NO" << endl;
		}else if( t1==t2 ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

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

int main(){

  double ax,ay,bx,by,cx,cy,dx,dy;
  double n,s,t;

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;

    s = (ay - by) / (ax - bx);
    t = (cy - dy) / (cx - dx);

    if(s == t) cout << "YES" << endl;
    else cout << "NO" << endl;

  }
}

C++: #include <iostream>

using namespace std;

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

C++: #include <iostream>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

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

C++: #include <iostream>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(){
	int n;
	cin >> n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	REP(i,n){
		 scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		//cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((y1-y2)*(x3-x4) == (x1-x2)*(y3-y4) ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<complex>
#include<cmath>
#include<string>
#include<queue>
using namespace std;
int main()
{
  int n;
  double x,y;
  queue<string> qs;
  cin >> n;
  for( int i = 0; i < n; ++i){
    complex<double> p[4];
    for( int j = 0; j < 4; ++j){
      cin >> x >> y;
      p[i] = complex<double>(x,y);
    }
    int S =(conj(p[1] - p[2])*(p[3] - p[4])).imag();
    if( S == 0) qs.push("YES");
    else qs.push("NO");
  }
  while(!qs.empty()){
    cout << qs.front() << endl;
    qs.pop();
  }
}