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 <iostream>
#include <complex>
using namespace std;

#define P complex<double>

int main(){
  int n;
  P a,b,c,d;

  cin >> n;
  for( int loop=0;loop<n;loop++ ){
    cin >> a.real() >> a.imag();
    cin >> b.real() >> b.imag();
    cin >> c.real() >> c.imag();
    cin >> d.real() >> d.imag();

    P x=a-b, y=c-d;
    x = x/abs(x);
    y = y/abs(y);

    if( x==y || x==-y )
      /*
      abs(x.real()-y.real()) < 1.0e-4  &&
	abs(x.imag()-y.imag()) < 1.0e-4  )
      */
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

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

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		float x[4], y[4];
		for(int j = 0; j < 4; j++){
			cin >> x[j] >> y[j];
		}
		//float ab = 999999, cd = 999999;
		ab = (y[0]-y[1]) / (x[0]-x[1]);
		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 = 0.00000000001;
    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>
#include<complex>
using namespace std;
typedef complex<long long> xy_t;

xy_t P[4];

long long cross(xy_t p,xy_t q){
    return (conj(p)*q).imag();
}

int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        for(int j=0;j<4;++j){
            double x,y;
            cin>>x>>y;
            P[j]=xy_t(100000*x,100000*y);
        }
        
        xy_t a[2]={
            P[0]-P[1],
            P[2]-P[3]
        };

        bool flag=(abs(cross(a[0],a[1]))==0);

        cout<<(flag?"YES":"NO")<<"\n";

    }
}

C++: #include<iostream>
using namespace std;
int main(){
	double ax[100],ay[100],bx[100],by[100],cx[100],cy[100],dx[100],dy[100];
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>ax[i]>>ay[i]>>bx[i]>>by[i]>>cx[i]>>cy[i]>>dx[i]>>dy[i];
	}
	for(int i=0;i<n;i++){
		double A=0,B=0;
		A=(by[i]-ay[i])/(bx[i]-ax[i]);
		B=(dy[i]-cy[i])/(dx[i]-cx[i]);
		if(A==B){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
}

C++: #include <stdio.h>

int
main(void)
{
	char line[100];
	int n;

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &n) != 1) {
		return 1;
	}

	for (int i = 0; i < n; i++) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		
		double x1, y1, x2, y2, x3, y3, x4, y4;
		
		if (sscanf(line, "%lf %lf %lf %lf %lf %lf %lf %lf",
				   &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4) == 8) {
			double ab = (y2 - y1)/(x2 - x1);
			double cd = (y4 - y3)/(x4 - x3);
			
			printf("%s\n", ((ab == cd) ? "YES" : "NO"));
		}
		
	}

	return 0;
}

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

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;



inline double dot(const P &a, const P &b) {
	return (conj(a) * b).real();
}


int main(){
	int n; cin >> n;
	while (n--) {
		P ps[4];
		rep(i, 4) {
			double x, y; cin >> x >> y;
			ps[i] = P(x, y);
		}
		cout << (dot(ps[0] - ps[1], ps[2] * P(0, 1) - ps[3] * P(0, 1)) == 0 ? "YES" : "NO") << endl;
	}
	
	return 0;
}

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

int main(){
	double N,xx,yy;
	long long X[5],Y[5];
	cin>>N;
	for(int j=1;j<=N;j++){
		for(int i=1;i<=4;i++){
			cin>>xx>>yy;
			X[i]=(int)(xx*100000.0);
			Y[i]=(int)(yy*100000.0);
		}
		if((X[2]-X[1])*(Y[4]-Y[3])==(X[4]-X[3])*(Y[2]-Y[1])){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

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

int main()
{
	int n;
	float x[4], y[4];
	cin >> n;

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

		float l1, l2;
		l1 = (y[1] - y[0]) / (x[1] - x[0]);
		l2 = (y[3] - y[2]) / (x[3] - x[2]);
		if (l1 == l2){
			cout << "YES" << endl;
		}

		else {
			cout << "NO" << endl;
		}
	}
	return (0);
}

C++: #include "geometry/intersect.hpp"

void solve() {
  Line p, q;
  cin >> p >> q;
  cout << (intersect<true>(p, q) ? "NO" : "YES") << endl;
}

int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) solve();
}

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

using namespace std;

#define EPS 1e-10
#define equals(a, b) (fabs(a - b) < EPS)

struct Point {
    double x, y;

    Point(){}
    Point(double x, double y) : x(x), y(y) {}
 
    Point operator - (const Point &p) const {  return Point(x - p.x, y - p.y); }
};

typedef Point Vector;

double cross(const Point &a, const Point &b)
{
    return a.x * b.y - b.x * a.y;
}

struct Line {
    Point s, t;
    Line(){}
    Line(Point s, Point t) : s(s), t(t) {}
};

bool isParallelSS(const Line &s1, const Line &s2)
{
    Vector a = s1.t - s1.s;
    Vector b = s2.t - s2.s;
    return equals(cross(a, b), 0);
}

istream &operator >> (istream &is, Point &p)
{
    return is >> p.x >> p.y;
}

int main()
{
    int N;
    Line l[2];
    cin >> N;
    while (N--) {
        for (int i = 0; i < 2; i++) {
            cin >> l[i].s >> l[i].t;
        }
        cout << (isParallelSS(l[0], l[1]) ? "YES" : "NO") << endl;
    }
    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>
 
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;
        double a1,a2;
        a1=(y2-y1)/(x2-x1);
        a2=(y4-y3)/(x4-x3);
        if(a1==a2)
        {
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}