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 <algorithm>
#include <cstdio>
using namespace std;

int main() {
	int n;
	double x1,x2,x3,x4,y1,y2,y3,y4,m,l;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		double a=y2-y1; double b=x2-x1;
		double d=y4-y3; double e=x4-x3;
 
		if(a*e-d*b==0) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

C++: #define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 201
#define _MAX 100
#define ABC 26
int main(void)
{
	int n, ans[_MAX] = { 0 };
	double x1, y1, x2, y2, x3, y3, x4, y4, a1, b1, a2, b2;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		a1 = (y1 - y2) / (x1 - x2);
		b1 = y1 - (x1 * a1);
		a2 = (y3 - y4) / (x3 - x4);
		b2 = y3 - (x3 * a2);
		if (a1 == a2 && b1 != b2)
			printf("YES");
		else
			printf("NO");
	}
}

C++: #include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define INF 1e+10

int main(){
  double x[4], y[4];
  int n;
  cin >> n;
  while( n-- ){
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
    double left, right;
    if (x[0] < x[1]) {
      left = (y[1] - y[0]) * abs(x[1] - x[0]);
    } else {
      left = (y[0] - y[1]) * abs(x[0] - x[1]);
    }
    if (x[2] < x[3]) {
      right = (y[3] - y[2]) * abs(x[3] - x[2]);
    } else {
      right = (y[2] - y[3]) * abs(x[2] - x[3]);
    }

    if ( left == right ) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
  int n; cin >> n;
  while(n--){
    double x[4],y[4];
    for(int i=0;i<4;i++) cin >> x[i] >> y[i]; 
    if(abs((x[3] - x[2]) * (y[1] - y[0]) - (x[1] - x[0]) * (y[3] - y[2])) < 1e-9)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define RFOR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))

using namespace std;

typedef complex<double> point;
typedef pair<int, int> paii;
typedef long long ll;

double dot(point va, point vb){
	return real(va) * real(vb) + imag(va) * imag(vb);
}

int main()
{
	int n;
	cin >> n;
	
	FOR(i, 0, n)
	{
		double x, y;
		point pt[4];
		
		FOR(j, 0, 4)
		{
			cin >> x >> y;
			pt[j] = point(x, y);
		}
		
		point s = pt[1] - pt[0], t = pt[3] - pt[2];
		
		double dt = dot(s, t);
		
		if( abs(dt - abs(s)*abs(t)) < 0.00000001 )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n;
double x[100], y[100];

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

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

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

    cin >> n;
    while(n--){
        cin >>x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

        ab = (y1 - y2) / (x1 - x2);
        cd = (y3 - y4) / (x3 - x4);

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

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

int main(){
	int n;
	double x[4], y[4];
	int xi[4], yi[4];
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);

		for(int i = 0; i < 4; i++){
			xi[i] = (int)(x[i] * 100000);
			yi[i] = (int)(y[i] * 100000);
		}
		
		if((yi[0] - yi[1])*(xi[2] - xi[3]) == (xi[0] - xi[1])*(yi[2] - yi[3])){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	return 0;
}

C++: #include <stdio.h>
#include <math.h>


int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4,value1,value2;
	int n;
	scanf("%d",&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);
		if(x1 == x2 && x3 == x4){
			printf("YES\n");
		}else if(x1 != x2 && x3 == x4){
			printf("NO\n");
		}else if(x1 == x2 && x3 != x4){
			printf("NO\n");
		}else{
			value1 = (y1-y2)/(x1-x2);
			value2 = (x3-x4)/(y3-y4);

			if(fabs(value1-value2) < 0.0000001){
				printf("YES\n");
			}else{
				printf("NO\n");
			}
		}
	}
    return 0;
}

C++: /* AOJ 0021 Parallelism */

#include <iostream>
#include <cmath>

using namespace std;

const double EPS = 1e-9;

int
main()
{
    int n;
    double x1, y1, x2, y2, x3, y3, x4, y4;
    double dx12, dy12, dx34, dy34;

    cin >> n;

    while (n--) {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        dx12 = x2 - x1;
        dy12 = y2 - y1;
        dx34 = x4 - x3;
        dy34 = y4 - y3;

        if (fabs(dx12 * dy34 - dx34 * dy12) < EPS)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }

    return 0;
}

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

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

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