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 <stdio.h>

int main(void){
  int i, j, n;
  double d[4], x[4], y[4];

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    for(j = 0; j < 4; j++){
      scanf("%lf%lf", &x[j], &y[j]);
    }
    d[0] = x[1]-x[0];
    d[1] = y[1]-y[0];
    d[2] = x[3]-x[2];
    d[3] = y[3]-y[2];
    if(d[0]*d[3] == d[1]*d[2]){
      printf("YES\n");
    }else{
      printf("NO\n");
    }
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
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;
        int ax = x1 * 100000 - x2 * 100000;
        int ay = y1 * 100000 - y2 * 100000;
        int bx = x3 * 100000 - x4 * 100000;
        int by = y3 * 100000 - y4 * 100000;
        cout << (ax * by == ay * bx ? "YES" : "NO") << endl;
    }
    return 0;
}

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

int main()
{
  double x1, x2, x3, x4, y1, y2, y3, y4;
  int n;

  cin >> n;

  for (int i = 0; i < n; i++){
    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++: #include<iostream>
using namespace std;
int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4,lI,lII;
  cin >> n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    cout << ((y2-y1)/(x2-x1) - (y4-y3)/(x4-x3) < 1e-10 ? "YES" : "NO") << endl;
  }
}

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

using namespace std;

struct Point {
    double x, y;
};

int main() {
    int n;
    cin >> n;
    while (n--) {
        Point p[4];
        for (int i = 0; i < 4; i++) {
            cin >> p[i].x >> p[i].y;
        }
        double div1 = (p[1].y - p[0].y) / (p[1].x - p[0].x);
        double div2 = (p[3].y - p[2].y) / (p[3].x - p[2].x);
        if (div1 == div2) {
            cout << "YES\n";
        }
        else {
            cout << "NO\n";
        }
    }
    
    return 0;
}

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<<(fabs((d-b)*(g-e)-(h-f)*(c-a))<1e-6?"YES":"NO")<<endl;
	}
}

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);
		b1 = y1 - (x1 * a1);
		a2 = (y3 - y4) / (x3 - x4);
		b2 = y3 - (x3 * a2);
		if (a1 == a2 && b1 != b2)
			printf("YES");
		else
			printf("NO");
	}
}

C++: #include <iostream>
using namespace std;
int main()
{
	int n; cin >> n ;
	double x[4],y[4];
	while(n--)
	{
		for(int i=0;i<4;i++) cin >> x[i] >> y[i] ;
		double vx[2],vy[2];
		for(int i=0;i<2;i++) vx[i]=x[2*i+1]-x[2*i], vy[i]=y[2*i+1]-y[2*i];
		bool failed=false;
		for(int i=0;i<2;i++) if(!vx[i] && !vy[i]) failed=true;
		if(failed) cout << "NO" << '\n';
		else if(vx[0]*vy[1]==vy[0]*vx[1]) cout << "YES" << '\n' ;
		else cout << "NO" << '\n' ;
	}
}

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

C++: #include <iostream>

using namespace std;

int main() {
	double x[4], y[4];
	double ab, cd;
	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];
		ab = cd = 999999;
		if (x[0] != x[1])
			ab = (y[1] - y[0]) / (x[1] - x[0]);
		if (x[2] != x[3])
			cd = (y[3] - y[2]) / (x[3] - x[2]);
		if (ab == cd)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int maxn=10000000;
bool is_prime[maxn];
int solve1(int n){
	for(int i=0;i<=n;i++)is_prime[i]=true;
	int ans=0;
	for(int i=2;i<=n;i++){
		if(is_prime[i]){
			ans++;
			for(int j=i*2;j<=n;j+=i)is_prime[j]=false;
		}
	}
	return ans;
}



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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>
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];
  }
  //傾きの求め方 yの増加量/xの増加量
  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>
#include<cmath>
using namespace std;
#define EPS 1e-10
double x1,y1,x2,y2,x3,y3,x4,y4;
int det(){
	double dx1,dy1,dx2,dy2;
	dx1 = x1-x2;
	dy1 = y1-y2;
	dx2 = x3-x4;
	dy2 = y3-y4;
	return dx1*dy2 - dy1*dx2;
}
int main(){
	int n;
	cin>>n;
	while(n--){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		cout<<(fabs(det())<EPS?"YES":"NO")<<endl;
	}
	return 0;
}

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

using namespace std;

typedef complex<double> Point;

int main() {
    int N;
    cin >> N;
    while(N--) {
        Point ps[4];
        for(int i = 0; i < 4; ++i) cin >> ps[i].real() >> ps[i].imag();
        Point v1 = ps[1]-ps[0], v2 = ps[3]-ps[2];
        double dot = v1.real()*v2.real() + v1.imag()*v2.imag();
        double n = norm(v1) * norm(v2);
        if(abs(dot*dot - n) < 1e-6) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

C++: #include <stdio.h>

int main(){
    int n;
    double x[5],y[5];
    int i,j;
    scanf("%d",&n);
    for(j=0;j<n;j++){
        for(i=1;i<5;i++)scanf("%lf %lf",&x[i],&y[i]);
        if(x[2]*y[3]-x[2]*y[4]-x[1]*y[3]+x[1]*y[4]-x[3]*y[2]+x[4]*y[2]+x[3]*y[1]-x[4]*y[1]){
            printf("NO\n");
        }else{
            printf("YES\n");
        }
    }
}

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

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double yoko1,yoko2,tate1,tate2;
	int ans[100]={0};
	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);
	yoko1=(x1-x3)*(x1-x3);
	yoko2=(x2-x4)*(x2-x4);
	tate1=(y1-y3)*(y1-y3);
	tate2=(y2-y4)*(y2-y4);
	
	if(sqrt(yoko1+tate1)==sqrt(yoko2+tate2))ans[i]=1;
	else ans[i]=0;
	}
	
	for(i=0;i<n;i++){
		if(ans[i]==1)printf("YES\n");
		else printf("NO\n");
	}
return 0;
}