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>
 
int main(){
     
    double x1,y1,x2,y2,x3,y3,x4,y4;
int a;
    std::cin>>a;
    for(int s=0;s<a;s++){
        std::cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
        if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)){
            std::cout<<"YES"<<std::endl;
        }else{
            std::cout<<"NO"<<std::endl;
        }
         
    }
    return 0;
}

C++: //
//  main.cpp
//  main
//
//  Created by h3037175 on 2018/01/22.
//  Copyright © 2018年 h3037175. All rights reserved.
//

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
double zeti(double);
int main() {
    pair<double,double> a;
    pair<double,double> b;
    pair<double,double>c;
    pair<double,double>d;
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a.first,&a.second,&b.first,&b.second,&c.first,&c.second,&d.first,&d.second);
        if(a.first==b.first&&c.first==d.first){
            cout<<"YES"<<endl;
            continue;
        }
        double s1,s2;
        s1=(a.second-b.second)/(a.first-b.first);
        s2=(c.second-d.second)/(c.first-d.first);
        if(s1==s2||1/s1*-1==s2){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define SZ(n)  (int)n.size()
#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x)cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define MP make_pair
#define PB push_back
	double EPS=0.00000001;
	bool same(double a,double b){
		if(fabs(a-b)<=EPS)return 1;
		else return 0;
	}
	
	
	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;
		double a1=(y2-y1)/(x2-x1);
		double a2=(y4-y3)/(x4-x3);
		if(same(a1,a2))cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	
	return 0;
}

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

using namespace std;


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

		}

		
	}
	
	return 0;
}

C++: #include <iostream>
#include <cmath>
      
int main() {
    int n;
    std::cin >> n;
    while(n--){
        double x1, y1, x2, y2, x3, y3, x4, y4;
        std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
        int ix1 = round(x1*100000), iy1 = round(y1*100000),
            ix2 = round(x2*100000), iy2 = round(y2*100000),
            ix3 = round(x3*100000), iy3 = round(y3*100000),
            ix4 = round(x4*100000), iy4 = round(y4*100000);
        int a = iy1 - iy2, b = ix2 - ix1, c = iy3 - iy4, d = ix4 - ix3;
        if(!((long long int)a*d - (long long int)b*c))
            std::cout << "YES" << std::endl;
        else
            std::cout << "NO" << std::endl;
        }
    return 0;
}

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

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;
		if ((y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3)) printf("YES\n");
		else printf("NO\n");
	}

	return 0;
}

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

int main(){
  double x1,x2,x3,x4,y1,y2,y3,y4;
  double abx,aby,cdx,cdy,abr,cdr;
  int n;
  cin>>n;

  for(int i=0;i<n;i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    abx=x1-x2;
    aby=y1-y2;
    cdx=x3-x4;
    cdy=y3-y4;
    
    abr=sqrt(abx*abx+aby*aby);
    cdr=sqrt(cdx*cdx+cdy*cdy);

    abx=abx/abr;
    aby=aby/abr;
    cdx=cdx/cdr;
    cdy=cdy/cdr;

    if(abx==cdx&&aby==cdy)
      cout<<"YES\n";
    else if(abx==-1*cdx&&aby==-1*cdy)
      cout<<"YES\n";
    else
      cout<<"NO\n";
  }
  return 0;
}

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

}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return false;
    }
    return true;
}

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

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
  double x1, y1, x2, y2, x3, y3, x4, y4;
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
    if(-1 * pow(10, -15) <= (y2 - y1) * (x4 - x3) - (y4 - y3) * (x2 - x1) && (y2 - y1) * (x4 - x3) - (y4 - y3) * (x2 - x1) <= pow(10, -15)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}

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

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

  for(int i=0;i<n;i++){
    complex<double> v[4];
    for(int j=0;j<4;j++){
      double x,y;
      cin >> x >> y;
      v[j]=complex<double>(x,y);
    }

    if(abs((conj(v[1]-v[0])*(v[3]-v[2])).imag())<0.01)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}