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 <stdio.h>

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

C++: #include<stdio.h>
int main(void) {
	int a, b, c, d;
	double e, f, g, h,x1,x2,x3,x4,y1,y2,y3,y4;
	scanf("%d", &a);
	for (size_t i = 0; i < a; i++)
	{
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		e = (y1 - y2) / (x1 - x2);
		f = (y3 - y4) / (x3 - x4);
		if (e==f)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}

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

int main() {
  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4,det;
  double vect1[2],vect2[2];

  cin >> n;
  for(int i=0;i<n;i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    vect1[0] = x2-x1;
    vect1[1] = y2-y1;
    vect2[0] = x4-x3;
    vect2[1] = y4-y3;
    det = vect1[0] * vect2[1] - vect1[1] * vect2[0];
    if(det == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  double x1,x2,x3,x4,y1,y2,y3,y4;
  cin >> n;
  string ans[n];
  for(int i=0;i<n;i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if((y1-y2)/(x1-x2)==(y3-y4)/(x3-x4) and (y1-y3)/(x1-x3)!=(y1-y2)/(x1-x2)){
      ans[i]="YES";
    }else{
      ans[i]="NO";
    }
  }
  for(int i=0;i<n;i++){
    cout << ans[i] << endl;
  }
  return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cctype>
#include <climits>
#include <fstream>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pair<int, int> > vpii;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second
using namespace std;

int main(){
	int N;
	vd a(8);
	cin >> N;
	rep(i,N){
		rep(i,8){
			cin>>a[i];
		}
		if(((a[1]-a[3])*(a[4]-a[6])-(a[5]-a[7])*(a[0]-a[2]))<0.0000001){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}

}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int main(){
	int n;
	cin>>n;
	rep(i,0,n){
		double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		m1=(y2-y1)/(x2-x1);
		m2=(y4-y3)/(x4-x3);
		if(fabs(m1-m2)<(1e-10) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

C++: #include<iostream>
#include<cmath>
using namespace std;
#define EPS 1e-10

double a,b,c,d,e,f,g,h;
double det(){
	double dx1,dy1,dx2,dy2;
	dx1 = a-c;
	dy1 = b-d;
	dx2 = e-g;
	dy2 = f-h;
	return dx1*dy2 - dy1*dx2;
}
int main(){
	int n;
	cin>>n;
	while(n--){
		cin>>a>>b>>c>>d>>e>>f>>g>>h;
		cout<<(fabs(det())<EPS?"YES":"NO")<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <iterator>

using namespace std;

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

C++: #include <bits/stdc++.h>
using namespace std;
typedef complex<double> xy_t; 
xy_t a[100], b[100], c[100], d[100];
double x, y;
int n;
int main()
{
	cin >> n;
	for(int i=0; i<n; i++)
	{
		cin >> x >> y;
		a[i]=xy_t(x, y);
		cin >> x >> y;
		b[i]=xy_t(x, y);
		cin >> x >> y;
		c[i]=xy_t(x, y);
		cin >> x >> y;
		d[i]=xy_t(x, y);
	}
	for(int i=0; i<n; i++)
	{
		if(abs((conj(b[i]-a[i])*(d[i]-c[i])).imag())<0.000000001)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> P;

// ?¨±?????????????????
#define EPS (1e-10)
// 2??????????????????????????????????????????
#define EQ(a,b) (abs((a)-(b)) < EPS)

// ?????? (cross product) : a??b = |a||b|sin??
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

// 2??´?????????????????? : a//b <=> cross(a, b) = 0
int is_parallel(P a1, P a2, P b1, P b2) {
  return EQ( cross(a1-a2, b1-b2), 0.0 );
}

int main() {
	int N;
	scanf("%d", &N);
	rep(i, N) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		P a(x1, y1), b(x2, y2), c(x3, y3), d(x4, y4);
		printf("%s\n", (is_parallel(a, b ,c ,d)) ? "YES" : "NO");
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main(){
    int n;
    int i;
    double x1,y1,x2,y2,x3,y3,x4,y4;
    scanf("%d",&n);
    //printf("%llf",1e-10);
    for(i=0;i<n;i++){
        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)){
            puts("YES");
        }
        else puts("NO");
    }
    return 0;
}

C++: #include <stdio.h>

int main(void) {

  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  int i;
  char c;
  
  scanf("%d",&n);

  //c=getchar();

  for(i=0;i<n;i++) {
    
    scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);

    if(x2-x1==0.0) {
      if(x4-x3==0.0) printf("YES\n");
      else printf("NO\n");
    }

    else if((x2-x1)*(y4-y3)==(x4-x3)*(y2-y1)) printf("YES\n");
    else printf("NO\n");

  }

  return 0;

}

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

int main(){
	int N;
	float xx,yy;
	float X[5],Y[5];
	string res[110];
	cin>>N;
	for(int j=1;j<=N;j++){
		for(int i=1;i<=4;i++){
			cin>>X[i]>>Y[i];
		}
		if((X[2]-X[1])*(Y[4]-Y[3])==(X[4]-X[3])*(Y[2]-Y[1])){
			res[j]="YES";
		}
		else{
			res[j]="NO";
		}
	}
	for(int i=1;i<=N;i++){
		cout<<res[i]<<endl;
	}
	return 0;
}