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)
		}
		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;
    double x[4],y[4];
    cin>>n;
    for(;n--;){
        for(int i=0;i<4;i++){
            cin>>x[i];
            cin>>y[i];
        }
        if((x[0]-x[1])*(y[2]-y[3])==(x[2]-x[3])*(y[0]-y[1])){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}

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

double abs_(double a)
{
	if (a > 0) return a;
	else return -a;
}

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 a = (y2 - y1)*(x4 - x3);
		double b = (y4 - y3)*(x2 - x1);
		if (abs_(a - b) < 0.0000001){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

typedef struct myvector{
  double x;
  double y;
}Vector;

Vector sub_vector(Vector& a, Vector& b)
{
  Vector ret;
  ret.x = b.x - a.x;
  ret.y = b.y - a.y;
  return ret;
}

int cross_product(Vector& a, Vector& b)
{
  return int(a.x * b.y * 10000)  - int(b.x * a.y * 10000);
}

int main()
{
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    Vector A, B, C, D;
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> D.x >> D.y;
    Vector AB = sub_vector(A, B);
    Vector CD = sub_vector(C, D);
    if(cross_product(AB, CD) == 0)
      cout << "YES" << endl;
    else 
      cout << "NO" << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)

double x[4], y[4];
int main(void){
    double eps = 1e-10;
    int n;
    cin >> n;
    rep(data, n) {
        rep(i, 4) cin >> x[i] >> y[i];
        if(abs((y[1]-y[0])/(x[1]-x[0]) - (y[3]-y[2])/(x[3]-x[2])) < eps) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

C++: #include <stdio.h>
#define EPSIRON (1.0e-30)

int main(void){
    int n;
    double x1, x2, x3, x4, dx1, dx2;
    double y1, y2, y3, y4, dy1, dy2;
    double cp; // cross product
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
        scanf("%lf %lf %lf %lf", &x3, &y3, &x4, &y4);
        dx1 = x2 - x1;
        dy1 = y2 - y1;
        dx2 = x4 - x3;
        dy2 = y4 - y3;
        cp = dx1 * dy2 - dy1 * dx2;
        printf("%s\n", cp < EPSIRON ? "YES" : "NO");
    }
    
    return 0;
}

C++: #include <iostream>

int main() {
    int n;
    std::cin >> n;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    
    for(int i = 0;i < n;i++){
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        double a = (y1-y2)/(x1-x2);
        double b = (y3-y4)/(x3-x4);
         std::cout <<  (a==b ? "YES":"NO") << '\n';
    }
}

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

using namespace std;

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

C++: #include <stdio.h>

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

// テ」ツδ凖」ツつッテ」ツδ暗」ツδォa, bテ」ツ?ョテ・ツ、ツ姪ァツゥツ催」ツ?ョテ・ツ、ツァテ」ツ?催」ツ?陛」ツつ津ヲツアツづ」ツつ?」ツつ凝」ツ??
double cross(point a, point b) {
  return a.x * b.y - a.y * b.x;
}

int main() {
  int Tc, tc;
  point A, B, C, D;
  scanf("%d", &Tc);
  for(tc = 0; tc < Tc; ++tc) {
    scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
          &A.x, &A.y, &B.x, &B.y, &C.x, &C.y, &D.x, &D.y);
    point va, vb;
    va.x = B.x - A.x;
    va.y = B.y - A.y;
    vb.x = D.x - C.x;
    vb.y = D.y - C.y;
    // テ」ツδ凖」ツつッテ」ツδ暗」ツδォa, bテ」ツ?ョテ・ツ、ツ姪ァツゥツ催」ツ?ョテ・ツ、ツァテ」ツ?催」ツ?陛」ツ?? テ「ツ??テ」ツδ凖」ツつッテ」ツδ暗」ツδォa, bテ」ツ?ッテ・ツケツウティツ。ツ?
    if(cross(va, vb) == 0.0) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
	int n;
	double x1,y1,x2,y2,x3,y3,x4,y4;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double a,b,c,d;
		a=sqrt(pow(x2-x1,2)+pow(y2-y1,2));
		b=sqrt(pow(x3-x1,2)+pow(y3-y1,2));
		c=sqrt(pow(x4-x3,2)+pow(y4-y3,2));
		d=sqrt(pow(x4-x2,2)+pow(y4-y2,2));
		if(a==c&&b==d){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main()
{
    int N;
	cin>>N;
	while(N--){
		bool ans;
		double x1,y1,x2,y2,x3,y3,x4,y4;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double a,b;
		if(x1==x2){
			x3==x4?ans=true:ans=false;
		}else if(x3==x4){
			ans=false;
		}else{
			a=(double)(y1-y2)/(x1-x2);
			b=(double)(y3-y4)/(x3-x4);
			a==b?ans=true:ans=false;
		}
		ans?puts("YES"):puts("NO");
	}
    return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> n;
	for (int z = 0; z < n; z++) {
		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;
	}
}

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

const double EPS = 1E-15;

inline bool cmp(double x, double y){
  return abs(x-y) < EPS;
}

int main(){
  int n;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  cin>>n;
  for(int i=0; i<n; i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    double s=(x1-x2)*(y3-y4), t=(y1-y2)*(x3-x4);
      if(cmp(s, t)) cout << "YES" << endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

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

using namespace std;

int main(void){
	int n;
	float x[2],y[2];
	pair<float,float> v[2];

	cin >> n;
	for(int i=0;i<n;i++){
		for(int j=0;j<2;j++){
			cin >> x[0] >> y[0] >> x[1] >> y[1];
			v[j]=make_pair(x[0]-x[1],y[0]-y[1]);
		}
		cout << (v[0].first*v[1].second-v[0].second*v[1].first?"NO":"YES") << endl;
	}
		
	return 0;
}

C++: #include <iostream>
using namespace std;
int n;
double xa,xb,xc,xd,ya,yb,yc,yd,ta,tb,tc,td;
int main(){
	int i;
	while(cin >> n){
		for(i=0;i<n;i++){
			cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;
			ta = xb - xa;
			tb = yb - ya;
			tc = xd - xc;
			td = yd - yc;
			if(tb == td && ta == tc) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	}
	return 0;
}

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

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

 	return 0;
}