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[1] == fpoints[3] {
			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 <complex>
#include <cmath>

using namespace std;

typedef complex<double> Point;

bool parallel(const Point &v1, const Point &v2) {
    return abs(v1.real()*v2.imag() - v1.imag()*v2.real()) < 1e-10;
}

int main() {
    int N;
    cin >> N;
    while(N--) {
        Point ps[4];
        for(int i = 0; i < 4; ++i) cin >> ps[i].real() >> ps[i].imag();
        Point v1 = ps[1]-ps[0], v2 = ps[3]-ps[2];

        if(parallel(v1, v2)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

C++: #include<cstdio>
#include<cmath>
struct Point
{
	double x,y;
};
int main(void)
{
	int num;
	Point a,b,c,d;
	scanf("%d",&num);
	for(int f1=0;f1<num;f1++)
	{
		scanf("%lf %lf",&a.x,&a.y);
		scanf("%lf %lf",&b.x,&b.y);
		scanf("%lf %lf",&c.x,&c.y);
		scanf("%lf %lf",&d.x,&d.y);
		Point vec1,vec2;
		vec1.x=b.x-a.x;vec1.y=b.y-a.y;
		vec2.x=d.x-c.x;vec2.y=d.y-c.y;
		if((int)atan2(vec1.y,vec1.x)==(int)atan2(vec2.y,vec2.x))
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>

using namespace std;

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;
		if((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

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

int judge(double a1,double a2,double b1,double b2,double c1,double c2,double d1,double d2);

int main(){
	int n;
	double a1,a2,b1,b2;
	double c1,c2,d1,d2;
	
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a1>>a2>>b1>>b2>>c1>>c2>>d1>>d2;
		if(judge(a1,a2,b1,b2,c1,c2,d1,d2))
			cout<<"YES"<<endl; 
		else
			cout<<"NO"<<endl;
	}

}


int judge(double a1,double a2,double b1,double b2,double c1,double c2,double d1,double d2){
	double aa,bb;
	aa=(b2-a2)/(b1-a1);
	bb=(d2-c2)/(d1-c1);
//	cout<<aa<<" "<<bb<<endl;
	if(aa==bb)return 1; else return 0;
}

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) )
		{
			cout << "YES\n" ;
		}
		else cout << "NO\n" ;
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main(void)
{
	int n;
	int i,j;
	double x[5],y[5];
	double xx,yy;
	int ta,yo;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		for(j=0;j<4;j++){
			scanf("%lf %lf",&x[j],&y[j]);
		}
		if(x[0]-x[1]==0 || x[2]-x[3]==0){
			if(x[0]-x[1]==0 && x[2]-x[3]==0){
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
		else {
			xx=(y[0]-y[1])/(x[0]-x[1]);
			yy=(y[2]-y[3])/(x[2]-x[3]);
	//		printf("%lf %lf\n",xx,yy);
			ta=xx*10000;
			yo=yy*10000;
			if(ta==yo){
				printf("YES\n");
			}
			else {
				printf("NO\n");
			}
		}
	}	
	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main() {
  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];
  
  if( fabs((y[0]-y[1])/(x[0]-x[1]) -(y[2]-y[3])/(x[2]-x[3]))<1e-10 ) 
      cout<<"YES\n";
    else
      cout<<"NO\n";
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <cctype>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map> // pair
#include <set>
#include <string>

#define MAXSIZE 200000
#define PI 3.141592653589
using namespace std;

template<typename T>
T add(T a,T b){
  return a+b;
}

namespace A
{
  int f(void){
    return 1;
  }
}


int main(){
  int n;
  std::cin >> n;

  for(int i=0;i<n;i++){
    double a,b,c,d,e,f,g,h;
    std::cin >> a>>b>>c>>d>>e>>f>>g>>h;

    if((a-c)*(f-h)==(b-d)*(e-g)){
      std::cout << "YES" << '\n';
    }else{
      std::cout << "NO" << '\n';
    }
  }
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

int 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 ABx = x2 - x1,
			ABy = y2 - y1,
			CDx = x4 - x3,
			CDy = y4 - y3;
		if (ABx / ABy == CDx / CDy)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

C++: #include<iostream>
#define rep(i,x) for(int i=0;i<x;i++)
using namespace std;
int main(){
    int n;
    while(n--){
        double a[4][2];
        rep(i,4)rep(j,2)cin>>a[i][j];
        double line1=(a[0][0]-a[1][0])/(a[0][1]-a[1][1]);
        double line2=(a[2][0]-a[3][0])/(a[2][1]-a[3][1]);
        if(line1!=line2)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

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

int main(){
	int n;
	double a1,a2,b1,b2,c1,c2,d1,d2;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a1>>a2>>b1>>b2>>c1>>c2>>d1>>d2;
		if(((a1-b1)/(a2-b2))==((c1-d1)/(c2-d2)))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}

}

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);
    if(a == b){
      cout << "YES" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }

  return 0;
}