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 <cmath>
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 <bits/stdc++.h>
using namespace std;
using ld = long double;
const ld eps = 1e-8;

int main()
{
	int n;
	ld x1, x2, x3, x4, y1, y2, y3, y4;
	cin >> n;
	while (n--) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		ld dx1 = x2 - x1, dy1 = y2 - y1;
		ld dx2 = x4 - x3, dy2 = y4 - y3;
		if (abs(dx1 * dy2 - dy1 * dx2) < eps) {
			puts("YES");
		}
		else {
			puts("NO");
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int n;
	double x[4], y[4];
	
	cin >> n;
	cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3] ;

	while(n != 0)
	{
		if((y[1] - y[0]) / (x[1] - x[0]) == (y[3] - y[2]) / (x[3] - x[2]))
		{
			cout << "YES" << endl;
		}

		else
		{
			cout << "NO" << endl;
		}
		n--;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main(void)
{
    double x1,x2,x3,x4,y1,y2,y3,y4,p1,p2;
    int n;
     
    cin >> n;
     
    rep(i,n)
    {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        p1 = (y2-y1)/(x2-x1);
        p2 = (y4-y3)/(x4-x3);
        if(p1 == p2)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
     
    return 0;
}

C++: #include <iostream>
#include <complex>
using namespace std;
typedef complex<double> P;
const double EPS = 1e-9;
int main(){
	int N;
	cin >> N;
	while(N--){
		P a,b,c,d;
		cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag() >> d.real() >> d.imag();
		P one = a-b;
		P two = c-d;
		bool f = false;
		if( abs(one.imag()) < EPS || abs(two.imag()) < EPS ){
			f = abs(one.imag()) < EPS && abs(two.imag()) < EPS;
		}else{
			f = abs(one.real()/one.imag() - two.real()/two.imag()) < EPS;
		}
		cout << (f?"YES":"NO") << endl;
	}
// }

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

int main()
{
	int n;
	double x[4], y[4];
	std::cin >> n;
	while( n-- ){
		for( int i = 0; i < 4; i++ ){
	 		std::cin >> x[i] >> y[i];
		}
		
		double m[2];
		if( x[1] - x[0] != 0 ) m[0] = ( y[1] - y[0] ) / ( x[1] - x[0] );
		else m[0] = 0;
		if( x[3] - x[2] != 0 ) m[1] = ( y[3] - y[2] ) / ( x[3] - x[2] );
		else m[1] = 0;
		
		if( m[0] == m[1] ) puts("YES");
		else puts("NO");
	}

 	return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main(){
    int mod=1000000007;
    int n;
    scanf("%d",&n);
    for (int i=0;i<n;i++) {
        double x1,y1,x2,y2,x3,y3,x4,y4;
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        //if (abs((y3-y4)*(x1-x2)-(y1-y2)*(x3-x4))<1e-10) {
        if (abs((y3-y4)/(x3-x4)-(y1-y2)/(x1-x2))<1e-10) {
            printf("YES\n");
        } else {
            printf("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;
		if((y2-y1)/(x2-x1) == (y4-y3)/(x4-x3)){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
		
	}
	return 0;
}

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

using namespace std;

int main() {
	int k;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double veku1[2];
	double veku2[2];
	double t;
	cin >> k;

	for (int i = 0; i < k; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		veku1[0] = x2 - x1;
		veku1[1] = y2 - y1;
		veku2[0] = x4 - x3;
		veku2[1] = y4 - y3;

		t = veku1[0] * veku2[0] + veku1[1] * veku2[1];

		if (t * t == (veku1[0] * veku1[0] + veku1[1] * veku1[1]) * (veku2[0] * veku2[0] + veku2[1] * veku2[1])) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
    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;
 
 
    double a,b;
    a=(y2-y1)/(x2-x1);
    b=(y4-y3)/(x4-x3);
    (a==b)? cout<<"YES"<<endl : cout<<"NO"<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  double x,y;
  double x1,y1;
  int n;
  int i;
  long double a=0,b=0;
  int k=0;
  int j=0;

  cin>>n;

  for(i=0;i<n;i++)
    {
      cin>>x>>y>>x1>>y1;
      if(x1-x!=0.0)
        {
          a=(y1-y);
          a*=(x1-x);
          j++;
        }
      else
        k++;

      cin>>x>>y>>x1>>y1;
      if(x1-x!=0.0)
        {
          b=(y1-y);
          b*=(x1-x);
          j++;
        }
      else
        k++;

      if((a==b && j==2) || k==2)
        puts("YES");
      else
        puts("NO");
    }

}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
#define EPS 0.000000000001

struct Line{
	double x[2],y[2];
};

int main(){
	int N;
	Line l[2];
	cin>>N;
	for(int tc=0;tc<N;tc++){
		for(int i=0;i<2;i++){
			for(int j=0;j<2;j++){
				cin>>l[i].x[j]>>l[i].y[j];
			}
		}
		double a,b;
		a = (l[0].y[1]-l[0].y[0])/(l[0].x[1]-l[0].x[0]);
		b = (l[1].y[1]-l[1].y[0])/(l[1].x[1]-l[1].x[0]);
		if(abs(a-b)<EPS) puts("YES");
		else puts("NO");
	}
}

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

int main(void){

	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((y1-y2)*(x3-x4)-(y3-y4)*(x1-x2))<1e-10) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
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;

		double a1 = (y2-y1)/(x2-x1);
		double a2 = (y4-y3)/(x4-x3);

		if(a1 == a2){
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}
}

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

using namespace std;

int main() {
  int n;
  double x[5], y[5], ep;
  pair<double, double> AB, CD;
  cin >> n;
  while(n--) {
    for(int i = 1; i <= 4; i++) {
      cin >> x[i] >> y[i];
    }
    AB.first = x[2] - x[1];
    AB.second = y[2] - y[1];
    CD.first = x[4] - x[3];
    CD.second = y[4] - y[3];
    ep = AB.first * CD.second - AB.second * CD.first;
    if (ep < 1e-10) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
  return 0;
}