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[4] == fpoints[6] {
			fmt.Println("YES")
		} else {
			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 <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;
double eps = 1e-11;

double cross_product (xy_t a, xy_t b) {
    return (conj(a) * b).imag();
}

xy_t P[110];

int main() {
    int n;
    cin >> n;
    double x[4], y[4];
    for (int i = 0; i < 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])
        };
        bool ok = abs(cross_product(a[0], a[1])) < eps;
        cout << (ok ? "YES" : "NO") << endl;
    }
}

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

typedef struct {
  double x;
  double y;
} point;

int main() {
  point a, b, c, d;
  int n;
  cin >> n;
  while (n--) {
    cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
    point p, q;
    p.x = b.x - a.x;
    p.y = b.y - a.y;
    q.x = d.x - c.x;
    q.y = d.y - c.y;

    if (-0.000001 < p.x * q.y - p.y * q.x && p.x * q.y - p.y * q.x < 0.000001)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

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

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
	int n;
	cin >> n;
	for(int i=0;i<n;++i){
		vector<double> a(2),b(2),c(2),d(2);
		double tmp;
		cin>>a[0]>>a[1]>>b[0]>>b[1]>>c[0]>>c[1]>>d[0]>>d[1];
		double x1=b[0]-a[0],y1=b[1]-a[1];
		double x2=d[0]-c[0],y2=d[1]-c[1];
		if(x1*y2-x2*y1>0) cout << "NO" << endl;
		else cout << "YES" << endl;
	}
	return 0;
}

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

using namespace std;

typedef complex<double> point;

const double EPS = 1e-7;
double cross(point a,point b){
    return imag(conj(a)*b);
}

bool is_parallel(point a1,point a2,point b1,point b2){
    return (cross(a2-a1,b2-b1) < EPS);
}

int main(){
    int N;
    cin >> N;
    for(int i=0;i<N;i++){
        vector<point> ps(4);
        for(int j=0;j<4;j++){
            cin >> ps[j].real() >> ps[j].imag();
        }
        if(is_parallel(ps[0],ps[1],ps[2],ps[3])){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#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 main()
{
	int n;
	cin >> n;
	int x1, y1, x2, y2, x3, y3, x4, y4;
	for(int i=0;i<n;i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		int a = (y2 - y1)*(x4 - x3) - (y4 - y3)*(x2 - x1);
		if (a - 1 < EPS )printf("YES");
		else printf("NO");
	}
	
	return 0;
}

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

struct Pos {
	double x, y;
}a, b, c, d;

int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i++ ) {
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		Pos e;
		e.x = b.x - a.x;
		e.y = b.y - a.y;
		Pos f;
		f.x = d.x - c.x;
		f.y = d.y - c.y;
		
		double men = e.x * f.y - e.y * f.x;
		double eps = 1e-11;
		if(-eps <= men && men <= eps)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
signed main(void){
	double x[4],y[4];
	int T;
	cin>>T;
	for(int t=1;t<=T;t++){
		for(int i=0;i<4;i++)
			cin>>x[i]>>y[i];
		if(abs((y[1]-y[0])*(x[3]-x[2])-(x[1]-x[0])*(y[3]-y[2]))<1e-8) 
			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(int j=0;j<n;j++){
    for(int i=0;i<4;i++)
      cin>>x[i]>>y[i];
  if((y[3]-y[2])/(x[3]-x[2])==(y[1]-y[0])/(x[1]-x[0])) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  }
  return 0;
}

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

bool IsEqual(double a, double b)
{
	if (fabs(a - b) < 0.0000001) return true;
	return false;
}

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

		double dx1 = x[1] - x[0];
		double dy1 = y[1] - y[0];
		double dx2 = x[3] - x[2];
		double dy2 = y[3] - y[2];

		if (IsEqual(dx1, 0) && IsEqual(dx2, 0)) cout << "YES" << endl;
		else if (IsEqual(dx1, 0) || IsEqual(dx2, 0)) cout << "NO" << endl;
		else if (IsEqual(dy1 / dx1, dy2 / dx2)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int n;
    cin>>n;
    while(n--){
        double x1,y1,x2,y2,x3,y3,x4,y4;
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        if((x1-x2)/(y1-y2)==(x3-x4)/(y3-y4))cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

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

int main(){
    
    int n;
    cin>>n;
    
    double x[4],y[4];
    for (int i = 0; i < n; ++i) {
        cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>x[3]>>y[3];
        double d[2];
        
        //直線がxに垂直の場合
        if (x[0] == x[1]){
            if(x[2] == x[3]) {
                cout<<"YES"<<endl;
            }else{
                cout<<"NO"<<endl;
            }
        }else{
            if(x[2] == x[3]) {
                cout<<"NO"<<endl;
            }
        }
        
        d[0] = (y[1] - y[0])/(x[1] - x[0]);
        d[1] = (y[3] - y[2])/(x[3] - x[2]);
        
        if (d[0] == d[1]) {
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
    
}

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

int main()
{
	int n;
	cin >> n;

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

		double abx = x[0] - x[1], cdx = x[2] - x[3];
		double aby = y[0] - y[1], cdy = y[2] - y[3];

		if (aby / abx == cdy / cdx){
		   cout << "YES" << endl;
		}

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