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

using namespace std;

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

C++: #include<stdio.h>
 
int main(void){
    double x[4],y[4];
    int n,i;
     
    scanf("%d",&n);
     
    for(i=0;i<n;i++){
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
         
        if(((y[1]-y[0])/(x[1]-x[0])) == ((y[3]-y[2])/(x[3]-x[2])))printf("YES\n");
        else printf("NO\n");
    }
     
    return 0;
}

C++: #include<cstdio>

main(){
  double x1,x2,x3,x4,y1,y2,y3,y4;
  int i;
  scanf("%d",&i);
  for(;i--;)
    {
      scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
	if(((x1-x2)*(y3-y4))==((x3-x4)*(y1-y2)))
	  puts("YES");
	else
	  puts("NO");
    }
  return 0;
}

C++: #include <iostream>

using namespace std;
 
int main(){
  double a,b,c,d,e,f,g,h;
  int t;
  
  cin >> t;
  while(t--){
    cin >> a >> b >> c >> d >> e >> f >> g >> h;
    if((d-b)/(c-a) == (h-f)/(g-e)){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
 
  return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>

using namespace std;

double EPS = 1e-12;

//誤差を考慮して足し算を行う
double add(double a, double b) {
	if( abs(a + b) < EPS * (abs(a) + abs(b))) {
		return 0;
	}

	return a + b;
}

//二次元ベクトル構造体
struct P {
	double x, y;

	P() {}
	P(double x, double y) : x(x), y(y) {
	}
	P operator + (P p) {
		return P(add(x, p.x), add(y, p.y));
	}
	P operator - (P p) {
		return P(add(x, -p.x), add(y, -p.y));
	}
	P operator * (double d) {
		return P(x * d, y * d);
	}
	double dot(P p) {	//　内積
		return add(x * p.x, y * p.y);
	}
	double det(P p) {	//　外積
		return add(x * p.x, -y * p.y);
	}
};

//　線分p1-p2上に点qがあるか判定
bool on_seg(P p1, P p2, P q) {
		return (p1 - q).det(p2 - q) == 0 && (p1 - q).dot(p2 - q) <= 0;
}

//　直線p1-p2と直線q1-q2の交点
P intersection(P p1, P p2, P q1, P q2) {
	return p1 + (p2 - p1) * ((q2 - q1).det(q1 - p1) / (q2 - q1).det(p2 - p1));
}


int main() {
	int n;

	cin >> n;

	P p, q, r, s;

	for(int i = 0; i < n; i++) {
		cin >> p.x >> p.y >> q.x >> q.y >> r.x >> r.y >> s.x >> s.y;
		if( (q - p).det(s - r) == 0) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}

}

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

int main(){
  double a,b,c,d,e,f,g,h,m[4];
  int s;
  cin>>s;
  for(int j=0;j<s;j++){
    cin>>a>>b>>c>>d>>e>>f>>g>>h;
    m[0]=c-a;
    m[1]=g-e;
    m[2]=d-b;
    m[3]=h-f;
    if(m[2]*m[0]==m[3]*m[1])cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

C++: #include <stdio.h>
 
struct point {
    double x;
    double y;
};
 
int main(void) 
{
    int i, n;
    struct point A, B, C, D;
    double slope_AB, slope_CD;
 
    scanf("%d", &n);
 
    for (i = 0; i < n; i++) {
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y, &D.x, &D.y);
 
        slope_AB = (A.y - B.y) / (A.x - B.x);
        slope_CD = (C.y - D.y) / (C.x - D.x);
 
        if (slope_AB == slope_CD) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }
    return 0;
}

C++: #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 <ctime>
#include <cstring>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define VS vector<string>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back

using namespace std;

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;
        x1 -= x2; y1 -= y2;
        x3 -= x4; y3 -= y4;
        if(fabs(x1/y1 - x3/y3)<1e-10) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

C++: #include <cstring>
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <queue>
#include <stack>
#include <string>
#include <cmath>
#include <bitset>
 
#define rep(i,a) for(int i = 0;i < (a); i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)
#define repd(i,a,b) for(int i = (a); i >= (b); i--)
#define repit(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)
#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())
#define pb push_back
#define mp make_pair
#define INF 1e8
#define EPS 1e-10
#define PI acos(-1.0)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef complex<double> P;
typedef vector<P> G;
 
int main(){
    int n;
    cin >> n;
    while(n--){
        G p(4);
        rep(i,4) cin >> p[i].real() >> p[i].imag();
        if(p[0].real() == p[1].real()){
            cout << (p[2].real() == p[3].real()? "YES": "NO") << endl;
        }else if(p[2].real() == p[3].real()){
            cout << "NO\n";
        }else{
            cout << ((p[0].imag()-p[1].imag())/(p[0].real()-p[1].real()) == 
                     (p[2].imag()-p[3].imag())/(p[2].real()-p[3].real())? "YES": "NO") << endl;
        }
    }
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n,x[4],y[4];

	cin >> n;

	for(int i = 0;i < n;i++){
		for(int j = 0;j < 4;j++){
			scanf("%d.%d",&x[j],&y[j]);
		}

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

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

int main(){
  int n;
  cin>>n;
  while(n--){
    double x[4];
    double y[4];
    for(int i=0;i<4;i++){
      cin>>x[i]>>y[i];
    }

    x[1]-=x[0];
    y[1]-=y[0];
    x[3]-=x[2];
    y[3]-=y[2];

    double xx=x[1]-x[3];
    double yy=y[1]-y[3];

    if(-1e-5 < xx && xx < 1e-5 && -1e-5 < yy && yy < 1e-5 ){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }

  }
  return 0;
}

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

using namespace std;
typedef long long ll;

typedef double R;
typedef complex<R> P;

const R EPS = 1e-10;
const R PI = acos(-1);
int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}


bool near(P a, P b) {
    return !sgn(abs(a-b));
}

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

void solve() {
    P p[4];
    for (int i = 0; i < 4; i++) {
        R x, y;
        cin >> x >> y;
        p[i] = P(x, y);
    }

    if (!sgn(cross(p[0]-p[1], p[2]-p[3]))) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        solve();
    }
    return 0;
}