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 <iostream>
#include <complex>
using namespace std;
typedef complex<double> P;
const double EPS = 1e-9;
int main(){
	int N;
	cin >> N;
	while(N--){
		P a,b,c,d;
		cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag() >> d.real() >> d.imag();
		P one = a-b;
		P two = c-d;
		bool f = false;
		if( abs(one.real()) < EPS || abs(two.real()) < EPS ){
			f = abs(one.real()) < EPS && abs(two.real()) < EPS;
		}else{
			f = abs(one.imag()/one.real() - two.imag()/two.real()) < EPS;
		}
		cout << (f?"YES":"NO") << endl;
	}
}

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(abs((x[3]-x[2])*(y[1]-y[0])-(x[1]-x[0])*(y[3]-y[2]))<1e-10)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;
int n;
double xa,xb,xc,xd,ya,yb,yc,yd,ta,tb,tc,td;
int main(){
	int i;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd;
		ta = xa - xb;
		tb = ya - yb;
		tc = xc - xd;
		td = yc - yd;
		if(tb == td && ta == tc) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #include <stdio.h>

#define ABS(X) ((X)<0 ? -(X) : (X))
int main(){
    int n;
    double x1, y1, x2, y2;
    double x3, y3, x4, y4;
    double dx1, dy1, dx2, dy2;
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
        scanf("%lf %lf %lf %lf", &x3, &y3, &x4, &y4);
        dx1 = x2 - x1;
        dy1 = y2 - y1;
        dx2 = x4 - x3;
        dy2 = y4 - y3;
        if (ABS(dx1*dy2 - dx2*dy1) < 0.001){
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }

    return 0;
}

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

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )

using namespace std;
typedef complex<double> P;

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

C++: #include<iostream>
using namespace std;
int main(){
    int n;
    double x1,y1,x2,y2,x3,y3,x4,y4,a,b;
    cin>>n;
    while(n>0){
        cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        a=(y1-y2)/(x1-x2);
        b=(y3-y4)/(x3-x4);
        if(a==b)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
        n--;
    }
}

C++: #include <iostream>
using namespace std;
int main()
{
    int n;cin>>n;
    for(int i=0;i<n;++i){
        double abdx,abdy,cddx,cddy;
        double x[4];
        double y[4];
        for(int j=0;j<4;++j){
            cin>>x[j]>>y[j];
        }
        abdx=x[0]-x[1];
        cddx=x[2]-x[3];
        abdy=y[0]-y[1];
        cddy=y[2]-y[3];
        if(abdy/abdx==cddy/cddx)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

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

using namespace std;

int main(){
    
  int n;
  cin >> n;
  while(n--){

    double x1,x2,x3,x4;
    double y1,y2,y3,y4;

    scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
    if( (y2-y1)/(x2-x1) == (y4-y3)/(x4-x3) ){
      printf("YES\n");
    }
    else printf("NO\n");
  }
}

C++: n = input()+1
for v in range(1,n):
        (x1,y1,x2,y2,x3,y3,x4,y4)=map(int,raw_input().split())
        if x2-x1=0 or x4-x3=0:
                if x2-x1=0 and x4-x3=0:
                        print "YES"
                else:
                        print "NO"
        elif y2-y1=0 or y4-y3=0:
                if y2-y1=0 and y4-y3=0:
                        print "YES"
                else:
                        print "NO"
        else:
                a = (y2-y1)/(x2-x1)

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>

typedef long long ll;
using namespace std;

int main()
{
	double pos[8];

	for(int i=0;i<8;i++){
		scanf("%lf",pos+i);
	}

	if((pos[1]-pos[3])/(pos[0]-pos[2])==(pos[1+4]-pos[3+4])/(pos[0+4]-pos[2+4])){
		cout << "YES" << endl;
	}else
	{
		cout << "NO" << endl;	
	}
}

C++: #include<iostream>
#include<vector>
int main()
{
	int n;
	std::cin >> n;
	std::vector<bool>result(n);
	for (int i = 0; i < n; i++)
	{
		long double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		result[i] = x1 == x2 && x3 == x4 || (y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4);
	}
	for (auto i : result)
	{
		std::cout << (i ? "YES" : "NO") << std::endl;
	}
	return 0;
}

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

const double EPS = 1e-9;

signed main() {
  int n;

  cin >> n;
  while (n--) {
    double x[4], y[4];
    for (int i = 0; i < 4; cin >> x[i] >> y[i], i++);
    if (fabs((y[1] - y[0]) / (x[1] - x[0]) - (y[3] - y[2]) / (x[3] - x[2])) < EPS) {
      puts("YES");
    } else {
      puts("NO");
    }
  }

  return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-11
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<double,double> P;
static const int INF=1<<24;

int main(){
	double x[3],y[3];
	int n;
	cin>>n;
	rep(i,n){
		rep(j,4){
			cin>>x[j]>>y[j];
			//cout<<x[j]<<" "<<y[j]<<endl;
		}
		P a( x[1]-x[0] ,y[1]-y[0]), b( x[3]-x[2] ,y[3]-y[2]);
		bool f;
		if(abs(a.F*b.S-b.F*a.S)<=EPS) f=true;
		else f=false;
		//CP c(3.0,2.0);
		//cout<<real(c)<<" "<<imag(c)<<endl;
		//cout<<real(a)<<" "<<imag(a)<<" "<<real(b)<<" "<<imag(b)<<endl;
		if(f) cout<<"YES\n";
		else cout<<"NO\n";
	}
	return 0;
}

C++: //AOJ 0021
#include <stdio.h>
//x???y?????????????????????????????????????????????
int main(){
    double x1,y1,x2,y2,x3,y3,x4,y4;
    double m1,m2;
    int n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
    	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);
    	if(m1==m2)puts("YES");
    	else puts("NO");
    	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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