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>
#include <math.h>

int
main(void)
{
	char line[100];
	int n;

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &n) != 1) {
		return 1;
	}

	for (int i = 0; i < n; i++) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		
		double x1, y1, x2, y2, x3, y3, x4, y4;
		
		if (sscanf(line, "%lf %lf %lf %lf %lf %lf %lf %lf",
				   &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4) != 8) {
			return 1;
		}
		
		double a = INFINITY;
		double b = INFINITY;

		if (x1 != x2) {
			a = (y2 - y1)/(x2 - x1);
		}
		if (x3 != x4) {
			b = (y4 - y3)/(x4 - x3);
		}
		
		printf("%s\n", ((a == b) ? "YES" : "NO"));
	}

	return 0;
}

C++: #include<complex>
#include<iostream>
int main(){const double E=1e-10;int n;double x1,y1,x2,y2,x3,y3,x4,y4;std::cin>>n;while(n--){std::cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;std::cout<<(std::abs((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1))<E)?"YES\n":"NO\n";}}

C++: //Parallelism
#include<bits/stdc++.h>
using namespace std;

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

  return 0;
}

C++: #include<iostream>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(void)
{
  double x,y;
  double x1,y1;
  int n;
  int i;
  long double a,b;

  cin>>n;

  for(i=0;i<n;i++)
    {
      cin>>x>>y>>x1>>y1;
      a=(y1-y)/(x1-x);

      cin>>x>>y>>x1>>y1;
      b=(y1-y)/(x1-x);
	
      if(a==b)
        puts("YES");
      else
        puts("NO");
    }

}

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

int main(){
	double x1,x2,x3,x4,y1,y2,y3,y4;
	double a1=0.0,a2=0.0;
	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);
			if(x1!=x2)a1=(y1-y2)/(x1-x2);
			if(x3!=x4)a2=(y3-y4)/(x3-x4);
		
			if( a1==a2 && x1!=x2 && x3!=x4)printf("YES\n");
			else if(x1==x2 && x3==x4)printf("YES\n");
			else printf("NO\n");
			a1=0;
			a2=0;
	}
return 0;
}

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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);

  for (int c = 0; c < n; ++c) {
    double input[8];
    for (int i = 0; i < 8; ++i) {
      scanf("%lf", &input[i]);
    }
    double k1 = (input[3] - input[1]) / (input[2] - input[0]);
    double k2 = (input[7] - input[5]) / (input[6] - input[4]);

    if (k1 == k2) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}

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

int main(){
    const double EPS = 1e-12;
    double x[5];
    double y[5];
    double s;
    double t;
    double u;
    double v;
    double m;
    int n;
    cin >> n;

    for(int i = 0;i < n;i++){
        cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

        s = x[1] - x[0];
        t = y[1] - y[0];
        u = x[3] - x[2];
        v = y[3] - y[2];

        if(s * v - t * u > 0){
            m = s * v - t * u;
        }
        else{
            m = t * u - s * v;
        }

        if(m < EPS){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

#define EPS 1e-7
#define EQUAL(a, b) (fabs((a)-(b))<EPS)

typedef vector<int> vi;

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);
		puts(EQUAL((x2-x1)*(y4-y3), (y2-y1)*(x4-x3)) ? "YES" : "NO");
	}

	return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-8;
const double PI  = acos(-1.0);

int main(){
  int N; cin >> N;
  for(;--N;){
	double x[4], y[4];
	REP(i,4)
	  cin >> x[i] >> y[i];
	//x[0] -= x[1], y[0] -= y[1], x[2] -= x[3], y[2] -= y[3];

	if((x[0]-x[1])*(y[2]-y[3]) == (x[2]-x[3])*(y[0]-y[1]))
	  cout << "YES" << endl;
	else
	  cout << "NO" << endl;
  }
  
  return 0;
}

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

#define eps 0.00001

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;
    
        vector<double> v1, v2;
        v1.push_back(x2 - x1);
        v1.push_back(y2 - y1);
        v2.push_back(x4 - x3);
        v2.push_back(y4 - y3);
    
        double r1, r2;
        r1 = v1.at(1)/v1.at(0);
        r2 = v2.at(1)/v2.at(0);

        if( fabs(r1-r2) < eps ) cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}

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

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

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