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 "bits/stdc++.h"
using namespace std;
using ll = long long;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double pi = acos(-1);
const double EPS = 1e-10;

double cross(pair<double,double> c,pair<double,double> d){
  return c.first * d.second - d.first * c.first;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<pair<double,double>> a(4);
  int n;
  pair<double,double> lineab, linecd;
  cin >> n;
  REP(i,n){
    REP(j,4){
      cin >> a[j].first >> a[j].second;
    }
    lineab.first = a[1].first - a[0].first;
    linecd.first = a[3].first - a[2].first;
    lineab.second = a[1].second - a[0].second;
    linecd.second = a[3].second - a[2].second;
    if (abs(cross(lineab,linecd)) < EPS) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  
  
  return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
  int N;
  cin >> N;
  double x1, y1, x2, y2, x3, y3, x4, y4;
  for (int i = 0; i < N; i++) {
    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;
    if (dy1/dx1 == dy2/dx2) {
      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-3;

#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++: // Volume0 - 0021: Parallelism
#include <iostream>
#include <complex>
#include <cmath>
using namespace std;
 
// 外積のスカラーを返す
double cross(complex<double> z1, complex<double> z2) {
    return (z1.real()*z2.imag() - z1.imag()*z2.real());
}
 
int main(int argc, char** argv) {
    static const double EPS = 1e-10;
    int n;
    cin >> n;
    for(int i=0; i<n; i++) {
        double x[4], y[4];
        for(int j=0; j<4; j++) {
            cin >> x[j] >> y[j];
        }
        complex<double> ab(x[1]-x[0], y[1]-y[0]);
        complex<double> cd(x[3]-x[2], y[3]-y[2]);
        if(abs(cross(ab, cd)) < EPS) { // 外積が0なら平行
            cout << "YES" << endl;
        }else {
            cout << "NO" << endl;
        }
    }
}

C++: #include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
int n;
double ax,ay,bx,by,cx,cy,dx,dy;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>ax>>ay>>bx>>by>>cx>>cy>>dx>>dy;
		if((ax-bx)*(cy-dy)==(ay-by)*(cx-dx))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

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

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  const double e = 1e-10;

  std::cin >> n;

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

    if(std::fabs((x1*y3+x2*y4+y2*x3+y1*x4)-(x2*y3+x1*y4+y1*x3+y2*x4))<e){
      std::cout << "YES" << std::endl;
    }else{
      std::cout << "NO" << std::endl;
    }
  }
}

C++: #include <iostream>

template <typename T>
struct Vector
{
    T x , y;

    auto operator - (Vector v) -> Vector
    {
        return Vector <T> {x - v.x , y - v.y};
    }
    auto cross (Vector v) -> T
    {
        return x * v.y - y * v.x;
    }
};

auto equal0 (double v) -> bool
{
    constexpr auto esp = 1e-10;
    return -esp < v && v < esp;
}

auto main () -> int
{
    int n;
    std::cin >> n;
    for (auto i = 0; i < n; ++ i)
    {
        Vector <double> A , B , C , D;
        std::cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> D.x >> D.y;
        auto AB = B - A;
        auto CD = D - C;
        auto d = AB.cross (CD);
        std::cout << (equal0 (d) ? "YES" : "NO") << std::endl;
    }
}

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

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

	cin >> num ;
	for( int i = 0 ; i < num ; i ++ )
	{
		cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy ;

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

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

using namespace std;

int main()
{
	double x1,x2,x3,x4,y1,y2,y3,y4,rad1,rad2,rad_1,rad_2;
	int n,i;
	
	cin >> n ;
	
	for(i=0;i<n;i++)
	{
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4 ;
		
		rad1=atan((x2-x1)/(y2-y1));
		rad2=atan((x4-x3)/(y4-y3));
		rad_1=atan((x1-x2)/(y1-y2));
		rad_2=atan((x3-x4)/(y3-y4));
		
		if(rad1==rad2 || rad_1==rad_2)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

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

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

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 || cross_product(AB, CD) < 0)
      cout << "NO" << endl;
    else 
      cout << "YES" << endl;
  }
}