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 <cstdio>
#include <queue>
#include <algorithm>
#include <cmath>

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

using namespace std;

int n;
double x[4];
double y[4];

int main(){
	scanf("%d", &n);
	rep(i, n){
		rep(j, 4){
			scanf("%lf%lf", x + j, y + j);
		}

		double dx[2];
		double dy[2];
		dx[0] = x[0] - x[1];
		dx[1] = x[2] - x[3];
		dy[0] = y[0] - y[1];
		dy[1] = y[2] - y[3];

		// printf("(%lf, %lf) (%lf, %lf)\n", dx[0], dy[0], dx[1], dy[1]);

		printf("%s\n", fabs(dx[0] * dy[1] - dx[1] * dy[0]) < 1e-9 ? "YES" : "NO");
	}
	return 0;
}

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

int main(){
  int n = 0;
  cin >> n;
  for(int i=0;i<n;i++){

    double x1 = 0.0;
    double y1 = 0.0;
    double x2 = 0.0;
    double y2 = 0.0;
    double x3 = 0.0;
    double y3 = 0.0;
    double x4 = 0.0;
    double y4 = 0.0;

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

    double a = (y2 - y1) / (x2 - x1);
    double b = (y4 - y3) / (x4 - x3);
    double c = (y3 - y4) / (x3 - x4);
    if(a == b || a == c){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
  double a,b,c,d,e,f,g,h;
  int t;

  cin >> t;
  while(t--){
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    
    c -= a,d -= b,g -= e,h -= f;
    
    cout << (c*g-d*h ? "NO" : "YES") << endl;
  }
  
  return 0;
}

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

int main() {
  // ifstream cin("../test.txt");
  int n;
  cin >> n;
  while (n--) {
    double x[4], y[4];
    for (int i = 0; i < 4; i++) {
      cin >> x[i] >> y[i];
    }
    // if((x2-x1)*(y4-y3)==(x4-x3)*(y2-y1))cout<<"YES"<<endl;
    double d = (x[1] - x[0]) * (y[3] - y[2]) - (x[3] - x[2]) * (y[1] - y[0]);
    if ((x[1] - x[0]) * (y[3] - y[2]) == (x[3] - x[2]) * (y[1] - y[0])) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;


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

const double EPS = 1e-6;
const double INF = 100000000;




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

    return 0;
}

C++: #include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)
class Point{
  public:
  double x,y;
  Point(double x=0,double y=0):x(x),y(y){}
  Point operator + (Point p){return Point(x+p.x,y+p.y);}
  Point operator - (Point p){return Point(x-p.x,y-p.y);}
  Point operator * (double a){return Point(a*x,a*y);}
  Point operator / (double a){return Point(x/a,y/a);}
  bool operator < (const Point &p) const{
    return x!=p.x?x<p.x:y<p.y;
  }
  bool operator == (const Point &p) const{
    return fabs(x-p.x)<EPS&&fabs(y-p.y)<EPS;
  }
};
struct seg{Point p1,p2;};
//??????
double dot(Point a,Point b){
  return a.x*b.x+a.y*b.y;
}
//??????
double cross(Point a,Point b){
  return a.x*b.y-a.y*b.x;
}
//??´?????????
bool C90(seg s1,seg s2){
  return equals(dot(s1.p2-s1.p1,s2.p2-s2.p1),0.0);
}
bool C0(seg s1,seg s2){
  return equals(cross(s1.p2-s1.p1,s2.p2-s2.p1),0.0);
}


main(){
  int n;
  cin>>n;
  while(n--){
    seg a,b;
    cin>>a.p1.x>>a.p1.y>>a.p2.x>>a.p2.y;
    cin>>b.p1.x>>b.p1.y>>b.p2.x>>b.p2.y;
    if(C0(a,b))cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
}

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

const double eps=1e-8;

int main(){
	int n;
	scanf(" %d", &n);
	for(int i=0; i<n; ++i){
		double x[4], y[4];
		for(int j=0; j<4; ++j) scanf(" %lf %lf", &x[j], &y[j]);
		
		double dx1=x[1]-x[0], dx2=x[3]-x[2], dy1=y[1]-y[0], dy2=y[3]-y[2];
		bool ans=true;
		if(dx1==0){
			if(dx2!=0) ans=false;	
		}
		else{
			double a=dx2/dx1, b=dy2/dy1;
			if(fabs(a-b)>eps) ans=false; 
		}
		
		if(ans) printf("YES\n");
		else printf("NO\n");
	}
}

C++: #include <cstdio>

int main(void)
{
    double x1, y1, x2, y2, x3, y3, x4, y4;
    double m1, m2;
    
    int n;
    scanf("%d", &n);
    while (n != 0){
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
        m1 = (y2 - y1) / (x2 - x1);
        m2 = (y4 - y3) / (x4 - x3);
        (m1 == m2) ? printf("YES\n") : printf("NO\n");
        n--;
    }
    
    return (0);
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

struct Vector2D
{
	float x, y;

	Vector2D()
	{

	}

	Vector2D(Vector2D v0, Vector2D v1)
	{
		this->x = v1.x - v0.x;
		this->y = v1.y - v0.y;
	}
};

float outer(Vector2D a, Vector2D b)
{
	return a.x * b.y - a.y * b.x;
}

int main()
{
	int n;
	for (cin >> n; n--;)
	{
		vector<Vector2D> p(4);

		for (int i = 0; i < 4; i++)
		{
			cin >> p.at(i).x >> p.at(i).y;
		}

		Vector2D ab = Vector2D(p.at(0), p.at(1));
		Vector2D cd = Vector2D(p.at(2), p.at(3));

		if (outer(ab, cd) == 0)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
 
signed main(){
int a;
cin>>a;
double c[8];
for(int b=0;b<a;b++){
    for(int d=0;d<8;d++)scanf("%lf",&c[d]);
    if(c[0]==c[1]&&c[2]==c[3])printf("YES\n");
    else if((c[2]-c[0])/(c[3]-c[1])==(c[6]-c[4])/(c[7]-c[5]))printf("YES\n");
    else printf("NO\n");
    }
}

C++: #include <iostream>

int main(){
	double x1,y1,x2,y2,x3,y3,x4,y4;
	int n;
	std::cin >> n;
	for(int i=0 ; i<n ; ++i){
		std::cin >>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		bool parallel=false;
		if(x1==x2 && x3==x4) {
			parallel=true;
		}
		else if(x1==x2 || x3==x4) {
		}
		else if ((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)) {
			parallel=true;
		}
		std::cout << ( parallel ? "YES" : "NO") << std::endl;
	}
	return 0; 
}