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()
{
	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);
		double a1 = ((y2 - y1) / (x2 - x1)), a2 = ((y4 - y3) / (x4 - x3));
		if (a1 == a2)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <iostream>

int main(){
	double x1,y1,x2,y2,x3,y3,x4,y4;
	double a,b;
	int n;
	std::cin >> n;
	for(int i=0 ; i<n ; ++i){
		std::cin >>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		bool parallel=false;
		if(x1==x2 && x3==x4) {
			parallel=true;
			goto result;
		}
		else if(x1==x2 || x3==x4) {
			goto result;
		}
		else if ((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)) {
			parallel=true;
		}
		result:
		std::cout << ( parallel ? "YES" : "NO") << std::endl;
	}
	return 0; 
}

C++: #include<iostream>
using namespace std;
int main(){
	long double ax[100],ay[100],bx[100],by[100],cx[100],cy[100],dx[100],dy[100];
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>ax[i]>>ay[i]>>bx[i]>>by[i]>>cx[i]>>cy[i]>>dx[i]>>dy[i];
	}
	for(int i=0;i<n;i++){
		long double A=0,B=0;
		A=(by[i]-ay[i])/(bx[i]-ax[i]);
		B=(dy[i]-cy[i])/(dx[i]-cx[i]);
		if(A==B){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

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

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

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

// ll stoll(string const& s){
//     ll res = 0;
//     rep(i,s.size()){
//         res*=10;
//         res+=s[i]-'0';
//     }
//     return res;
// }

ll input(){
    string s; cin>>s;
    size_t p=0;
    int sign = s[0]=='-' ? -1 : 1;
    if(sign==-1) s.erase(s.begin());
    while(p<s.size() && s[p]!='.') p++;
    while(s.size()-p < 6) s += '0';
    s.erase(s.begin()+p);
    dump(s);
    return sign*stoll(s);
}

int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                x[i][j] = input();
                y[i][j] = input();
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        ll dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}

C++: //#define _USE_MATH_DEFINES
//#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
//#include <vector>
#include <string>
//#include <algorithm>
//#include <functional>
//#include <time.h>
//#include <sstream>
//#include <queue>

using namespace std;


int main(){

	int n;
	double p[8];

	cin >> n;

	while (n--){
		for (int i = 0; i < 8; i++){
			cin >> p[i];
		}

		if ((p[3] - p[1]) / (p[2] - p[0]) == (p[7] - p[5]) / (p[6] - p[4])) cout << "YES" << endl;
		else cout << "NO" << endl;


	}


	return 0;
}

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

int main()
{
  double x1,x2,x3,x4,y1,y2,y3,y4;
  double dx1,dy1,dx2,dy2;
  int n;
  int i;

  cin>>n;
  for(i=0;i<n;i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    dx1=x2-x1;
    dy1=y2-y1;
    dx2=x4-x3;
    dy2=y4-y3;

    if(dx1==0 && dx2==0)
      cout<<"YES"<<endl;
    else if(dx1==0 || dx2==0)
      cout<<"NO"<<endl;
    else if(dy1/dx1 == dy2/dx2)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

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() {
  int n;
  cin >> n;

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

  return 0;
}

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 (x1 == x2 && x3 == x4){
			cout << "YES" << endl;
		}
		else if (x1 == x2 || x3 == x4){
			cout << "NO" << endl;
		}
		else if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)){
			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,m1,m2;
  int n;
  cin>>n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    double a,b,c,d;
    a=y2-y1;
    b=y4-y3;
    c=x2-x1;
    d=x4-x3;
    if(a*c==b*d)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}
  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
#define EPS 1e-10

int main(){
  int n;
  double x1,x2,x3,x4,y1,y2,y3,y4;
  cin >> n;
  while(n--){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if(abs((x4-x3)*(y2-y1) - (x2-x1)*(y4-y3)) < EPS) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

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

class vec2d {
public:
  double x,y;
  vec2d() {
    this->x = 0;
    this->y = 0;
  }
  void set(double x,double y) {
    this->x = x - this->x;
    this->y = y - this->y;
  }
};

int main() {
  int n;
  cin >> n;
  while(n--) {
    double x,y;
    vec2d p[4];
    for(int i=0;i<4;i++) {
      cin >> x >> y;
      p[i].set(x,y);
    }
    double tanAB = (p[1].x - p[0].x) / (p[1].y - p[0].y);
    double tanCD = (p[3].x - p[2].x) / (p[3].y - p[2].y);
    if((tanAB - tanCD)*(tanAB - tanCD) < 10e-9) {
      cout << "YES" << endl;
    }
    else {
      cout << "NO" << endl;
    }
  }
}