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;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    cin >> n;
    while(n--){
        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++: #include <stdio.h>

int main()
{
	int num ;
	double ax, ay, bx, by, cx, cy, dx, dy ;

	scanf("%d",&num) ;
	for( int i = 0 ; i < num ; i ++ )
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", ax , ay , bx , by , cx , cy , dx , dy ) ;

		if( ((by-ay)/(bx-ax)) == ((dy-cy)/(dx-cx)) ) printf("YES\n") ;
		else printf("NO\n") ;
	}
	return 0;
}

C++: #include<stdio.h>

int main(void)
{
	double a[2]={0},b[2]={0},c[2]={0},d[2]={0},x1,x2,y1,y2;
	int i;
	scanf("%d",&i);//繰り返す回数の入力

	while(i!=0)
	{
		scanf("%f %f %f %f %f %f %f %f",&a[0],&a[1],&b[0],&b[1],&c[0],&c[1],&d[0],&d[1]);//入力した数の読み込み
		x1 = b[0]-a[0];   y1 = b[1]-a[1];//傾きを求めるのに必要な数を求める
		x2 = d[0]-c[0];   y2 = d[1]-c[1];
		if(x1==0 && x2==0)//傾き0のときは０で割ることができないため
			printf("YES\n");
		else if(x1==0 || x2==0)//片方が傾き0のとき
			printf("NO\n");
		else if(y1/x1 == y2/x2)//傾きが等しい＝平衡
			printf("YES\n");
		else //傾きが等しくない＝平衡ではない
			printf("NO\n");

		i-=1;
	}
 return 0;
}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
const double eps=1e-9;
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;

signed 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)/(x2-x1),b=(y4-y3)/(x4-x3);
    cout<<(abs(a-b)<eps?"YES":"NO")<<endl;
  }
  return 0;
}

C++: #include <iostream>

struct Point {
	double x;
	double y;
};

int main(void)
{
	struct Point p[4];
	int n;
	std::cin >> n;
	for(int j=0; j<n; j++){
	for(int i=0; i<4; i++)
		std::cin >> p[i].x >> p[i].y;
	double t1,t2;
	if( (p[1].y-p[0].y)/(p[1].x-p[0].x) == (p[3].y-p[2].y)/(p[3].x-p[2].x) )
		std::cout << "YES" << std::endl;
	else
		std::cout << "NO" << std::endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

typedef complex<double> P;
struct Line : public vector<P>
{
  Line(P a=P(), P b=P()) {
    push_back(a); push_back(b);
  }
};

double cross(P const& a, P const& b) {
  return imag(conj(a)*b);
}

bool is_parallel(Line const& s, Line const& t) {
  return abs(cross(s[1]-s[0], t[1]-t[0])) < 1e-7;
}

int main() {
  int N; cin >> N;
  rep(tc, 2) {
    P ps[4]; rep(i, 4) cin >> ps[i].real() >> ps[i].imag();
    cout << (is_parallel(Line(ps[0], ps[1]), Line(ps[2], ps[3])) ? "YES\n" : "NO\n");
  }
}

C++: #include<iostream>
using namespace std;
int main(){
  double a[2],b[2],c[2],d[2];
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a[0] >> a[1] >> b[0] >> b[1] >> c[0] >> c[1] >> d[0] >> d[1];
    if((b[1]-a[1])/(b[0]-a[0])==(d[1]-c[1])/(d[0]-c[0])) cout << "YES" << endl;
    else cout << "NO" << endl;
  }   
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

int main(void){
	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 dx1 = x2 - x1;
		double dy1 = y2 - y1;
		double dx2 = x4 - x3;
		double dy2 = y4 - y3;
		double dot = (dx1 * dx2 + dy1 * dy2);
		if((dx1*dx1 + dx2*dx2)*(dy1*dy1 + dy2*dy2) - dot*dot < 1e-7) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <complex>
#include <vector>
#include <cmath>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

typedef complex<double> P;
typedef vector<P> VP;
const double EPF = 1e-4;

#define X real()
#define Y imag()
#define EQ(x,y) (abs(x-y) < EPF)

double dot(P a, P b) {
  return (conj(a)*b).X;
}
double cross(P a, P b) {
  return (conj(a)*b).Y;
}
double distPP(P a, P b) {
  return sqrt(dot(a-b,a-b));
}
P crosspoint(P a, P b, P c, P d) {//ac , bd
  double d1 = cross(d-b,b-a);
  double d2 = cross(d-b,c-a);
  if(EQ(d1,0) & EQ(d2,0)) return a;
  if(EQ(d2,0)) return a;
  return a + (c-a)*d1/d2;
}
P normal_vector(P a) {
  P b(-a.Y, a.X);
  return b;
}
P polar(double r, double theta) {
  P a(r*cos(theta),r*sin(theta));
  return a;
}

int main() {
  int n;
  scanf("%d",&n);
  REP(i,n) {
    double x,y;
    P a,b,c,d;
    scanf("%lf %lf", &x, &y);
    a = P(x,y);
    scanf("%lf %lf", &x, &y);
    b = P(x,y);
    scanf("%lf %lf", &x, &y);
    c = P(x,y);
    scanf("%lf %lf", &x, &y);
    d = P(x,y);
    
    if(EQ(cross(a-b, c-d),0))printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

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);
       if(k1==k2) cout<<"YES"<<endl;
       else cout<<"NO"<<endl;     
           
   }
   //while(1);      
   return 0;    
 }

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
  double x1,x2,x3,x4;
  double y1,y2,y3,y4;
  int n;
  cin >> n;
  while(n--){
    cin >> x1>> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
  if(abs((x2 - x1)*(x4 - x3) - (y2 - y1)*(y4 - y3)) < 10e-10) cout << "YES"<<endl;
  else cout << "NO" << endl;
}
  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
const double eps = 1e-18;
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;
        x1 -= x2;
        y1 -= y2;
        x3 -= x4;
        y3 -= y4;
        if (abs(x1) < eps and abs(y1) < eps) { cout << "NO" << endl; continue; }
        if (abs(x3) < eps and abs(y3) < eps) { cout << "NO" << endl; continue; }
        cout << (abs(x1 * y3 - y1 * x3) < eps ? "YES" : "NO") << endl;
    }
    return 0;
}

C++: for i in range(int(input())):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    det = abs((y1-y2) * (x3-x4) - (x1-x2) * (y3-y4))
    if det<1e-12 :
        print("YES")
    else:
        print("NO")