Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&n)
	for i := 0 ; i < n; i++ {
		fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  int n; cin >> n;

  while (n--) {

    Real x1,y1,x2,y2,x3,y3,x4,y4;
    cin >> x1 >> y1 >> x2 >> y2;
    cin >> x3 >> y3 >> x4 >> y4;

    if ((x1 - x2) * (y3 - y4) == (y1 - y2) * (x3 - x4)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }

  }

  return 0;
}

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

int main()
{
	int n;
	setprecision(5);
	long double x[4], y[4],d1,d2,d3,d4;
	int ans[100];
	cin >> n;
	for (int a = 0; a < n; a++) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		if (x[0] > x[1]) {
			d1 = x[0] - x[1];
			d3 = y[0] - y[1];
		}
		else {
			d1 = x[1] - x[0];
			d3 = y[1] - y[0];
		}
		if (x[2] > x[3]) {
			d2 = x[2] - x[3];
			d4 = y[2] - y[3];
		}
		else {
			d2 = x[3] - x[2];
			d4 = y[3] - y[2];
		}

		if (d3 / d1 == d4 / d2)
			ans[a] = 0;
		else
			ans[a] = 1;
	}
	for (int b = 0; b < n; b++) {
		if (ans[b] == 0)
			cout << "YES" << endl;
		else if (ans[b] == 1)
			cout << "NO" << endl;
	}
}

C++: #include <iostream>
#include <stdio.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;
		(y1-y2)*(x3-x4)==(y3-y4)*(x1-x2)?printf("YES\n"):printf("NO\n");
	}
    return 0;
}

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

C++: #include<iostream>
using namespace std;
int main(){
  double a[2],b[2],c[2],d[2];
  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(b[0]-a[0]==0&&d[1]-c[1]==0) cout << "NO" << endl;
    if(b[1]-a[1]==0&&d[0]-c[0]==0) cout << "NO" << endl;
    if((b[1]-a[1])*(d[0]-c[0])==(d[1]-c[1])*(b[0]-a[0])) cout << "YES" << endl;
    else cout << "NO" << endl;
  }   
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
const double EPS=1e-10;
double x[4],y[4];
int main(){
    int n;
    cin>>n;
    while(n--){
        for(int i=0;i<4;i++)cin>>x[i]>>y[i];
        for(int i=0;i<4;i+=2){
            x[i]-=x[i+1];y[i]-=y[i+1];
        }
        if(fabs(x[0]*y[2]-x[2]*y[0])<EPS)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	double x[4], y[4];
	double ab, cd;
	int n;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
		ab = cd = 999999;
		if (x[0] != x[1])
			ab = (y[0] - y[1]) / (x[0] - x[1]);
		if (x[2] != x[3])
			cd = (y[2] - y[3]) / (x[2] - x[3]);
		if (ab == cd)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;

int main(){
    double e = 1e-8;
    double x[4];
    double y[4];
    double s;
    double t;
    double u;
    double v;
    double m;
    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<e){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

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 = 0;
  double d[8];
  cin >> n;

  for(int i = 0; i < n && 0 <= n && n < 100; i++) {
    for(int j = 0; j < 4*2; j++)
      cin >> d[j];
    double tanAB = (d[3]-d[1])/(d[0]-d[2]);
    double tanCD = (d[7]-d[5])/(d[4]-d[6]);
    if(tanAB == tanCD)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

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

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

int main()
{
	const double EPS = 1e-3;
	const double PI = 4.*atan(1.);

	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;
		complex<double> A(x1,y1),B(x2,y2),C(x3,y3),D(x4,y4);
		double a = arg((A-B)/(C-D));
		cout << ( abs(a)<EPS || abs(a)>PI-EPS ? "YES" : "NO" ) << endl;
	}
	return 0;
}

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

int main(){

	typedef struct{
		double x, y;
	}_td;

	int n;
	_td p1, p2, p3, p4;
	double r_ab, r_cd, eps;
	
	cin >> n;
	
	for(int i=0; i<n; i++){
		cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y;
		
		if(p1.x - p2.x != 0 && p3.x - p4.x != 0){
			r_ab = (p1.y - p2.y) / (p1.x - p2.x);
			r_cd = (p3.y - p4.y) / (p3.x - p4.x);
			if(r_ab == r_cd) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else if(p1.x - p2.x == 0 && p3.x - p4.x == 0){
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}

	return 0;

}

C++: #include<iostream>
#include<vector>
using namespace std;
struct c {
	double x;
	double y;
};
int main() {
	int d;
	cin >> d;
	vector<bool>qq;
	for (int j = 0; j < d; j++) {
		const int num = 4;
		c l[num];
		for (int i = 0; i < num; i++) {
			cin >> l[i].x >> l[i].y;
		}
		if ((l[0].x - l[1].x) / (l[0].y - l[1].y) == (l[2].x - l[3].x) / (l[2].y - l[3].y))
			qq.push_back(true);

		else
			qq.push_back(false);
	}
	for (int i = 0; i < d; i++){
		if (qq[i] == true)cout << "YES";
		else cout << "NO";
		cout << endl;
	}
	char c; 
	cin >> c;
}