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[1] == fpoints[3] {
			fmt.Println("YES")
			continue
		}
		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 <iostream>
#include <complex>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-11;
double x[4],y[4];
int N;
int main(int argc, const char * argv[]) {
    cin >> N;
    for(int t=0; t<N; ++t){
        for(int i=0; i<4; ++i){
            cin >> x[i] >> y[i];
        }
        xy_t a[2] ={
            xy_t(x[0],y[0]) - xy_t(x[1],y[1]),
            xy_t(x[2],y[2]) - xy_t(x[3],y[3])
        };
        bool p = abs(cross_product(a[0], a[1])) < eps;
        cout << (p ? "YES" : "NO") << endl;
        }
    return 0;
}

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;
}
}