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 <complex>
#include <cmath>
#include <iostream>
#include <stdio.h>

using namespace std;
typedef complex<double> xy_t;

const double eps= a1e&#8722;11;
double x[4], y[4];
int N;
int main(){
  cin >> N;
  for(int t= 0; t<N; ++i){
    for (int i = 0; i < 4; ++i) cin >> x[i] >> y[i];
    xy_t a[2]={xy_t(x[0],y[0])-xy_t(x[1],y[1]), xy_t(x[2],y[2])-xy_t(x[3],y[3])};
    xy_t x=a[0],y=a[1];
    bool p = abs(x.real()*y.imag()-x.imag()*y.real()) < eps;
    cout << ( p ? ”YES” : ”NO” ) << endl ;
  }

}

C++: #include <stdio.h>
#include <math.h>
int main(void){
double p[4][2],a;
int n,i,j;
scanf("%d",&n);
while(n--){
for(i=0;i<4;i++)
for(j=0;j<2;j++)
scanf("%lf",&p[i][j]);
a=(p[2][0]-p[3][0])*(p[0][1]-p[1][1])-(p[0][0]-p[1][0])*(p[2][1]-p[3][1]);
if(fabs(a)<1e-5)
puts("YES");
else
puts("NO");
}
return 0;
}

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

using namespace std;

void q21() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		double ax, ay, bx, by, cx, cy, dx, dy;
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;
		if (bx - ax == 0 || dx - cx == 0) {
			if (bx - ax == dx - cx) {
				cout << "YES" << endl;
				continue;
			}
		}
		else if (abs((by - ay) / (bx - ax) - (dy - cy) / (dx - cx)) <= 0.00001 ){
			cout << "YES" << endl;
			continue;
		}
		cout << "NO" << endl;
	}
}

int main() {
	q21();
	return 0;
}

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

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

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

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

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

		double l1, l2;
		l1 = (y[1] - y[0]) / (x[1] - x[0]);
		l2 = (y[3] - y[2]) / (x[3] - x[2]);
		if (l1 == l2){
			cout << "YES" << endl;
		}

		else {
			cout << "NO" << endl;
		}
	}
	return (0);
}

C++: #include <stdio.h>
 
int main(void) {
    int kaisu,i,j;
    double x[4],y[4];

    scanf("%d",&kaisu);
    for(i=0;i<kaisu;i++)
	{
        for(j=0;j<4;j++)
		{
			scanf("%lf %lf",&x[j],&y[j]);
			if(-100 > x[j] || 100 < x[j] || -100 > x[j] || 100 < x[j])break;
        if(x[0]==x[1]) 
		{
            if(x[2] == x[3])
				printf("YES\n");
            else 
				printf("NO\n");
        } 
		else if(x[2] == x[3])
			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");
        }
    }
    return 0;
}

C++: #include <iostream>
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];
		if((x[1]-x[0])*(y[2]-y[3])==(x[3]-x[2])*(y[0]-y[1]))
		cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int n,AB,CD;
double ax,ay,bx,by,cx,cy,dx,dy,ab,cd,abx,aby,cdx,cdy,abC,cdC;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		AB=CD=0;
		cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy;
		abx=(ax-bx);
		cdy=(cy-dy);
		aby=(ay-by);
		cdx=(cx-dx);
		if(abx==0.0&&aby==0.0)AB=1;
		if(cdx==0.0&&cdy==0.0)CD=1;
		if(AB==1||CD==1){
			cout<<"NO"<<endl;
			continue;
		}
		if(abx!=0&&cdx!=0){
			ab=aby/abx;
			cd=cdy/cdx;
			abC=ay-ab*ax;
			cdC=cy-cd*cx;
			if(ab==cd&&abC!=cdC){
				cout<<"YES"<<endl;
			}else{
				cout<<"NO"<<endl;
			}
		}else{
			if(abx==cdx&&ax!=cx){
				cout<<"YES"<<endl;
			}else{
				cout<<"NO"<<endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <math.h>

using namespace std;

void myswap(double* a,double* b)
{
	double temp=*a;
	*a=*b;
	*b=temp;
}
int main()
{
	double x1,x2,x3,y1,y2,y3,x4,y4;
	int n;
	double AB,CD; 

	cin>>n;

	for(int i=0;i<n;i++)
	{
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if(x1>x2)
		{
			myswap(&x1,&x2);
			myswap(&y1,&y2);
		}
		if(x3>x4)
		{
			myswap(&x3,&x4);
			myswap(&y3,&y4);
		}

		if((x2-x1)==0||(x4-x3)==0)
		{
			if((x2-x1)==0&&(x4-x3)==0)
				cout<<"YES"<<endl;
			else
				cout<<"NO"<<endl;
			continue;
		}
		
		AB=(y2-y1)/(x2-x1);
		CD=(y4-y3)/(x4-x3);

		if((fabs(AB-CD))<0.00001)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;


	}
	

	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <sstream>
#include <cmath>
 
using namespace std;
 
#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)
 
#define EPS 1e-10
#define EQUAL(a, b) (fabs((a)-(b))<EPS)
 
typedef vector<int> vi;
 
int main()
{
    int n;
    scanf("%d", &n);
    rep(i, n){
        double x1, y1, x2, y2, x3, y3, x4, y4;
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
        puts(EQUAL((x2-x1)*(y4-y3), (y2-y1)*(x4-x3)) ? "YES" : "NO");
    }
 
    return 0;
}

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

const double EPS = 1e-10;

signed main() {
  int n;

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

  return 0;
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int n;
    pair<double, double> pa;
    vector<pair<double, double> > a;
    vector<pair<double, double> > b;
    cin >> n;
    rep(j, n)
    {
        rep(i, 2)
        {
            cin >> pa.first;
            cin >> pa.second;
            a.push_back(pa);
        }
        rep(i, 2)
        {
            cin >> pa.first;
            cin >> pa.second;
            b.push_back(pa);
        }
        SORT(a);
        SORT(b);
        double anglea = (a[1].second - a[0].second)*(b[1].first - b[0].first);
        double angleb = (b[1].second - b[0].second)*(a[1].first - a[0].first);
        if(DEBUG) cout<<anglea<<" "<<angleb<<endl;
        if (anglea==angleb)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
        a.clear();
        b.clear();
    }
    return 0;
}

C++: #include <cstdio>

using namespace std;

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

int main()
{
    int n; scanf( "%d\n", &n );
    while( n > 0 )
    {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf\n", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4 );
        double dx1 = x2 - x1, dx2 = x4 - x3, dy1 = y2 - y1, dy2 = y4 - y3, det = dx1 * dy2 - dx2 * dy1;

        if( det < 0.000000001 )
        {
            printf( "YES\n" );
        }
        else
        {
            printf( "NO\n" );
        }

        /* if( (dx1 == 0 && dx2 == 0) || (dy1 == 0 && dy2 == 0 ) )
        {
            printf( "YES\n" );
        }
        else if( dx1 != 0 && dx2 != 0 )
        {
            dy1 /= dx1;
            dy2 /= dx2;
            if( dy1 == dy2 || dy1 == -dy2 )
            {
                printf( "YES\n" );
            }
        }
        else
        {
            printf( "NO\n" );
        }
         */
        n--;
    }
    return 0;
}