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>
#include<cmath>
using namespace std;
int main(){
	int n;
	cin >> n;
	while(n--){
		double x[4], y[4], p1 ,p2;
		for(int i = 0; i < 4; i++) cin >> x[i] >> y[i];
		p1 = (y[1] - y[0]) / (x[1] - x[0]);
		p2 = (y[3] - y[2]) / (x[3] - x[2]);
		if(abs(p1 - p2) < 1e-5) cout << "YES" << endl;
		else cout << "NO" << endl;	
	}
}

C++: #include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define fori(i,k,n) for(int i=k;i<n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
/*
(char)'1' - (int)48 = (int)1; 


*/


int main()
{
	int n;
	cin >> n;
	while (n--){
		double x[4], y[4];
		rep(i, 4)cin >> x[i]>>y[i];
		rep(i, 4)
		{
			x[i] += 3.51;
			y[i] += 3.51;;

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

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

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
    int n;
    double x1,x2,x3,x4,y1,y2,y3,y4;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
 
 
    double a,b;
    a=(y2-y1)/(x2-x1);
    b=(y4-y3)/(x4-x3);
    (a==b)? cout<<"YES"<<endl : cout<<"NO"<<endl;
    }
    return 0;
}

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

using namespace std;

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

	cin >> n;

	for(i=0;i<n;i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

		dega = (y2 - y1) / (x2 - x1);
		degb = (y4 - y3) / (x4 - x3);
	
		if(fabs(dega - degb) < 1.0e-10){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

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

using namespace std;

int main()
{
	int i,num;
	float x[4],y[4];
	cin >> num;

	for ( i = 0 ; i< num; i++ ) {
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

		if( fabs( (x[0]-x[1])*(y[2]-y[3]) - (y[0]-y[1])*(x[2]-x[3]) ) < 1e-10 ){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>

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

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





}

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

const double eps = 1e-10;

int n;
//math.hライブラリでy1, y2...とかって変数名が使われてるらしい
double ix1, ix2, ix3, ix4;
double iy1, iy2, iy3, iy4;

//増加率を見る方法
int solve1() {
    double r1 = (iy2-y1)/(ix2-ix1);
    double r2 = (iy4-y3)/(ix4-ix3);
    return (fabs(r1-r2) < eps)
}

int main() {
    scanf("%d", &n);
    for(int i=0; i<n; ++i) {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &ix1, &iy1, &ix2, &iy2, &ix3, &iy3, &ix4, &iy4);

        if(solve1()) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }
}

C++: #include <iostream>
using namespace std;
int main()
{
	double x[4], y[4];
	int n;
	cin >> n;
	while (n--) {
		for (int i = 0; i < 4; ++i) cin >> x[i] >> y[i];
		double A1 = y[1] - y[0];
		double B1 = x[0] - x[1];
		double C1 = A1 * x[0] + B1 * y[0];
		double A2 = y[3] - y[2];
		double B2 = x[2] - x[3];
		double C2 = A1 * x[2] + B1 * y[2];
		if (A1 * B2 - A2 * B1 == 0)
			cout << "YES";
		else
			cout << "NO";
		cout << endl;
	}
	return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    double x1, y1, x2, y2, x3, y3, x4, y4;
    scanf(
        "%lf %lf %lf %lf %lf %lf %lf %lf",
        &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);

    double v1x = x1 - x2, v1y = y1 - y2;
    double v2x = x3 - x4, v2y = y3 - y4;
    if (v1x * v2x < 0 && v1y * v2y < 0) {
      v2x *= -1;
      v2y *= -1;
    }
    double z1 = sqrt(v1x * v1x + v1y * v1y);
    v1x /= z1;
    v1y /= z1;
    double z2 = sqrt(v2x * v2x + v2y * v2y);
    v2x /= z2;
    v2y /= z2;

    puts(
        abs(sqrt(v1x * v2x + v1y * v2y) - 1.0) < 0.000001 ? "YES" : "NO");
  }

  return 0;
}

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

int main(){
	int N;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double dx1, dy1, dx2, dy2;
	
	cin >> N;
	
	for(int i = 0; i < N; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		dx1 = x2 - x1; dy1 = y2 - y1;
		dx2 = x4 - x3; dy2 = y4 - y3;
		if(dy1 / dx1 == dy2 * dx2) cout << "YES" << endl;
		else cout << "NO" << endl;
		
		//cout << dx1 * dy2 << " " << dx2 * dy1 << endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <complex>

using namespace std;

int main()
{
	int n;
	double x[4],y[4];

	cin>>n;

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

	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
#define EPS 1e-10

int main(){
  int n;
  double x1,x2,x3,x4,y1,y2,y3,y4;
  cin >> n;
  while(n--){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if(abs((x4-x3)*(y2-y1) - (x2-x1)*(y4-y2)) < EPS) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 double abs(double x)
 {
   if(x<0) return -x;
   else return x;       
 }
  
 int main()
 {
   double x1,y1,x2,y2,x3,y3,x4,y4;
   int n;
   cin>>n;
   while(n--)
   {
     cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    
       double k1=(y2-y1)/(x2-x1);
       double k2=(y4-y3)/(x4-x3);
       double judge=(x2-x1)*(y4-y3)-(y2-y1)*(x4-x3);
       if((abs(judge)<0.000000000001)) cout<<"YES"<<endl;
       else cout<<"NO"<<endl;     
           
   }
   //while(1);      
   return 0;    
 }