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[1] == fpoints[3] {
			fmt.Println("YES")
			continue
		}
		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 <vector>
#include <algorithm>
#include <cstdio>
#include <string>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;


int main(void){

int N;
double x[4], y[4];

	cin >> N;
	while( N--){
		rep(i,4) cin >> x[i] >> y[i];
		
		if((y[1]-y[0])*(x[3]-x[2]) == (y[3]-y[2])*(x[1]-x[0])) 
  	    	cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n; cin>>n;
    rep(i,n){
    pdd a,b,c,d; cin>>a.first>>a.second>>b.first>>b.second;
    cin>>c.first>>c.second>>d.first>>d.second;
    if(abs((c.first-d.first)*(a.second-b.second)-(a.first-b.first)*(c.second-d.second))<=EPS)
        cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    }
}

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
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(fabs((y2-y1)/(x2-x1)-(y4-y3)/(x4-x3))<0.0000001)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4,lI,lII;
  cin >> n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    cout << ((y2-y1)/(x2-x1) == (y4-y3)/(x4-x3) ? "YES" : "NO") << endl;
  }
}

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

int main(void)
{
    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 ((x2-x1)==0 && (x4-x3)==0)
            cout << "YES" << endl;
        else
            cout << (((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3))? "YES" : "NO") << endl;
    }
    return 0;
}

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

using namespace std;

int main( ) {
	int i, n;
	double x[4][100], y[4][100];
	double slope1[100], slope2[100];

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			scanf("%lf %lf", &x[j][i], &y[j][i]);
			slope1[i] = (y[1][i] - y[0][i]) / (x[1][i] - x[0][i]);
			slope2[i] = (y[3][i] - y[2][i]) / (x[3][i] - x[2][i]);
		}
	}

	for (i = 0; i < n; i++) {
		if (slope1[i] == slope2[i]) {
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	
	return 0;
}

C++: #include<bits/stdc++.h>
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;
      if((y2-y1)/(x2-x1) == (y4-y3)/(x4-x3))cout << "YES" << endl;
      else cout << "NO" << endl;
    }


  return 0;
}

C++: // includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  rep(j, n){
    double x[4], y[4];
    rep(i, 4){
      cin >> x[i] >> y[i];
    }
    if(abs((x[1] - x[0]) * (y[3] - y[2]) - (x[3] - x[2]) * (y[1] - y[0])) < EPS){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
	return 0;
}

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

int main()
{
	int n ;
	double ax,ay,bx,by,cx,cy,dx,dy ;

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

		double a = (ay-by)/(ax-bx) ;
		double b = (cy-dy)/(cx-dx) ;

		if( a == b )
		{
			cout << "YES" << endl ;
		}
		else
		{
			cout << "NO" << endl ;
		}
	}
	return 0 ;
}

C++: #include<iostream>
#include<cmath>
//#define e 0.00000000001
using namespace std;
int main(){
  double a[2],b[2],c[2],d[2];
  double e = 0.0000000001;
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a[0] >> a[1] >> b[0] >> b[1] >> c[0] >> c[1] >> d[0] >> d[1];
    if(abs((b[1]-a[1])*(d[0]-c[0])-(d[1]-c[1])*(b[0]-a[0]))<e) cout << "YES" << endl;
    else cout << "NO" << endl;
  }   
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  double x[4],y[4];
  
  cin >> n;
  
  while(n--){
    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;
      continue;
    }
    
    double a,b;
    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>
using namespace std;
int main()
{
	int n;cin>>n;
	for(;n--;)
	{
		double a,b,c,d,e,f,g,h;cin>>a>>b>>c>>d>>e>>f>>g>>h;
		cout<<((d-b)*(g-e)==(h-f)*(c-a)?"YES":"NO")<<endl;
	}
}

C++: #include <stdio.h>
#define sqr(a) (a) * (a)

int main(void){
	int n, i;
	double x1,x2,x3,x4,y1,y2,y3,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);
		double left = (sqr(x2 - x1) + sqr(y2 - y1)) * (sqr(x4 - x3) + sqr(y4 - y3));
		double right = sqr((x2 - x1) * (x4 - x3) + (y2 - y1) * (y4 - y3));
		if(left == right || -left == right){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

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

typedef struct {
  double x;
  double y;
} point;

int main() {
  point a, b, c, d;
  int n;
  cin >> n;
  while (n--) {
    cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
    point p, q;
    p.x = b.x - a.x;
    p.y = b.y - a.y;
    q.x = d.x - c.x;
    q.y = d.y - c.y;

    if (-0.00001 < p.x * q.y - p.y * q.x && p.x * q.y - p.y * q.x < 0.00001)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}