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>
#include <complex>
using namespace std;
typedef complex<double> P;
const double EPS = 1e-9;
int main(){
	int N;
	cin >> N;
	while(N--){
		P a,b,c,d;
		cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag() >> d.real() >> d.imag();
		P one = b-a;
		P two = d-c;
		bool f = false;
		f = abs(one.imag()/one.real() - two.imag()/two.real()) < EPS;
		cout << (f?"YES":"NO") << endl;	
	}
}

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

#define pow(a) ((a)*(a))

using namespace std;

int main(void){
    int n;
    while(scanf("%d", &n),n>0){
        double x[4]={0};
        double y[4]={0};

        for(int i = 0; i < 4; i++){
            scanf("%lf %lf",&x[i], &y[i]);
        }

        double a = ((x[0]-x[1])/(y[0]-y[1]));
        double b = ((x[2]-x[3])/(y[2]-y[3]));

        if(a==b)
            puts("YES");
        else
            puts("NO");

    }

    return 0;
}

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

using namespace std;
typedef complex<double> P;

double cross(P a,P b){
  return a.real()*b.imag()-a.imag()*b.real();
}

int main(){
  int n;
  cin >> n;
  while(n--){
    P p[4];
    for(int i=0; i<4; i++)
      cin >> p[i].real() >> p[i].imag();
    if(cross(p[1]-p[0],p[3]-p[2])<1e-10)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}

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

C++: #include <iostream>

using namespace std;
 
int main() 
{
     int n;
    double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
     cin>>n;
     for(int i=0;i<n;i++)
   {
        int p=0;
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        if(x1==x2&&x3==x4){p=1;}
        else if(x1==x2||x3==x4){}
        else if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)){p=1;}
        if(p==1)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
     
    return 0;
}

C++: #include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
#define INF 1<<20

struct edge{
	int to;
	int cost;
	edge() {};
	edge(int a, int b) {
		to = a;
		cost = b;
	}
};

struct Node {
	int pos;
	int cost;
	Node() {};
	Node(int a, int b) {
		pos = a;
		cost = b;
	}
	bool operator <(const Node& rhs) const {
		return cost > rhs.cost;
	}
};

void dijkistra(int st, int TO,int V,vector<vector<edge> > graph) {
	priority_queue<Node> q;
	vector<int> d(V);
	for (int i = 0;i < V;i++) {
		d[i] = INF;
	}
	d[st] = 0;
	q.push(Node(st, 0));
	while (!q.empty()) {
		Node s = q.top(); q.pop();
		int pos = s.pos;
		for (int i = 0;i < graph[pos].size();i++) {
			int to = graph[pos][i].to;
			int cost = graph[pos][i].cost;
			if (d[pos] + cost < d[to]) {
				d[to] = d[pos] + cost;
				q.push(Node(to, d[to]));
			}

		}
	}
	cout << d[TO] << endl;
}
int partition(int A[],int p, int r) {
	int x = A[r];
	int i = p - 1;
	for (int j = p;j < r;j++) {
		if (x >= A[j]) {
			i = i + 1;
			swap(A[i], A[j]);
		}
	}
		swap(A[i + 1], A[r]);
		return i + 1;
}
void quicksort(int A[], int p, int r) {
	if (p < r) {
		int q = partition(A, p, r);
		quicksort(A, p, q-1);
		quicksort(A, q + 1, r);
	}
}

int getNumberOfCoin(int C[],int n,int m) {
	int T[50000];
	for (int j = 0;j <= n;j++) {
		T[j] = INF;
	}
	T[0] = 0;
	for (int i = 0;i < m;i++) {
		for (int j = 0;j <= n;j++) {
			if (j - C[i] >=0  ) {
				T[j] = min(T[j], T[j - C[i]] + 1);
			}
		}
	}
	return T[n];
}
int knapsack(int w, int n,int* v,int* ww) {
	int W[101][10001];
		for (int j = 0;j <= w;j++) {
			W[0][j] = 0;
		}
	for (int i = 0;i < n;i++) {
		for (int k = 0;k < n;k++){
			for (int j = 0;j <= w;j++) {
				if (j - ww[k] < 0) {
					W[i + 1][j] = W[i][j];
				}
				if (j - ww[i] >= 0) {
					W[i + 1][j] = max(W[i][j], W[i][j - ww[k]] + v[k]);

				}
			}
		}
	}
	return W[n][w];
}
int fib(int n) {
	vector<int> v(n+1);
	v[0] = 1;
	v[1] = 1;
	for (int i = 2;i < n+1;i++) {
		v[i] = v[i - 2] + v[i - 1];
	}
	return v[n];
}
int isPrime(int x) {
	if (x <= 1) return false;
	if (x>2 && x % 2 == 0) return false;
	for (int i = 2;i <= sqrt(x);i++) {
		if (x%i == 0) {
			return false;
		}
	}
	if (x == 2) return true;
	return true;
}
int Prime(int x) {
	vector<int> prime(x+1,1);
	int num = 2;
	while (num <= sqrt(x)) {
		for (int i = 2;i <= x / num;i++) {
			prime[num*i] = 0;
		}
		num++;
		while (prime[num] == 0)
			num++;
	}
	int count = 0;
	for (int i = 2;i < x + 1;i++) {
		if (prime[i] == 1) count++;
	}
	return count;
}
int main(){
	double x[4], y[4];
	int n;
	cin >> n;
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < 4;j++) {
			cin >> x[j] >> y[j];
		}
		double X1 = x[1] - x[0];
		double Y1 = y[1] - y[0];
		double X2 = x[3] - x[2];
		double Y2 = y[3] - y[2];
		if (fabs(X1*Y2-X2*Y1)<0.00001) cout << "YES"<<endl;
		else cout << "NO"<<endl;
	}
	

}

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

int main(){

	typedef struct{
		double x, y;
	}_td;

	int n;
	_td p1, p2, p3, p4;
	double r_ab, r_cd, eps;
	eps = 0.000001;
	
	cin >> n;
	
	for(int i=0; i<n; i++){
		cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p4.x >> p4.y;
		
		if(p1.x - p2.x != 0 && p3.x - p4.x != 0){
			r_ab = (p1.y - p2.y) / (p1.x - p2.x);
			r_cd = (p3.y - p4.y) / (p3.x - p4.x);
			if(r_ab == r_cd) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		else if(p1.x - p2.x < eps && p3.x - p4.x < eps){
			cout << "YES" << endl;
		}
		else cout << "NO" << endl;
	}

	return 0;

}

C++: #include <iostream>
#include <cmath>
 
#define EPS (1e5)
#define Eq(a,b) (fabs(a-b) <= EPS) 
 
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);
    double t2 = (y3-y4);
    //cout << t1 << " " << t2 << endl;
    if ( Eq((x1-x2)*t1, (x3-x4)*t2) ) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
    
  return 0;
}

C++: #include<iostream>
using namespace std;
struct point{
  double x,y;
    };
int main(){
  point p[4];
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> p[0].x >> p[0].y>>p[1].x>>p[1].y>>p[2].x>>p[2].y>>p[3].x>>p[3].y;
    if((p[1].y -p[0].y)/(p[3].y-p[2].y) - ((p[1].x-p[0].x)/(p[3].x -p[2].x)) == 0){
	cout << "YES" << endl;
      } else {cout << "NO" << endl;}
      
  }
}

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


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

		if(fabs(value1-value2)<0.00001){
			printf("YES\n");
		}else{
			printf("NO\n");
		}

	}
    return 0;
}