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<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cmath>
#include<numeric>
using namespace std;


int main(void) {

  int n;
  cin >> n;
  for(int i=0; i<n; i++){
    double x1, y1, x2, y2;
    double x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if( abs((y2-y1)*(x4-x3) - (y4-y3)*(x2-x1)) < 0.000001 ) cout << "YES" << endl;
    else cout << "NO" << endl;
  }

  return 0;
}

C++: #include<iostream>

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

  std::cin >> n;

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

    if((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>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> xy_t;
double dot_product(xy_t a, xy_t b) { return (conj(a) * b).real(); }
double cross_product(xy_t a, xy_t b) { return (conj(a) * b).imag(); }
xy_t projection(xy_t p, xy_t b) { return b * dot_product(p, b) / norm(b); }
int main()
{
	int n;
	double x, y;
	xy_t points[4];
	cin >> n;
	while (n--)
	{
		for (int i = 0; i < 4; i++)
		{
			cin >> x >> y;
			points[i] = xy_t(x, y);
		}
		double area = cross_product(points[1] - points[0], points[3] - points[2]);
		if (abs(area) < 1e-11)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> pint;
#define rep(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

int main(){
	int n;
	cin>>n;
	rep(i,n){
		double x[4],y[4];
		rep(j,4)cin>>x[j]>>y[j];
		if(x[0]==x[1]){
			cout<<(x[2]==x[3]?"YES":"NO")<<endl;
		}else{
			if(x[2]==x[3])cout<<"NO\n";
			else{
				cout<<((y[0]-y[1])/(x[0]-x[1])==(y[2]-y[3])/(x[2]-x[3])?"YES":"NO")<<endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <sstream>
using namespace std;
int main(){
	double a,b,c,d,e,f,g,h;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b>>c>>d>>e>>f>>g>>h;
		if((c-a)/(d-b)==(g-e)/(h-f)){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

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

using namespace std;

int main()
{

    int TestCase;
    cin >> TestCase;

    string Answer[100];

    for(int a = 0; a < TestCase; a++)
    {
            float line1;
            float line2;
            float x1,x2,x3,x4;
            float y1,y2,y3,y4;

            cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

            line1 = (y2-y1)/(x2-x1);
            line2 = (y4-y3)/(x4-x3);

            if (line1 == line2)
            {
                Answer[a] = "YES";
            }
            else
            {
                Answer[a] = "NO";
            }
    }

    for(int b = 0; b < TestCase; b++)
    {
        cout << Answer[b] << endl;
    }



    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                double x_,y_;
                cin >> x_ >> y_;
                x[i][j] = x_*100000 + 1e-10;
                y[i][j] = y_*100000 + 1e-10;
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        ll dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}

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

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double a1,a2;
	int n,i;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&x2,&x3,&x4,&y1,&y2,&y3,&y4);
		
		if(((y1-y2)*(x3-x4))==((y3-y4)*(x1-x2)))printf("YES\n");
		else printf("NO\n");
	}
return 0;
}

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

int main() {
	int n;
	for (cin >> n; n; n--) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		cout << (((y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4)) ? "YES" : "NO") << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
const double eps = 1e-9;
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++: #include <bits/stdc++.h>
#include <vector>
using namespace std;
double x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4, a, b, x;
double gradien(double x_1, double y_1, double x_2, double y_2){
	double m = 0;
	m = (y_1 - y_2)/(x_1 - x_2);
	
	return m;
}
int main(){
	cin >> x;
	for(int i = 1; i <= x; i++){
		cin >> x_1 >> y_1 >> x_2 >> y_2 >> x_3 >> y_3 >> x_4 >> y_4;
		a = gradien(x_1, y_1, x_2, y_2);
		b = gradien(x_3, y_3, x_4, y_4);
		if(a == b){
			if(i == x)
				cout << "YES";
			else
				cout << "YES\n";
		}
		else{
			if(i == x)
				cout << "NO";
			else
				cout << "NO\n";
		}
	}
	return 0;
}