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 <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>

using namespace std;


bool solve(){
	double x[4],y[4];
	for(int i=0;i<4;i++){
		cin>> x[i]>> y[i];
	}
	double rad1 = atan2(y[1]-y[0],x[1]-x[0]);
	double rad2 = atan2(y[3]-y[2],x[3]-x[2]);
	cout<< rad1<< " "<< rad2<<endl;
	if(rad1 == rad2){
		cout<< "YES"<< endl;
	}else{
		cout<< "NO"<< endl;
	}
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	int n;
	cin>> n;
	for(int i=0;i<n;i++){
		solve();
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int main(){
	int n;
	cin>>n;
	rep(i,0,n){
		int ans=0;
		double x1,y1,x2,y2,x3,y3,x4,y4,m1,m2;
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if(x1==x2||x3==x4){
			if(x1==x2&&x3==x4) ans=1;
		}else{
			m1=(y2-y1)/(x2-x1);
			m2=(y4-y3)/(x4-x3);
			if(fabs(m1-m2)<(1e-10)) ans=1;
		}
		if(ans)	cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

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

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define EPS 1e-10
#define equals(a,b) (fabs((a)-(b)) < EPS)
//???
class Point{
	public:	
		double x,y;
		Point(double x = 0,double y = 0):x(x),y(y){}
		//?????????
		Point operator + (Point p) { return Point(x + p.x,y + p.y);}
		Point operator - (Point p) { return Point(x - p.x,y - p.y);}
		Point operator * (double a) { return Point(x*a,y*a);}
		Point operator / (double a) { return Point(x/a,y/a);}
		//???????????¨??§??????
		double abs() {return sqrt(norm());}
		double norm() {return x*x+y*y;}

		bool operator < (const Point &p) const{
			return x != p.x ? x < p.x : y < p.y;
		}
		bool operator == (const Point &p) const{
			return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
		}
};
//??????
struct Segment{Point p1,p2;};
//????????????
typedef Point Vector;
//??´???
typedef Segment Line;
//???
class Circle{
	public:
		Point c;
		double r;
		Circle(Point c = Point(),double r = 0.0): c(c),r(r){}
};
//????§???¢
//typedef Vector<Point> Polygon;
//????????¨??????
double dot(Vector a,Vector b){
	return a.x*b.x + a.y*b.y;
}
double cross(Vector a,Vector b){
	return a.x*b.y - a.y*b.x;
}

int main(){
	int n;
	cin >> n;
	double x0,y0,x1,y1,x2,y2,x3,y3,s,t;
	for(int i = 0;i < n;i++){
		cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		s = (y1-y0)/(x1-x0);
		t = (y3-y2)/(x3-x2);
		if(s == t){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

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

//EPS ??? 10???-10?????????
#define EPS (1e - 10)
//fabs??¢??°??????????°???°?????°?????¶???????????????
//EPS??????????????????true?????????
#define equal(a,b) (fabs((a) - (b)) < EPS)

//Point class

class Point {
    public:
    double x, y;
    
    Point(double x = 0, double y = 0): x(x), y(y) {}
    
    //???????????????????????????
    Point operator + (Point p) {return Point(x + p.x, y + p.y);}
    Point operator - (Point p) {return Point(x - p.x, y + p.y);}
    Point operator * (double a) {return Point(a * x. a * y);}
    Point operator / (double a) {return Point(x / a, y / a);}
    
    double abs() {return sqrt(norm());}
    double norm() {return x * x + y * y;}
    
    bool operator < (const Point &p) const {
        return x != p.x ? x < p.x: y < p.y;
    }
    
    bool operator == (const Point &p) const {
        return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
    }
     
};

typedef Point Vector;

int main(void){
    Vector a, b,c,d;
    int n;
    
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a.x >> a.y >> b.x >> b.y;
        cin >> c.x >> c.y >> d.x >> d.y;
        
        //p????????????
        Vector p = a - b;
        //q????????????
        Vector q = c - d;
        
        //??????????????¨??£????????¨????????????????????§??????
        if(1 == (p.x* q.x + p.y * q.y)) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    
    return 0;
}

C++: #include<iostream>
#include<vector>
int main()
{
	int n;
	std::cin >> n;
	std::vector<bool>result(n);
	for (int i = 0; i < n; i++)
	{
		double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		result[i] = x1 == x2 && x3 == x4 || (y1 - y2) / (x1 - x2) == (y3 - y4) / (x3 - x4);
	}
	for (auto i : result)
	{
		std::cout << (i ? "YES" : "NO") << std::endl;
	}
	return 0;
}

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

using db = double;
const db eps = 1e-12;

struct poi {
	db x, y;
	void r() { cin >> x >> y; }
	poi operator -(poi p) {
		return {x - p.x, y - p.y};
	}
	db cross(poi p) {
		return x * p.y - y * p.x;
	}
};

int main() {
	ios :: sync_with_stdio(false);
	int t; cin >> t;
	while(t --) {
		poi a, b, c, d;
		a.r(); b.r(); c.r(); d.r();
		db t = (b - a).cross(d - c);
		if(t > -eps && t < eps)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}

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 x[4], y[4];
  int n;
  cin >> n;
  for(int j = 0; j < n; j++){
    for(int i = 0; i < 4; i++){
      cin >> x[i] >> y[i];
    }
    if((y[1] - y[0]) / (x[1] - x[0]) == (y[3] - y[2]) / (x[3] - x[2])){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}

C++: #define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 201
#define _MAX 100
#define ABC 26
int main(void)
{
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4, a1, b1, a2, b2;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		a1 = (y1 - y2) / (x1 - x2);
		b1 = y1 - (x1 * a1);
		a2 = (y3 - y4) / (x3 - x4);
		b2 = y3 - (x3 * a2);
		if (a1 == a2 && b1 != b2)
			printf("YES\n");
		else
			printf("NO\n");
	}
}

C++: include <iostream>
#include <complex>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }
const double eps = 1e-11;
double x[4],y[4];
int N;
int main(int argc, const char * argv[]) {
    cin >> N;
    for(int t=0; t<N; ++t){
        for(int i=0; i<4; ++i){
            cin >> x[i] >> y[i];
        }
        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])
        };
        bool p = abs(cross_product(a[0], a[1])) < eps;
        cout << (p ? "YES" : "NO") << endl;
        }
    return 0;
}