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 <stdio.h>
#include <math.h>

int main(void){
    int n;
    cin >> n;
    for(int i=0,i<n,i++) {

    double x[4],y[4],a,b,c,d,p,q,det,ansx,ansy;
    //入力を多少簡略化
    for(int i=0;i<4;i++) {
        scanf("%lf" ,&x[i]);
        scanf("%lf" ,&y[i]);
    }
    //(x1,y1)(x2,y2)を結ぶax+by=p の係数
    a = y[0]-y[1];  b = x[1]-x[0];
    //(x3,y3)(x4,y4)を結ぶcx+dy=q の係数
    c = y[2]-y[3];  d = x[3]-x[2];
    //係数についての行列式
    det = a*d-c*b;
    if(det == 0) puts("YES");
    else puts("NO");
    /*
    //det=0で解は存在しない(この問題については２線分は同一直線上にないから)
    if(fabs(det) < 0.00001) puts("YES");
    //逆行列を用いて解を導出
    else {
        /*
        ansx = (d*p - b*q)/det;
        ansy = (-c*p + a*q)/det;
        //ansxがどちらの線分のx座標範囲にも含まれるかを判定
        if((x[0] - ansx)*(x[1] - ansx) <= 0.00001 && (x[2] - ansx)*(x[3] - ansx) <= 0.00001 ) {
            printf("YES (%lf, %lf)\n",ansx,ansy);
        } else puts("NO");
        
       puts("NO");
    }
    */
    }
}

C++: 
#include <iostream>
#include <complex>
#include <cmath>

using namespace std;

typedef complex<double> Point;

bool parallel(const Point &v1, const Point &v2) {
    return abs(v1.real()*v2.imag() - v1.imag()*v2.real()) < 1e-6;
}

int main() {
    int N;
    cin >> N;
    while(N--) {
        Point ps[4];
        for(int i = 0; i < 4; ++i) cin >> ps[i].real() >> ps[i].imag();
        Point v1 = ps[1]-ps[0], v2 = ps[3]-ps[2];

        if(parallel(v1, v2) && !parallel(v1, ps[2]-ps[1])) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <complex>
#include <vector>
#include <cmath>

#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-15

using namespace std;

typedef complex<double> P;

int main()
{
	int n;
	cin >> n;
	while(n--)
	{
		vector<P> p;
		rep(i,4)
		{
			double a,b;
			cin >> a >> b;
			p.push_back(P(a,b));
		}

		P a = p[1] - p[0];
		P b = p[3] - p[2];
		double t = a.real()*b.imag() - a.imag()*b.real();
		if(abs(t) < EPS)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main()
{
	int num ;
	float ax, ay, bx, by, cx, cy, dx, dy ;

	cin >> num ;
	for( int i = 0 ; i < num ; i ++ )
	{
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy ;

		if( (ay-by)/(ax-by) == (cy-dy)/(cx-dx) ) cout << "YES\n" ;
		else cout << "NO\n" ;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<utility>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<list>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
#define F first
#define S second
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
struct XY
{
	int x;
	int y;
};
int in()
{
	int x;
	cin >> x;
	return x;
}

/*
(char)'1' - (int)48 = (int)1;
　1111181
*/
////////////////////////////////////////////////////
int main()
{
	int n;
	cin >> n;
	rep(EEE, n)
	{
		double x1, x2, x3, x4, y1, y2, y3, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (x1 == x2 || x3 == x4)
		{
			if (x1 == x2&&x3 == x4)cout << "YES<" < endl;
			else cout << "NO" << endl;
		}
		else if ((x1 - x2)*(y3-y4) == (x3 - x4)*(y1 - y2))cout << "YES" << endl;
		else cout << "NO" << endl;

	}

}

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

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*1e6;
      y[i]=yy*1e6;
      //   cout<<x[i]<<","<<y[i]<<endl;
    }
    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++: //Parallelism
#include<bits/stdc++.h>
using namespace std;

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

C++: #include <iostream>
using namespace std;
int main() {
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4, a, b, c, d;
  cin >> n;
  while (n--) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    a = x2 - x1, b = x4 - x3, c = y2 - y1, d = y4 - y3;
    if ((a == 0 && b == 0 && c != 0 && d != 0) || c / a == d / b) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

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

int main()
{
	int n, i, j;
	float x[4], y[4];

	cin >> n;

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

		if (((x[1]-x[0])/(y[1]-y[0])) == ((x[3]-x[2])/(y[3]-y[2])))
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

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

C++: #include<string>
#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<stack>
#include<set>
#include<cmath>

#define REP(i,s,e) for(int i=int(s);i<=int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)

#define EPS 1e-6

using namespace std;

int main(){

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

	cin >> n;

	rep(i,n){

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

	double a=y2-y1; double b=x2-x1;
	double d=y4-y3; double e=x4-x3;

	if(a*e-d*b==0) cout << "YES" << endl;
	else cout << "NO" << endl;

	}

	return 0;
}