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 <cmath>
using namespace std;

int main() {
	double x1, y1, x2, y2, x3, y3, x4, y4;
	int n;
	double veku1[2];
	double veku2[2];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		veku1[0] = x2 - x1;
		veku1[1] = y2 - y1;
		veku2[0] = x4 - x3;
		veku2[1] = y4 - y3;
		if (abs(veku1[0]*veku2[1]-veku1[1]*veku2[0]) <= 0.0000001) {
			/*veku1[0] = x3 - x1;
			veku1[1] = y3 - y1;
			veku2[0] = x4 - x1;
			veku2[1] = y4 - y1;
			if (abs(veku1[0]*veku2[1]-veku1[1]*veku2[0]) <= 0.0000001) {
				cout << "NO" << endl;
			} else {*/
				cout << "YES" << endl;
			//}
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>

using namespace std;

int main(){
	double x1,y1,x2,y2,x3,y3,x4,y4;
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
		x2-=x1; y2-=y1;
		x4-=x3; y4-=y3;
		if(x2*y4-y2*x4==0) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);

#include <complex>
typedef complex<double> P;

struct L {
	P a, b;
	L(const P &a, const P &b) : a(a), b(b) { }
};

struct C {
	P p; double r;
	C(const P p, double r) : p(p), r(r) { }
};

double dot(P a, P b) {
	return real(conj(a)*b);
}

double cross(P a, P b) {
	return imag(conj(a)*b);
}

bool LLcross(L l1, L l2) {
	return abs(cross(l1.b-l1.a, l2.b-l2.a)) > EPS/* || abs(cross(l1.b-l1.a, l2.b-l1.a)) < EPS*/;
}

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

	REP(i, n) {
		double x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		L l1(P(x1, y1), P(x2, y2));

		
		cin >> x1 >> y1 >> x2 >> y2;
		L l2(P(x1, y1), P(x2, y2));

		cout << (LLcross(l1, l2) ? "NO" : "YES") << endl;
	}

	return 0;
}

C++: #include <iostream>

int main() {
    int n;
    std::cin >> n;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    
    for(int i = 0;i < n;i++){
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        double a = (y1-y2)/(x1-x2);
        double b = (y3-y4)/(x3-x4);
         std::cout <<  (a==b ? "YES":"NO") << '\n';
    }
}

C++: #include <iostream>

int main() {
    int n;
    std::cin >> n;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    
    for(int i = 0;i < n;i++){
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        double a = (y1-y2)/(x1-x2);
        double b = (y3-y4)/(x3-x4);
         std::cout <<  (a==b ? "YES":"NO") << '\n';
    }
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
  int n;
  double x[4],y[4];
  
  cin >> n;
  
  while(n--){
    for(int i=0;i<4;i++){
      cin >> x[i] >> y[i];
    }
    
    double a,b;
    a = (y[0]-y[1])*(x[2]-x[3]);
    b = (y[2]-y[3])*(x[0]-x[1]);

    if(fabs(a-b) < 0.00001) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  
  return(0);
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0,  1, -1,  1, -1 };
static const int dy[] = { 0, -1, 0, 1 , 1,  1, -1, -1 };

int n;
double x1, x2, x3, x4, y1, y2, y3, y4;

int main() {
	scanf( "%d", &n );
	for ( int i = 0; i < n; i++ ) {
		scanf( "%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4 );
		if ( fabs( ( x2 - x1 ) * ( y4 - y3 ) - ( x4 - x3 ) * ( y2 - y1 ) ) < EPS ) {
			printf( "YES\n" );
		}
		else {
			printf( "NO\n" );
		}
	}
	return 0;
}

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

using namespace std;

int main() {
	int k;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double veku1[2];
	double veku2[2];
	double veku3[2];
	double veku4[2];
	double t;

	cin >> k;

	for (int i = 0; i < k; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		veku1[0] = x2 - x1;
		veku1[1] = y2 - y1;
		veku2[0] = x4 - x3;
		veku2[1] = y4 - y3;

		t = veku1[0] * veku2[0] + veku1[1] * veku2[1];

		if (t * t != (veku1[0] * veku1[0] + veku1[1] * veku1[1]) * (veku2[0] * veku2[0] + veku2[1] * veku2[1])) {
			cout << "NO" << endl;
		} else {
			veku3[0] = x3 - x1;
			veku3[1] = y3 - y1;
			veku4[0] = x4 - x1;
			veku4[1] = y4 - y1;

			t = veku3[0] * veku4[0] + veku3[1] * veku4[1];

			if (t * t != (veku3[0] * veku3[0] + veku3[1] * veku3[1]) * (veku4[0] * veku4[0] + veku4[1] * veku4[1])) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int n,AB,CD;
double ax,ay,bx,by,cx,cy,dx,dy,ab,cd,abx,aby,cdx,cdy;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		AB=CD=0;
		cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy;
		abx=(ax-bx);
		cdy=(cy-dy);
		aby=(ay-by);
		cdx=(cx-dx);
		if(abx==0.0)AB=1;
		if(aby==0.0)AB=2;
		if(cdx==0.0)CD=1;
		if(cdy==0.0)CD=2;
		if(abx*cdy==cdx*aby&&AB==CD)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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