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 <cmath>
#include <complex>
#include <iostream>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define REP(i,n) FOR(i,0,n)

using namespace std;

typedef complex<double> xy_t;
double dot_product(xy_t a, xy_t b){ return (conj(a) * b).real(); }
double cross_product(xy_t a, xy_t b){ return (conj(a) * b).imag(); }
const double eps = 1e-10;

int main(){
    int n;
    xy_t p[4];
    double x,y;
    cin >> n;
    REP(i,n){
        REP(j,4){
            cin >> x >> y;
            p[j] = xy_t (x,y);
        }
        bool ans = fabs(cross_product(p[0] - p[1], p[2] - p[3])) < eps;
        cout << (ans ? "YES" : "NO") << endl;
    }
}

C++: #include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int i,j,k,T;
  cin>>T;
  while(T--){
    double xx,yy;
    ll x[4],y[4];
    rep(i,4){
      cin>>xx>>yy;
      x[i]=xx*1e5;
      y[i]=yy*1e5;
    }
    rep(i,2){
      x[i*2+1]-=x[i*2];
      y[i*2+1]-=y[i*2];
    }
    cout<<(x[1]*y[3]==x[3]*y[1]?"YES":"NO")<<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
#define int long long
signed main(){
        int n;
        scanf("%lld",&n);
        for(int i=0;i<n;i++){
                double x1, y1, x2, y2, x3, y3, x4, y4;
                scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
                double c1 = (y2-y1)/(x2-x1);
                double c2 = (y4-y3)/(x4-x3);
                if((x2-x1==0 && x4-x3==0) || c1==c2) printf("YES\n");
                else printf("NO\n");
        }
        return 0;
}

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

const double eps=1e-9;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    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)*(y4-y3)==(x4-x3)*(y2-y1)) cout<<"YES\n";
        else cout<<"NO\n";
    }
    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-8)cout << "YES";
    else cout << "NO";
    cout << endl;
    }
  return 0;
}

C++: #include <iostream>

int main(){
	double x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4;
	bool parallel;
	int n;
	std::cin >> n;
	for(int i=0 ; i<n ; ++i){
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if(x1==x2 && x3==x4) {
			parallel=true;
			goto result;
		}
		else if(x1==x2 || x3==x4) {
			parallel=false;
			goto result;
		}
		else if ((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)) {
			parallel=true;
		}
		else {
			parallel=false;
		}
		result:
		std::cout << ( parallel ? "YES" : "NO") << std::endl;
	}
	return 0; 
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
  int n; cin >> n;
  while(n--){
    double x[4],y[4];
    for(int i=0;i<4;i++) cin >> x[i] >> y[i]; 
    if(abs((x[3] - x[2]) * (y[1] - y[0]) - (x[1] - x[0]) * (y[3] - y[2])) < 1e-10)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

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

int main(void){
    int n;
    double x[4];
    double y[4];
    cin >> n;
    while(n--){
        for(int i=0;i<4;i++) cin >> x[i] >> y[i];
        double ll,lll;
        ll = (y[1]-y[0])/(x[1]-x[0]);
        lll = (y[3]-y[2])/(x[3]-x[2]);
        if(ll == lll) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

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

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

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

struct Pos {
	double x, y;
}a, b, c, d;

int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i++ ) {
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		Pos e;
		e.x = b.x - a.x;
		e.y = b.y - a.y;
		Pos f;
		f.x = d.x - c.x;
		f.y = d.y - c.y;
		
		double men = e.x * f.y - e.y * f.x;
		double eps = 1e-9;
		if(-eps <= men && men <= eps)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
double x1,y1,x2,y2;
double a,b,c,d;

double chaji(){
	double dx=x2-x1,dy=y2-y1;
	double aa=c-a,bb=d-b;
	return (dx*bb-dy*aa);
}
int main(){
	int N;cin>>N;
	while(N--){
		cin>>a>>b>>c>>d;
		cin>>x1>>y1>>x2>>y2;
		double ans1=chaji();
		x1=(x1+x2)/2;
		y1=(y1+y2)/2;
		x2=(a+c)/2;
		y2=(b+d)/2;
		double ans2=chaji();
		if(ans1==0&&ans2!=0)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

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

struct vec {
	double x, y;
};

static vec P(double x, double y){
	vec P = {x, y};
	return P;
}

static vec sub(vec a, vec b){
	return P(a.x - b.x, a.y - b.y);
}

static double cross(vec a, vec b){
	return (a.x * b.y - a.y * b.x);
}

int main(void){
    
int n;
cin >> n;
double D[8];
vec V[4];
for(int i = 0; i < n; i++){
	for(int j = 0; j < 4; j++){
		cin >> D[2*j] >> D[2*j+1];
		V[j] = P(D[2*j], D[2*j+1]);
	}
	vec a = sub(V[0], V[1]);
	vec b = sub(V[2], V[3]);
	if (cross(a, b) == 0)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
return 0;

}

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

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

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