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")
			continue
		}
		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;

#define EPS (1e-9)

double cross_product( double x1, double y1,
					  double x2, double y2 )
{
	return ((x1 * y2) - (x2 * y1));
}

int main( void )
{
	int n;
	while ( 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;

			if (EPS > fabs(cross_product((x2-x1), (y2-y1), (x4-x3), (y4-y3))))
				cout << "YES" << endl;
			else
				cout << "NO" << endl;
		}
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    while(n--)
    {
        float x1,x2,y1,y2,x3,x4,y3,y4;
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        float m1=(y2-y1)/(x2-x1);
        float m2=(y4-y3)/(x4-x3);
        if(m1==m2)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }



    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  
  int n;
  double x1,x2,x3,x4,y1,y2,y3,y4,ans1,ans2;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    
    if(x1==x2){
      if(x3==x4) cout << "YES" << endl;
      else cout << "NO" << endl;
    }
    else if(x3==x4&&x1!=x2) cout << "NO" << endl;
    else if(y1==y2){
      if(y3==y4) cout << "YES" << endl;
      else cout << "NO" << endl;
    }
    else if(y3==y4&&y1!=y2) cout << "NO" << endl;
    else {
      ans1 = (y1-y2)/(x1-x2);
      ans2 = (y3-y4)/(x3-x4);
      
      if(ans1==ans2) cout << "YES" << endl;
      else cout << "NO" << endl;
    }
  }
  
  return (0);
}

C++: #include <iostream>
#include <cmath>
#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(fabs((dx1*dx1 + dx2*dx2)*(dy1*dy1 + dy2*dy2) - dot*dot) < 1e-7) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

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

struct Point
{
    double x;
    double y;
};
struct Line
{
    Line(const Point& a, const Point& b)
    : p1(a), p2(b) {}
    Point p1;
    Point p2;
};
double GetSlope(const Line& line)
{
    return
    (line.p2.y - line.p1.y) /
    (line.p2.x - line.p1.x);
}
bool IsParallel(const Line& l1, const Line&l2)
{
    // std::cerr << GetSlope(l1) << std::endl;
    // std::cerr << GetSlope(l2) << std::endl;
    const double gosa = 1e-10;
    double Slope1 = GetSlope(l1);
    double Slope2 = GetSlope(l2);
    return std::fabs(Slope1 - Slope2) < gosa || std::fabs(Slope1 + Slope2) < gosa;
}
bool IsParallel(const std::vector<Point>& points)
{
    assert(points.size() == 4);
    return IsParallel(Line(points[0], points[1]), Line(points[2], points[3]));
}
std::vector<Point> Input(std::istream& is)
{
    std::vector<Point> points(4);
    for(int i = 0; i < points.size(); ++i){
        is >> points[i].x >> points[i].y;
    }
    return points;
}
int main()
{
    int n;
    std::cin >> n;
    for(int i = 0; i < n; ++i) {
        std::vector<Point> points = Input(std::cin);
        std::cout << (IsParallel(points) ? "YES" : "NO") << std::endl; 
    }
    return 0;
}

C++: #include<iostream>

using namespace std;


int main(){
	
	int n;
	cin >> n;
	
	double x1, y1, x2, y2, x3, y3, x4, y4;
	
	while(n--) {
		
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		
		double a = ( y2 - y1 ) / ( x2 - x1 );
		double b = ( y4 - y3 ) / ( x4 - x3 );
		
		if( a == b)
		cout << "YES\n";
		
		else
		cout << "NO\n";
		
	}
	
    return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main(){
    int mod=1000000007;
    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);
        if (abs((y2-y1)/(x2-x1)-(y4-y3)/(x4-x3))<1e-10) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int n;
    cin >> n;
    rep(j, n)
    {
        double a[8];
        rep(i, 8)
        {
            cin >> a[i];
        }
        double ans = (a[2] - a[0]) * (a[7] - a[5]) - (a[3] - a[1]) * (a[6] - a[4]);
        if (ans < 0.0000001)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}