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 <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <complex>
using namespace std;
int main() {
	double x[4],y[4];
	int n;
	cin >> n;
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < 4;j++) {
				cin >> x[j] >> y[j];
		}
		double X1, Y1, X2, Y2;
		X1 = x[1] - x[0];
		X2 = x[3] - x[1];
		Y1 = y[1] - y[0];
		Y2 = y[3] - y[2];
		if (X1*Y2 == X2*Y1) {
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}
}

C++:  #include<iostream> using namespace std;   int main(){     int n;     double x[4],y[4];     cin>>n;     for(;n--;){         for(int i=0;i<4;i++){             cin>>x[i];             cin>>y[i];         }         if((x[0]-x[1])*(y[2]-y[3])==(x[2]-x[3])*(y[0]-y[1])){             cout<<"YES"<<endl;         }else{             cout<<"NO"<<endl;         }     }     return 0; }

C++: #include<stdio.h>

int main(void){
	double x[4] = { 0 };
	double y[4] = { 0 };
	int n = 0;
	int i;
	scanf("%d", &n);
	while (n-- > 0){
		for (i = 0; i < 4; i++)
			scanf("%lf %lf", &x[i], &y[i]);
		for (i = 0; i < 4; i += 2) {
			x[i] -= x[i + 1];
			y[i] -= y[i + 1];
		}
		if (x[0] == 0 || x[2] == 0){
			if (x[0] == 0 && x[2] == 0)
				printf("YES\n");
			else
				printf("NO\n");
		}
		else if ((y[0] / x[0]) == (y[2] / x[2]))
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 1e9
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
const double eps=1e-10;
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;
if(((abs(y1-y2)/abs(x1-x2))<=(abs(y3-y4)/abs(x3-x4))+eps)&&
((abs(y1-y2)/abs(x1-x2))>=(abs(y3-y4)/abs(x3-x4))-eps))
  cout<<"YES"<<endl;
 else
   cout<<"NO"<<endl;
}
return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
using namespace std;
int main() {
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double a = 9090909, b = 9090909;
		if(x1!=x2)a = (y1 - y2) / (x1 - x2);
		if(x3!=x4)b = (y3 - y4) / (x3 - x4);
		if (a == b) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

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

int main()
{
	const double EPS = 1e-20;
	const double PI = 4.*atan(1.);

	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;
		complex<double> A(x1,y1),B(x2,y2),C(x3,y3),D(x4,y4);
		double a = arg((A-B)/(C-D));
		cout << ( abs(a)<EPS || abs(a)>PI-EPS ? "YES" : "NO" ) << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define SZ(n)  (int)n.size()
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x)cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define MP make_pair
#define PB push_back
	double EPS=0.000000001;
	bool same(double a,double b){
		if(fabs(a-b)<=EPS)return 1;
		else return 0;
	}
	
	
	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 a1=(y2-y1)/(x2-x1);
		double a2=(y4-y3)/(x4-x3);
		if(same(a1,a2))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}

C++: #include<vector>
#include<iostream>
#include<cstdio>
using namespace std;
double x1,y1,x2,y2,x3,y3,x4,y4;
int n;
int main(){
    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((y1-y2)*(x4-x3)-(y4-y3)*(x1-x3)==0) printf("YES\n");
      else printf("NO\n");
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
using ld = long double;
const ld eps = 1e-11;

int main()
{
	int n;
	ld x1, x2, x3, x4, y1, y2, y3, y4;
	cin >> n;
	while (n--) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		ld dx1 = x2 - x1, dy1 = y2 - y1;
		ld dx2 = x4 - x3, dy2 = y4 - y3;
		if (abs(dx1 * dy2 - dy1 * dx2) < eps && dx1 * dx2 + dy1 * dy2 > -eps) {
			puts("YES");
		}
		else {
			puts("NO");
		}
	}
	return 0;
}

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

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

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

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 = (y2-y1) / (x2-x1);
		double CD = (y4-y3) / (x4-x3);

		if(AB == CD){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}

	}
	return 0;
}

C++: #include <iostream>

int main(){
	int a;
	long double x1,y1,x2,y2,x3,y3,x4,y4;
	std::cin>>a;
	for(int s=0;s<a;s++){
		std::cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)){
			std::cout<<"YES"<<std::endl;
		}else{
			std::cout<<"NO"<<std::endl;
		}
		
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <math.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;
		if((y1-y2)*(x3-x4)==(y3-y4)*(x1-x2)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

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

int main(){
  double a,b,c,d,e,f,g,h,m[4];
  int s;
  cin>>s;
  for(int j=0;j<s;j++){
    cin>>a>>b>>c>>d>>e>>f>>g>>h;
    m[0]=c-a;
    m[1]=g-e;
    m[2]=d-b;
    m[3]=h-f;
    if(m[2]*m[0]==m[3]*m[1])cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  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 res1 = (x1 - x2)*(y3 - y4);
    double res2 = (y1 - y2)*(x3 - x4);

    if ( res1 == res2 ) cout << "YES" << endl;
    else cout << "NO" << endl;
  }

  return 0;
}