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<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;

int n;
double x[5];
double y[5];

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

		double k = (x[1] - x[0])*(x[3] - x[2]) + (y[1] - y[0])*(y[3] - y[2]);
		double j = sqrt((x[1] - x[0])*(x[1] - x[0]) + (y[1] - y[0])*(y[1] - y[0]))*sqrt((x[3] - x[2])*(x[3] - x[2]) + (y[3] - y[2])*(y[3] - y[2]));
		if (fabs(k/j - 1) < EPS || fabs(k/j + 1) < EPS)cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	
	return 0;
}

C++: #include <cstdio>

using namespace std;

int n;
double x[4],y[4];

int main()
 {
	
scanf("%d",&n);
	
for (int c = 0; c < n; c++)
{
		
for(inti = 0; i < 4; i++)scanf("%lf%lf",&x[i],&y[i]);
		
puts((y[1]-y[0])/(x[1]-x[0]) == (y[3]-y[2])/(x[3]-x[2])?"YES":"NO");
	
}
 }

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int main(){
	int n;
	cin>>n;
	rep(i,0,n){
		double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		m1=(y2-y1)/(x2-x1);
		m2=(y4-y3)/(x4-x3);
		if(fabs(m1-m2)<1e-10) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

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

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

  scanf("%d", &n);
  for (int i = 0; i < n; i++){
    for (int j = 0; j < 2; j++){
      for (int k = 0; k < 2; k++){
        scanf("%lf%lf", &x[k], &y[k]);
      }
      a[j] = (y[1] - y[0]) / (x[1] - x[0]);
    }
    if (a[0] == a[1]){
      puts("YES");
    }
    else {
      puts("NO");
    }
  }

  return (0);
}

C++: #include <stdio.h>
#include<cmath>


int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	int n;
	scanf("%d",&n);
	for(int i=0; i<n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);

		if(abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < 0.0000001){ //I copied yutaka watabe's code here
			printf("YES\n");
		}else{
			printf("NO\n");
		}

	}
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int n;
  cin>>n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    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() {
	int N;
	cin>>N;
	for(;N--;){
		double x1,y1,x2,y2,x3,y3,x4,y4;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double a1=(y2-y1)/(x2-x1);
		double a2=(y4-y3)/(x4-x3);
		if(a1==a2) cout<<"YES"<<endl;
			else cout<<"NO"<<endl;
	}
}

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


int main(void) {

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

  return 0;
}

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

int main(){

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

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

int main(void){

	double n,x1,x2,x3,x4,y1,y2,y3,y4,x5,x6,y5,y6;

	cin>>n;
	for(int i=0;i<n;i++){
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
	x5=x2-x1;x6=x4-x3;
	y5=y2-y1;y6=y4-y3;
	if(y5/x5==y6/x6) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	
	}
    return 0;
}

C++: #include<iostream>
#include<complex>

#define EPS 1e-7
using namespace std;

typedef complex<double> P;


double cross(P p1,P p2){
	return p1.real()*p2.imag()-p1.imag()*p2.real();
}
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		P p[2];
		for(int i=0;i<2;i++){
			P tp[2];
			for(int j=0;j<2;j++){
				cin>>tp[j].real()>>tp[j].imag();
			}
			p[i]=tp[1]-tp[0];
		}
		if(abs(cross(p[0],p[1]))<=EPS)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

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] ) * 1000 / ( x[1] - x[0] );
      long long int t2 = ( y[3] - y[2] ) * 1000 / ( x[3] - x[2] );

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

    }

  }

  return 0;

}

C++: #include<bits/stdc++.h>
using namespace std;
main(void){
	int T;cin>>T;
	double x1,x2,x3,x4,y1,y2,y3,y4;
	for(int t=1;t<=T;t++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if(x1==x2&&x3==x4)cout<<"YES"<<endl;
		if(y1==y2&&y3==y4)cout<<"YES"<<endl;
		else if(abs((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4))<0.0000001)
			cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}