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 <cstdio>
#include <iostream>
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, a1, a2;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        a1 = (y1-y2)/(x1-x2);
        a2 = (y3-y4)/(x3-x4);
        if(a1==a2)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
}

C++: #include<iostream>

using namespace std;


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

C++: #include<iostream>

using namespace std;

int main(){
  double x1, x2, x3, x4, y1, y2, y3, y4;
  double a1, a2, b1, b2;
  int n;
  cin >> n;
  for(int i =0; i < n; i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    
    a1 = x2 - x1;
    a2 = x4 - x3;
    b1 = y2 - y1;
    b2 = y4 - y3;
    
    if (b2 == a2 * b1 / a1) cout << "YES"<< endl;
    else cout << "NO" << endl;
  }
}

C++: #include <stdio.h>
struct point{
    double x;
    double y;
};
double abs(double a){
if(a>0)return a;
return -a;
}
int main(){
    int n;
    point a[4];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        for(int j=0;j<4;j++){
            scanf("%lf%lf",&a[j].x,&a[j].y);
        }
        if(a[1].x==a[0].x){
            if(a[3].x==a[2].x)printf("YES\n");
            else printf("NO\n");
        }
        else  if(a[1].y==a[0].y){
            if(a[3].y==a[2].y)printf("YES\n");
            else printf("NO\n");
        }
        else  if(a[3].x==a[2].x){
            printf("NO\n");
        }
        else if(a[3].y==a[2].y){
            printf("NO\n");
        }
        else if(abs(((a[1].x-a[0].x)*(a[3].y-a[2].y))-((a[3].x-a[2].x)*(a[1].y-a[0].y)))<=0.001)printf("YES\n");
        else printf("NO\n");
    }
}

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

int main()
{
    int n;
    cin>>n;
    while(n--){
        pair<double,double>a[4];
        for(int i=0;i<4;i++){
            cin>>a[i].first>>a[i].second;
        }
        if(abs((a[1].first-a[0].first)*(a[3].second-a[2].second)-(a[3].first-a[2].first)*(a[1].second-a[0].second))<1e-10)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

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

C++: #include <stdio.h>
int main()
{
  int n;
  float x1,y1,x2,y2,x3,y3,x4,y4,k1,k2;
  scanf("%d",&n);
  while(n>0){
    scanf("%f%f%f%f%f%f%f%f",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
    if(x1==x2 && x3==x4) printf("YES\n");
    else if(x1==x2 || x3==x4) printf("NO\n");
    else {
      k1 = (y2-y1)/(x2-x1);
      k2 = (y4-y3)/(x4-x3);
      k1 = (int)(k1*1000)/1000.0;
      k2 = (int)(k2*1000)/1000.0;
      if(k1==k2) printf("YES\n");
      else printf("NO\n");
    }
    n--;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int t;
   float x1,x2,x3,x4,y1,y2,y3,y4;
  cin >> t;
  while(t--){
cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if( (y2-y1)/(x2-x1) == (y4-y3)/(x4-x3) ) 
      cout<<"YES\n";
    else
      cout<<"NO\n";
  }
  
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  double n,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((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
  return 0;
}

C++: #pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

typedef complex<double> Point, Vector;

#define X real()
#define Y imag()
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

double cross(Vector a, Vector b){
    return a.X * b.Y - a.Y * b.X;
}

// 平行判定
bool isParallel(Vector a, Vector b){
    return equals(cross(a, b), 0);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin>>n;
    while(n--){
        double x1, y1, x2, y2, x3, y3, x4, y4; cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        Vector v1 = Point(x1, y1) - Point(x2, y2), v2 = Point(x3, y3) - Point(x4, y4);
        cout << (isParallel(v1, v2) ? "YES" : "NO") << endl;
    }

    return 0;
}