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<stdio.h>
#include<math.h>

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double a1,a2;
	int n,i;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&x2,&x3,&x4,&y1,&y2,&y3,&y4);
		
		a1=(y1-y2)/(x1-x2);
		a2=(y3-y4)/(x3-x4);
	
		if(a1==a2)printf("YES\n");
		else printf("NO\n");
	}
return 0;
}

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*y3+x2*y4+y2*x3+y1*x4)==(x2*y3+x1*y4+y1*x3+y2*x4)){
      std::cout << "YES" << std::endl;
    }else{
      std::cout << "NO" << std::endl;
    }
  }
}

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

int main(void) {
  int n;
  cin >> n;
  while (n--) {
    double x1, y1, x2, y2, x3, y3, x4, y4;
    bool flag;
    cin >> x1 >> y1 >> x2 >> y2
	>> x3 >> y3 >> x4 >> y4;

    if (x1 == x2) {
      if (x3 == x4) {
	flag = true;
      } else {
	flag = false;
      }
    } else if (x3 == x4) {
      flag = false;
    } else {
      if ( (y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3) ) {
	flag = true;
      } else {
	flag = false;
      }
    }
    /*
      if (x1 == x2 || x3 == x4) {
      if (x1 == x2 && x3 == x4) flag = true;
      } else {
      ang1 = (y2 - y1) / (x2 - x1);
      ang2 = (y4 - y3) / (x4 - x3);
      if (ang1 == ang2) flag = true;
      }
    */
    if (flag) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}

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

int main(){
    const double EPS = 1e-12;
    double x[4];
    double y[4];
    double s;
    double t;
    double u;
    double v;
    double m;
    int n;
    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];
        s = x[1] - x[0];
        t = y[1] - y[0];
        u = x[3] - x[2];
        v = y[3] - y[2];
        if(s * v - t * u > 0){
            m = s * v - t * u;
        }
        else{
            m = t * u - s * v;
        }
        if(m < EPS){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

int main(void){
    int n = 0;
    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(((x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4)) == 0){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
}

C++: #include <bits/stdc++.h>
using namespace std;

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

C++: #include <bits/stdc++.h>
using namespace std;
typedef complex<double> xy_t; 
xy_t a, b, c, d;
double x, y;
int n;
int main()
{
	cin >> n;
	for(int i=0; i<n; i++)
	{
		cin >> x >> y;
		a=xy_t(x, y);
		cin >> x >> y;
		b=xy_t(x, y);
		cin >> x >> y;
		c=xy_t(x, y);
		cin >> x >> y;
		d=xy_t(x, y);
		if((conj(b-a)*(d-c)).imag()==0)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	double n=0,ax[100],ay[100],bx[100],by[100],cx[100],cy[100],dx[100],dy[100];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>ax[i]>>ay[i]>>bx[i]>>by[i]>>cx[i]>>cy[i]>>dx[i]>>dy[i];
	}
	for(int i=0;i<n;i++){
		double A=0,B=0;
		A=ax[i]*by[i]-bx[i]*ay[i];
		B=cx[i]*dy[i]-dx[i]*cy[i];
		if(A==B){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
}

C++: #include <cstdio>

using namespace std;

double x1,y1,x2,y2,x3,y3,x4,y4;
    

int main()
{
    int n; scanf( "%d\n", &n );
    for( int i = 0; i < n; i++ )
    {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf %lf\n", &x1, &y1, &y2, &y2, &y3, &y3, &y4, &y4 );
        double num1 = x2 - x1, num2 = x4 - x3, num3 = y2 - y1, num4 = y4 - y3;
        if( (num1 == 0 && num3 == 0) || (num2 == 0 && num4 == 0 ) )
        {
            printf( "YES\n" );
        }
        else
        {
            num2 /= num1;
            num4 /= num3;
            if( num3 == num4 || num3 == -num4 )
            {
                printf( "YES\n" );
            }
        }
        printf( "NO\n" );
        n--;
    }
    return 0;
}

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

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

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(y1!=y2)a = (x1 - x2) / (y1 - y2);
		if(y3!=y4)b = (x3 - x4) / (y3 - y4);
		if (a == b) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	cin >> n;
}

C++: /*
Powered by 0736TuT
Code + Music + Games = Life
*/

#include<iostream>
#include<cstdio>

typedef long long qwq;

using namespace std;

int scan(int *buf_tar)
{
    char buf_c=0; bool is_rev=0;
    while(buf_c!='-'&&(buf_c<'0'||buf_c>'9')) {buf_c=getchar(); if(buf_c==EOF) return EOF;}
    if(buf_c=='-') is_rev=1,buf_c=getchar();
    *buf_tar=0;
    while(buf_c>='0'&&buf_c<='9') {*buf_tar*=10; *buf_tar+=buf_c-'0'; buf_c=getchar();}
    if(is_rev) *buf_tar=-*buf_tar;
    return 0;
}

double a,b,c,d,e,f,g,h;

int main()
{
    int T;
    scan(&T);
    double temp_a,temp_b;
    while(T--)
    {
	scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f,&g,&h);
	temp_a=(b-d)/(a-c);
	temp_b=(f-h)/(e-g);
	if(temp_a==temp_b) printf("YES\n");
	else printf("NO\n");
    }
    return 0;
}

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

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

C++: #include<iostream>
#include<cmath>
#include<cassert>
#include<cstdlib>
using namespace std;
#define EPS 0.0000001
 
 
main(){
  int tcase;   cin >> tcase;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  for ( int i = 0; i < tcase; i++ ){
      cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
 
   
      if ( abs((y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1) ) < EPS ) cout << "YES" << endl;
      else cout << "NO" << endl;
  }
}