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

#define fs first
#define sc second

using namespace std;

typedef double D;
typedef complex<D> P;
typedef pair<P, P> L;
const D EPS=1e-12;


namespace std{
  bool operator<(const P &a, const P &b){
    return real(a)==real(b)?imag(a)<imag(b):real(a)<real(b);
  }
}

D cross(P x, P y){return imag(conj(x)*y);}

bool para(L a, L b){return abs(cross(a.fs - a.sc, b.fs-b.sc))<EPS;}

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    D x1, y1, x2, y2, x3, y3, x4, y4;
    cin >>  x1 >> y1 >> x2 >> y2 >>  x3>> y3>> x4>> y4;
    P A = P(x1, y1);
    P B = P(x2, y2);
    P C = P(x3, y3);
    P D = P(x4, y4);
    L AB = L(A, B);
    L CD = L(C, D);
    if(para(AB, CD)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}

C++: #include <iostream>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
 
int main(){
	int n;
	cin >> n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	REP(i,n){
		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 <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    double x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> n;
    while(n--) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        cout << ((x2-x1)*(y4-y3) == (x4-x3)*(y2-y1) ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>
#include<iomanip>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const int INF = pow(10, 8);
int main(){
  int n;cin>>n;
  while(n--){
    double ax, ay, bx, by, cx, cy, dx, dy;
    cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy;
    bx-=ax;by-=ay;dx-=cx;dy-=cy;
    if(abs(bx*dy-dx*by)<1e-10)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

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

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

C++: #include <iostream>
int main()
{
  int n;
  std::cin >> n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  while (n--) {
    std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
//    std::cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << " " << x4 << " " << y4;
    double a1, a2;
    a1 = (x2 - x1) / (y2 - y1);
    a2 = (x4 - x3) / (y4 - y3);
    if ((a1 - a2) * (a1 - a2) < 0.00001) std::cout << "YES" << std::endl;
    else                                 std::cout << "NO"  << std::endl;
  }
  return 0;
}

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

using namespace std;
typedef long long ll;

typedef double R;
typedef complex<R> P;

const R EPS = 1e-8;
const R PI = acos(-1);
int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}


bool near(P a, P b) {
    return !sgn(abs(a-b));
}

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

void solve() {
    P p[4];
    for (int i = 0; i < 4; i++) {
        R x, y;
        cin >> x >> y;
        p[i] = P(x, y);
    }

    if (!sgn(cross(p[0]-p[1], p[2]-p[3]))) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

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

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

C++: #include <bits/stdc++.h>
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;

    double X1 = x2-x1, Y1 = y2-y1;
    double X2 = x4-x3, Y2 = y4-y3;

    if(abs(X1*Y2-X2*Y1) < 0.00000001) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;


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

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

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

C++: #include<iostream>

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  const double e = 1e-12;

  std::cin >> n;

  for(int i=0;i<n;i++){
    std::cin >> x1 >> y1
             >> x2 >> y2
             >> x3 >> y3
             >> x4 >> y4;

    if((x1*y3+x2*y4+y2*x3+y1*x4)-(x2*y3+x1*y4+y1*x3+y2*x4)<e){
      std::cout << "YES" << std::endl;
    }else{
      std::cout << "NO" << std::endl;
    }
  }
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;


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

const double EPS = 1e-11;
const double INF = 100000000;




int main(){
    int n;
    cin>>n;
    rep(i,n){
        double x[4],y[4],ax,ay,bx,by,ans;
        
        rep(j,4){
            cin>>x[j]>>y[j];
        }
        
        ax=x[1]-x[0];
        ay=y[1]-y[0];
        bx=x[3]-x[2];
        by=y[3]-y[2];
        
        ans=ax*by-bx*ay;
        if(fabs(ans)<=EPS)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
        
    }
    
    return 0;
}