Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	for i := 0; i < n; i++ {
		scanner.Scan()
		points := strings.Split(scanner.Text(), " ")
		fpoints := make([]float64, 0)
		for _, v := range points {
			tmp, _ := strconv.ParseFloat(v, 64)
			fpoints = append(fpoints, tmp)
		}
		if fpoints[0] == fpoints[2] && fpoints[1] == fpoints[3] {
			fmt.Println("YES")
			continue
		}
		a := (fpoints[1]-fpoints[3])/(fpoints[0]-fpoints[2])
		b := (fpoints[5]-fpoints[7])/(fpoints[4]-fpoints[6])
		if a == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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;
  }
}

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){
        double x_,y_;
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                cin >> x_ >> y_;
                x[i][j] = x_*100000;
                y[i][j] = y_*100000;
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[1][0]-y[1][1];
        ll dx2=x[0][0]-x[0][1], dy2=y[1][0]-y[1][1];
        puts(dx1*dy2==dx2*dy1 ? "NO" : "YES");
    }
}

C++: #include <iostream>
struct IVect2
{
    double x,y;
    IVect2(double _x, double _y)
    {
        x = _x;
        y = _y;
    }
};

bool isParallel(IVect2 a, IVect2 b)
{
    if(a.x == 0 || b.x == 0)
    {
        if(a.x == 0 && b.x == 0)
            return true;
        else
            return false;
    }
    
    if(a.y/a.x == b.y/b.x)
        return true;
    else
        return false;
}

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

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

int main(void)
{
	int i,count=0;
	cin>>i;
	while(count != i)
	{
	float x1,y1,x2,y2,x3,y3,x4,y4;
	cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;

	float ax,ay,bx,by;
	
	if(x2<x1){ax=x1-x2;bx=x3-x4;}
	else{ax=x2-x1;bx=x4-x3;}
	
	if(y2<y1){ay=y1-y2;by=y3-x4;}
	else{ay=y2-y1;by=y4-y3;}

	if(ax==bx&&ay==by)puts("YES");
	else puts("NO");
	count++;
	}
	
	return 0;
}