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)
		}
		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 <stdio.h>

int main(){
  int n, i;
  double x[4], y[4];
  scanf("%d", &n);
  while(n--){
    scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &x[3], &y[3]);
    if(((y[1] - y[0]) / (x[1] - x[0])) == ((y[3] - y[2]) / (x[3] - x[2]))) puts("YES");
    else puts("NO");
  }
  return 0;
}

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

const double EPS = 1e-10;
template<class T>
bool eq(const T& a, const T& b) {return abs(a - b) < EPS;}

/* 点
 *
 * x 座標は p.real()
 * y 座標は p.imag()
 * 足し算，引き算，スカラー倍は定義済み
 */
using point = complex<double>;
namespace std {
	bool operator<(const point& a, const point& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}

/*
 * 直線・線分
 *
 * 辞書順の比較演算子が定義済み
 * 端点を for で走れる
 * {{x, y}} で初期化
 */
using line = array<point, 2>;

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


bool is_parallel(const line& s, const line& t) {
	return eq(cross(s[0] - s[1], t[0] - t[1]), 0.0);
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		line s, t;
		for (auto& p : s) {
			double x, y; cin >> x >> y;
			p = point(x, y);
		}
		for (auto& p : t) {
			double x, y; cin >> x >> y;
			p = point(x, y);
		}
		cout << (is_parallel(s, t)?"YES":"NO") << endl;
	}
	return 0;
}

C++: #include<iostream>
#define INF 10000000
using namespace std;
int main(){
  int n;
  double lI,lII,x1,y1,x2,y2,x3,y3,x4,y4;
  cin >> n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    x1+=1000,y1+=1000,x2+=1000,y2+=1000,x3+=1000,y3+=1000,x4+=1000,y4+=1000;
    x2-=x1,y2-=y1,x4-=x3,y4-=y3;
    cout << ((x2==0&&x4==0)||(y2/x2 == y4/x4)?"YES":"NO") << endl;
  }
}

C++: #include <iostream>

using namespace std;

int main()
{
	int n;
	double ax[4], ay[4], x[4], y[4];

	cin >> n;

	for(int i = 0; i < n; i++){
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

		if(x[0] > x[1]){
			ax[0] = x[1];
			ay[0] = y[1];
			ax[1] = x[0];
			ay[1] = y[0];
		}
		else{
			ax[0] = x[0];
			ay[0] = y[0];
			ax[1] = x[1];
			ay[1] = y[1];
		}

		if(x[2] > x[3]){
			ax[2] = x[3];
			ay[2] = y[3];
			ax[3] = x[2];
			ay[3] = y[2];
		}
		else{
			ax[2] = x[2];
			ay[2] = y[2];
			ax[3] = x[3];
			ay[3] = y[3];
		}

		if((ax[1]-ax[0])==(ax[3]-ax[2]) && (ay[1]-ay[0])==(ay[3]-ay[2]))
			cout << "YES" << endl;
		else 
			cout << "NO" << endl;
	}

	return 0;
}

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

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

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

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

int main()
{
	int num ;
	float ax, ay, bx, by, cx, cy, dx, dy ;

	cin >> num ;
	for( int i = 0 ; i < num ; i ++ )
	{
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy ;

		if( (ay-by)/(ax-by) == (cy-dy)/(cx-dx) )
		{
			if( ax != cx && bx != dx )
			{
				cout << "YES\n" ;
			}
		}
		else cout << "NO\n" ;
	}
	return 0;
}

C++: #include<stdio.h>

int main(void)
{
	double x[4]={0},y[4]={0};
	int i;
	scanf("%d",&i);

	while(i!=0)
	{
		scanf("%f %f %f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
		if(x[1]-x[0] == 0 && x[3]-x[2] == 0)
			printf("YES\n");
		else if(x[1]-x[0] == 0 || x[3]-x[2] == 0)
			printf("NO\n");
		else if(y[1]-y[0] == 0 && y[3]-y[2] == 0)
			printf("YES\n");
		else if(y[1]-y[0] == 0 || y[3]-y[2] == 0)
			printf("NO\n");
		else if((y[1]-y[0])/(x[1]-x[0]) == (y[3]-y[2])/(x[3]-x[2]))
			printf("YES\n");
		else 
			printf("NO\n");

		i-=1;
	}
 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 AB = (y1-y2)/(x1-x2);
    double CD = (y3-y4)/(x3-x4);
    if ( AB == CD ) cout << "YES" << endl;
    else cout << "NO" << endl;
  }

  return 0;
}

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



int main(){

  int num;
  cin >> num;

  double x[4], y[4];
  double xx, yy;
  int i = 0;

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

 
  return 0;
}

C++: #include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

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

  cin>>n;

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

      cin>>x>>y>>x1>>y1;
      b=(y1-y)/(x1-x);
	
      if(a==b)
        puts("YES");
      else
        puts("NO");
    }

}

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

int main(){
	int n;
	double x[4], y[4];
	cin >> n;
	while (n-- != 0){
		for (int i = 0; i < 4; i++)
			cin >> x[i] >> y[i];
		if ((x[0] - x[1]) / (y[0] - y[1]) == (x[2] - x[3]) / (y[2] - y[3]))
			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-8;

  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++: //41
#include<iostream>
#include<complex>

using namespace std;

int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    complex<double> p[2];
    for(int j=0;j<2;j++){
      double x,xx,y,yy;
      cin>>x>>y>>xx>>yy;
      p[j]=complex<double>(x-xx,y-yy);
    }
    cout<<((p[0].real()*p[1].imag()-p[0].imag()*p[1].real())?"NO":"YES")<<endl;
  }
  return 0;
}