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++: #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 + 0.5;
                y[i][j] = y_ *100000 + 0.5;
            }
        }
        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++: #include <iostream>

using namespace std;

int main(){
	int n;
	float x1,y1,x2,y2,x3,y3,x4,y4,s1,s2;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		s1=(y2-y1)/(x2-x1);
		s2=(y4-y3)/(x4-x3);
		if(s1==s2){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;	
		}
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

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

C++: #include<stdio.h>

int main(void){
	double x[4],y[4];
	int n,i;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		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])))printf("YES\n");
		else printf("NO\n");
	}
	
	return 0;
}

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

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

		bool h = (x[0] - x[1]) / (y[0] - y[1]) == (x[2] - x[3]) / (y[2] - y[3]);
		if (h)
		{
			cout << "YES" << endl;
		}
		else
			cout << "NO" << endl;
	}




	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>
#include <vector>
#include <list>
#include <iterator>

#include <cmath>

typedef std::pair<double,double> Vec;
typedef std::pair<Vec,Vec> Line;

Vec operator+(const Vec& lhs, const Vec& rhs) {
	return std::make_pair(lhs.first+rhs.first, lhs.second+rhs.second);
}

Vec operator-(const Vec& lhs, const Vec& rhs) {
	return std::make_pair(lhs.first-rhs.first, lhs.second-rhs.second);
}

Vec lineToVec(const Line& l) {
	return l.first - l.second;
}

double cross(const Vec& lhs, const Vec& rhs) {
  return lhs.first*rhs.second - lhs.second*rhs.first;
}

int main(void){
	using namespace std;

	int n;
	cin >> n;

	vector< pair<Line,Line> > input;
	input.reserve(n);

	double x1,y1,x2,y2,x3,y3,x4,y4;
	while(cin
		>> x1 >> y1
		>> x2 >> y2
		>> x3 >> y3
		>> x4 >> y4){

		auto AB = make_pair( make_pair(x1,y1), make_pair(x2,y2) );
		auto CD = make_pair( make_pair(x3,y3), make_pair(x4,y4) );

		input.push_back(make_pair(AB,CD));
	}

	for(auto itr=input.begin(); itr!=input.end(); itr++){
		auto AB = itr->first;
		auto CD = itr->second;

		auto cr = cross( lineToVec(AB), lineToVec(CD) );

		if( abs(cr) <10e-10 ){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
}

C++: #include<iostream>

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

  std::cin >> n;

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

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

int main() {
  int n;
  double x[4];
  double y[4];
  const double eps = 1.0e-12;

  scanf("%d", &n);
  while (n--) {
    for (int i=0; i<4; i++) {
      scanf("%lf %lf", &x[i], &y[i]);
    }
    if (abs((y[1]-y[0])*(x[3]-x[2]) - (x[1]-x[0])*(y[3]-y[2])) < eps) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }

  return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <iostream>


using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		double x[4], y[4];
		for (int j = 0; j < 4; ++j)
			scanf("%lf %lf", x+j, y+j);

		double x1 = x[1] - x[0];
		double y1 = y[1] - y[0];
		double x2 = x[3] - x[2];
		double y2 = y[3] - y[2];
		if (abs(x1) < 0.001 && abs(x2) < 0.001
			|| abs(y1/x1-y2/x2) < 0.001)
			puts("YES");
		else
			puts("NO");
	}

	return 0;
}

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

int main() {

  int n;
  cin >> n;

  for ( int i = 0; i < n; i++ ) {

    double x[4],y[4];
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

    if ( ( x[0] - x[1] ) * ( x[2] - x[3] ) == 0 ) {

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

    }else {

      long long int t1 = ( y[1] - y[0] ) * 1000000 / ( x[1] - x[0] );
      long long int t2 = ( y[3] - y[2] ) * 1000000 / ( x[3] - x[2] );

      if ( t1 == t2 ) {
	cout << "YES" << endl;
      }else {
	cout << "NO" << endl;
      }

    }

  }

  return 0;

}

C++: #include <stdio.h>
#define EPSIRON (1.0e-30)

int main(void){
    int n;
    double x1, x2, x3, x4, dx1, dx2;
    double y1, y2, y3, y4, dy1, dy2;
    double cp; // cross product
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
        scanf("%lf %lf %lf %lf", &x3, &y3, &x4, &y4);
        dx1 = x2 - x1;
        dy1 = y2 - y1;
        dx2 = x4 - x3;
        dy2 = y4 - y3;
        cp = dx1 * dy2 - dy1 * dx2;
        printf("%s\n", cp*cp < EPSIRON ? "YES" : "NO");
    }
    
    return 0;
}

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

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

	int n;
	cin >> n;

	while(n > 0){
		double x[4];
		double y[4];

		for(int i = 0; i < 4; ++i){
			cin >> x[i] >> y[i];
		}

		double m1 = (y[0] - y[1]) / (x[0] - x[1]);
		double m2 = (y[2] - y[3]) / (x[2] - x[3]);

		cout << (m1 == m2 ? "YES" : "NO") << endl;

		--n;
	}

	return 0;
}

C++: #include <stdio.h>

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

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		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((x[1]-x[0])*(y[3]-y[2]) == (y[1]-y[0])*(x[3]-x[2])) puts("YES");
		else puts("NO");
	}

	return 0;
}