Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	for i := 0; i < n; i++ {
		scanner.Scan()
		points := strings.Split(scanner.Text(), " ")
		fpoints := make([]float64, 0)
		for _, v := range points {
			tmp, _ := strconv.ParseFloat(v, 64)
			fpoints = append(fpoints, tmp)
		}
		if fpoints[0] == fpoints[2] && fpoints[4] == fpoints[6] {
			fmt.Println("YES")
		} else {
			a := (fpoints[1] - fpoints[3]) / (fpoints[0] - fpoints[2])
			b := (fpoints[5] - fpoints[7]) / (fpoints[4] - fpoints[6])
			if a == b {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
	}
}

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, y, 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, &y, &x2, &y2, &x3, &y3, &x4, &y4 );
		double x1_x2 = x2 - x1;
		double y1_y2 = y2 - y;
		double x3_x4 = x4 - x3;
		double y3_y4 = x4 - x3;
		if ( x1_x2 / x3_x4 == y1_y2 / y3_y4 ) {
			printf( "YES\n" );
		}
		else {
			printf( "NO\n" );
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
#define EPS 0.000001

struct Line{
	double x[2],y[2];
};

int main(){
	int N;
	Line l[2];
	cin>>N;
	for(int tc=0;tc<N;tc++){
		for(int i=0;i<2;i++){
			for(int j=0;j<2;j++){
				cin>>l[i].x[j]>>l[i].y[j];
			}
		}
		double a,b;
		a = (l[0].y[1]-l[0].y[0])/(l[0].x[1]-l[0].x[0]);
		b = (l[1].y[1]-l[1].y[0])/(l[1].x[1]-l[1].x[0]);
		if(abs(a-b)<EPS) puts("YES");
		else puts("NO");
	}
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main() {
    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;
        int ax = x1 * 1000000 - x2 * 1000000;
        int ay = y1 * 1000000 - y2 * 1000000;
        int bx = x3 * 1000000 - x4 * 1000000;
        int by = y3 * 1000000 - y4 * 1000000;
        cout << (ax * by == ay * bx ? "YES" : "NO") << endl;
    }
    return 0;
}

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

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

C++: #include <iostream>

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++ ){
 
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
 
    if( (y2-y1)/(x2-x1) == (y4-y3)/(x4-x3) ) cout << "YES" << endl;
    else cout << "NO" << endl;
 
  }
 
  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-10)cout << "YES";
    else cout << "NO";
    cout << endl;
    }
  return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double pi = acos(-1);
const double EPS = 1e-8;

double cross(pair<double,double> c,pair<double,double> d){
  return c.first * d.second - d.first * c.first;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<pair<double,double>> a(4);
  int n;
  pair<double,double> lineab, linecd;
  cin >> n;
  REP(i,n){
    REP(j,4){
      cin >> a[j].first >> a[j].second;
    }
    lineab.first = a[1].first - a[0].first;
    linecd.first = a[3].first - a[2].first;
    lineab.second = a[1].second - a[0].second;
    linecd.second = a[3].second - a[2].second;
    if (fabs(cross(lineab,linecd)) < EPS) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  
  
  return 0;
}

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

using namespace std;


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

		}

		
	}
	
	return 0;
}

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

using namespace std;
#define EPS 0.0000001
int main(){

	int n; cin >> n;
	double x1,x2,x3,x4,y1,y2,y3,y4; //??\????????§?¨?

	for(int i=0;i<n;i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if( abs((y1-y2)*(x4-x3) + (x1-x2)*(y3-y4)) < EPS  ){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main()
{
    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;
    
        vector<double> v1, v2;
        v1.push_back(x2 - x1);
        v1.push_back(y2 - y1);
        v2.push_back(x4 - x3);
        v2.push_back(y4 - y3);
    
        double r1, r2;
        r1 = v1.at(1)/v1.at(0);
        r2 = v2.at(1)/v2.at(0);

        if( r1==r2 ) cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <complex>
using namespace std;
int main() {
	double x[4],y[4];
	int n;
	cin >> n;
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < 4;j++) {
				cin >> x[i] >> y[i];
		}
		double X1, Y1, X2, Y2;
		X1 = x[1] - x[0];
		X2 = x[3] - x[1];
		Y1 = y[1] - y[0];
		Y2 = y[3] - y[2];
		if (X1*Y2 == X2*Y1) {
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}
}