Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	for i := 0; i < n; i++ {
		scanner.Scan()
		points := strings.Split(scanner.Text(), " ")
		fpoints := make([]float64, 0)
		for _, v := range points {
			tmp, _ := strconv.ParseFloat(v, 64)
			fpoints = append(fpoints, tmp)
		}
		a := (fpoints[1]-fpoints[3])/(fpoints[0]-fpoints[2])
		b := (fpoints[5]-fpoints[7])/(fpoints[4]-fpoints[6])
		if a == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

struct Point
{
    double x;
    double y;
};
struct Line
{
    Line(const Point& a, const Point& b)
    : p1(a), p2(b) {}
    Point p1;
    Point p2;
};
double GetSlope(const Line& line)
{
    return
    (line.p2.y - line.p1.y) /
    (line.p2.x - line.p1.x);
}
bool IsParallel(const Line& l1, const Line&l2)
{
    
    return std::fabs(GetSlope(l1) - GetSlope(l2)) < 0.000001;
}
bool IsParallel(const std::vector<Point>& points)
{
    assert(points.size() == 4);
    return IsParallel(Line(points[0], points[1]), Line(points[2], points[3]));
}
std::vector<Point> Input(std::istream& is)
{
    std::vector<Point> points(4);
    for(int i = 0; i < points.size(); ++i){
        is >> points[i].x >> points[i].y;
    }
    return points;
}
int main()
{
    int n;
    std::cin >> n;
    for(int i = 0; i < n; ++i) {
        std::vector<Point> points = Input(std::cin);
        std::cout << (IsParallel(points) ? "YES" : "NO") << std::endl; 
    }
    return 0;
}

C++: #include <iostream>
main(){int n,i,j;double x[4],y[4];std::cin>>n;for(i=0;i<n;i++){for(j=0;j<4;)std::cin>>x[j]>>y[j++];if((y[0]-y[1])/(x[0]-x[1])==(y[2]-y[3])/(x[2]-x[3]))std::cout<<"YES\n";else std::cout<<"NO\n";}}

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

const double EPS=1E-12;

int main(){
  int n;
  cin>>n;
  complex<double> a, b, c, d;
  while(n--){
    cin>>a.real()>>a.imag()>>b.real()>>b.imag()>>c.real()>>c.imag()>>d.real()>>d.imag();
    a=a-b;
    c=c-d;
    cout<<(a.real()*c.imag()-a.imag()*c.real()<EPS?"YES":"NO")<<endl;
  }

  return 0;
}

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

int main(){
	double x1, x2, x3, x4, y1, y2, y3, y4;
	double ab_x, ab_y, cd_x, cd_y;
	int n, i;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3>> x4 >> y4;
		ab_x = x1-x2;
		ab_y = y1-y2;
		cd_x = x3-x4;
		cd_y = y3-y4;
		if(ab_y/ab_x == cd_y/cd_x){
			cout << "YES\n";
		}else{
			cout << "NO\n";
		}
	
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){
  
  double x1,x2,x3,x4;
  double y1,y2,y3,y4;
  
  int n;
  cin >> n;
  while(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 <iostream>
#include <cstdint>

int main()
{
	std::uint32_t n;
	std::cin >> n;
	for (std::uint32_t i = 0; i < n; ++i) {
		double x1, y1, x2, y2, x3, y3, x4, y4;
		std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if ((x1 - x2) * (y3 - y4) - (x3 - x4) * (y1 - y2) == 0.0) {
			std::cout << "NO" << std::endl;
		}
		else {
			std::cout << "YES" << std::endl;
		}
	}
	return 0;
}

C++: #include<cstdio>
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        double x1,y1,x2,y2,x3,y3,x4,y4;
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
        if((y2-y1)/(x2-x1)==(y4-y3)/(x4-x3)) printf("YES\n");
        else printf("NO\n");
    }

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

int main(int argc, const char * argv[]) {
    std::vector<int> r;
    int num;
    std::cin >> num;
    double xa,ya,xb,yb,xc,yc,dx,dy;
    double a,b;
    for(int i = 0;i < num;i++){
        std::cin >> xa >> ya>> xb >> yb >> xc >> yc >> dx >> dy;
        a = (yb - ya) / (xb - xa);
        b = (dy - yc) / (dx - xc);
        if(a == b){
            printf("YES\n");
        }else{
            printf("NO\n");
        }
    }
    
    }

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

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

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

		if((y2-y1)/(x2-x1) == (y4-y3)/(x4-x3)) cout << "YES" << endl;
		else cout << "NO" << endl;
		}
	}
    return 0;
}

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

struct Point{
  double x,y;
};
bool isParallel(const vector<Point>& data){
  return (data[1].y-data[0].y)*(data[3].x-data[2].x)==(data[3].y-data[2].y)*(data[1].x-data[0].x);
}

int main(){
  int n;
  cin>>n;
  vector<vector<Point> > data(n);
  for(int j=0;j<n;j++){
    data[j].resize(4);
    for(int i=0;i<4;i++){
      cin>>data[j][i].x>>data[j][i].y;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<4;j++){
      cout<<data[i][j].x<<" "<<data[i][j].y<<" ";
    }
    cout<<endl;
  }
  for(int i=0;i<n;i++){
    if(isParallel(data[i])){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}

C++: import java.io.*;
class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br
		= new BufferedReader(new InputStreamReader(System.in));
		String buf;
		double[][] data=new double[4][2];
		int n=Integer.parseInt(br.readLine());
		for(int k=0;k<n;k++){
			if((buf=br.readLine())==null)break;
			if(buf.length()==0)break;
			
			String[] buf2=buf.split(" ");
			for(int i=0;i<4;i++){
				for(int j=0;j<2;j++){
					data[i][j]=Double.parseDouble(buf2[i*2+j]);
				}
			}
			if((data[0][1]-data[1][1]/data[0][0]-data[1][0])==(data[2][1]-data[3][1]/data[2][0]-data[3][0]))
					System.out.println("YES");
			else
				System.out.println("NO");
		}
	}
}

C++: 
#include<iostream>
#include <string>
#include<stdio.h>

using namespace std;

int main(int argc, char* argv[])
{
	double x1, y1, x2, y2, x3, y3, x4, y4;
	double tendAB, tendCD;
	int num;

	cin >> num;
	while (num--) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		tendAB = (y1 == y2) ? 0 : (x2 - x1) / (y2 - y1);
		tendCD = (y3 == y4) ? 0 : (x4 - x3) / (y4 - y3);
		if (tendAB == tendCD) cout << "YES" << endl; else cout << "NO" << endl;
	}

	return 0;
}