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 <iostream>
using namespace std;

int main() {
	int n;
	float x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> n;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4) {
		if (((y2 - y1) / (x2 - x1)) == ((y4 - y3) / (x4 - x3))) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 201
#define _MAX 100
#define ABC 26
int main(void)
{
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4, a1, b1, a2, b2;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		a1 = (y1 - y2) / (x1 - x2);
		a2 = (y3 - y4) / (x3 - x4);
		if (a1 == a2)
			printf("YES\n");
		else
			printf("NO\n");
	}
}

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

int main(){
  int n;
  double x[4]={0};
  double y[4]={0};
  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 <iostream>
using namespace std;

typedef struct P {
	double x, y;
}P;
int n;
double a1, a2, b1, b2, c1, c2;
P p[4];

int main(){
	cin >> n;
	for (int l = 0; l < n; l++) {
		for (int i = 0; i < 4; i++) {
			cin >> p[i].x >> p[i].y;
		}
		a1 = p[0].x - p[1].x;
		a2 = p[0].y - p[1].y;
		b1 = p[2].x - p[3].x;
		b2 = p[3].y - p[3].x;
		c1 = a1*b1;
		c2 = a2*b2;
		c2 -= c1;
		if (c2 < 0.00001 && c2 > -0.00001) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	double vx1, vy1, vx2, vy2;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		vx1 = x2 - x1;
		vy1 = y2 - y1;
		vx2 = x4 - x3;
		vy2 = y4 - y3;
		if ((vx1!=0 &&vy1!=0) || (vx2!=0 && vy2!=0))
			if (vy1*vx2 == vx1*vy2) cout << "YES\n";
			else cout << "NO\n";
		else cout << "NO\n";
	}
}

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

int main(){
  double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
  int n;
  cin>>n;
  while(n--){
    m1=0;
    m2=0;

    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if(x1!=x2||y1!=y2){m1 =(y2-y1)/(x2-x1);}
    if(x3!=x4||y3!=y4){m2 =(y4-y3)/(x4-x3);}

    if(m1==m2&&m1!=0&&m2!=0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}
  return 0;
}

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

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

C++: #include <iostream>
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((x1-x2) * (y3 - y4) == (y1-y2) * (x3-x4)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

int main(){
	int n;
	double a1,a2,b1,b2,c1,c2,d1,d2;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a1>>a2>>b1>>b2>>c1>>c2>>d1>>d2;
		if(((a1-b1)/(a2-b2))==((c1-d1)/(c2-d2)))cout<<"YWS"<<endl;
		else cout<<"NO"<<endl;
	}

}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n;cin>>n;
	for(;n--;)
	{
		double a,b,c,d,e,f,g,h;cin>>a>>b>>c>>d>>e>>f>>g>>h;
		cout<<(abs((d-b)*(g-e)-(h-f)*(c-a))<1e-10?"YES":"NO")<<endl;
	}
}

C++: #include <bits/stdc++.h>

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) REP (i, 0, n)
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;

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;
		// 対角線の中点で判定
		// double cx1 = (x3 - x1) / 2.0;
		// double cy1 = (y3 - y1) / 2.0;
		// double cx2 = (x4 - x2) / 2.0;
		// double cy2 = (y4 - y2) / 2.0;
		// if (cx1 == cx2 && cy1 == cy2) {
		//  cout << "YES" << endl;
		// } else {
		//  cout << "NO" << endl;
		// }
		// 傾きで判定
		if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
}

C++: #include <iostream>
#include <complex>
#include <cmath>
#include <cstdio>
using namespace std;
typedef complex<double> xy_t;
xy_t P[110];
const double eps = 1e-11;

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


int main(){
	int i,t,n;
	double x,y,area;
	scanf("%d\n",&n);
	for(t=0;t<n;t++){
		for(i=0;i<4;i++){
			scanf("%lf %lf\n",&x,&y);
			P[i]= xy_t(x,y);
		}
		area = cross_product(P[1]-P[0],P[3]-P[2])/2;;
		bool p = abs(area)<eps;
		cout << (p ? "YES" : "NO") << endl;
	}

	return 0;
}

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

ll stoll(string const& s){
    ll res = 0;
    rep(i,s.size()){
        res*=10;
        res+=s[i]-'0';
    }
    return res;
}

ll input(){
    string s; cin>>s;
    size_t p=0;
    int sign = s[0]=='-' ? -1 : 1;
    if(sign==-1) s.erase(s.begin());
    while(p<s.size() && s[p]!='.') p++;
    while(s.size()-p < 6) s += '0';
    s.erase(s.begin()+p);
    dump(s);
    return sign*stoll(s);
}

int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                x[i][j] = input();
                y[i][j] = input();
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        ll dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}

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

int main() {
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  double d1, d2;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if (x2 == x1 && x4 == x3 ){
      cout << "NO" << endl;
    }
    d1 = (y2 - y1) / (x2 - x1);
    d2 = (y4 - y3) / (x4 - x3);
    if (d1 == d2) {
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}