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<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  double x,y;
  double x1,y1;
  int n;
  int i;
  long double a=0,b=;
  int k1=0,k2=2;

  cin>>n;

  for(i=0;i<n;i++)
    {
      cin>>x>>y>>x1>>y1;
      if(x1-x!=0)
        a=(y1-y)/(x1-x);
      else
        a=100;

      cin>>x>>y>>x1>>y1;
      if(x1-x!=0)
        b=(y1-y)/(x1-x);
      else
        b=100;

      if(a==b)
        puts("YES");
      else
        puts("NO");
    }

}

C++: #include<iostream>

using namespace std;

bool get_line( double x1 , double x2 , double y1 , double y2 , double& a , double& b );

int main(void)
{
	double x1, x2, x3, x4;
	double y1, y2, y3, y4;

	double a1, a2;
	double b1, b2;

	bool result1 , result2;

	int num;

	cin >> num;

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

		result1 = get_line( x1 , x2 , y1 , y2 , a1 , b1 );
		result2 = get_line( x3 , x4 , y3 , y4 , a2 , b2 );

		if( result1 == false && result2 == false ) cout << "YES" << endl;

		else
		{
			if( a1 != a2 ) cout << "NO" << endl;
			else cout << "YES" << endl;
		}
	}

	return 0;
}

bool get_line( double x1 , double x2 , double y1 , double y2 , double& a , double& b )
{
	if( x1 - x2 >= -0.0000001 && x1 - x2 <= 0.0000001 ) return false;

	a = ( y1 - y2 ) / ( x1 - x2 );
	b = y1 - a * x1;

	return true;
}

C++: #include<stdio.h>

int main()
{
	int n;
	double x1,y1,x2,y2,x3,y3,x4,y4,p,q;

	scanf("%d",&n);
	for(int x=0;x<n;x++)
	{
		for(;;)
		{
			scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
			if(x1>100||y1>100||x2>100||y2>100||x3>100||y3>100||x4>100||y4>100)
			{
			}
			else if(x1<-100||y1<-100||x2<-100||y2<-100||x3<-100||y3<-100||x4<-100||y4<-100)
			{
			}
			else
			{
				break;
			}
		}

		x2-=x1;
		y2-=y1;
		x1=0;
		y1=0;
		x4-=x3;
		y4-=y3;
		x3=0;
		y3=0;

		p=x2/x4;
		q=y2/y4;

		if(p==q)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

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

int main()
{
	int number;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	double value,value_2;
	
	cin >> number;

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

		value = (y2 - y1) / (x2 - x1);
		value_2 = (y4 - y3) / (x4 - x3);

		if(value == value_2)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long llong;
class Point {
public:
	double x, y;
};
int main() {
	int n; cin >> n;
	while (n--) {
		Point a, b, c, d;
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		b.x -= a.x; a.x = 0;
		b.y -= a.y; a.y = 0;
		d.x -= c.x; c.x = 0;
		d.y -= c.y; c.y = 0;
		double z = b.x*d.y - b.y*d.x;
		if (fabs(z)<1e-10)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

double X1, Y1, X2, Y2, X3, Y3, X4, Y4, X5, Y5;
double xp[1], yp[1];
double x[4], y[4];

int main() {
	while (cin >> X1 >> Y1 >> X2 >> Y2 >> X3 >> Y3 >> X4 >> Y4)
	{
		X5 = X3 - (Y4 - Y3);
		Y5 = Y3 + (X4 - X3);
		X4 = X5;
		Y4 = Y5;
		x[0] = X1; x[1] = X2; x[2] = X3; x[3] = X4;
		y[0] = Y1; y[1] = Y2; y[2] = Y3; y[3] = Y4;
		xp[0] = x[0] - x[1];
		yp[0] = y[0] - y[1];
		xp[1] = x[2] - x[3];
		yp[1] = y[2] - y[3];
		if (yp[0] == 0 && yp[1] == 0) { goto E; }
		if (yp[0] == 0 && yp[1] != 0) { goto F; }
		if (yp[0] != 0 && yp[1] == 0) { goto F; }
		if ((xp[0] / yp[0]) == (xp[1] / yp[1])) { goto E; }
		goto F;
	E:; cout << "YES" << endl;
		goto G;
	F:; cout << "NO" << endl;
	G:;

	}
}

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

int main()
{
  int n;
  while (cin >> n) {
    for (int i = 0; i < n; ++i) {
      double x1, y1, x2, y2, x3, y3, x4, y4, g1, g2;
      cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

      if ((x1-x2)*(y3-y4) == (x3-x4)*(y1-y2))
	cout << "YES" << endl;
      else
	cout << "NO" << endl;
    }
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

class Vector2D {
  private:
    double x;
    double y;
  public:
    Vector2D(double, double);
    Vector2D operator - (Vector2D vec2) {
      double newX = this->x - vec2.x;
      double newY = this->y - vec2.y;
      Vector2D newvec(newX, newY);
      return newvec;
    }
    double GetX() { return x; };
    double GetY() { return y; };
    bool isParallel(Vector2D);
};

Vector2D::Vector2D(double _x, double _y) {
  x = _x;
  y = _y;
}

bool Vector2D::isParallel(Vector2D vec2) {
  if (vec2.GetY()/this->y == vec2.GetX()/this->x)
    return true;
  else
    return false;
}

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;
    Vector2D vecAB = Vector2D(x2,y2) - Vector2D(x1,y1);
    Vector2D vecCD = Vector2D(x4,y4) - Vector2D(x3,y3);
    cout << (vecAB.isParallel(vecCD) ? "YES" : "NO") << endl;
  }

  return 0;
}

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(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)))<=1e-9)printf("YES\n");
        else printf("NO\n");
    }
}

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

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

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
 
int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                double x_,y_;
                cin >> x_ >> y_;
                x[i][j] = x_*100000;
                y[i][j] = y_*100000;
            }
        }
        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");
    }
}