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 <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int n;
int main() {
    cin>>n;
    double x1,y1;
    double x2,y2;
    double x3,y3;
    double x4,y4;
    rep(i,n) {
        cin>>x1>>y1;
        cin>>x2>>y2;
        cin>>x3>>y3;
        cin>>x4>>y4;
        double tx1 = x1-x2;
        double ty1 = y1-y2;
        double tx2 = x3-x4;
        double ty2 = y3-y4;

        if(tx1*ty2==tx2*ty1) {
            cout<<"YES"<<endl;
        }
        else {
            cout<<"NO"<<endl;
        }

    }
    return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;

	double x[4];
	double y[4];

	while(n > 0){
		for(int i = 0; i < 4; ++i){
			cin >> x[i] >> y[i];
		}

		double m1 = (y[0] - y[1]) / (x[0] - x[1]);
		double m2 = (y[2] - y[3]) / (x[2] - x[3]);

		cout << (m1 == m2 ? "YES" : "NO") << endl;

		--n;
	}

	return 0;
}

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

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        double A[2], B[2], C[2], D[2];
        cin >> A[0] >> A[1] >> B[0] >> B[1] >> C[0] >> C[1] >> D[0] >> D[1];
        double AB[2] = {A[0] - B[0], A[1] - B[1], };
        double CD[2] = {C[0] - D[0], C[1] - D[1], };
        double outerProduct = AB[0] * CD[1] - AB[1] * CD[0];
        if (outerProduct == 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

C++: #include<iostream>

using namespace std;

int main(void){
    int n;
    double x[4],y[4];
    double ansx[2],ansy[2];
    cin>>n;
    for(int i = 0 ; i < n ;  i ++){	
      for(int j = 0 ; j < 4 ; j ++)cin>>x[i]>>y[i];
      for(int j = 0 ; j < 4 ; j +=2){
	ansx[i]=ansx[i]-ansx[i+1];
	ansy[i]=ansy[i]-ansy[i+1];
      }
      if(ansx[0]*ansy[1]-ansx[1]*ansy[0])
	cout<<"NO"<<endl;
      else
	cout<<"YES"<<endl;

    }
}

C++: #include<iostream>

using namespace std;


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

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

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ( (a).real() , (b).real() ) && EQ( (a).imag(), (b).imag() ) )

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  cin>>n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if( (y2-y1)/abs(x2-x1) - (y4-y3)/abs(y4-y3) <= EPS ){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}

C++: #include <stdio.h>
struct point{
    double x;
    double y;
};
double abs(double a){
    if(a<0)return -a;
    return a;
}
double triangle(point a,point b,point c){
    return abs(a.x*b.y+b.x*c.y+c.x*a.y-a.y*b.x-b.y*c.x-c.y*a.x);
}
int main(){
    point a[4];
    while(scanf("%lf%lf",&a[0].x,&a[0].y)!=EOF){
        for(int i=1;i<4;i++)scanf("%lf%lf",&a[i].x,&a[i].y);
        if(triangle(a[0],a[1],a[2])==triangle(a[0],a[1],a[3])){
            printf("YES\n");
        }
        else printf("NO\n");
    }
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

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

C++: #include <iostream>
using namespace std;
int main()
{
	int n, i, j;
	float x[4], y[4];

	cin >> n;

	for (i = 0; i < n; i++)
	{
		for (j = 0; j < 4; j++)
			cin >> x[j] >> y[j];

		if (((y[0]-y[1])/(x[0]-x[1])) == ((y[2]-y[3])/(x[2]-x[3])))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
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;
    if( abs( (ay-by)/(ax-bx) - (cy-dy)/(cx-dx) ) < 1e-10)cout << "YES\n";
    else cout << "NO\n";
  }
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
  int n; 
  cin >> n;

  double cx[4], cy[4];
  for (int i = 0 ; i < n; ++i) {
    for (int j = 0; j < 4; j++)
      cin >> cx[j] >> cy[j];
    
    if (cx[1] != cx[0] && cx[3] != cx[2]) {
      double kx = (cy[1] - cy[0]) / (cx[1] - cx[0]);
      double ky = (cy[3] - cy[2]) / (cx[3] - cx[2]);
      if (abs(kx - ky) < 0.0001) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    } else if (cx[1] == cx[0] && cx[3] == cx[2]) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

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

int main()
{
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double slope_ab, slope_cd;
	int loop;
	int i = 0;

	cin >> loop;

	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4){

		++i;

		slope_ab = (y2-y1) / (x2-x1);
		slope_cd = (y4-y3) / (x4-x3);

		if(slope_ab==slope_cd){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}

		if(i==loop) break;
	}
}