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[4] == fpoints[6] {
			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<string>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		long float x1, x2, x3,y1, y2, y3, y4, x4 ;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if (y1 > y2) {
			swap(y1, y2);
			swap(x1, x2);
		}
		if (y3 > y4) {
			swap(y3, y4);
			swap(x3, x4);
		}
		if ((x1 > x2&&x3 > x4 && ((y2 - y1) / (x1 - x2) == (y4 - y3) / (x3 - x4))) || (x2 > x1&&x4 > x3 && ((y1 - y2) / (x2 - x1) == (y3 - y4) / (x4 - x3)))) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}

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

int main() {
  int n;
  int x1, y1, x2, y2, x3, y3, x4, y4;
  int d1, d2;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    d1 = (y2 - y1) / (x2 - x1);
    d2 = (y4 - y3) / (x4 - x3);
    if (d1 == d2) {
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}

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

int main(){
  int num;
  double array[4][2];
  cin >> num;
  while(num != 0){
    for(int i = 0; i < 4; i++){
      for(int j = 0; j < 2; j++){
	cin >> array[i][j];
      }
    }
    double N = (array[1][0] - array[0][0]) / (array[1][1] - array[0][1]);
    double M = (array[3][0] - array[2][0]) / (array[3][1] - array[2][1]);
    if(N == M)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
    num--;
  }
  


 return 0;

}

C++: #include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pf push_front
#define pb push_back
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

signed main(){
  int n;
  cin>>n;
  while(n){
  double x1,y1,x2,y2,x3,y3,x4,y4;
  cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
  double AB=(y2-y1)/(x2-x1);
  double CD=(y4-y3)/(x4-x3);
  cout<<(AB==CD?"YES":"NO")<<endl;
  n--;
  }
  return 0;
}

C++: #include<iostream>

int main()
{
	int n;

	std::cin >> n;

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

	for(int i=0;i<n;++i)
	{
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

		double m1 = (y1-y2)/(x1-x2);

		double m2 = (y3-y4)/(x3-x4);

		std::cout <<  (m1==m2 ? "YES":"NO") << '\n';
	}
}

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

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

    for (int t = 0;t < n;++t) {
        for (int i = 0;i < 4;++i){
            cin >> x[i] >> y[i]; 
        }
    }
    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){
        double m = s * v - t * u;
    }
    else{
        double m = t * u - s * v;
    }

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



    cout << "NO" << endl;
}

C++: #include <iostream>

using namespace std;

class Vector2D {
  private:
    double x;
    double y;
  public:
    Vector2D(double, double);
    Vector2D operator - (Vector2D vec2) {
      double newX = this->x - vec2.x;
      double newY = this->y - vec2.y;
      Vector2D newvec(newX, newY);
      return newvec;
    }
    double GetX() { return x; };
    double GetY() { return y; };
    bool isParallel(Vector2D);
};

Vector2D::Vector2D(double _x, double _y) {
  x = _x;
  y = _y;
}

bool Vector2D::isParallel(Vector2D vec2) {
  if (vec2.GetY()/this->y == vec2.GetX()/this->x)
    return true;
  else
    return false;
}

int main() {
  double x1,y1,x2,y2,x3,y3;
  while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3) {
    Vector2D vecAB = Vector2D(x2,y2) - Vector2D(x1,y1);
    Vector2D vecBC = Vector2D(x3,y3) - Vector2D(x2,y2);
    cout << (vecAB.isParallel(vecBC) ? "YES" : "NO") << endl;
  }

  return 0;
}

C++: /* AOJ 0021 Parallelism */

#include <iostream>
#include <cmath>

using namespace std;

const double EPS = 10e-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 <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-6)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
	
	return 0;
}

C++: #include<iostream>

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

	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define double long double
const double pi = acos(-1);
const double EPS = 1e-10;

double crosss(pair<double,double> c,pair<double,double> d){
  return c.first * d.second - d.first * c.second;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<pair<double,double>> a(4);
  int n;
  pair<double,double> lineab, linecd;
  cin >> n;
  REP(i,n){
    REP(j,4){
      cin >> a[j].first >> a[j].second;
    }
    lineab.first = a[1].first - a[0].first;
    linecd.first = a[3].first - a[2].first;
    lineab.second = a[1].second - a[0].second;
    linecd.second = a[3].second - a[2].second;
    if (fabs(crosss(lineab,linecd)) == 0){
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  
  
  return 0;
}

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

const double EPS=1E-12;

int main(){
  int n;
  cin>>n;
  complex<double> a, b, c, d;
  while(n--){
    cin>>a.real()>>a.imag()>>b.real()>>b.imag()>>c.real()>>c.imag()>>d.real()>>d.imag();
    a=a-b;
    c=c-d;
    cout<<(a.real()*c.imag()-a.imag()*c.real()<=EPS?"YES":"NO")<<endl;
  }

  return 0;
}