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;

int main()
{
    int n;
    cin>>n;
    while(n--){
        pair<double,double>a[4];
        for(int i=0;i<4;i++){
            cin>>a[i].first>>a[i].second;
        }
        if(abs((a[1].first-a[0].first)*(a[3].second-a[2].second)-(a[3].first-a[2].first)*(a[1].second-a[0].second))<0)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

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

using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-11;
double x[4],y[4];
int N;
int main() {
    cin >> N;
    for(int t=0; t<N; ++t){
        for(int i=0; i<4; ++i){
            cin >> x[i] >> y[i];
        }
        xy_t a[2] ={
            xy_t(x[0],y[0]) - xy_t(x[1],y[1]),
            xy_t(x[2],y[2]) - xy_t(x[3],y[3])
        };
        bool p = abs(cross_product(a[0], a[1])) < eps;
        cout << (p ? "YES" : "NO") << endl;
        }
    return 0;
}

C++: #include<stdio.h>

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

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

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

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

int main(){

  double ax,ay,bx,by,cx,cy,dx,dy;
  int n;

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> ax >> ay >> bx >> by >> cx >> cy >> dx >> dy;

    if(ax == bx && cx == dx) cout << "YES" << endl;

    if((ay - cy) == (by - dy)){
      if(ax < cx && bx < dx) cout << "YES" << endl;
      if(ax > cx && bx > dx) cout << "YES" << endl;
      else cout << "NO" << endl;
    }

    else  cout << "NO" << endl;

  }
}

C++: #include <iostream>
#include <cmath>
using namespace std;
void judge(double,double,double,double,double,double,double,double);
#define EPS 0.00001

int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4, ab, cd;

	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		judge(x1, y1, x2, y2, x3, y3, x4, y4);
	}
	
	return 0;
}

void judge(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
	double abx = x2 - x1;
	double aby = y2 - y1;
	double cdx = x4 - x3;
	double cdy = y4 - y3;
	if (abs(abx * cdy - aby * cdx) <= EPS) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return;

}

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

    }
    return 0;
}

C++: #include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))


int main(){
	int n;
	double x[4],y[4],t;
	scanf("%d",&n);
	rep(j,n){
		rep(i,4)scanf("%lf%lf",x+i,y+i);
		rep(i,2){
			x[i]=x[i*2]-x[i*2+1];
			y[i]=y[i*2]-y[i*2+1];
		}
		puts(abs(x[0]*y[1]-y[0]*x[1])<=0.00001?"YES":"NO");
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

int main() {

	int n;
	double x[4] = { 0 }, y[4] = { 0 }, slope[2] = { 0 };
	bool ans[100];

	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> x[j] >> y[j];
		}
		slope[0] = (y[1] - y[0]) / (x[1] - x[0]);
		slope[1] = (y[3] - y[2]) / (x[3] - x[2]);

		if (slope[0] == slope[1])
			ans[i] = true;
		else
			ans[i] = false;

		slope[0] = slope[1] = 0;

		for (int j = 0; j < 4; j++) {
			x[j] = y[j] = 0;
		}
	}

	for (int i = 0; i < n; i++) {
		if (ans[i])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

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

int main() {
  int n = 0;
  cin >> n;

  for(int i = 0; i < n; i++) {
    double d[8];
    for(int j = 0; j < 4*2; j++)
      cin >> d[j];
    if(d[4] + d[0]-d[2] == d[6] && d[5] + d[1]-d[3] == d[7])
      cout << "YES" << endl;
    else if(d[4] - (d[0]-d[2]) == d[6] && d[5] - (d[1]-d[3]) == d[7])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

C++: #include<stdio.h>

int main(){

	int n=1, i, x[3][4000] = {},  y=0;

	for (n = 1; n > 0;n++){
		
		scanf("%d", &n);if (n == 0){ break; }

		for (i = 0; i < n; i++){
			scanf("%d %d %d",&x[0][i],&x[1][i],&x[2][i]);
		}
		for (i = 0; i < n; i++){
			if (x[1][i] * x[2][i] > 1000000){
				printf("%d\n", x[0][i],y++);
			}	
		}
		if (y == 0){ printf("NA\n"); y = 0; };
	}
	return 0;
}

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

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

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

int main(void) {
    double x1, y1, x2, y2, x3, y3, x4, y4;
    double slope1, slope2;
    int n;
    
    cin >> n;
    for(int i = 0; i < n; ++i) {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        slope1 = (y2 - y1) * (x4 - x3);
        slope2 = (y4 - y3) * (x2 - x1);
        
        if(abs(slope1 - slope2) < 0.0000000001) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}

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

bool solve();

int main(){
	int n;cin>>n;
	while(n--){
		if(solve()){
			cout<<"YES";
		}else{
			cout<<"NO";
		}
		cout<<endl;
	}	
	return 0;
}

bool solve(){
	double x1,x2,y1,y2;
	double vx1,vx2,vy1,vy2;
	
	cin>>x1>>y1>>x2>>y2;
	vx1=x2-x1;vy1=y2-y1;
	cin>>x1>>y1>>x2>>y2;
	vx2=x2-x1;vy2=y2-y1;
	
	//vx1:vy1=vx2:vy2
	return (vx1*vy2==vy1*vx2);
}