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;
    cin>>n;
    while(n--){
        pair<double,double>a[4];
        for(int i=0;i<4;i++){
            cin>>a[i].first>>a[i].second;
        }
        if((a[1].first-a[0].first)*(a[3].second-a[2].second)-(a[3].first-a[2].first)*(a[1].second-a[0].second)>1e-10)
            cout<<"NO"<<endl;
        else
            cout<<"YES"<<endl;
    }
    return 0;
}

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

int n;

void solve()
{
	long double x[4],y[4],px[2],py[2];


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

	px[0] = x[1] - x[0];
	px[1] = x[3] - x[2];
	py[0] = y[1] - y[0];
	py[1] = y[3] - y[2];



	if(px[0]*py[0] == px[1]*py[1])
		cout << "YES";
	else
		cout << "NO";
	cout << endl;

}

int main(void)
{
	cin >> n;
	for(int i = 0; i < n; i++)
		solve();


	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
signed main(){
int a;
cin>>a;
double c[8];
for(int b=0;b<a;b++){
    for(int d=0;d<8;d++)cin>>c[d];
    if(c[0]==c[2]&&c[4]==c[6])printf("YES\n");
    else if((c[6]-c[4])/(c[7]-c[5])==(c[2]-c[0])/(c[3]-c[1]))printf("YES\n");
    else printf("NO\n");s
    }
}

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\n");
		else printf("NO\n");
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
#define INF 1e+15

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

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(void){
    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;
        if(fabs(x2-x1)<0.00001 && fabs(x4-x3)<0.00001)   cout << "YES" <<endl;
        else{
            if(fabs((y2-y1)/(x2-x1) - (y4-y3)/(x4-x3))<0.00001)  cout << "YES" << endl;
            else cout << "NO" << endl;
        }
 
    }
    return 0;
}

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