Go: package main

import "fmt"

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	var x1, y1, x2, y2, x3, y3, x4, y4 float64
	fmt.Scan(&n)
	for i := 0 ; i < n; i++ {
		fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)
		if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include <iostream>
#include <cmath>
using namespace std;
 
const double EPS= 1e-12;
 
struct zahyo{
    double x;
    double y;
};
 
 
int main(){
    zahyo a , b , c , d , ab , cd;
    int n;
    std::cin >> n;
    for(int i=0 ; i<n ; ++i){
        std::cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
        ab.x=b.x-a.x;
        ab.y=b.y-a.y;
        cd.x=d.x-c.x;
        cd.y=d.y-c.y;
        if (abs(ab.x*cd.y-ab.y*cd.x)<EPS){ //gaiseki
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }           
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

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

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

	while (n--){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		cout << (((y2 - y1) / (x2 - x1) - (y4 - y3) / (x4 - x3) == 0) ? "YES\n" : "NO\n");
	}

	return 0;
}

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

C++: #include <iostream>

using namespace std;

int main()
{
    double x1, y1, x2, y2, x3, y3, x4, y4, n;
    
    cin >> n;
    
    for(int i = 0; i < n; i++)
    {
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        
        double ax = x2 - x1;
        double ay = y2 - y1;
        double bx = x4 - x3;
        double by = y4 - y3;
        
        cout << (ax * by == ay * bx ? "YES" : "NO") << endl;
    }
    
    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(void)
{
  int n;
  double x[4],y[4];
  double degree[2];
  
  cin >> n;

  for(int i = n ; i > 0 ; i--){
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];
    degree[0] = (y[1] - y[0]) / (x[1] - x[0]);
    degree[1] = (y[3] - y[2]) / (x[3] - x[2]);

    if(degree[0] == degree[1]) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	double ax[100],ay[100],bx[100],by[100],cx[100],cy[100],dx[100],dy[100];
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>ax[i]>>ay[i]>>bx[i]>>by[i]>>cx[i]>>cy[i]>>dx[i]>>dy[i];
	}
	for(int i=0;i<n;i++){
		double A=0,B=0;
		A=(by[i]-ay[i])/(bx[i]-ax[i]);
		B=(dy[i]-cy[i])/(dx[i]-cx[i]);
		if(A==B){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

typedef complex<double> P;
struct Line : public vector<P>
{
  Line(P a=P(), P b=P()) {
    push_back(a); push_back(b);
  }
};

double cross(P const& a, P const& b) {
  return imag(conj(a)*b);
}

bool is_parallel(Line const& s, Line const& t) {
  return abs(cross(s[1]-s[0], t[1]-t[0])) < 1e-9;
}

int main() {
  int N; cin >> N;
  rep(tc, 2) {
    P ps[4]; rep(i, 4) cin >> ps[i].real() >> ps[i].imag();
    cout << (is_parallel(Line(ps[0], ps[1]), Line(ps[2], ps[3])) ? "YES\n" : "NO\n");
  }
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> n;
	for (int z = 0; z < n; z++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		double a = 99999, b = 99999;
		if((x2 - x1)*(y4 - y3)==(x4 - x3)*(y2 - y1)) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

C++: #include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-10;
const int MOD = 1000000007;

#define X real()
#define Y imag()

typedef complex<double> P;
struct L{
	P p1, p2;
	L(P p1, P p2):p1(p1), p2(p2){}
	L(){}
};
istream& operator>>(istream &is, P &p) {
	double x, y;
	is >> x >> y;
	p = P(x, y);
	return is;
}
inline int sig(double x) { return (abs(x) < EPS ? 0 : x > 0 ? 1 : -1); }
inline double norm(const P &p){return p.X*p.X+p.Y*p.Y;}
inline double inp(const P& a, const P& b){return (conj(a)*b).X;}
inline double outp(const P& a, const P& b){return (conj(a)*b).Y;}


int T;

int main(){
	ios::sync_with_stdio(false);
	cin >> T;
	while(T--){
		P p1, p2, p3, p4;
		cin >> p1 >> p2 >> p3 >> p4;
		puts(!sig(outp(p2-p1, (p4-p3))) ? "YES" : "NO");
	}
	return 0;
}

C++: #include <iostream>

int main() {
  int a, b;
  int i;

  double x[4];
  double y[4];

  bool isYes;

  std::cin >> a;

  for(i = 0; i < a; i++) {

    std::cin >> x[0] >> y[0];
    std::cin >> x[1] >> y[1];
    std::cin >> x[2] >> y[2];
    std::cin >> x[3] >> y[3];

    if( (x[1] - x[0]) != 0 ) {
      if( (x[3] - x[2]) != 0 ) {
	if( ((x[3] - x[2])*(y[1] - y[0])) == ((x[1] - x[0])*(y[3] - y[2])) ) {
	  isYes = true;
	}
	else {
	  isYes = false;
	}
      }
      else {
	isYes = false;
      }
    }
    else {
      if( (x[3] - x[2]) == 0 ) {
	isYes = true;
      }
      else {
	isYes = false;
      }
    }
      
    if( isYes ) {
      std::cout << "YES" << std::endl;
    }
    else {
      std::cout << "NO" << std::endl;
    }

  }
 
  return 0;
}