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 <vector>

using namespace std;
typedef pair<double, double> P;

void solve()
{
	int n;
	while(cin >> n)
	{
		while(n--)
		{
			vector<P> p(4);
			for(int i = 0; i < 4; ++i)
			{
				cin >> p[i].first >> p[i].second;
			}
			if((p[0].first == p[1].first && p[0].second == p[1].second) || (p[2].first == p[3].first && p[2].second == p[3].second))
			{
				cout << "NO" << endl;
			}
			else if((p[0].first == p[1].first && p[2].first != p[3].first) || (p[0].first != p[1].first && p[2].first == p[3].first))
			{
				cout << "NO" << endl;
			}
			else if((p[1].second - p[0].second) / (p[1].first - p[0].first) == (p[3].second - p[2].second) / (p[3].first - p[2].first))
			{
				cout << "YES" << endl;
			}
			else
			{
				cout << "NO" << endl;
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

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

using namespace std;
double cross(double x1,double y1,double x2,double y2);

int main(){
	double x1,y1,x2,y2;
	double x3,y3,x4,y4;
	double ans1,ans2;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
	cin>>x1>>y1>>x2>>y2;
	cin>>x3>>y3>>x4>>y4;
	ans1=cross(x1,y1,x2,y2);
	ans2=cross(x3,y3,x4,y4);
	if(ans1==ans2)
		cout<<"YES"<<endl;
	else 
		cout<<"NO"<<endl;
	}
}


double cross(double x1,double y1,double x2,double y2){
	return (x1-x2)/(y1-y2);
}

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

int main()
{
  int n;
  float x[2], y[2], a[2];

  scanf("%d", &n);
  for (int i = 0; i < n; i++){
    for (int j = 0; j < 2; j++){
      for (int k = 0; k < 2; k++){
        scanf("%f%f", &x[k], &y[k]);
      }
      a[j] = (y[1] - y[0]) / (x[1] - x[0]);
    }
    if (a[0] == a[1]){
      puts("YES");
    }
    else {
      puts("NO");
    }
  }

  return (0);
}

C++: #include<iostream>
using namespace std;
struct point{
  double x,y;
    };
int main(){
  point p[4];
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> p[0].x >> p[0].y>>p[1].x>>p[1].y>>p[2].x>>p[2].y>>p[3].x>>p[3].y;
    if((((p[1].y -p[0].y)/(p[3].y-p[2].y)) - ((p[1].x-p[0].x)/(p[3].x -p[2].x))) == 0){
	cout << "YES" << endl;
      } else {cout << "NO" << endl;}
      
  }
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
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;
        if (y1 == y2 && y3 == y4) {
            cout << "YES" << endl;
            continue;
        } else if (y1 == y2 || y3 == y4) {
            cout << "NO" << endl;
            continue;
        }
        double a = (x2 - x1) / (y2 - y1);
        double b = (x4 - x3) / (y4 - y3);
        if (abs(a - b) < 1e-8) {
            cout << "YES" << endl;
            continue;
        }
        cout << "NO" << endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int n;
	float s, t, m, a, b, k;
	cin >> n;
	while(n--){
		cin >> a >> b >> s >> t;
		k = 0;
		if(s-a == 0){
			m = 0;
			k = 1;
		} else if(t-b == 0){
			m = 0;
			k = 2;
		} else {
			m = (t-b)/(s-a);
		}
		cin >> a >> b >> s >> t;
		if(s-a == 0){
			if(k == 1){
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		} else if(t-b == 0){
			if(k == 2){
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		} else if(m == (t-b)/(s-a)){
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
 
int main(){
     
    int n;
    cin>>n;
    while(n--){
        double x1,y1,x2,y2,x3,y3,x4,y4;
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        if(fabs(x1-x2)<1e-9){
            if(fabs(x3-x4)<1e-9)cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
        else{
            double a=(y1-y2)/(x1-x2);
            double b=(y3-y4)/(x3-x4);
            if(fabs(a-b)<1e-9)cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
    }
     
    return 0;
}

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

  while(n--){
    for(int i = 0 ; i < 4 ; i++ )cin >> x[i] >> y[i];
    y[1]-=y[0];
    x[1]-=x[0];
    y[3]-=y[2];
    x[3]-=x[2];
    if(fabs(y[1]*x[3] - y[3]*x[1]) < 10e-10)cout << "YES";
    else cout << "NO";
    cout << endl;
    }
  return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>

using namespace std;


bool solve(){
	double x[4],y[4];
	for(int i=0;i<4;i++){
		cin>> x[i]>> y[i];
	}
	if(x[1]==x[0] || x[3]==x[2]){
		if(x[1]==x[0] && x[3]==x[2]){
			cout<< "YES"<< endl;
		}else{
			cout<< "NO"<< endl;
		}
		return true;
	}
	double rad1 = atan( (y[1]-y[0]) / (x[1]-x[0]) );
	double rad2 = atan( (y[3]-y[2]) / (x[3]-x[2]) );
	if(rad1 == rad2){
		cout<< "YES"<< endl;
	}else{
		cout<< "NO"<< endl;
	}
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	int n;
	cin>> n;
	for(int i=0;i<n;i++){
		solve();
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

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

const double EPS = 1e-10;

signed main() {
  int n;

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

  return 0;
}

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

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

C++: #include <iostream>
#include <cmath>
 
using namespace std;
 
bool test (double x1, double y1, double x2, double y2) {
    return x1 * y2 == x2 * y1;
}
 
int main (void) {
    int n;
    cin >> n;
    while (n--) {
        double x1, x2, x3, x4, y1, y2, y3, y4;
        cin >> x1; cin >> y1;
        cin >> x2; cin >> y2;
        cin >> x3; cin >> y3;
        cin >> x4; cin >> y4;
        if (test(x1 - x2, y1 - y2, x3 - x4, y3 - y4)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}