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 <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int i,j,k,T;
  cin>>T;
  while(T--){
    double xx,yy;
    ll x[4],y[4];
    rep(i,4){
      cin>>xx>>yy;
      x[i]=xx*1e5;
      y[i]=yy*1e5;
      //   cout<<x[i]<<","<<y[i]<<endl;
    }
    rep(i,2){
      x[i*2+1]-=x[i*2];
      y[i*2+1]-=y[i*2];
    }
    cout<<(x[1]*y[3]==x[3]*y[1]?"YES":"NO")<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <complex.h>
#include <math.h>
using namespace std;

const double eps = pow(10, -11);
double x[4], y[4];
int N;
typedef complex<double> xy_t;

double dot_product(xy_t a , xy_t b) {return (conj(a)*b).real();}

int main() {
  cin >> N; //問題数
  for (int t=0; t<4; ++t) {
    for (int i=0; i<4; ++i)
	  cin >> x[i] >> y[i]; //x0,y0..x3,y3
	xy_t a[2] = {
	  xy_t(x[0], y[0]) - xy_t(x[1],y[1]),
	  xy_t(x[2], y[2]) - xy_t(x[3],y[3])
	  };
	  double s = dot_product(a[0] , a[1])/2;
	  bool p = abs(s) < eps;
	  cout << (p ? "YES" : "NO") << endl;
	  cout << "s:" << s << endl;
	  cout << "abs(s):" << abs(s) << endl;
	  }
	 }

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

using namespace std;

int main() {
	int n;
	float 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;
		pair<float, float> vec1(x2 - x1, y2 - y1);
		pair<float, float> vec2(x4 - x3, y4 - y3);

		float d = ((vec1.first*vec2.first + vec1.second*vec2.second) / (hypot(vec1.first, vec1.second)*hypot(vec2.first, vec2.second)));

		if (isnan(acos(d))) {
			cout << "YES";
		}else{
			cout << "NO";
		}
		cout << endl;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

ll stoll(string const& s){
    ll res = 0;
    rep(i,s.size()){
        res*=10;
        res+=s[i]-'0';
    }
    return res;
}

ll input(){
    string s; cin>>s;
    size_t p=0;
    int sign = s[0]=='-' ? -1 : 1;
    if(sign==-1) s.erase(s.begin());
    while(p<s.size() && s[p]!='.') p++;
    while(s.size()-p < 6) s += '0';
    s.erase(s.begin()+p);
    dump(s);
    return sign*stoll(s);
}

int main(){
    int n; cin>>n;
    rep(_,n){
        ll x[2][2], y[2][2];
        rep(i,2){
            rep(j,2){
                x[i][j] = input();
                y[i][j] = input();
            }
        }
        ll dx1=x[0][0]-x[0][1], dy1=y[0][0]-y[0][1];
        ll dx2=x[1][0]-x[1][1], dy2=y[1][0]-y[1][1];
        dump(dx1,dx2,dy1,dy2);
        puts(dx1*dy2==dx2*dy1 ? "YES" : "NO");
    }
}

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

int main(void)
{
	double x1, y1, x2, y2, x3, y3, x4, y4, tnd1, tnd2;
	int count;

	cin >> count;
	for (int i = 0; i < count; i++) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		tnd1 = (y2 - y1) / (x2 - x1);
		tnd2 = (y4 - y3) / (x4 - x3);
		if (tnd1 == tnd2) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

C++: #include <stdio.h>
#include <string.h>
 
int main(void){
    int n;
    double x1,x2,x3,x4,y1,y2,y3,y4,ax,ay,bx,by;
 
    scanf("%d",&n);
    for(1;n>0;n--){
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        ax=(x2-x1);ay=(y2-y1);bx=(x4-x3);by=(y4-y3);
        if(ax*by-ay*bx==0.0)printf("YES\n"); else printf("NO\n");
    }
 
    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(abs((x[0]-x[1])*(y[2]-y[3])-(x[2]-x[3])*(y[0]-y[1]))<EPS)
	  cout << "YES" << endl;
	else
	  cout << "NO" << endl;
  }
  
  return 0;
}

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

int main(){
  int n, i;
  long double x1, x2, x3, x4, y1, y2, y3, y4, slopeofAB, slopeofCD;

  cin >> n;

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

    slopeofAB = (y2 - y1) / (x2 - x1);
    slopeofCD = (y4 - y3) / (x4 - x3);

    if(slopeofAB == slopeofCD){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }

  return 0;
}